geant4 tutorial asp2018mancinit/teaching/asp2018/geant4...geant4 tutorial african school of...
TRANSCRIPT
![Page 1: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/1.jpg)
Geant4 Tutorial
African School of Fundamental Physics and ApplicationsWindhoek (Namibia) 3rd July 2018
Carlo Mancini [email protected]
![Page 2: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/2.jpg)
Use the simmetry!
�2
![Page 3: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/3.jpg)
Let’s run the example• enable python 2.7:
scl enable python27 bash
• install the library for the plots:pip2.7 install matplotlib —user
• create a folder:mkdir example
• go inside the folder:cd example
• download the example:wget http://www.roma1.infn.it/~mancinit/Teaching/ASP2018/integral.py
• run it:python2.7 integral.py
�3
![Page 4: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/4.jpg)
Example of an integral
• Have a look of the code:emacs integral.py &
• How to increase the number of random points extracted?
�4
![Page 5: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/5.jpg)
Let’s calculate p
• Is there a way to speed up the convergence of the computation?
• Use the symmetry!
• This is the method for calculating p was proposed by Laplace in “Théorie Analytique des Probabilitiés” (1825)!
�5
![Page 6: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/6.jpg)
Let’s use the symmetry!
• download the example:wget http://www.roma1.infn.it/~mancinit/Teaching/ASP2018/calculatepi.py
• run the example to see how it works:python2.7 calculatepi.py
• edit the code:emacs calculatepi.py &
• find the variable that defines the extremes of integration
• change it to integrate from 0 to 1
• run the example and check:python2.7 calculatepi.py
�6
![Page 7: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/7.jpg)
How to compile the Geant4 example• set all the Geant4 variables:
source /opt/geant/geant4.10.04.p01-install/bin/geant4.sh
• download the code from the repository:git clone https://github.com/carlomt/AnaEx01.git
• create a directory where compile the code: mkdir anaEx01build
• go inside such directory:cd anaEx01build
• run cmake to copy all the needed files and create the Makefile: cmake -DGeant4_DIR=/opt/geant/geant4.10.04.p01-install ../AnaEx01
• compile:make
�7
![Page 8: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/8.jpg)
How to run the example
• just run the executable:./AnaEx01
�8
![Page 9: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/9.jpg)
Shot a proton on the detector
• /gps/particle proton
• /gps/energy 1 GeV
• /gps/position -10 0 0 cm
• /gps/direction 1 0 0
• /run/beamOn 1
�9
![Page 10: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/10.jpg)
Shot another one…
�10
![Page 11: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/11.jpg)
Simulate cosmic muons
• /control/execute cosmicMuons.mac
�11
![Page 12: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/12.jpg)
Lets see how Geant4 track a photon
• have a look of the script gamma.mac: emacs gamma.mac &
• what is it simulating?
• run it:./AnaEx01 gamma.mac
�12
![Page 13: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/13.jpg)
Let’s run a simulation with protons!• copy the gamma.mac script:
cp gamma.mac proton.mac
• edit the new script:emacs proton.mac &
• decrease verbosity:/tracking/verbose 0/gps/verbose 0
• change the primary and its energy:/gps/particle proton /gps/energy 300 MeV
• simulate 1000 events:/run/beamOn 1000
• run it:./AnaEx01 proton.mac
�13
![Page 14: Geant4 Tutorial ASP2018mancinit/Teaching/ASP2018/Geant4...Geant4 Tutorial African School of Fundamental Physics and Applications Windhoek (Namibia) 3rd July 2018 Carlo Mancini Terracciano](https://reader034.vdocuments.us/reader034/viewer/2022052615/60904f3241ed86350d0c168a/html5/thumbnails/14.jpg)
Check the output
• open the root file: root -l AnaEx01.root
• open a TBrowser: root [1] TBrowser tb
• plot the energy deposited in the lAr gaps:
�14