Detector simulation & Geant4
Transcript of Detector simulation & Geant4
![Page 1: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/1.jpg)
Detector simulation & Geant4
Nam Tran Boston University
1Vietnam School on Neutrino 2020
![Page 2: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/2.jpg)
Outline• Simulation in high energy physics
• Why? • What is simulated? • How simulation is done?
• (Short) Introduction to Geant4
2
![Page 3: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/3.jpg)
Why?• HEP detectors are very complex machines
• Expensive, and take long time to build • Once built, will stay in operation for many years
• The gap between R&D to full detector is huge • 2-3 orders of magnitude in terms of dimensions, number of
readout channels • Cannot afford to build a full detector without careful
evaluation of mechanical, electronic and physics performance
3
![Page 4: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/4.jpg)
Why?• New physics, enhanced/suppressed processes
• Can introduce new physics, • Or tweak branching ratio of a specific process • Simulation is not magic! Cannot invent/create physics
that you are not including • Also very important in data analysis and
interpretation of the physics measurements
4
![Page 5: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/5.jpg)
Needed in all stages• First ideas about an experiment
• Given the physics goals, what kind of detectors are needed? What level of performance?
• Formal proposal • More detailed simulation show feasibilities of the
experiment • R&D and construction
• Optimize detectors & development and test algorithms • Running & analysis
• Test reconstruction algorithms, study backgrounds, … • More understanding of detector performance, inputs for
next R&D, …5
![Page 6: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/6.jpg)
What are simulated?• Particle generation • Interaction with materials & transportation in
detectors • Digitization
6
![Page 7: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/7.jpg)
How?
7
Particle generation Detector simulation Digitization
Particles from collision, beam, or cosmic ray, …
-Geometry, material,
- Electric & magnetic field
- Particle transportation
- Physics interactions
-Electronic signal modeling
- Pile up/overlap
![Page 8: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/8.jpg)
Raw data to physics
8
https://indico.cern.ch/event/656460/timetable/#47-introduction-to-geant4-1
![Page 9: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/9.jpg)
Physics to simulated data
9
https://indico.cern.ch/event/656460/timetable/#47-introduction-to-geant4-1
![Page 10: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/10.jpg)
Types of simulation• Toy simulation
• Simple analytical equations without detailed geometry/field descriptions
• Zeroth order detector or physics studies • Very fast: small fraction of a second per event
• Parameterized simulation • Approximate geometry/field descriptions • Parameterized energy response, shower shapes, … • Relative fast: ~second per event
• Full simulation • Detailed, as close as possible to real geometry/field • Can be really slow …
10
![Page 11: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/11.jpg)
Event generation• Use knowledge about particle physics to simulate a
known process • Or use alternative models/theories
• E.g.: Mu2e • Can be simple
• Particle beam with mono-energetic particles • Or complicated
• Heavy ion collisions
11
![Page 12: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/12.jpg)
An example• An event:e+e− → μ+μ−
12
https://indico.cern.ch/event/656460/timetable/#47-introduction-to-geant4-1
![Page 13: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/13.jpg)
Detector simulation• Input: particles from event generation stage • Next question: how those particles would interact
with our detector? • Need
• Description of detector materials • Description of electric and magnetic fields • Knowledge about particle-material interactions
• Most popular simulation package in HEP: Geant4 toolkit • Also widely used in other fields: nuclear physics,
medical, space, …13
![Page 14: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/14.jpg)
Digitization• Convert results of interactions to detector signals
• Charges/voltages: similar to what we can readout from real detectors
• Apply pile-up, overlapping if needed
14
![Page 15: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/15.jpg)
Monte Carlo method• Computational algorithms which use repeated
random sampling to obtain numerical results • Example: integral calculation
f(x) = 1.5 [sin4 (x) cos5 ( x2
5 ) + sin6 ( x4 )] exp (− x2
16 )
15
![Page 16: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/16.jpg)
MC method example• Randomly
generated points in the x-y plane • Orange: accepted • Blue: rejected
• Result: accepted
accepted + rejected× area
16
![Page 17: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/17.jpg)
MC in particle tracking• Track a particle in medium, one of the most common
applications of MC in particle physics • Assume that all the possible interactions are known • The distance s between two subsequent interactions is
distributed as • is a property of the medium, proportional to the
probability of an interaction per unit length and density
• where is partial cross section of process ,
p(s) = μexp(−μs)μ
μ = Nσ = N∑i
σi = ∑i
μi
σi i μi = Nσi
17
![Page 18: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/18.jpg)
MC in particle tracking• Divide the particle trajectory in “steps”
• Straight free-flight tracks along the step • Could be limited by geometry boundaries
• Sampling the step length accordingly to • Sampling the interaction at the end of the step • Sampling the interaction accordingly to • Sampling the final state using the physics model of
the interaction • Update the properties of the primary particle • Add the possible secondaries produced (to be
tracked later)
p(s)
μi/μ
i
18
![Page 19: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/19.jpg)
Geant4 simulation toolkit• Original acronym for
GEometry ANd Tracking • Developed at CERN, first
version in 1974 • Last FORTRAN version:
GEANT 3.21 • Rewritten in object-oriented
C++ in 1994-1998 • Currently maintained by the
Geant4 Collaboration • https://geant4.web.cern.ch
19
https://cds.cern.ch/record/118715?ln=en
![Page 20: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/20.jpg)
It is only a toolkit• Toolkit = collection of tools, and not a completed
application • You cannot run it out of the box • Have to provide your own code to string Geant4 tools
together in order to complete an application • Required code from you (at minimum)
• Experimental set-up (detector geometry, fields) • Primary particles input to your simulation • Decide which particles and physics models you want
to use out of those available in Geant4
20
![Page 21: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/21.jpg)
User classes in Geant4• You have to provide a main() function • Initialization classes
• G4VUserDetectorConstruction • G4VUserPhysicsList • G4VUserActionInitialization
• Action classes • G4VUserPrimaryGeneratorAction • G4UserEventAction • G4UserStackingAction • G4UserTrackingAction • G4UserSteppingAction
21
Mandatory elements
![Page 22: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/22.jpg)
An example of Geant4 application
22
main()B1DetectorConstruction
concrete class, inherited from G4VUserDetectorConstruction
Instance of G4VModularPhysicsList
(Inherited from G4VUserPhysicsList)
B1ActionInitializationconcrete class, inherited from G4VUserActionIntialization
B1PrimaryGeneratorActionconcrete class, inherited from
G4VUserPrimaryGeneratorAction
![Page 23: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/23.jpg)
Many jargons …• World volume, mother/daughter volume • Run, event, track, step, step point • Process
• At rest, along step, post step • Cut • Sensitive detector, score, hit, hits collection
23
![Page 24: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/24.jpg)
Geant4 system of units• Geant4 is aware of units
• Always use appropriate units, Don’t rely on default units! • e.g.: radius = 10.0 * cm; E = 1.0*GeV;
• To output in a specific unit
• Or use “best” unit
• Can define custom units as well
24
![Page 25: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/25.jpg)
Detector geometry components
25
![Page 26: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/26.jpg)
Materials• Different kind of materials are
available • Isotopes ↔ G4Isotope
• Elements ↔ G4Element
• Molecules ↔ G4Material
• Compounds, mixture ↔ G4Material
• Attributes • Density, temperature, pressure, state
• Lots of predefined materials • G4NistManager
26
Properties of atoms A, Z, cross section, …
Macroscopic properties - temperature, pressure,
state, density - Radiation length,
absorption length, …
![Page 27: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/27.jpg)
Defining detector geometry
27
Step 1: Create geom.
object
Step 2: Assign properties:
material
Step 3: Place in a mother
volume
• A unique volume must exist and fully contains all other volumes -> world volume
![Page 28: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/28.jpg)
Checking geometry• Geant4 does not allow malformed geometries
• Protruding • Overlapping
• Checking can be done at construction (but requires lots of CPU time!)
• Or at run time, generally less demanding than the previous one
28
/geometry/test/grid_test /geometry/test/recursive_test
![Page 29: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/29.jpg)
Sensitive detector (SD)• A specific volume that you want to read out
information from • Position, time, energy deposited, dose, … • Corresponds to active materials in real detectors (e.g.
plastic scintillator, crystal, gas volume, …) • A logical volume becomes sensitive if it has a pointer
to a sensitive detector (G4VSensitiveDetector) • Two possibilities to make a Geant4 SD
• Create your own SD: more manual coding, but highly customizable
• Use Geant4 built-in tools, namely primitive scorers
29
![Page 30: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/30.jpg)
Run• A collection of events which share the same detector and
physics configuration • Start with “beamOn”, geometry is optimized for navigation
and cross section tables are (re)calculated • G4RunManager • G4UserRunAction is the optional user hook
30
Interactions hadron
Run
![Page 31: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/31.jpg)
Event• An event is the basic unit of simulation in Geant4 • Represents by G4Event class, • At the beginning of processing, primary tracks are
generated, and pushed into a stack • A track is popped from the stack one-by-one and tracked
• Secondaries are also pushed into the stack • When the stack is empty, the processing of the event is
completed • Output: hits and trajectory collections • G4EventManager• G4UserEventAction
31
![Page 32: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/32.jpg)
Step• Has two points (pre and post step points) • Ends when a physics process is invoked • Or at volume boundaries
• In case a step is limited by a boundary, the end point stands on the boundary, and it logically belongs to the next volume
• Boundary processes such as transition radiation or refraction could also be simulated
• Information can be extracted at the end of each step • G4SteppingManager • G4UserSteppingAction
32
![Page 33: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/33.jpg)
Track• A Track is a snapshot of a particle, represented by the
G4Track class • Keeps current info about the particle: energy, momentum,
position, … • Is updated after every G4Step
• A track object is deleted when • It goes outside of the world volume • It disappears in an interaction (decay, inelastic scattering) • It is slowed down to 0 kinetic energy and there are no
'AtRest' processes • It is manually killed by the user
• No track object persists at the end of an event33
![Page 34: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/34.jpg)
Run, event, track and step
34
![Page 35: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/35.jpg)
Particle in Geant4• 3 layers of description
• G4Track: geometrical information (position) • G4DynamicalParticle: dynamic physical properties
• Energy, momentum, polarization, … • G4ParticleDefinition: characteristic properties of the
particle • Charge, mass, lifetime, …
35
![Page 36: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/36.jpg)
Flowchart of an event
36
![Page 37: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/37.jpg)
MC sampling at each step• Each particle has its own list of applicable
processes. At each step, MC sampling is performed to determine • Step length • A particular process which would be invoked
• The process which requires the shortest interaction length limits the step
37
![Page 38: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/38.jpg)
Geant4 process kinds• At rest
• e.g. muon decay • Along the step
• e.g. Cherenkov radiation • Post step
• e.g.: decay in flight, hadron interactions
38
![Page 39: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/39.jpg)
Physics list• A class which collects all the particles, physics
processes and production thresholds needed for your application
• It tells the run manager how and when to invoke physics • It is a very flexible way to build a physics environment
• user can pick the particles he wants • user can pick the physics to assign to each particle
• But, user should have a good understanding of the physics required • omission of particles or physics could cause errors or poor
simulation
39
![Page 40: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/40.jpg)
Predefined physics lists• Geant4 provides ~20 reference physics list
• Used by larger experiments like CMS, ATLAS, … • These are routinely validated and updated with each
release • Should only be considered as starting points which you
may need to validate or modify for your application • Production cuts on secondary particles set to a
default 1 mm threshold • Secondary particles with Ekin < Eneeded to travel 1 mm are
stopped
40https://geant4-userdoc.web.cern.ch/UsersGuides/PhysicsListGuide/fo/PhysicsListGuide.pdf
![Page 41: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/41.jpg)
Don’t forget about the production cut!
41
![Page 42: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/42.jpg)
Geant4 examples• Extensive examples demonstrate how to use
Geant4 tools • https://gitlab.cern.ch/geant4/geant4/tree/master/
examples • With different levels: “basic”, “extended”, “advanced”
42
![Page 43: Detector simulation & Geant4](https://reader030.fdocuments.us/reader030/viewer/2022012019/616882f6d394e9041f701679/html5/thumbnails/43.jpg)
Summary• Simulation is an important part of doing
experimental HEP • The most widely used toolkit is Geant4
• It is a very flexible tool • Can be complicated … • There are lots of example code to learn/start
43