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