Geant4 Cross Reference |
1 This example shows how to use Geant4 as a generator for simulating 2 inelastic hadron-nuclear interactions. 3 4 The class HadronicGenerator is the "generator". 5 The main hadronic models (FTFP, QGSP, BERT, BIC, IonBIC, INCL) 6 and some combinations of two of them - in a transition energy region, 7 similarly to what happens in physics lists - are available. 8 See include/HadronicGenerator.hh for more detailed information. 9 10 The main, Hadr09.cc, shows an example of how to use it. 11 It samples randomly the projectile hadron, its energy, its direction 12 and the target material, and then it calls the generator. 13 Some information regarding the secondaries which are produced can be 14 printed out. 15 See the comments in Hadr09.cc for more information and how eventually 16 to change some of its configurations. 17 Notice that Hadr09.cc does nothing really useful: users should consider 18 to use eventually only the class HadronicGenerator. 19 20 ( 21 The file Hadr09.cc-ION_PROJECTILE shows an example of a ion-ion 22 collision, for fixed type of projectile ion, target ion, projectile 23 kinetic energy, and projectile direction. 24 This file is obtained from Hadr09.cc with minimal changes. 25 ) 26 27 Notice that the Geant4 run-manager is not used. 28 29 To build this example: 30 mkdir Build; cd Build 31 cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ 32 -DGeant4_DIR=/path-to-geant4-libraries ../. 33 make 34 35 To run it: 36 ./Hadr09 37 38 which simulates 1000 hadron-nucleus collisions, randomnly selected, and 39 prints out some information about the secondaries produced in these 40 interactions. It takes only a few seconds to run. 41 42 Note: this example has been included in Geant4 10.7, but it should work 43 also for early versions of Geant4, in particular 10.6, 10.5 and 10.4.