Detector simulation & Geant4
Nam Tran Boston University
1Vietnam School on Neutrino 2020
Outline• Simulation in high energy physics
• Why? • What is simulated? • How simulation is done?
• (Short) Introduction to Geant4
2
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
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
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
What are simulated?• Particle generation • Interaction with materials & transportation in
detectors • Digitization
6
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
Raw data to physics
8
https://indico.cern.ch/event/656460/timetable/#47-introduction-to-geant4-1
Physics to simulated data
9
https://indico.cern.ch/event/656460/timetable/#47-introduction-to-geant4-1
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
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
An example• An event:e+e− → μ+μ−
12
https://indico.cern.ch/event/656460/timetable/#47-introduction-to-geant4-1
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
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
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
MC method example• Randomly
generated points in the x-y plane • Orange: accepted • Blue: rejected
• Result: accepted
accepted + rejected× area
16
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
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
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
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
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
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
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
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
Detector geometry components
25
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, …
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
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
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
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
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
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
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
Run, event, track and step
34
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
Flowchart of an event
36
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
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
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
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
Don’t forget about the production cut!
41
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
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
Top Related