Home

A Simulation Toolkit for High Energy Physics Experiments

image

Contents

1. A A E ID Advanced European Infrastructures for Detectors at Accelerators G4VSDFilter G4VSensitiveDetector Geant4SensDet sequence 0 1 Invisible to clients Geant4SensdetActionSequence gt Geant4Filter m_filters 0 n m_actions 0 n Geant4Action Geant4SensitiveAction lt gt TrackerHitCollector TrackerDetailedHitCollector TrackerHitMonitor Figure 6 The sensitive detector design The actual energy deposits are collected in user defined subclasses of the Geant4Sensitive Here as an example possible actions called TrackerHitCollector TrackerDetailedHitCollector and TrackerHitMonitor are shown 3 5 1 Helpers of Sensitive Detectors The Geant4VolumeManager Sooner or later when a hit is created in a sensitive placed volume the hit must be associated with this volume For this purpose DD4hep provides the concept of the VolumeManager which identifies placed volumes uniquely by a 64 bit identifier the Cell D This mechanism allows to quickly retrieve a given volume given the hit data containing the CellI D The CellID is a very compressed representation for any element in the hierarchy of placed volumes to the sensitive volume in question During the simulation the reverse mechanism must be applied Geant4 provides the hierarchy of G4PhysicalVolumes to the hit location and the local coordinates of the hit within the sensitive volume Hence to determine the volume identifier is
2. Begin of event callback virtual void begin const G4Event event End of event callback virtual void end const G4Event event or register a callback with the signature void T const G4Event either to receive begin of run or end or calls using the methods Register begin of event callback template lt typename Q typename T gt void callAtBegin Q p void T f const G4Event Register end of event callback template lt typename Q typename T gt void callAtEnd Q p void T f const G4Event of the Geant4EventActionSequence from the Geant4Context object e The GeneratorAction attached to the G4VUserPrimaryGeneratorAction implemented by the Geant4GeneratorActionSequence class and is called at the start of every event and provided all initial tracks from the Monte Carlo generator Members of the Geant4GeneratorActionSequence are of type Geant4EventAction and receive the callbacks by overloading the member function Callback to generate primary particles virtual void operator G4Event event or register a callback with the signature void T G4Event to receive calls using the method Register primary particle generation callback template lt typename Q typename T gt void call Q p void T f G4Event of the Geant4GeneratorActionSequence from the Geant4Context object e The TrackingAction attached to the G4UserTrackingAction implemented by the Geant4 Tracking Acti
3. gt lt action name Geant4TestEventAction UserEvent_1 gt lt Anonymouns action lt properties Property_int 01234 lt Properties go inline Property_double 1e11 Property_string Hello_1 gt lt action gt lt action name UserEvent_2 gt lt Global action defined in actions lt Only the name is referenced here lt action name Geant40utput2RO0T RootOutput gt lt ROOT I O action DDG4 User Manual 16 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 pa ROUO0OO YX MO UONE m FS ren A A e ID Advanced European Infrastructures for Detectors at Accelerators lt properties Output simple root gt lt Output file property gt lt action gt lt action name Geant40utput2LCI0 LCIO0Output gt lt LCIO output action gt lt properties Output simple_lcio gt lt Qutput file property gt lt action gt lt sequence gt lt sequence sd SiTrackerBarrel type Geant4SensDetActionSequence gt lt filter name GeantinoRejector gt lt filter name EnergyDepositMinimumCut gt lt action name Geant4SimpleTrackerAction SiTrackerBarrelHandler gt lt sequence gt lt sequence sd SiTrackerEndcap type Geant4SensDetActionSequence gt lt filter name GeantinoRejector gt lt filter name EnergyDepositMinimumCut gt lt action name Geant4SimpleTrackerAction SiTrackerEndcapHandler gt lt sequence gt lt l next sequen
4. Advanced European Infrastructures for Detectors at Accelerators DDG4 A Simulation Toolkit for High Energy Physics Experiments using Geant4 and the DD4hep Geometry Description M Frank CERN 1211 Geneva 23 Switzerland ION ren AIDA Advanced European Infrastructures for Detectors at Accelerators DDG4 User Manual Abstract Simulating the detector response is an essential tool in high energy physics to analyze the sensitivity of an experiment to the underlying physics Such simulation tools require a detailed though convenient detector description as it is provided by the DD4hep toolkit We will present the generic simulation toolkit DDG4 using the DD4hep detector description toolkit The toolkit implements a modular and flexible approach to simulation activities using Geant4 User defined simulation applications using DDG4 can easily be configured extended using specialzed action routines The design is strongly driven by easy of use developers of detector descriptions and applications using them should provide minimal information and minimal specific code to achieve the desired result Document History Document version Date Author 1 0 19 11 2013 Markus Frank CERN LHCb DDG4 User Manual BEN ren e AIDA Advanced European Infrastructures for Detectors at Accelerators Contents 1 Introduction 1 2 The Geant4 User Interface 1 2 3 1 The Application Core
5. simple_lcio evt_lcio enableUI kernel eventAction add evt_root kernel eventAction add evt_lcio Setup particle gun gun DDG4 GeneratorAction kernel Geant4ParticleGun Gun gun energy 0 5 GeV gun particle e gun multiplicity 1 gun enableUl kernel generatorAction add gun Setup global filters fur use in sensntive detectors f1 DDG4 Filter kernel GeantinoRejectFilter GeantinoRejector DDG4 User Manual 22 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 n PON Sy AIDA Advanced European Infrastructures for Detectors at Accelerators 2 DDG4 Filter kernel ParticleRejectFilter OpticalPhotonRejector f 2 particle opticalphoton 3 DDG4 Filter kernel ParticleSelectFilter OpticalPhotonSelector f3 particle opticalphoton 4 DDG4 Filter kernel EnergyDepositMinimumCut 14 Cut 10 MeV 4 enableUI kernel registerGlobalFilter f1 kernel registerGlobalFilter f2 kernel registerGlobalFilter f3 kernel registerGlobalFilter f4 F seq act seq seq seq act seq act seq seq seq seq act seq seq seq seq act seq seq act seq N seq act seq seq act seq
6. Simulation 9 using namespace DD4hep Simulation Test 10 using namespace DD4hep Simulation Setup 11 12 if defined __MAKECINT__ 13 pragma link C class Geant4RunActionSequence 14 pragma link C class Geant4EventActionSequence 15 pragma link C class Geant4SteppingActionSequence 16 pragma link C class Geant4StackingActionSequence 17 pragma link C class Geant4GeneratorActionSequence 18 pragma link C class Geant4Action 19 pragma link C class Geant4Kernel 20 endif 21 22 SensitiveSeq handled_type setupDetector Kernel amp kernel const std string amp name 23 SensitiveSeq sd SensitiveSeq kernel name 24 Sensitive sens Sensitive kernel Geant4TestSensitive name Handler name 25 sd gt adopt sens 26 sens Sensitive kernel Geant4TestSensitive name Monitor name 27 sd gt adopt sens 28 return sd 29 30 31 void exampleAClick 4 32 Geant4Kernel amp kernel Geant4Kernel instance LCDD getInstance 33 kernel loadGeometry file DD4hep trunk DDExamples CLICSiD compact compact xm1 34 kernel loadXML DDG4_field xml 35 36 GenAction gun kernel Geant4ParticleGun Gun 37 gun energy 0 5 GeV Set properties 38 gun particle e 39 gun multiplicity 1 40 kernel generatorAction adopt gun 41 42 Action run_init kernel Geant4TestRunAction RunInit 43 run_init Property_int 12345 44 kernel runAction callAtB
7. ee 33 7 3 1 Base class Geant4GeneratorAction 0 0 0 0 0 ee ee ee 33 7 3 2 Geant4GeneratorActionSequence see eee eee eee eee ee 33 7 3 3 Geant4GeneratorActionInit 22 eee eee eee ee 33 7 3 4 Geant4InteractionVertexBoost ee 34 7 3 5 Geant4InteractionVertexBoostl eee ee 34 7 3 6 Geant4InteractionVertexBoostl ee 34 parla Lethe a a A ae 34 rar ma Ad ad o Did A etn ide oe 34 NO E A 35 7 3 10 Geant4ParticleHandlerl eee eee 0000 2 eee eee eee eee 35 DDG4 User Manual ll Fa ren e AIDA Advanced European Infrastructures for Detectors at Accelerators 7 4 Geant4 Event Action Modules 37 7 4 1 Base class Geant4EventAction 0 0 eee a 37 7 4 2 Geant4EventActionSequence 2 20 0 ee eee eee eee 37 143 Geant4ParticlePrint 2 00 240 eA ke oe RRR a RR RE ae EA 37 7 0 Sensitive Detectors a ooa aoa a a a a eee eee eee 38 75 1 Geant4 TrackerAction ooo a 38 ot oy yeas ARE A A ne va ee 38 7 6 I O Components is ew eais g rad OR So dee OS Dee ke ee wo 39 et hob ete Go he pea Soe da od ee ee giia 39 SAR Re e Ghost hae a ee aes 39 DDG4 User Manual III Sa A A gt ID Advanced European Infrastructures for Detectors at Accelerators 1 Introduction This manual should introduce to the DDG4 framework One goal of DDG4 is to easily configure the simulation applications capable of simulating the physics response of detector configurations
8. 25 lt particle name mu gt 26 lt process name G4MuMultipleScattering ordAtRestDolt 1 ordAlongSteptDolt 1 27 ordPostStepDoIt 1 gt 28 lt process name G4Mulonisation ordAtRestDolt 1 ordAlongSteptDolt 2 29 ordPostStepDoIt 2 gt 30 lt particle gt 31 peas 32 lt processes gt 33 34 lt physics gt lt Physics constructors gt 35 lt construct name G4EmStandardPhysics gt 36 lt construct name HadronPhysicsQGSP gt 37 grans 38 lt physics gt 39 40 lt physicslist gt 41 lt geant4_setup gt Figure 9 XML snippet showing the configuration of a physics list e To base all these constructs on an already existing predefined Geant4 physics list use the lt extends gt tag with the attribute containing the name of the physics list as shown in line 4 e To trigger a call to a particle constructors line 7 14 use the lt particles gt section and define the Geant4 particle constructor to be called by name To trigger a call to e physics process constructors as shown in line 19 30 Define for each particle matching the name pattern regular expression and the default cut value for the corresponding processes The attributes ordXXXX correspond to the arguments of the Geant4 call G4ProcessManager AddProcess process ordAtRestDoIt ordAlongSteptDoIt ordPostStepDoIt The processes themself are created using the ROOT plugin mechanism To trigger a call to e physics constructors as shown in
9. Within one collection the instance name must be unique Properties of Geant4Actions are set by placing them as attributes into the lt properties gt section 4 1 3 Setup of Geant4 Filters Filters are special actions called by Geant4Sensitives Filters may be global or anonymous i e reusable by several sensitive detector sequences as illustrated in Section 4 1 4 The setup is analogous to the setup of global actions lt filters gt lt filter name GeantinoRejectFilter GeantinoRejector gt lt filter name ParticleRejectFilter OpticalPhotonRejector gt lt properties particle opticalphoton gt lt filter gt lt filter name ParticleSelectFilter OpticalPhotonSelector gt lt properties particle opticalphoton gt lt filter gt lt filter name EnergyDepositMinimumCut gt lt properties Cut 10 MeV gt lt filter gt lt next global filter gt lt filters gt Global filters are accessible from the Geant4Kernel object 4 1 4 Geant4 Action Sequences Geant4 Action Sequences by definition are Geant4Action objects Hence they share the setup mecha nism with properties etc For the setup mechanism two different types of sequences are known to DDG4 Action sequences and Sensitive detector sequences Bot are declared in the sequences section lt geant4_setup gt lt sequences gt lt sequence name Geant4EventActionSequence EventAction gt lt Sequence EventAction of type Geant4EventActionSequence
10. including interaction merging etc 7 3 10 Geant4ParticleHandler Extract the relevant particle information during the simulation step This procedure works as follows e At the beginning of the event generation the object registers itself as Monte Carlo truth handler to the event context e At the begin of each track action a particle candidate is created and filled with all properties known at this time e At each stepping action a flag is set if the step produced secondaries e Sensitive detectors call the MC truth handler if a hit was created This fact is remembered e At the end of the tracking action a first decision is taken if the candidate is to be kept for the final record e At the end of the event action finally all particles are reduced to the final record This logic can be overridden by a user handler to be attached Any of these actions may be intercepted by a Geant4UserParticleHandler attached to the particle handler See class Geant4UserParticleHandler for details DDG4 User Manual 35 Fm ren A A SS ID Advanced European Infrastructures for Detectors at Accelerators Class name Geant4ParticleHandler File name DDG4 src Geant4ParticleHandler cpp Type Geant4GeneratorAction Component Properties defaults apply KeepAllParticles bool Flag to keep entire particle record without any reduction This may result in a huge output record SaveProcesses vector string Array of Geant4 process names which produ
11. line 34 35 use the lt physics gt section If only a predefined physics list is used which probably already satisfies very many use cases all these section collapse to 1 lt geant4_setup gt 2 lt physicslist name Geant4PhysicsList MyPhysics 0 gt 3 lt extends name QGSP_BERT gt lt Geant4 basic Physics list gt 4 lt physicslist gt 5 lt geant4_setup gt 4 1 2 Setup of Global Geant4 Actions Global actions must be defined in the lt actions gt section as shown in the following snippet 1 lt geant4_setup gt 2 lt actions gt 3 lt action name Geant4TestRunAction RunInit gt 4 lt properties Property_int 12345 5 Property_double 5e15 6 Property_string Startrun Hello_2 gt 7 lt action gt DDG4 User Manual 15 8 9 10 11 12 13 1 2 3 4 5 6 7 8 9 10 11 12 SN EQ e AIDA Advanced European Infrastructures for Detectors at Accelerators lt action name Geant4TestEventAction UserEvent_2 Property_int 1234 Property_double be15 Property_string Hello_2 gt lt actions gt lt geant4_setup gt The default properties of every Geant4Action object are Name string Action name OutputLevel int Flag to customize the level of printout Control boolean Flag if the UI messenger should be installed The name attribute of an action child is a qualified name The first part denotes the type of the plugin i e its class the second part the name of the instance
12. objects using the plugin mechanism and setting properties to Geant4Action objects These helpers and the corresponding functionality are not included in the wrapped classes themselves to not clutter the code with stuff only used for the setup All contained objects are in the namespace DD4hep Simulation Setup Save yourself specifying all the namespaces objects are in CINT processing pragmas Classes defined here will be available at the ROOT prompt after this AClick is loaded Sampler to fill the sensitive detector sequences for each subdetector with two entries a handler and a monitor action Please note that this here is example code and in real life specialized actions will have to be provided for each subdetector Let s go for it here the entry point starts Create the Geant4Kernel object Load the geometry into DD4hep Redefine the setup of the sensitive detectors Create the generator action of type Geant4ParticleGun with name Gun set non default properties and activate the configured object by attaching it to the Geant4Kernel Create a user defined begin of run action callback set the properties and attach it to the begin of run calls To collect statistics extra member functions are registered to be called at the beginning and the end of each event Create a user defined event action routine set its properties and attach it to the event action sequence Create a second event action and register it to the event a
13. records allows to adapt DDG4 in a simple and flexible manner to any input format Currently supported is the input from raw LCIO files StdHep records using LCIO and ASCII files using the HEPEvt format e Similarly as for the input stage also the output format can be freely chosen by the clients e No assumptions was made concerning the structure to store information from energy deposits Any information extract produced by the sensitive actions can be adapted provided at the output stage the proper conversion mechanism is present The sensitive detectors provided by DDG4 are optional only and by no means mandatory User defined classes may be provided at any time Appropriate tools to extract MC truth information is provided at the output stage e The modular approach of the action sequences described in 3 4 allows to easily extend the gener ation sequence to handle multiple simultaneous interactions event overlay or spillover response very easily In section the generic mechanism of input data handling is described In section 5 3 the MC truth handling is discussed In section 6 we describe the output mechanism 3The handling of spillover is only possible if during the digitization step the correct signal shape corresponding to the shift of signal creation is taken into account DDG4 User Manual 26 Sa A A N ID Advanced European Infrastructures for Detectors at Accelerators Geant4GenerationActionInit i E
14. seq act act seq act act seq irst the tracking detectors DDG4 SensitiveSequence kernel Geant4SensDetActionSequence SiVertexBarrel DDG4 SensitiveAction kernel Geant4SimpleTrackerAction SiVertexBarrelHandler SiVertexBarrel add act add f1 add f4 add f1 DDG4 SensitiveSequence kernel Geant4SensDetActionSequence SiVertexEndcap DDG4 SensitiveAction kernel Geant4SimpleTrackerAction SiVertexEndcapHandler SiVertexEndcap add act add f1 add 4 DDG4 SensitiveSequence kernel Geant4SensDetActionSequence SiTrackerBarrel DDG4 SensitiveAction kernel Geant4SimpleTrackerAction SiTrackerBarrelHandler SiTrackerBarrel add act add f1 add f4 DDG4 SensitiveSequence kernel Geant4SensDetActionSequence SiTrackerEndcap DDG4 SensitiveAction kernel Geant4SimpleTrackerAction SiTrackerEndcapHandler SiTrackerEndcap add act DDG4 SensitiveSequence kernel Geant4SensDetActionSequence SiTrackerForward DDG4 SensitiveAction kernel Geant4SimpleTrackerAction SiTrackerForwardHandler SiTrackerForward add act ow the calorimeters DDG4 SensitiveSequence kernel Geant4SensDetActionSequence EcalBarrel DDG4 SensitiveAction kernel Geant4SimpleCalorimeterAction EcalBarrelHandler EcalBarrel add act DDG4 SensitiveSequence kernel Geant4SensDetActionSequence Eca
15. Fm ren A A SS ID Advanced European Infrastructures for Detectors at Accelerators lcdd kernel 1cdd print List of sensitive detectors for i in lcdd detectors o DDG4 DetElement i second sd lcdd sensitiveDetector o name if sd isValid print 32s type 4s A o name sd type Configure Run actions runi DDG4 RunAction kernel Geant4TestRunAction RunInit runi Property_int 12345 runi Property_double 5e15 keV runi Property_string Startrun Hello 2 print runi Property_string runi Property_double runi Property_int run1 enableUI kernel registerGlobalAction run1 kernel runAction add run1 it Configure Event actions evt2 DDG4 EventAction kernel Geant4TestEventAction UserEvent_2 evt2 Property_int 123454321 evt2 Property_double 5e15 GeV evt2 Property_string Hello_2 from the python setup evt2 enableUI kernel registerGlobalAction evt2 evti DDG4 EventAction kernel Geant4TestEventAction UserEvent_1 evt1 Property_int 01234 evt1 Property_double 1e11 evti Property_string Hello_1i evti enableUI kernel eventAction add evt1 kernel eventAction add evt2 Configure I 0 evt root DDG4 EventAction kernel Geant40utput2RO0T RootOutput evt_root Control True evt_root Dutput simple root evt_root enableUI evt_lcio DDG4 EventAction kernel Geant40utput2LC1I0 LcioOutput evt_1cio Dutput
16. Object Geant4Kernel o o o o e e 2 3 2 Action Sequences dos ies ek a a A RR a M 3 3 3 The Base Class of DDG4 Actions Geant4Action eee eee ne 3 3 3 1 The Properties of Geant4Action Instances o a 4 A E E E rer 4 3 0 Sensitive Detectorsl eee eee eee eee eee eee ee 7 3 5 1 Helpers of Sensitive Detectors The Geant4VolumeManager 8 3 5 2 DDG4 Intrinsic Sensitive Detectors 2 aoa a ee 9 3 0 3 sensitive Detector Filters ee 9 3 6 The Geant4 Physics List o ee ee 11 srt 12 4 Setting up DDG4 14 4 1 Setting up DDG4 using XML 2 ee 14 4 1 1 Setup of the Physics List 2 0 0 0 0 0000 eee eee 14 Lt amp be 84 24 aa ee ek Bee bbe ha 15 We ee o ee Bde ee Se ee A a ee a 16 onde wre tbs dx eee dane a Sere ok eed A 16 e Se pea ee tk ee rico ge Bee 17 hs Gt tees he he as ee dy ev ee es ee ee 18 Lanre BoM ow em He ek Aton hd eh Be eee hee ee 18 2 Setting up DDG4 using ROOT CINT oaoa aaa eee eee eee 19 Zi os oir we en Aa Gh Gate Sh eek cae eae 21 Pe ah a a ee Ie eee he hea ee ee ae es 25 26 51 Input Data Handling se se e a ee eR a A 27 5 2 Anatomy of the Input Action 2 2 0 0 000 eee ee ee 28 5 3 Monte Carlo Truth Handling 2 2 02 0 000022 ee eee 29 6 Output Data Handling 30 31 7 1 Generic Action Modules 32 ave o da pda a sa pad bos 32 E E E ee E a 32 7 3 Geant4 Generation Action Modules 2
17. UIMessenger class responsible for the interaction between the user and the components of DDG4 and Geant4 The UI control is enabled as soon as the property Control boolean is set to true Be default all properties of the action are exported Similar to the callback mechanism described above it is also feasible to register any object callback invoking a method of a Geant4Action subclass The following shortened screen dump illustrates the usage of the generic interface any Geant4Action offers Idle gt 1s Command directory path Sub directories control UI control commands units Available units process Process Table control commands ddg4 Control for all named Geant4 actions Idle gt cd ddg4 Idle gt 1s Control for all named Geant4 actions Sub directories ddg4 RunInit Control hierarchy for Geant4 action RunInit ddg4 RunAction Control hierarchy for Geant4 action RunAction ddg4 EventAction Control hierarchy for Geant4 action EventAction ddg4 GeneratorAction Control hierarchy for Geant4 action GeneratorAction ddg4 LCI01 Control hierarchy for Geant4 action LCIO1 ddg4 Smeari Control hierarchy for Geant4 action Smear1 ddg4 PrimaryHandler Control hierarchy for Geant4 action PrimaryHandler ddg4 TrackingAction Control hierarchy for Geant4 action TrackingAction ddg4 SteppingAction Control hierarchy for Geant4 action SteppingAction ddg4 ParticleHandler Control hierarchy for Geant4 action ParticleHandle
18. ant4TrackingAction e The SteppingAction attached to the G4UserSteppingAction implemented by the Geant4 SteppingActionSequence class and is called for each step when tracking a particle Members of the Geant4SteppingActionSequence are of type Geant4SteppingAction and receive the callbacks by overloading the member function User stepping callback virtual void operator const G4Step step G4SteppingManager mgr or register a callback with the signature void T const G4Step G4SteppingManager to receive calls using the method Register stepping action callback template lt typename Q typename T gt void call Q p void T f const G4Step G4SteppingManager e The StackingAction attached to the G4UserStackingAction implemented by the Geant4 StackingActionSequence class Members of the Geant4StackingActionSequence are of type Geant4StackingAction and receive the callbacks by overloading the member functions DDG4 User Manual 6 BEN ren A A e ID Advanced European Infrastructures for Detectors at Accelerators New stage callback virtual void newStage Preparation callback virtual void prepare or register a callback with the signature void T O to receive calls using the method Register begin of event callback Types Q and T must be polymorph template lt typename T gt void callAtNewStage T p void T f Register end of event callback Types Q and T must be pol
19. articlePrint Geant4Action to print MC particle information Class name Geant4ParticlePrint File name DDG4 src Geant4ParticlePrint cpp Type Geant4EventAction Component Properties defaults apply OutputType bool Flag to steer output type 1 Print table of particles 2 Print table of particles 3 Print table and tree of particles PrintHits Print associated hits to every particle big output DDG4 User Manual 37 Advanced European Infrastructures for Detectors at Accelerators 7 5 Sensitive Detectors 7 5 1 Geant4TrackerAction Simple sensitive detector for tracking detectors These trackers create one single hit collection The created hits may be written out with the output modules described in Section and The basic specifications are Basics Class name File name Hit collection Hit class File name Geant4SensitiveAction lt Geant4Tracker gt DDG4 plugins Geant4SDActions cpp Name of the readout object Geant4Tracker Hit DDG4 include Geant4Data h Component Properties defaults apply 7 5 2 Geant4CalorimeterAction Simple sensitive detector for calorimeters The sensitive detector creates one single hit collection The created hits may be written out with the output modules described in Section and The basic specifications are Basics Class name File name Hit collection Hit class File name Geant4SensitiveAction lt Geant4Calorimeter gt DDG4 plugins Geant4SDActi
20. as they are used for example in high energy physics experiments In such simulation programs the user normally has to define the experimental setup in terms of its geometry and in terms of its active elements which sample the detector response The goal of DDG4 is to generalize the configuration of a simulation application to a degree which does not force users to write code to test a detector design At the same time it should of course be feasible to supply specialized user written modules which are supposed to seamlessly operate together with standard modules supplied by the toolkit Detector simulation depends strongly on the use of an underlying simulation toolkit the most prominent candidate nowadays being Geant4 8 DD4hep supports simulation activities with Geant4 providing an automatic translation mechanism between geometry representations The simulation response in the active elements of the detector is strongly influenced by the technical choices and precise simulations depends on the very specific detection techniques Similar to the aim of DD4hep I where with time a standard palette of detector components developed by users should become part of the toolkit DDG4 also hopes to provide a standard palette of compo nents used to support simulation activities for detector layouts where detector designers may base the simulation of a planned experiment on these predefined components for initial design and optimization studies The longterm v
21. at option sequences gt lt geant4_setup gt To setup a DDG4 4 application any number of xml setup files may be interpreted iteratively In the following subsections the content of these first level sub trees will be discussed 4 1 1 Setup of the Physics List The main tag to setup a physics list is lt physicslist gt with the name attribute defining the instance of the Geant4PhysicsList object An example code snippet is shown below in F igure 9 lt geant4_setup gt lt physicslist name Geant4PhysicsList MyPhysics 0 gt lt extends name QGSP_BERT gt lt Geant4 basic Physics list gt lt particles gt lt Particle constructors gt lt construct name G4Geantino gt lt construct name G4ChargedGeantino gt lt construct name G4Electron gt lt construct name G4Gamma gt lt construct name G4BosonConstructor gt lt construct name G4LeptonConstructor gt lt construct name G4MesonConstructor gt lt construct name G4BaryonConstructor gt lt particles gt lt processes gt lt Process constructors gt lt particle name e cut 1 mm gt lt process name G4eMultipleScattering ordAtRestDoIt 1 ordAlongSteptDolt 1 ordPostStepDoIt 1 gt lt process name G4elonisation ordAtRestDolt 1 ordAlongSteptDolt 2 DDG4 User Manual 14 EN ren A A e ID Advanced European Infrastructures for Detectors at Accelerators 23 ordPostStepDoIt 2 gt 24 lt particle gt
22. ated with the DD4hep detector description package Values must match e In the event that several xml files are parsed it is absolutely vital that the lt actions gt section is interpreted before the sequences e For each XML file several lt sequences gt are allowed 4 1 5 Setup of Geant4 Sensitive Detectors lt geant4_setup gt lt sensitive_detectors gt lt sd name SiTrackerBarrel type Geant4SensDet ecut 10 0 MeV verbose true hit_aggregation position gt lt sd gt lt next sensitive detector gt lt sensitive_detectors gt lt geant4_setup gt DDG4 User Manual 17 EN ren e AIDA Advanced European Infrastructures for Detectors at Accelerators 4 1 6 Miscellaneous Setup of Geant4 Objects This section is used for the flexible setup of auxiliary objects such as the electromagnetic fields used in Geant4 1 lt geant4_setup gt 2 lt properties gt 3 lt attributes name geant4_field 4 id 0 5 type Geant4FieldSetup 6 object GlobalSolenoid 7 global true 8 min_chord_step 0 01 mm 9 delta_chord 0 25 mm 10 delta_intersection 1e 05 mm 11 delta one step 0 001xmm 12 eps min 5e 05xmm 13 eps max 0 001xmm 14 stepper HelixSimpleRunge 15 equation Mag_UsualEgRhs gt 16 lt attributes gt 17 sacs 18 lt properties gt 19 lt geant4_setup gt Important are the tags type and object which are used to firstly define the plugin to be called and secondly define t
23. ating hit s using the information of G4Step object virtual bool process G4Step step G4TouchableHistory history See the implementation file DDG4 plugins Geant4SDA ction cpp for details The produced hits are of type Geant4Tracker Hit e The Geant4CalorimeterAction which may be used to handle generic calorimeter like devices This sensitive detector produces at most one hit for every cell in the calorimeter If several tracks contribute to the energy deposit of this cell the contributions are added up See the implementation file for details The produced hits are of type propagate the MC truth information with respect to each track kept in the particle record Both sensitive detectors use the Geant4VolumeManager discussed in section 3 5 1 to identify the sensi tive elements PLEASE NOTE The above palette of generic sensitive detectors only contains two very often used implementations We hope that this palette over time grows from external contributions of other generic sensitive detectors We would be happy to extend this palette with other generic implementations One example would be the handling of the simulation response for optical detectors like RICH Cerenkov detectors 3 5 3 Sensitive Detector Filters The concept of filters allows to build more flexible sensitive detectors by restricting the hit processing of a given instance of a sensitive action e Examples would be to demand a given particle type before a sens
24. bed in Section 4 Such a palette based approach obviously depends on the availibility of documentation for exisisting components describing the properties of each component and the interaction of each component within the DDG4 framework All components defer from the basic type Geant4Action This means all components have the default properties described in the table below Component Properties default OuputLevel int Output level of the component to customize printouts Name string Component name read only Control boolean Steering of the Geant4 Messenger creation Important notice for developers Since the documentation of developed components is VERY important please never forget to supply the corresponding documentation At least supply the minimal documentation ash shown below in the ap pended examples for the Simple detector response and I O compo nents DDG4 User Manual 31 AN E A N e ID Advanced European Infrastructures for Detectors at Accelerators 7 1 Generic Action Modules 7 1 1 Geant4UlManager The Geant4UIManager handles interactivity aspects between Geant4 its command handlers ie ter minal and the various components the actions interact The Geant4UIManager is a component attached to the Geant4Kernel object All properties of all Geant4Action instances may be exported to Geant4 messengers and may hence be accessible directly from the Geant4 prompt To export properti
25. ce gt lt sequences gt lt geant4_setup gt Here firstly the EventAction sequence is defined with its members Secondly a sensitve detector sequence is defined for the subdetector SiTrackerBarrel of type Geant4SensDetActionSequence The se quence uses two filters GeantinoRejector to not generate hits from geantinos and EnergyDepositMinimumCut to enforce a minimal energy deposit These filters are global i e they may be applied by many subdetec tors The setup of global filters is described in Section 4 1 3 Finally the action SiTrackerEndcapHandler of type Geant4SimpleTrackerAction is chained which collects the deposited energy and creates a collec tion of hits The Geant4SimpleTrackerAction is a template callback to illustrate the usage of sensitive elements in DDG4 The resulting hit collection of these handlers by default have the same name as the object instance name Analogous below the sensitive detector sequence for the subdetector SiTrackerEndcap is shown which reuses the same filter actions but will build its own hit collection Plase note e It was already mentioned but once again Event run generator tracking stepping and stacking actions sequences have predefined names These names are fixed and part of the common knowledge they cannot be altered Please refer to Section 3 4 for the names of the global action sequences e the sensitive detector sequences are matched by the attribute sd to the subdetectors cre
26. ced European Infrastructures for Detectors at Accelerators Geant4PrimaryEvent Geant4vertex vertices 1 n interactions 0 n i V Geant4Primaryinteraction Geant4PrimaryMap particles 0 n Geant4Particle daughters 0 n G4PrimaryParticle GeantaParticie _Aprents 0 m Figure 10 The DDG4 event data model primaryMap 5 Higher Level Components Layered components which base on the general framework implement higher level functionality such as the handling of Monte Carlo truth associations between simulated energy deposits and the corre sponding particles or the generic handling of input to the simulation To generalize such common behavior it is mandatory that the participating components collaborate and understand the data components the commonly access The data model is shown in Figure 10 Please note that this data model is by no means to be made persistent and used for physics user analysis This model is optimized to support the simulation process and the necessary user actions to handle MC truth to easily and relatively fast look up and modify parent daughter relationships etc This choice is based on the assumption that the additional overhead to convert particles at the input output stage is small compared to the actual resource consumption of Geant4 to simulate the proper detector response On the other hand this choice has numerous advantages e Accepting the fact to convert input
27. ction sequence This action will be called after the previously created action For this event action we want to receive callbacks at start and end of run to produce additional summary output Call the sampler routine to attach test actions to the subdetectors defined Configure initialize and run the Geant4 application Most of the Geant4 actions will only be created here and the action sequences created before will be attached now Terminate the Geant4 application and exit DDG4 User Manual 20 SN EPA e AIDA Advanced European Infrastructures for Detectors at Accelerators CINT currently cannot handle pointers to member functions Hence the above AClick only works in compiled mode To invoke the compilation the following action is necessary from the ROOT prompt 1 gt root exe 2 RO KK KK KK KK KK KKR KK KK k kk kk kkk 3 x 4 WELCOME to ROOT 5 xk 6 Version 5 34 10 29 August 2013 7T xx 8 You are welcome to visit our Web site 9 http root cern ch 10 MPPPCoororirororerer RR ERR SKK KK kkk k 12 13 ROOT 5 34 10 heads v5 34 00 patches v5 34 10 5 g0e8bac8 Sep 04 2013 11 52 19 on linux 14 15 CINT ROOT C C Interpreter version 5 18 00 July 2 2010 16 Type for help Commands must be C statements 17 Enclose multiple statements between Y 18 root 0 X initAClick C 19 Setting up the CINT include pathes and the link statements 20 2lroot 1 L DD4hep trunk DDG4 examples e
28. cts and parent should NOT be reduced MinimalKineticEnergy double Minimal energy below which particles should be ignored unless other criteria Process created hits etc apply DDG4 User Manual 36 2 fm ren A A A ID Advanced European Infrastructures for Detectors at Accelerators ae 7 4 Geant4 Event Action Modules 7 4 1 Base class Geant4EventAction The EventAction is called for every event This class is the base class for all user actions which have to hook into the begin and end of event actions Typical use cases are the collection computation of event related properties Examples of this functionality may include for example e Reset variables summing event related information in the begin event callback e Monitoring activities such as filling histograms from hits collected during the end event action See also Geant4EventAction in the doxygen documentation Class name Geant4EventAction File name DDG4 src Geant4EventAction cpp Type Geant4EventAction Component Properties defaults apply 7 4 2 Geant4Event ActionSequence The Geant4EventActionSequence is directly steered by the single instance of the G4UserEventAction the Geant4 provided user hook which is private See also Geant4UserEventAction in the doxygen documentation Class name Geant4EventAction File name DDG4 src Geant4EventAction cpp Type Geant4EventAction Component Properties defaults apply 7 4 3 Geant4P
29. e base class G4VSensitiveDetector 3 DDG4 Implementation A basic design criteria of the a DDG4 simulation application was to process any user defined hook provided by Geant4 as a series of algorithmic procedures which could be implemented either using inheritance or by a callback mechanism registering functions fulfilling a given signature Such sequences are provided for all actions mentioned in the list in Section 2 as well as for the callbacks to sensitive detectors The callback mechanism was introduced to allow for weak coupling between the various actions For example could an action performing monitoring using histograms at the event level initialize or reset its histograms at the start end of each run To do so clearly a callback at the start end of a run would be necessary In the following sections a flexible and extensible interface to hooks of Geant4 is discussed starting with the description of the basic components Geant4Kernel and Geant4Action followed by the implementation of the relevant specializations The specializations exposed are sequences of such actions which also call registered objects In later section the configuration and the combination of these components forming a functional simulation application is presented 3 1 The Application Core Object Geant4Kernel The kernel object is the central context of a DDG4 simulation application and gives all clients access to the user hooks see Figure 2 All Geant4 callback
30. ean Infrastructures for Detectors at Accelerators 4 Setting up DDG4 DDG4 offers several possibilities to configure a simulation application using e XML files e by coding a setup script loaded from the ROOT interpreter with the AClick mechanism e by creating a setup script using python and ROOT s reflection mechanism exposed by PyROOT The follwing subsection describe these different mechanism An attempt was made to match the naming conventions of all approaches where possible 4 1 Setting up DDG4 using XML A special plugin was developed to enable the configuration of DDG4 using XML structures These files are parsed identically to the geometry setup in DD4hep the only difference is the name of the root element which for DDG4 is lt geant4_setup gt The following code snippet shows the basic structure of a DDG4 setup file lt geant4_setup gt lt physicslist gt 3 lt physicslist gt lt Defintiion of the physics list gt lt actions gt lt actions gt lt The list of global actions gt lt phases gt lt phases gt lt The definition of the various phases gt lt filters gt lt filters gt lt The list of global filter actions gt lt sequences gt lt sequences gt lt The list of defined sequences gt lt sensitive_detectors gt lt sensitive_detectors gt lt The list of sensitive detectors gt lt properties gt lt properties gt lt Free form
31. egin run_init get amp Geant4TestRunAction begin 45 kernel eventAction callAtBegin run_init get amp Geant4TestRunAction beginEvent 46 kernel eventAction callAtEnd run_init get amp Geant4TestRunAction endEvent 47 48 Action evt_1 kernel Geant4TestEventAction UserEvent_1 49 evt_1 Property_int 12345 Set properties 50 evt_1 Property_string Events 51 kernel eventAction adopt evt_1 DDG4 User Manual 19 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 SS A A Ve ID Advanced European Infrastructures for Detectors at Accelerators EventAction evt_2 kernel Geant4TestEventAction UserEvent_2 kernel eventAction adopt evt_2 kernel runAction callAtBegin evt_2 get amp Geant4TestEventAction begin kernel runAction callAtEnd evt_2 get amp Geant4TestEventAction end setupDetector kernel SiVertexBarrel setupDetector kernel SiVertexEndcap R Rana more subdetectors here setupDetector kernel LumiCal setupDetector kernel BeamCal kernel configure kernel initialize kernel run std cout lt lt Successfully executed application lt lt std endl kernel terminate Line 6 10 13 19 22 29 31 32 33 34 36 40 42 46 48 51 53 54 56 57 59 63 65 66 69 The header file Geant4Config h contains a set of wrapper classes to easy the creation of
32. electFilter ParticleRejectFilter GeantinoRejectFilter Figure 7 The sensitive detector filters design The shown class diagram is actually implemented EnergyDepositMinimumCut DDG4 User Manual 10 LIN ren A A e ID Advanced European Infrastructures for Detectors at Accelerators 3 6 The Geant4 Physics List Geant4 provides the base class G4VUserPhysicsList which allows users to implement customized physics according to the studies to be made Any user defined physics list must provide this interface DDG4 provides such an interface through the ROOT plugin mechanism using the class G4VModularPhysicsList The flexibility of DDG4 allows for several possibilities to setup the Geant4 physics list Instead of explicitly coding the physics list DDG4 foresees the usage of the plugin mechanism to instantiate the necessary calls to Geant4 in a sequence of actions e The physics list is realized as a sequence of actions of type Geant4PhysicsListActionSequence Members of the Geant4PhysicsListActionSequence are of type Geant4PhysicsList and receive the callbacks by overloading the member functions Callback to construct the physics constructors virtual void constructProcess Geant4UserPhysics interface constructParticle callback virtual void constructParticles Geant4UserPhysics particle constructPhysics callback virtual void constructPhysics Geant4UserPhysics physics or register a callback with the
33. es from any action call the enableUI method of the action The callback signature is void operator G4Event event Class name Geant4 File name DDG4 src Geant4 cpp Type Geant4Action Component Properties defaults apply SessionType string Session type csh tcsh etc SetupUI string Name of the UI macro file SetupVIS string Name of the visualization macro file HaveVIS bool Flag to instantiate Vis manager def false unless VisSetup set HaveUI bool Flag to instantiate UI default true 7 2 Predfined Geant4 Physics List Objects The physics list may be defined entirely data driven using the factory mechanism using a variety of predefined objects e Inventory of predefined physics lists which may be inherited DDG4 plugins Geant4PhysiscsLists cpp e Inventory of predefined physics constructors which may be instantiated DDG4 plugins Geant4PhysicsConstructors cpp e Inventory of predefined process constructors which may be instantiated DDG4 plugins Geant4Processes cpp e Inventory of predefined particle constructors which may be instantiated DDG4 plugins Geant4Particles cpp DDG4 User Manual 32 AN ED A A e ID Advanced European Infrastructures for Detectors at Accelerators 7 3 Geant4 Generation Action Modules Here we discuss modules which are instrinsically part of DDG4 and may be attached to the Geant4GeneratorActionSeqt 7 3 1 Base class Geant4GeneratorAction The Geant4Generato
34. essential to store hits so that they can be later accessed and processed efficiently This mechanism is provided by the Geant4VolumeManager Clients typically do not interact with this object any access necessary is provided by the Geant4Sensitive action Method for generating hit s using the information of G4Step object bool MySensitiveAction process G4Step step G4TouchableHistory hist Hit hit new HitQ Retrieve the cellID xxx hit gt cellID cellID step The call is realized using a member function provided by the Geant4Sensitive action DDG4 User Manual 8 SS E A A e ID Advanced European Infrastructures for Detectors at Accelerators Returns the cellID of the sensitive volume corresponding to the step The CellID is the VolumeID the local coordinates of the sensitive area Calculated by combining the VolIDS of the complete geometry path Geant4TouchableHistory from the current sensitive volume to the world volume long long int cellID G4Step step Note The Geant4VolumeManager functionality is not for free It requires that match geant4 volume with TGeo volume 3 5 2 DDG4 Intrinsic Sensitive Detectors Currently there are two generic sensitive detectors implemented in DDG4 e The Geant4TrackerAction which may be used to handle tracking devices This sensitive detec tor produces one hit for every energy deposition of Geant4 i e for every callback to Method for gener
35. he object from the DD4hep description to be configured for the use within Geant4 4 1 7 Setup of Geant4 Phases Phases are configured as shown below However the use is discouraged since it is not yet clear if there are appropriate use cases 1 lt phases gt 2 lt phase type RunAction begin gt 3 lt action name RunInit gt 4 lt action name Geant4TestRunAction UserRunInit gt 5 lt properties Property_int 1234 6 Property_double 5e15 7 Property_string Hello_2 gt 8 lt action gt 9 lt phase gt 10 lt phase type EventAction begin gt 11 lt action name UserEvent_2 gt 12 lt phase gt 13 lt phase type EventAction end gt 14 lt action name UserEvent_2 gt 15 lt phase gt 16 tnt 17 lt phases gt DDG4 User Manual 18 AIDA Advanced European Infrastructures for Detectors at Accelerators 4 2 Setting up DDG4 using ROOT CINT The setup of DDG4 directly from the the ROOT interpreter using the AClick mechanism is very simple but mainly meant for purists like me since it is nearly equivalent to the explicit setup within a C main program The following code section shows how to do it For explanation the code secment is discussed below line by line l1 ttinclude DDG4 Geant4Config h 2 ttinclude DDG4 Geant4TestActions h 3 ttinclude DDG4 Geant4TrackHandler h 4 include lt iostream gt 5 6using namespace std 7 using namespace DD4hep 8using namespace DD4hep
36. ision is to construct simulation applications writing only new components not yet present i e the main work will be to select the appropriate components from the palette and connect them to a functional program This is not a manual to Geant4 nor the basic infrastructure of DD4hep It is assumed that this knowledge is present and the typical glossary is known 2 The Geant4 User Interface The Geant4 simulation toolkit 8 implements a very complex machinery to simulate the energy depo sition of particles traversing materials To ease its usage for the clients and to shield clients from the complex internals when actually implementing a simulation applications for a given detector design it provides several user hooks as shown in Figure Each of these hooks serves a well specialized purpose but unfortunately also leads to very specialized applications One aim of DDG4 is to formalize these user actions so that the invocation at the appropriate time may be purely data driven In detail the following object hooks allow the client to define user provided actions e The User Physics List allows the client to customize and define the underlying physics pro cess es which define the particle interactions inside the detector defined with the geometry description These interactions define the detector response in terms of energy depositions e The Run Action is called once at the start and end of a run i e a series of generated events These two cal
37. itive action is invoked a sensitive action dealing with optical photons RICH detectors etc would e g not be interested in energy depositions of other particles A filter object restricting the particle type to optical photons would be appropriate e Another example would be to implement a special action instance which would be only called if the filter requires a minimum energy deposit There are plenty of possible applications hence we would like to introduce this feature here Filters are called by Geant4 before the hit processing in the sensitive detectors start The global filters may be shared between many sensitive detectors Alternatively filters may be directly attached to the sensitive detector in question Attributes are directly passed as properties to the filter action Technically do Geant4Filter objects inherit from the base class Geant4Filter see Figure 7 Any filter inherits from the common base class Geant4Filter then several specializations may be configured like filters to select reject particles to specify the minimal energy deposit to be processed etc A sensitive detector is called if the filter callback with the signature returns a true result DDG4 User Manual 9 JER EN e AIDA Advanced European Infrastructures for Detectors at Accelerators Filter action Return true if hits should be processed virtual bool operator const G4Step step const Geant4Action Geant4Filter ParticleFilter ParticleS
38. lEndcap DDG4 SensitiveAction kernel Geant4SimpleCalorimeterAction EcalEndCapHandler EcalEndcap add act DDG4 SensitiveSequence kernel Geant4SensDetActionSequence HcalBarrel DDG4 SensitiveAction kernel Geant4SimpleCalorimeterAction HcalBarrelHandler HcalBarrel adoptFilter kernel globalFilter OpticalPhotonRejector add act DDG4 SensitiveAction kernel Geant4SimpleCalorimeterAction Hcal0pticalBarrelHandler HcalBarrel adoptFilter kernel globalFilter OpticalPhotonSelector add act DDG4 User Manual 23 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 ION ren SS AIDA Advanced European Infrastructures for Detectors at Accelerators seq DDG4 SensitiveSequence kernel Geant4SensDetActionSequence HcalEndcap act DDG4 SensitiveAction kernel Geant4SimpleCalorimeterAction HcalEndcapHandler HcalEndcap seq add act seq DDG4 SensitiveSequence kernel Geant4SensDetActionSequence HcalPlug act DDG4 SensitiveAction kernel Geant4SimpleCalorimeterAction HcalPlugHandler HcalPlug seq add act seq DDG4 SensitiveSequence kernel Geant4SensDetActionSequence MuonBarrel act DDG4 SensitiveAction kernel Geant4Si
39. lbacks allow clients to define run dependent actions such as statistics summaries etc e The Primary Generator Action is called for every event During the callback all particles are created which form the microscopic kinematic action of the particle collision This input may either origin directly from an event generator program or come from file e The Event Action is called once at the start and the end of each event It is typically used for a simple analysis of the processed event If the simulated data should be written to some persistent medium the call at the end of the event processing is the appropriate place e The Tracking Action e The Stepping Action e The Stacking Action Geant4 provides all callbacks with the necessary information in the form of appropriate arguments DDG4 User Manual 1 Sa A A SS ID Advanced European Infrastructures for Detectors at Accelerators NE nn ee sn G4UserStackingAction G4TouchableHistory Figure 1 The various user hooks provided by Geant4 Not shown here is the callback system interfacing to the active elements of the detector design Besides the callback system Geant4 provides callbacks whenever a particle traverses a sensitive volume These callbacks are called similar to event actions once at the start and the end of the event but in addition if either the energy deposit of a particle in the sensitive volume exceeds some threshold The callbacks are formalized within th
40. le filters which ignore the sensitive detector action if the particle is a geantino or if the energy deposit is below a given threshold Objects of type Geant4Sensitive receive the callbacks by overloading the member function Method invoked at the begining of each event virtual void begin G4HCofThisEvent hce Method invoked at the end of each event virtual void end G4HCofThisEvent hce Method for generating hit s using the information of G4Step object virtual bool process G4Step step G4TouchableHistory history Method invoked if the event was aborted virtual void clear G4HCofThisEvent hce or register a callback with the signature void T G4HCofThisEvent respectively void T G4Stepx G4TouchableHistory to receive callbacks using the methods Register begin of event callback template lt typename T gt void callAtBegin T p void T f G4HCofThisEvent Register end of event callback template lt typename T gt void callAtEnd T p void T f G4HCofThisEvent Register process hit callback template lt typename T gt void callAtProcess T p void T f G4Step G4TouchableHistory Register clear callback template lt typename T gt void callAtClear T p void T f G4HCofThisEvent Please refer to the Geant4 Applications manual from the Geant4 web page for further details about the concept of sensitive detectors DDG4 User Manual 7 SS
41. mpleCalorimeterAction MuonBarrelHandler MuonBarrel seq add act seq DDG4 SensitiveSequence kernel Geant4SensDetActionSequence MuonEndcap act DDG4 SensitiveAction kernel Geant4SimpleCalorimeterAction MuonEndcapHandler MuonEndcap seq add act seq DDG4 SensitiveSequence kernel Geant4SensDetActionSequence LumiCal act DDG4 SensitiveAction kernel Geant4SimpleCalorimeterAction LumiCalHandler LumiCal seq add act seq DDG4 SensitiveSequence kernel Geant4SensDetActionSequence BeamCal act DDG4 SensitiveAction kernel Geant4SimpleCalorimeterAction BeamCalHandler BeamCal seq add act Now build the physics list phys kernel physicsList phys extends FTFP BERT phys transportation True phys decays True phys enableUI ph DDG4 PhysicsList kernel Geant4PhysicsList Myphysics ph addParticleConstructor G4BosonConstructor ph addParticleConstructor G4LeptonConstructor ph addParticleProcess e G4eMultipleScattering 1 1 1 ph addPhysicsConstructor G40pticalPhysics ph enableUI phys add ph phys dump kernel configure kernel initialize kernel run kernel terminate if __name__ __main__ run DDG4 User Manual 24 LON AIDA e Advanced European Infrastructures for Detectors at Accelerators 4 4 A Simple Example Bla bal DDG4 User Manual 25 Sa A A SS ID Advan
42. onSequence class and is called at the start and the end of tracking one single particle trace through the material of the detector Members of the Geant4TrackingActionSequence are of type Geant4TrackingAction and receive the callbacks by overloading the member function Pre tracking action callback virtual void begin const G4Track trk Post tracking action callback virtual void end const G4Track trk DDG4 User Manual 5 Sa A A N ID Advanced European Infrastructures for Detectors at Accelerators G4UserTrackingAction Geant4TrackingActionSequence gt i and Geant4Action Geant4TrackingAction parent 1 Geant4UserTrackingAction m_sequence 0 1 Invisible to clients Geant4Context m_actions 0 n Geant4TrackActionVertex Geant4TrackActionByEnergy Figure 5 The design of the tracking action sequence Specialized tracking action objects inherit from the Geant4TrackingAction object and must be attached to the sequence or register a callback with the signature void T const G4Step G4SteppingManager to receive calls using the method Register Pre track action callback template lt typename Q typename T gt void callAtBegin Q p void T f const G4Track Register Post track action callback template lt typename Q typename T gt void callAtEnd Q p void T f const G4Track Figure 5 show as an example the design class diagram of the Ge
43. ons cpp Name of the readout object Geant4Calorimeter Hit DDG4 include Geant4Data h Component Properties defaults apply DDG4 User Manual 38 LON E AIDA e Advanced European Infrastructures for Detectors at Accelerators 7 6 I O Components 7 6 1 ROOT Output Simple 7 6 2 LCIO Output Simple DDG4 User Manual 39 yn EN e AIDA Advanced European Infrastructures for Detectors at Accelerators References 1 DD4Hep web page http aidasoft web cern ch DD4hep 2 LHCb Collaboration LHCb the Large Hadron Collider beauty experiment reoptimised detector design and performance CERN LHCC 2003 030 3 S Ponce et al Detector Description Framework in LHCb International Conference on Comput ing in High Energy and Nuclear Physics CHEP 2003 La Jolla CA 2003 proceedings 4 The ILD Concept Group The International Large Detector Letter of Intent ISBN 978 3 935702 42 3 2009 5 H Aihara P Burrows M Oreglia Editors SiD Letter of Intent arXiv 0911 0006 2009 6 R Brun A Gheata M Gheata The ROOT geometry package Nuclear Instruments and Methods A 502 2003 676 680 7 R Brun et al Root An object oriented data analysis framework Nuclear Instruments and Methods A 389 1997 81 86 8 S Agostinelli et al Geant4 A Simulation Toolkit Nuclear Instruments and Methods A 506 2003 250 303 9 T Johnson et al LCGO geometry descri
44. ption for ILC detectors International Conference on Computing in High Energy and Nuclear Physics CHEP 2007 Victoria BC Canada 2012 Proceedings 10 N Graf et al lcsim An integrated detector simulation reconstruction and analysis environment International Conference on Computing in High Energy and Nuclear Physics CHEP 2012 New York 2012 Proceedings 11 R Chytracek et al Geometry Description Markup Language for Physics Simulation and Analysis Applications IEEE Trans Nucl Sci Vol 53 Issue 5 Part 2 2892 2896 http gdml web cern ch 12 C Grefe et al The DDSegmentation package Non existing documentation to be written DDG4 User Manual 40
45. quence which then calls all registered clients of type Geant4TrackingAction The main action sequences have a fixed name These are e The RunAction attached to the G4UserRunAction implemented by the Geant4RunActionSequence class and is called at the start and the end of every run beamOn Members of the Geant4RunActionSequence are of type Geant4RunAction and receive the callbacks by overloading the two routines DDG4 User Manual 4 EN ren e AIDA Advanced European Infrastructures for Detectors at Accelerators begin of run callback virtual void begin const G4Run run End of run callback virtual void end const G4Run run or register a callback with the signature void T const G4Run either to receive begin of run or end or calls using the methods Register begin of run callback Types Q and T must be polymorph template lt typename Q typename T gt void callAtBegin Q p void T f const G4Run Register end of run callback Types Q and T must be polymorph template lt typename Q typename T gt void callAtEnd Q p void T f const G4Run of the Geant4RunActionSequence from the Geant4Context object e The EventAction attached to the G4UserEventAction implemented by the EventActionSequence class and is called at the start and the end of every event Members of the Geant 4EventActionSequence are of type Geant4EventAction and receive the callbacks by overloading the two routines
46. r DDG4 User Manual 12 n Fm ren A A SS ID Advanced European Infrastructures for Detectors at Accelerators ddg4 UserParticleHandler Control hierarchy for Geant4 action UserParticleHandler Idle gt ls Smear1 Command directory path ddg4 Smear1 Commands show Show all properties of Geant4 component Smear1 Control Property item of type bool Mask Property item of type int Name Property item of type std string Offset Property item of type ROOT Math LorentzVector lt ROOT Math PxPyPzE4D lt double gt gt DutputLevel Property item of type int Sigma Property item of type ROOT Math LorentzVector lt ROOT Math PxPyPzE4D lt double gt gt name Property item of type std string Idle gt Smear1 show PropertyManager Property Control True PropertyManager Property Mask 1 PropertyManager Property Name Smeari PropertyManager Property Offset 20 10 10 0 PropertyManager Property OutputLevel 4 PropertyManager Property Sigma 12 8 8 0 PropertyManager Property name Smear1 Idle gt Smeari Offset 200 mm 3 mm 15 mm 10 ns Geant4UIMessenger Smear1 gt Setting property value Offset 200 mm 3x mm 15 mm 10 ns native 200 3 15 10 Idle gt Smear1 show PropertyManager Property Offset 200 3 15 10 DDG4 User Manual 13 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 SN EQ e AIDA Advanced Europ
47. r not and than later install the required data structures These by default are extensions of type e Geant4PrimaryEvent with multiple interaction sections one for each interaction This is the MAIN and ONLY information to feed Geant4 e Geant4PrimaryInteraction containing the track vertex information to create the primary par ticles for Geant4 This record is build from the Geant4PrimaryEvent information e Geant4PrimaryMap a map of the Geant4Particles converted to G4PrimaryParticles to ease particle handling later e Geant4ParticleMap the map of particles created during the event simulation This map has directly the correct particle offsets so that the merging of Geant4PrimaryInteraction particles and the simulation particles is easy DDG4 User Manual 33 ION E AIDA A Advanced European Infrastructures for Detectors at Accelerators Class name File name Type Geant 4Geant4GeneratorActionInit DDG4 src Geant4GeneratorActionInit cpp Geant4GeneratorAction Component Properties Angle double Mask double defaults apply Lorentz Angle of boost Interaction identifier 7 3 4 Geant4InteractionVertexBoost Boost the primary vertex and all particles outgoing the primary interaction Class name File name Type Geant4InteractionVertexBoost DDG4 src Geant4InteractionVertexBoost cpp Geant4GeneratorAction Component Properties Angle double Mask double defaults apply Lorentz Angle of boost In
48. rAction is called for every event During the callback all particles are created which form the microscopic kinematic action of the particle collision This input may either origin directly from an event generator program or come from file The callback signature is void operator G4Event event See also in the doxygen documentation Class name Geant4GeneratorAction File name DDG4 src Geant4GeneratorAction cpp Type Geant4Action Geant4GeneratorAction Component Properties defaults apply 7 3 2 Geant4Generator ActionSequence The sequence dispatches the callbacks at the beginning of an event to all registered Geant4GeneratorAction members and all registered callbacks See also The Geant4GeneratorActionSequence is directly steered by the single instance of the G4VUserPrimaryGeneratorAction the Geant4 provided user hook which is private See also Geant4UserGeneratorAction and Geant4GeneratorActionSequence in the doxygen documen tation Class name Geant 4Geant4GeneratorActionSequence File name DDG4 src Geant4GeneratorAction cpp Type Geant4Action Component Properties defaults apply 7 33 Geant4GeneratorActionInit Initialize the Geant4Event objects to host generator and MC truth related information Geant4 actions to collect the MC particle information This action should register all event extension required for the further processing We want to avoid that every client has to check if a given object is present o
49. s passed to Geant4 After this step all event related user interaction with Geant4 has completed and the detector simulation may commence All modules used are subclasses of the Geant4GeneratorAction and must be added to the Geant4 GeneratorActionSequence as described in 3 4 DDG4 User Manual 27 LON E AIDA e Advanced European Infrastructures for Detectors at Accelerators 5 2 Anatomy of the Input Action DDG4 User Manual 28 BES EN A A e ID Advanced European Infrastructures for Detectors at Accelerators One input action fills one primary interaction Geant4InputAction instances may be followed by decorators which allow to to smear primary vertex Geant4InteractionVertexSmear or to boost the primary vertex Geant4InteractionVertexBoost and all related particles vertices Please note that a possible reduction of particles in the output record may break this unambiguous relationship between hits and particles 5 3 Monte Carlo Truth Handling DDG4 User Manual 29 BEN ren e AIDA Advanced European Infrastructures for Detectors at Accelerators 6 Output Data Handling DDG4 User Manual 30 Aa E AIDA A Advanced European Infrastructures for Detectors at Accelerators 7 Existing DDG4 components In the introduction the longterm goal was expressed that with DDG4 users should be able to pick components from a growing palette and connect the selected components using the setup mechanisms descri
50. signature void T Geant4UserPhysics to receive calls using the method Register process construction callback t template lt typename Q typename T gt void constructProcess Q p void T f Geant4UserPhysics Register particle construction callback template lt typename Q typename T gt void constructParticle Q p void T f Geant4UserPhysics The argument of type Geant4UserPhysics provides a basic interface to the original G4VModular PhysicsList which allows to register physics constructors etc e In most of the cases the above approach is an overkill and often even too flexible Hence alternatively the physics list may consist of a single entry of type Geant4PhysicsList The basic implementation of the Geant4PhysicsList supports the usage of various e particle constructors such as single particle constructors like G4Gamma or G4Proton or whole particle groups like G4BosonConstructor or G4IonConstrutor e physics process constructors such as e g G4GammaConversion G4PhotoElectricEffect or G4ComptonScattering e physics constructors combining particles and the corresponding interactions such as e g G40pticalPhysics HadronPhysicsLHEP or G4HadronElasticPhysics and e predefined Geant4 physics lists such as FTFP BERT CHIPS or QGSP_INCLXX This option is triggered by the content of the string property extends of the Geant4Kernel physicsList action These constructors are in
51. structor as shown here declareProperty OutputLevel m_outputLevel INFO declareProperty Control m_needsControl false The internal setup of the Geant4Action objects then ensure that all declared properties will be set after the object construction to the values set in the setup file Note Because the values can only be set after the object was constructed the actual values may not be used in the constructor of any base or sub class 3 4 Geant4 Action Sequences All Geant4 user hooks are realized as action sequences As shown in Figure 2 these sequences are accessible to the user who may attach specialized actions to the different action sequences This allows a flexible handing of specialized user actions e g to dynamically add monitoring actions filling histograms or to implement alternative hit creation mechanism in a sensitive detector for detailed detector studies Figure 4 shows the schematic call structure of an example Geant4TrackingActionSequence Geant4UserTrackingAction Geant4TrackingActionSequence Geant4TrackingAction aes Geant4TrackingAction Figure 4 The design of the tracking action sequence Specialized tracking action objects inherit from the Geant4TrackingAction object and must be attached to the sequence Geant4 calls the function from the virtual interface G4UserTrackingAction which is realised by the Geant4UserTrackingAction with the single purpose to propagate the call to the action se
52. structures are exposed so that clients can easily objects implementing the required interface or register callbacks with the correct signature Each of these action sequences is connected to an instance of a geant4 provided callback structure as it is shown in Figure DDG4 User Manual 2 po ren A A e ID Advanced European Infrastructures for Detectors at Accelerators Geant4Context m_generatorAction 0 1 Geant4GeneratorActionSequence m_runAction 0 1 Geant4RunActionSequence ane Geant4EventActionSequence FY i Geant4Kernel Z m_trackAction 0 1 Geant4TrackingActionSequence ne gt m_stepAction 0 1 z Geant4SteppingActionSequence se srt dotados Geant4StackingActionSequence m_phases 0 n _ Geant ActionPhase Figure 2 The main application object gives access to all sequencing actions in a DDG4 4 application Sequence actions are only container of user actions calling one user action after the other Optionally single callbacks may be registered to a user action 3 2 Action Sequences As shown in 3 3 The Base Class of DDG4 Actions Geant4Action The class Geant4Action is a common component interface providing the basic interface to the framework to e configure the component using a property mechanism e provide an appropriate interface to Geant4 interactivity The interactivity included a generic way to change and access properties from the Geant4 Ul prompt as well as executing registered commands e As sho
53. t Accelerators Class name Geant4PrimaryHandler File name DDG4 src Geant4PrimaryHandler cpp Type Geant4GeneratorAction Component Properties defaults apply 7 3 9 Geant4ParticleGun Implementation of a particle gun using Geant4Particles The Geant4ParticleGun is a tool to shoot a number of particles with identical properties into a given region of the detector to be simulated The particle gun is a input source like any other and participates in the general input stage merging process like any other input e g from file Hence there may be several particle guns present each generating it s own primary vertex Use the mask property to ensure each gun generates it s own well identified primary vertex There is one user lazyness support though If there is only one particle gun in use the property Standalone which by default is set to true invokes the interaction merging and he Geant4 primary generation directly Class name Geant4PrimaryHandler File name DDG4 src Geant4PrimaryHandler cpp Type Geant4GeneratorAction Component Properties default particle string Particle type to be shot energy double Particle energy in MeV position XYZVector Pole position of the generated particles in mm direction XYZVector Momentum direction of the generated particles isotrop bool Isotrp particle directions in space Mask int bitmask Interaction identifier Standalone bool Setup for standalone execution
54. teraction identifier 7 3 5 Geant4InteractionVertexBoost Boost the primary vertex and all particles outgoing the primary interaction Class name File name Type Geant4InteractionVertexBoost DDG4 src Geant4InteractionVertexBoost cpp Geant4GeneratorAction Component Properties Angle double Mask double defaults apply Lorentz Angle of boost Interaction identifier 7 3 6 Geant4InteractionVertexBoost Boost the primary vertex and all particles outgoing the primary interaction Class name File name Geant4InteractionVertexBoost DDG4 src Geant4InteractionVertexBoost cpp Component Properties Offset PxPyPzEVector Mask PxPyPzEVector defaults apply Smearing offset Sigma on offset 7 3 7 Geant4InteractionMerger Merge all interactions created by each Geant4InputAction into one single record The input records are taken from the item Geant4PrimaryEvent and are merged into the Geant4PrimaryInteraction object attached to the Geant4Event event context Class name File name Type Geant4InteractionMerger DDG4 src Geant4InteractionMerger cpp Geant4GeneratorAction Component Properties defaults apply 7 3 8 Geant4PrimaryHandler Convert the primary interaction object Geant4PrimaryInteraction object attached to the Geant4Event event context and pass the result to Geant4 for simulation DDG4 User Manual BEN EQ A A e ID Advanced European Infrastructures for Detectors a
55. ternally connected to the above callbacks to register themselves The con structors are instantiated using the ROOT plugin mechanism The description of the above interface is only for completeness The basic idea is that the physics list with its particle and physics constructors is configured entirely data driven using the setup mechanism described in the following chapter However DDG4 is not limited to the data driven approach Spe cialized physics lists may be supplied but there should be no need New physics lists could always be composed by actually providing new physics constructors and actually publishing these using the factory methods 1 Framework include files 2 include DDG4 Factories h 3 4 include My_Very_Own_Physics_Constructor h 5 DECLARE_GEANT4_PHYSICS My_Very_Own_Physics_Constructor where My_Very_Own Physics Constructor represents a sub class of G4VPhysicsConstructor DDG4 User Manual 11 SS A A N ID Advanced European Infrastructures for Detectors at Accelerators 3 7 The Support of the Geant4 UI Geant4UIMessenger The support of interactivity in Geant4 is mandatory to debug detector setups in small steps The Geant4 toolkit did provide for this reason a machinery of UI commands G4UlMessenger m directory 0 1 m properties 1 Geant4UlMessenger m control 0 1 m_propertyCmd 0 m_actionCmd 0 Geant4Action Figure 8 The design of the Geant4
56. wn in Figure 3 the base class also provides to its sub class a reference to the Geant4Kernel objects through the Geant4Context The Geant4Action is a named entity and can be uniquely identified within a sequence attached to one Geant4 user callback m_properties 0 PropertyManager m_context 1 Geant4Context Geant4Action m_control 0 1 Geant4UlMessenger Figure 3 The design of the common base class Geant4Action DDG4 knowns two types of actions global actions and anonymous actions Global actions are accessible externally from the Geant4Kernel instance Global actions are also re usable and hence may be con tribute to several action sequences see the following chapters for details Global actions are uniquely DDG4 User Manual 3 Sa A A VT ID Advanced European Infrastructures for Detectors at Accelerators identified by their name Anonymous actions are known only within one sequence and normally are not shared between sequences 3 3 1 The Properties of Geant4Action Instances Nearly any subclass of a Geant4Action needs a flexible configuration in order to be reused modified etc The implementation of the mechanism uses a very flexible value conversion mechanism using boost spirit which support also conversions between unrelated types provided a dictionary is present Properties are supposed to be member variables of a given action object To publish a property it needs to be declared in the con
57. xampleAClick C 22 Info in lt TUnixSystem ACLiC gt creating shared library exampleAClick_C so 23 some Cint warnings concerning member function pointers 24 25 root 2 exampleAClick 26 and it starts The above scripts are present in the DDG4 example directory located in svn The intialization script initAClick C may require customization to cope with the installation pathes 4 3 Setting up DDG4 using Python Given the reflection interface of ROOT the setup of the simulation interface using DD4hep is of course also possible using the python interpreted language In the following code example the setup of Geant4 using the ClicSid example is shown using python P 1 import DDG4 2 from System0fUnits import 3 4 nnn 5 6 DD4hep example setup using the python configuration 7 8 author M Frank 9 version 1 0 10 ie 12 def run 13 kernel DDG4 Kernel 14 kernel loadGeometry file DD4hep trunk DDExamples CLICSiD compact compact xml 15 kernel loadXML DDG4_field xml 16 1This may change in the future once ROOT uses clang and cling as the interpreting engine 2For comparison the same example was used to illustrate the setup using XML files DDG4 User Manual 21 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
58. xecution flow Geant4InputAction es Data flow Initialize N empty objects input single interaction fill primary interaction create G4 primaries and attach to G4Event Geant4 Simulation we Geant4ParticleHandler Figure 11 The generic handling of input sources to DDG4 optimize particle record 5 1 Input Data Handling Input handling has several stages and uses several modules e First the data structures Geant4PrimaryEvent Geant4PrimaryInteraction and Geant4Primary Map are initialized by the action Geant4GenerationActionInit and attached to the Geant4Event structure e The initialization is then followed by any number of input modules Typically each input module add one interaction Each interaction has a unique identifier which is propagated later to all particles Hence all primary particles can later be unambiguously be correlated to one of the initial interactions Each instance of a Geant4InputAction creates and fills a separate instance of a Geant4PrimaryInteraction In section 5 2 the functionality and extensions are discussed in more detail e All individual primary interactions are then merged to only single record using the Geant4 InteractionMerger component This components fills the Geant4PrimaryInteraction regis tered to the Geant4Event which serves as input record for the next component e the Geant4PrimaryHandler The primary handler creates the proper G4PrimaryParticle and G4PrimaryVertex object
59. ymorph template lt typename T gt void callAtPrepare T p void T f All sequence types support the method void adopt T member_reference to add the members Once adopted the sequence takes ownership and manages the member The design of all sequences is very similar 3 5 Sensitive Detectors Sensitive detectors are associated by the detector designers to all active materials which would pro duce a signal which can be read out In Geant4 this concept is realized by using a base class G4VSensitiveDetector The mandate of a sensitive detector is the construction of hit objects using information from steps along a particle track The G4VSensitiveDetector receives a callback at the begin and the end of the event processing and at each step inside the active material whenever an energy deposition occurred The sensitive actions do not necessarily deal only the collection of energy deposits but could also be used to simply monitor the performance of the active element e g by producing histograms of the absolute value or the spacial distribution of the depositions Within DDG4 the concept of sensitive detectors is implemented as a configurable action sequence of type calling members of the type as shown in Figure 6 The actual processing part of such a sensitive action is only called if the and of a set of required filters of type Geant4Filter is positive see also section 3 5 3 No filter is also positive Possible filters are e g partic

Download Pdf Manuals

image

Related Search

Related Contents

S200 - Espresso Mechanics  35ページ超のブックレット  Ver Ficha Técnica  RCA RCR660 User's Manual  Nobo Moderation    FC-POSの詳細パンフレットはこちらから - フジミック新潟  Stadler Form Charly Stand  - Hurst Jaws Of Life  

Copyright © All rights reserved.
Failed to retrieve file