introduction to geant4 makoto asai (slac) geant4 tutorial course @ cern may 25-27, 2005 may 2005,...

55
Introduction Introduction to to Geant4 Geant4 Makoto Asai (SLAC) Makoto Asai (SLAC) Geant4 Tutorial Course @ Geant4 Tutorial Course @ CERN CERN May 25-27, 2005 May 25-27, 2005 May 2005, Geant4 v7.0p01

Upload: mark-greer

Post on 03-Jan-2016

247 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

IntroductionIntroductiontoto

Geant4Geant4

Makoto Asai (SLAC)Makoto Asai (SLAC)

Geant4 Tutorial Course @ CERNGeant4 Tutorial Course @ CERN

May 25-27, 2005May 25-27, 2005

May 2005, Geant4 v7.0p01

Page 2: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 22

ContentsContents General introduction and General introduction and

brief historybrief history

Highlights of user Highlights of user

applications applications

Geant4 kernelGeant4 kernel

Basic concepts and Basic concepts and

kernel structurekernel structure

User classesUser classes

Page 3: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

General introduction General introduction and brief historyand brief history

Page 4: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 44

What is Geant4?What is Geant4? Geant4 is the successor of GEANT3, the world-standard toolkit Geant4 is the successor of GEANT3, the world-standard toolkit

for HEP detector simulation.for HEP detector simulation.

Geant4 is one of the first successful attempt to re-design a Geant4 is one of the first successful attempt to re-design a

major package of HEP software for the next generation of major package of HEP software for the next generation of

experiments using an Object-Oriented environment. experiments using an Object-Oriented environment.

A variety of requirements also came from heavy ion physics, A variety of requirements also came from heavy ion physics,

CP violation physics, cosmic ray physics, astrophysics, space CP violation physics, cosmic ray physics, astrophysics, space

science and medical applications. science and medical applications.

In order to meet such requirements, a large degree of In order to meet such requirements, a large degree of

functionality and flexibility are provided.functionality and flexibility are provided.

G4 is not only for HEP but goes well beyond that.G4 is not only for HEP but goes well beyond that.

Page 5: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 55

Flexibility of Geant4Flexibility of Geant4 In order to meet wide variety of requirements from various In order to meet wide variety of requirements from various

application fields, a large degree of functionality and flexibility application fields, a large degree of functionality and flexibility

are provided. are provided.

Geant4 has many types of geometrical descriptions to describe Geant4 has many types of geometrical descriptions to describe

most complicated and realistic geometries most complicated and realistic geometries

CSG, BREP, BooleanCSG, BREP, Boolean

STEP compliant STEP compliant

XML interfaceXML interface

Everything is open to the user Everything is open to the user

Choice of physics processes/modelsChoice of physics processes/models

Choice of GUI/Visualization/persistency/histogramming Choice of GUI/Visualization/persistency/histogramming

technologiestechnologies

Page 6: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 66

Physics in Geant4Physics in Geant4 It is rather unrealistic to develop a uniform physics model to It is rather unrealistic to develop a uniform physics model to

cover wide variety of particles and/or wide energy range.cover wide variety of particles and/or wide energy range. Much wider coverage of physics comes from mixture of theory-Much wider coverage of physics comes from mixture of theory-

driven, parameterized, and empirical formulae. Thanks to driven, parameterized, and empirical formulae. Thanks to polymorphism mechanism, both cross-sections and models polymorphism mechanism, both cross-sections and models (final state generation) can be combined in arbitrary manners (final state generation) can be combined in arbitrary manners into one particular process.into one particular process. Standard EM processesStandard EM processes Low energy EM processesLow energy EM processes Hadronic processesHadronic processes Photon/lepton-hadron processesPhoton/lepton-hadron processes Optical photon processesOptical photon processes Decay processesDecay processes Shower parameterizationShower parameterization Event biasing technique Event biasing technique

Page 7: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 77

Physics in Geant4Physics in Geant4 Each cross-section table or physics model (final state generation) Each cross-section table or physics model (final state generation)

has its own applicable energy range. Combining more than one has its own applicable energy range. Combining more than one

tables / models, one physics process can have enough coverage tables / models, one physics process can have enough coverage

of energy range for wide variety of simulation applications.of energy range for wide variety of simulation applications.

Geant4 provides sets of alternative physics models so that the Geant4 provides sets of alternative physics models so that the

user can freely choose appropriate models according to the type user can freely choose appropriate models according to the type

of his/her application.of his/her application.

Several individual universities / physicists groups are contributing Several individual universities / physicists groups are contributing

their physics models to Geant4. Given the modular structure of their physics models to Geant4. Given the modular structure of

Geant4, developers of each physics model are well recognized Geant4, developers of each physics model are well recognized

and credited.and credited.

Page 8: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 88

Page 9: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 99

Geant4 – Its historyGeant4 – Its history Dec ’94 - Project startDec ’94 - Project start Apr ’97 - First alpha release Apr ’97 - First alpha release Jul ’98 - First beta release Jul ’98 - First beta release Dec ’98 - First Geant4 public releaseDec ’98 - First Geant4 public release …… Dec ’03 - Geant4 6.0 releaseDec ’03 - Geant4 6.0 release Mar ’04 - Geant4 6.1 releaseMar ’04 - Geant4 6.1 release Jun ’04 - Geant4 6.2 releaseJun ’04 - Geant4 6.2 release Dec 17Dec 17thth, ’04 - Geant4 7.0 release, ’04 - Geant4 7.0 release

Feb 26Feb 26thth, ’05 - Geant4 7.0-patch01 release, ’05 - Geant4 7.0-patch01 release We currently provide two to three public releases and bimonthly We currently provide two to three public releases and bimonthly

beta releases in between public releases every year.beta releases in between public releases every year.

Page 10: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 1010

Geant4 Geant4 CollaborationCollaboration

Collaborators also from non-member institutions, including

Budker Inst. of PhysicsIHEP Protvino

MEPHI Moscow Pittsburg University

Helsinki Inst. Ph.

PPARCUniv. Barcelona

HARP

Lebedev

Page 11: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Highlights ofHighlights ofUsers ApplicationsUsers Applications

Page 12: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 1212

BaBarBaBar BaBar at SLAC is the pioneer experiment in HEP in use of BaBar at SLAC is the pioneer experiment in HEP in use of

Geant4Geant4 Started in 2000Started in 2000 Simulated 5*10Simulated 5*1099 events so far events so far Produced at 20 sites in North America and EuropeProduced at 20 sites in North America and Europe Current average production rate 6.1 x 10Current average production rate 6.1 x 1077 events/week events/week

Now simulating PEP beam line as well (-9m < zIP < 9m)

Courtesy of D.Wright (SLAC)

Page 13: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 1313

Page 14: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 1414

Page 15: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 1515

Page 16: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 1616

Page 17: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 1717

Page 18: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 1818

Geant4 for beam Geant4 for beam transportationtransportation

Courtesy of V.D.Elvira (FNAL)

Page 19: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 1919Courtesy of G.Blair (CERN)

Page 20: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 2020Courtesy of S.Incerti (IN2P3/CNRS)

Page 21: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 2121

Chandra X-ray observatory, Chandra X-ray observatory, with similar orbit, experienced with similar orbit, experienced unexpected degradation of unexpected degradation of CCDs CCDs

Possible effects on XMM?Possible effects on XMM?BaffleBaffle

ss

X-ray X-ray detectorsdetectors

(CCDs)(CCDs)

MirrorMirrorss

Telescope Telescope tubetube

X-ray Multi-Mirror mission X-ray Multi-Mirror mission (XMM)(XMM) Launch December Launch December

19991999 Perigee 7000 kmPerigee 7000 km apogee 114000 kmapogee 114000 km Flight through the Flight through the

radiation belts radiation belts

Page 22: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

MAXIISS Columbus AMS

EUSO

Bepi Colombo SWIFT

LISA

Smart-2

ACE

INTEGRAL

Astro-E2

JWSTGAIA

Herschel

Cassini

GLAST

XMM-Newton

Page 23: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 2323

INTEGRAL in the ESA/ESTEC test center

INTEGRAL Geant4 model byINTEGRAL Geant4 model byUniversity of University of SouthamptonSouthampton

Page 24: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 2424

Cou

rtes

y T

. Ers

mar

k, K

TH

Sto

ckho

lm

Page 25: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 2525

X-Ray Surveys of X-Ray Surveys of Asteroids and MoonsAsteroids and Moons

Induced X-ray line emission:indicator of target composition(~100 m surface layer)

Cosmic rays,jovian electrons

Geant3.21Geant3.21

G4 “standard”G4 “standard”

Geant4 low-EGeant4 low-E

Solar X-rays, e, p

Courtesy SOHO EIT

C, N, O line emissions includedC, N, O line emissions included

ESA Space Environment & Effects Analysis SectionGeant4 in space Geant4 in space

sciencescience

Page 26: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 2626

Bepi Colombo: X-Ray Bepi Colombo: X-Ray Mineralogical Survey of Mineralogical Survey of MercuryMercury

Alfonso Mantero, Thesis, Univ. Genova, 2002

Space Environments Space Environments and Effects Sectionand Effects Section

Page 27: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01
Page 28: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 2828

Page 29: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 2929

Page 30: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 3030

Page 31: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 3131

Page 32: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 3232

CT-simulation with a Rando phantomExperimental data obtained with TLD LiF dosimeter

CT images used to define the geometry:

a thorax slice from a Rando

anthropomorphic phantom

Comparison with commercial treatment Comparison with commercial treatment planning systemsplanning systems

M. C. Lopes 1, L. Peralta 2, P. Rodrigues 2, A. Trindade 2

1 IPOFG-CROC Coimbra Oncological Regional Center - 2 LIP - Lisbon

Agreement better than 2% between GEANT4 and TLD dosimeters

Page 33: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 3333

Page 34: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Basic conceptsBasic conceptsand kernel structureand kernel structure

Page 35: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 3535

Geant4 kernelGeant4 kernel Geant4 consists of 17 categories.Geant4 consists of 17 categories.

Independently developed and Independently developed and

maintained by WG(s) responsible maintained by WG(s) responsible

to each category.to each category.

Interfaces between categories Interfaces between categories

(e.g. top level design) are (e.g. top level design) are

maintained by the global maintained by the global

architecture WG.architecture WG.

Geant4 KernelGeant4 Kernel

Handles run, event, track, step, Handles run, event, track, step,

hit, trajectory.hit, trajectory.

Provides frameworks of Provides frameworks of

geometrical representation and geometrical representation and

physics processes.physics processes.

Geant4

ReadoutVisuali zation

Persis tency

Run

Event

Inter faces

Tracking

Digits + Hits

Processes

Track

Geometry Particle

Graphic _reps

Material

Intercoms

Global

Page 36: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 3636

Run in Geant4Run in Geant4 As an analogy of the real experiment, a run of Geant4 starts with As an analogy of the real experiment, a run of Geant4 starts with

“Beam On”.“Beam On”.

Within a run, the user cannot changeWithin a run, the user cannot change

detector geometrydetector geometry

settings of physics processessettings of physics processes

---> detector is inaccessible during a run---> detector is inaccessible during a run

Conceptually, a run is a collection of events which share the same Conceptually, a run is a collection of events which share the same

detector conditions.detector conditions.

At the beginning of a run, geometry is optimized for navigation and At the beginning of a run, geometry is optimized for navigation and

cross-section tables are calculated according to materials appear in cross-section tables are calculated according to materials appear in

the geometry and the cut-off values defined. the geometry and the cut-off values defined.

G4RunManagerG4RunManager class manages processing a run, a run is represented class manages processing a run, a run is represented

by by G4RunG4Run class or a user-defined class derived from G4Run. class or a user-defined class derived from G4Run.

G4UserRunActionG4UserRunAction is the optional user hook. is the optional user hook.

Page 37: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 3737

Event in Geant4Event in Geant4 At beginning of processing, an event contains primary particles. At beginning of processing, an event contains primary particles.

These primaries are pushed into a stack.These primaries are pushed into a stack.

When the stack becomes empty, processing of an event is over.When the stack becomes empty, processing of an event is over.

G4EventManagerG4EventManager class manages processing an event. class manages processing an event.

G4Event G4Event class represents an event. It has following objects at the class represents an event. It has following objects at the

end of its processing. end of its processing.

List of primary vertexes and particles (as input)List of primary vertexes and particles (as input)

Hits collectionsHits collections

Trajectory collection (optional)Trajectory collection (optional)

Digits collections (optional)Digits collections (optional)

G4UserEventActionG4UserEventAction is the optional user hook. is the optional user hook.

Page 38: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 3838

Track in Geant4Track in Geant4 Track is a snapshot of a particle.Track is a snapshot of a particle.

It has only position and physical quantities of current It has only position and physical quantities of current

instance.instance. Step is a “delta” information to a track.Step is a “delta” information to a track.

Track is not a collection of steps.Track is not a collection of steps. Track is deleted whenTrack is deleted when

it goes out of the world volumeit goes out of the world volume it disappears (e.g. decay)it disappears (e.g. decay) it goes down to zero kinetic energy and no “AtRest” it goes down to zero kinetic energy and no “AtRest”

additional process is requiredadditional process is required the user decides to kill itthe user decides to kill it

No track object persists at the end of event.No track object persists at the end of event. For the record of track, use trajectory class objects.For the record of track, use trajectory class objects.

G4TrackingManagerG4TrackingManager manages processing a track, a track is manages processing a track, a track is

represented by represented by G4TrackG4Track class. class. G4UserTrackingActionG4UserTrackingAction is the optional user hook. is the optional user hook.

Page 39: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 3939

Step in Geant4Step in Geant4 Step has two points and also “delta” information of a particle (energy Step has two points and also “delta” information of a particle (energy

loss on the step, time-of-flight spent by the step, etc.).loss on the step, time-of-flight spent by the step, etc.). Each point knows the volume (and material). In case a step is limited Each point knows the volume (and material). In case a step is limited

by a volume boundary, the end point physically stands on the by a volume boundary, the end point physically stands on the

boundary, and it logically belongs to the next volume.boundary, and it logically belongs to the next volume. Because one step knows materials of two volumes, boundary Because one step knows materials of two volumes, boundary

processes such as transition radiation or refraction could be processes such as transition radiation or refraction could be

simulated.simulated. G4SteppingManager G4SteppingManager class manages processing a step, a step is class manages processing a step, a step is

represented by represented by G4StepG4Step class. class. G4UserSteppingActionG4UserSteppingAction is the optional user hook. is the optional user hook.

Begin of step pointEnd of step point

Step

Boundary

Page 40: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 4040

Particle in Geant4Particle in Geant4 A particle in Geant4 is represented in three layers of classes.A particle in Geant4 is represented in three layers of classes. G4TrackG4Track

Position, geometrical information, etc.Position, geometrical information, etc. This is a class representing a particle to be tracked.This is a class representing a particle to be tracked.

G4DynamicParticleG4DynamicParticle "Dynamic" physical properties of a particle, such as "Dynamic" physical properties of a particle, such as

momentum, energy, spin, etc.momentum, energy, spin, etc. Each G4Track object has its own and unique Each G4Track object has its own and unique

G4DynamicParticle object.G4DynamicParticle object. This is a class representing an individual particle (which is not This is a class representing an individual particle (which is not

necessarily to be tracked).necessarily to be tracked). G4ParticleDefinitionG4ParticleDefinition

"Static" properties of a particle, such as charge, mass, life "Static" properties of a particle, such as charge, mass, life time, decay channels, etc.time, decay channels, etc.

G4ProcessManager which describes processes involving to G4ProcessManager which describes processes involving to the particlethe particle

All G4DynamicParticle objects of same kind of particle share All G4DynamicParticle objects of same kind of particle share the same G4ParticleDefinition.the same G4ParticleDefinition.

Page 41: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 4141

CutsCuts in Geant4 in Geant4 A Cut in Geant4 is a A Cut in Geant4 is a production thresholdproduction threshold..

Only for physics processes that have infrared divergenceOnly for physics processes that have infrared divergence Not tracking cut, which does not exist in Geant4Not tracking cut, which does not exist in Geant4

Energy threshold must be determined at which discreteEnergy threshold must be determined at which discrete energy loss is energy loss is

replaced by continuous lossreplaced by continuous loss Old way: Old way:

Track primary particle until cut-off energy is reached,Track primary particle until cut-off energy is reached, calculate calculate

continuous loss and dump it at that point,continuous loss and dump it at that point, stop tracking primarystop tracking primary Create secondaries only above cut-off energy, or add to Create secondaries only above cut-off energy, or add to

continuous loss of primary for less energetic secondariescontinuous loss of primary for less energetic secondaries Geant4 way: Geant4 way:

Specify range (which is converted toSpecify range (which is converted to energy for each material) at energy for each material) at

which continuous loss begins, trackwhich continuous loss begins, track primary down to zero rangeprimary down to zero range Create secondaries only above specified range, or add to Create secondaries only above specified range, or add to

continuous loss of primary for secondaries of less energetic than continuous loss of primary for secondaries of less energetic than

travelling the required range in the current materialtravelling the required range in the current material

Page 42: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 4242

Energy cut vs. range cutEnergy cut vs. range cut 500 MeV/c proton in liq.Ar (4mm) / Pb (4mm) sampling calorimeter500 MeV/c proton in liq.Ar (4mm) / Pb (4mm) sampling calorimeter

liq.Ar

Pb liq.Ar

Pb

Geant3 (energy cut)Geant3 (energy cut) Ecut = 450 keVEcut = 450 keV

Geant4 (range cut)Geant4 (range cut) Rcut = 1.5 mmRcut = 1.5 mm Corresponds to Corresponds to

Ecut in liq.Ar = 450 Ecut in liq.Ar = 450 keV, Ecut in Pb = 2 MeVkeV, Ecut in Pb = 2 MeV

Page 43: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 4343

StackStack Track is a class object, thus it is easy to Track is a class object, thus it is easy to

treat suspending or postponing tracks. For treat suspending or postponing tracks. For

example,example,

Suspend tracks at the entrance of Suspend tracks at the entrance of

calorimeter, i.e. simulate all tracks in calorimeter, i.e. simulate all tracks in

tracking region before generating tracking region before generating

showers.showers.

Suspend a “looper” track after certain Suspend a “looper” track after certain

time and postpone it to next event.time and postpone it to next event.

Prioritized tracking without performance Prioritized tracking without performance

costcost

Stacks are managed by Stacks are managed by G4StackManagerG4StackManager

with user's with user's G4UserStackingActionG4UserStackingAction..

Well-thought prioritization/abortion of Well-thought prioritization/abortion of

tracks/events makes entire simulation tracks/events makes entire simulation

process much more efficient.process much more efficient.

Page 44: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 4444

Geant4 as a state machineGeant4 as a state machine Geant4 has six application states.Geant4 has six application states.

G4State_PreInitG4State_PreInit Material, Geometry, Particle and/or Material, Geometry, Particle and/or

Physics Process need to be Physics Process need to be initialized/definedinitialized/defined

G4State_IdleG4State_Idle Ready to start a runReady to start a run

G4State_GeomClosedG4State_GeomClosed Geometry is optimized and ready to Geometry is optimized and ready to

process an eventprocess an event G4State_EventProcG4State_EventProc

An event is processingAn event is processing G4State_QuitG4State_Quit

(Normal) termination(Normal) termination G4State_AbortG4State_Abort

A fatal exception occurred and program A fatal exception occurred and program is abortingis aborting

PreInit

Idle

EventProc

GeomClosed

Quit

Abort

initialize

beamOnexit

Page 45: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 4545

G4cout, G4cerrG4cout, G4cerr

G4coutG4cout and and G4cerrG4cerr are are ostream ostream objects defined by Geant4.objects defined by Geant4.

G4endlG4endl is also provided. is also provided.

G4cout << ”Hello Geant4!” << G4endl;G4cout << ”Hello Geant4!” << G4endl;

SomeSome GUIs are buffering output streams so that they display print-outs GUIs are buffering output streams so that they display print-outs

on another window or provide storing / editing functionality.on another window or provide storing / editing functionality.

The user should not use std::cout, etc.The user should not use std::cout, etc.

The user should not use std::cin for input. Use user-defined commands The user should not use std::cin for input. Use user-defined commands

provided by intercoms category in Geant4.provided by intercoms category in Geant4.

Ordinary file I/O is OK.Ordinary file I/O is OK.

Page 46: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

User classesUser classes

Page 47: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 4747

The user has to…The user has to… Define material and geometryDefine material and geometry Select appropriate particles and processesSelect appropriate particles and processes Define production threshold(s)Define production threshold(s) Define the way of primary particle generationDefine the way of primary particle generation Define the way to extract useful information from Geant4Define the way to extract useful information from Geant4

Optionally,Optionally, Define the way of visualization and interactivityDefine the way of visualization and interactivity Provide the way of I/OProvide the way of I/O Select or provide some artificial mechanism for effective simulationSelect or provide some artificial mechanism for effective simulation etc.etc.

Page 48: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 4848

User classesUser classes Initialization classesInitialization classes

Use G4RunManager::SetUserInitialization() to define.Use G4RunManager::SetUserInitialization() to define. Invoked at the initializationInvoked at the initialization

G4VUserDetectorConstructionG4VUserDetectorConstruction G4VUserPhysicsListG4VUserPhysicsList

Action classesAction classes Use G4RunManager::SetUserAction() to define.Use G4RunManager::SetUserAction() to define. Invoked during an event loopInvoked during an event loop

G4VUserPrimaryGeneratorActionG4VUserPrimaryGeneratorAction G4UserRunActionG4UserRunAction G4UserEventActionG4UserEventAction G4UserStackingActionG4UserStackingAction G4UserTrackingActionG4UserTrackingAction G4UserSteppingActionG4UserSteppingAction

main()main() Geant4 does not provide Geant4 does not provide main().main().

Note : classes written in Note : classes written in yellowyellow are mandatory. are mandatory.

Page 49: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 4949

The main programThe main program Geant4 does not provide the Geant4 does not provide the mainmain().().

In your In your main(),main(), you have to you have to

Construct G4RunManager (or your derived class)Construct G4RunManager (or your derived class)

Set user mandatory classes to RunManagerSet user mandatory classes to RunManager

G4VUserDetectorConstructionG4VUserDetectorConstruction

G4VUserPhysicsListG4VUserPhysicsList

G4VUserPrimaryGeneratorActionG4VUserPrimaryGeneratorAction

You can define VisManager, (G)UI session, optional user action You can define VisManager, (G)UI session, optional user action

classes, and/or your persistency manager in your classes, and/or your persistency manager in your main()main()..

Page 50: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 5050

Describe your detectorDescribe your detector Derive your own concrete class from Derive your own concrete class from

G4VUserDetectorConstructionG4VUserDetectorConstruction abstract base class. abstract base class. In the virtual method In the virtual method Construct()Construct(),,

Instantiate all necessary materialsInstantiate all necessary materials Instantiate volumes of your detector geometryInstantiate volumes of your detector geometry Instantiate your sensitive detector classes and set Instantiate your sensitive detector classes and set

them to the corresponding logical volumesthem to the corresponding logical volumes Optionally you can define Optionally you can define

Regions for any part of your detectorRegions for any part of your detector Visualization attributes (color, visibility, etc.) of your Visualization attributes (color, visibility, etc.) of your

detector elementsdetector elements

Page 51: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 5151

Select physics processesSelect physics processes Geant4 does not have any default particles or processes.Geant4 does not have any default particles or processes.

Even for the particle transportation, you have to define it Even for the particle transportation, you have to define it

explicitly.explicitly.

Derive your own concrete class from Derive your own concrete class from G4VUserPhysicsListG4VUserPhysicsList

abstract base class.abstract base class.

Define all necessary particlesDefine all necessary particles

Define all necessary processes and assign them to proper Define all necessary processes and assign them to proper

particlesparticles

Define production thresholds applied to the world (and Define production thresholds applied to the world (and

each region, if needed)each region, if needed)

Geant4 provides lots of utility classes/methods and examples.Geant4 provides lots of utility classes/methods and examples.

"Educated guess" physics lists for defining processes for "Educated guess" physics lists for defining processes for

various use-cases.various use-cases.

Page 52: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 5252

Generate primary eventGenerate primary event Derive your concrete class from Derive your concrete class from G4VUserPrimaryGeneratorActionG4VUserPrimaryGeneratorAction

abstract base class.abstract base class.

Pass a G4Event object to one or more primary generator concrete Pass a G4Event object to one or more primary generator concrete

class objects which generate primary vertices and primary particles.class objects which generate primary vertices and primary particles.

Geant4 provides several generators in addition to the Geant4 provides several generators in addition to the

G4VPrimaryParticlegenerator base class.G4VPrimaryParticlegenerator base class.

G4ParticleGunG4ParticleGun

G4HEPEvtInterface, G4HepMCInterfaceG4HEPEvtInterface, G4HepMCInterface

Interface to /hepevt/ common block or HepMC classInterface to /hepevt/ common block or HepMC class

G4GeneralParticleSourceG4GeneralParticleSource

Define radioactivityDefine radioactivity

Page 53: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 5353

Optional user action classesOptional user action classes All user action classes, methods of which are invoked during “Beam All user action classes, methods of which are invoked during “Beam

On”, must be constructed in the user’s On”, must be constructed in the user’s mainmain() and must be set to the () and must be set to the

RunManager.RunManager. G4UserRunActionG4UserRunAction

G4Run* GenerateRun()G4Run* GenerateRun() Instantiate user-customized run objectInstantiate user-customized run object

void BeginOfRunAction(const G4Run*)void BeginOfRunAction(const G4Run*) Define histogramsDefine histograms

void EndOfRunAction(const G4Run*)void EndOfRunAction(const G4Run*) Store histogramsStore histograms

G4UserEventActionG4UserEventAction void BeginOfEventAction(const G4Event*)void BeginOfEventAction(const G4Event*)

Event selectionEvent selection Define histogramsDefine histograms

void EndOfEventAction(const G4Event*)void EndOfEventAction(const G4Event*) Analyze the eventAnalyze the event

Page 54: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 5454

Optional user action classesOptional user action classes G4UserStackingActionG4UserStackingAction

void PrepareNewEvent()void PrepareNewEvent()

Reset priority controlReset priority control

G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*)G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*)

Invoked every time a new track is pushed Invoked every time a new track is pushed

Classify the new track -- priority controlClassify the new track -- priority control

Urgent, Waiting, PostponeToNextEvent, KillUrgent, Waiting, PostponeToNextEvent, Kill

void NewStage()void NewStage()

Invoked when the Urgent stack becomes emptyInvoked when the Urgent stack becomes empty

Change the classification criteria Change the classification criteria

Event filtering (Event abortion)Event filtering (Event abortion)

Page 55: Introduction to Geant4 Makoto Asai (SLAC) Geant4 Tutorial Course @ CERN May 25-27, 2005 May 2005, Geant4 v7.0p01

Introduction to Geant4 - M.Asai (SLAC)Introduction to Geant4 - M.Asai (SLAC) 5555

Optional user action classesOptional user action classes G4UserTrackingActionG4UserTrackingAction

void PreUserTrackingAction(const G4Track*)void PreUserTrackingAction(const G4Track*)

Decide trajectory should be stored or notDecide trajectory should be stored or not

Create user-defined trajectoryCreate user-defined trajectory

void PostUserTrackingAction(const G4Track*)void PostUserTrackingAction(const G4Track*)

G4UserSteppingActionG4UserSteppingAction

void UserSteppingAction(const G4Step*)void UserSteppingAction(const G4Step*)

Kill / suspend / postpone the trackKill / suspend / postpone the track

Draw the step (for a track not to be stored as a trajectory)Draw the step (for a track not to be stored as a trajectory)