Geant4 Cross Reference |
1 ========================================= 1 ========================================================= 2 Geant4 - an Object-Oriented Toolkit for S 2 Geant4 - an Object-Oriented Toolkit for Simulation in HEP 3 ========================================= 3 ========================================================= 4 4 5 5 6 Example extensibleFactory 6 Example extensibleFactory 7 7 8 R. Hatcher 8 R. Hatcher 9 Fermilab 9 Fermilab 10 (based on Hadr00 by V. Ivantchenko, CERN) 10 (based on Hadr00 by V. Ivantchenko, CERN) 11 11 12 Examples in the physicslist category show the 12 Examples in the physicslist category show the possible ways how to define 13 a physics list from Geant4 physics constructor 13 a physics list from Geant4 physics constructors. This example demonstrates 14 the usage of g4alt::G4PhysListFactory to build 14 the usage of g4alt::G4PhysListFactory to build the concrete physics list. 15 15 16 Physics List can be defined by its name given 16 Physics List can be defined by its name given by the -p argument of the of the 17 run command or by the PHYSLIST environment var 17 run command or by the PHYSLIST environment variable. 18 18 19 ./extensibleFactory -m my.macro [ -p QGSP_B 19 ./extensibleFactory -m my.macro [ -p QGSP_BERT ] \ 20 [ -v | --verbose ] [ -h | --help ] 20 [ -v | --verbose ] [ -h | --help ] 21 21 22 By default, FTFP_BERT Physics List will be ins 22 By default, FTFP_BERT Physics List will be instantiated if 23 -p argument is not set and the PHYSLIST enviro 23 -p argument is not set and the PHYSLIST environment variable is not defined. 24 This is the system default, but can be overrid 24 This is the system default, but can be overridden using the 25 SetDefaultReferencePhysList() method on the fa 25 SetDefaultReferencePhysList() method on the factory (see the code). 26 26 27 The extensible factory allows users to define 27 The extensible factory allows users to define and register their own physics 28 lists. This example shows the addtional a new 28 lists. This example shows the addtional a new list "MySpecialPhysList". 29 29 30 ./extensibleFactory -m run.mac -p MySpecial 30 ./extensibleFactory -m run.mac -p MySpecialPhysList 31 31 32 The extensible factory also allows for the ext 32 The extensible factory also allows for the extension of lists by adding 33 (using "+" as a separator) or replacing (using 33 (using "+" as a separator) or replacing (using "_" as a separator) 34 specific physics constructors. These can be s 34 specific physics constructors. These can be specified by 35 pre-defining a short name (e.g. RADIO for G4Ra 35 pre-defining a short name (e.g. RADIO for G4RadioactiveDecayPhysics) or 36 providing the full class name. 36 providing the full class name. 37 37 38 ./extensibleFactory -m run.mac -p FTFP_BERT 38 ./extensibleFactory -m run.mac -p FTFP_BERT_EMX+G4OpticalPhysics+RADIO 39 39 40 uses the FTFP_BERT physics list as a base 40 uses the FTFP_BERT physics list as a base 41 * replaces the list's standard EM portion wi 41 * replaces the list's standard EM portion with 42 G4EmStandardPhysics_option2 ( standard 42 G4EmStandardPhysics_option2 ( standard EMX extension ) 43 * adds G4OpticalPhysics 43 * adds G4OpticalPhysics 44 * adds G4RadioactiveDecayPhysics (RADIO defi 44 * adds G4RadioactiveDecayPhysics (RADIO defined in code to map to this) 45 45 46 The same experimental setup is used for all ex 46 The same experimental setup is used for all examples in the physicslist 47 category: 47 category: 48 48 49 1- Detector description 49 1- Detector description 50 ----------------------- 50 ----------------------- 51 51 52 The geometry (defined in the DetectorConstruct 52 The geometry (defined in the DetectorConstruction class) consists in a box of 53 scintillator material (CsI) followed by a thin 53 scintillator material (CsI) followed by a thin box of air (screen) which is used 54 to simplify scoring. 54 to simplify scoring. 55 55 56 56 57 2- Primary generator 57 2- Primary generator 58 -------------------- 58 -------------------- 59 59 60 The primary generator is defined with usage of 60 The primary generator is defined with usage of G4ParticleGun. 61 The default particle is proton which hits the 61 The default particle is proton which hits the box perpendicular to the input face. 62 The type of the particle and its energy are se 62 The type of the particle and its energy are set in the PrimaryGeneratorAction class, and can 63 be changed via the G4 built-in commands of the 63 be changed via the G4 built-in commands of the G4ParticleGun class. 64 64 65 65 66 3- Scoring (ntuples) 66 3- Scoring (ntuples) 67 -------------------- 67 -------------------- 68 68 69 The screen volume is associated with a sensiti 69 The screen volume is associated with a sensitive detector, ScreenSD, 70 which accounts the following particle properti 70 which accounts the following particle properties: 71 - trackID 71 - trackID 72 - particle PDG encoding 72 - particle PDG encoding 73 - particle kinetic energy 73 - particle kinetic energy 74 - particle X,Y position 74 - particle X,Y position 75 - particle time 75 - particle time 76 76 77 The scored quantities are filled in the Screen 77 The scored quantities are filled in the Screen ntuple, which is defined using G4AnalysisManager 78 in RunAction class. The ntuple is saved in a R 78 in RunAction class. The ntuple is saved in a Root file, which name is set to be equal to the 79 example name in main () function. 79 example name in main () function. 80 80 81 4- How to build 81 4- How to build 82 ---------------- 82 ---------------- 83 83 84 An additional step is needed when building the 84 An additional step is needed when building the example with GNUmake 85 due to using the extra shared directory: 85 due to using the extra shared directory: 86 % cd path_to_example/example 86 % cd path_to_example/example 87 % gmake setup 87 % gmake setup 88 % gmake 88 % gmake 89 89 90 This will copy the files from shared in the ex 90 This will copy the files from shared in the example include and src; 91 to remove these files: 91 to remove these files: 92 % gmake clean_setup 92 % gmake clean_setup 93 93