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] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/basic/B2/README (Version 11.3.0) and /examples/basic/B2/README (Version 10.7.p2)


  1 ----------------------------------------------      1 -------------------------------------------------------------------
  2                                                     2 
  3      =========================================      3      =========================================================
  4      Geant4 - an Object-Oriented Toolkit for S      4      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
  5      =========================================      5      =========================================================
  6                                                     6 
  7                             Example B2              7                             Example B2
  8                             ----------              8                             ----------
  9                                                     9 
 10  This example simulates a simplified fixed tar     10  This example simulates a simplified fixed target experiment.
 11                                                    11 
 12  1- GEOMETRY DEFINITION                            12  1- GEOMETRY DEFINITION
 13                                                <<  13  
 14      The setup consists of a target followed b     14      The setup consists of a target followed by six chambers of increasing
 15      transverse size at defined instances from <<  15      transverse size at defined instances from the target. These chambers are 
 16      located in a region called the Tracker re <<  16      located in a region called the Tracker region. 
 17      Their shape are cylinders, constructed as     17      Their shape are cylinders, constructed as simple cylinders
 18      (in B2a::DetectorConstruction) and as par <<  18      (in B2aDetectorConstruction) and as parametrised volumes 
 19      (in B2b::DetectorConstruction), see also  <<  19      (in B2bDetectorConstruction), see also B2bChamberParameterisation class.
 20                                                    20 
 21      In addition, a global, uniform, and trans <<  21      In addition, a global, uniform, and transverse magnetic field can be 
 22      applied using G4GlobalMagFieldMessenger,  <<  22      applied using G4GlobalMagFieldMessenger, instantiated in 
 23      B2[a,b]::DetectorConstruction::ConstructS <<  23      B2[a,b]DetectorConstruction::ConstructSDandField with a non zero field value,
 24      or via interactive commands.              <<  24      or via interactive commands. 
 25      For example:                                  25      For example:
 26                                                    26 
 27      /globalField/setValue 0.2 0 0 tesla           27      /globalField/setValue 0.2 0 0 tesla
 28                                                <<  28  
 29      An instance of the B2::TrackerSD class is <<  29      An instance of the B2TrackerSD class is created and associated with each 
 30      logical chamber volume (in B2a) and with  <<  30      logical chamber volume (in B2a) and with the one G4LogicalVolume associated 
 31      with G4PVParameterised (in B2b).          <<  31      with G4PVParameterised (in B2b). 
 32                                                    32 
 33      One can change the materials of the targe     33      One can change the materials of the target and the chambers
 34      interactively via the commands defined in <<  34      interactively via the commands defined in B2aDetectorMessenger
 35      (or B2b::DetectorMessenger). For example: <<  35      (or B2bDetectorMessenger). For example:
 36                                                    36 
 37      /B2/det/setTargetMaterial G4_WATER            37      /B2/det/setTargetMaterial G4_WATER
 38      /B2/det/setChamberMaterial G4_Ar              38      /B2/det/setChamberMaterial G4_Ar
 39                                                <<  39  
 40  2- PHYSICS LIST                                   40  2- PHYSICS LIST
 41                                                    41 
 42      The particle's type and the physic proces     42      The particle's type and the physic processes which will be available
 43      in this example are set in the FTFP_BERT  <<  43      in this example are set in the FTFP_BERT physics list. This physics list 
 44      requires data files for electromagnetic a     44      requires data files for electromagnetic and hadronic processes.
 45      See more on installation of the datasets      45      See more on installation of the datasets in Geant4 Installation Guide,
 46      Chapter 3.3: Note On Geant4 Datasets:         46      Chapter 3.3: Note On Geant4 Datasets:
 47      http://geant4.web.cern.ch/geant4/UserDocu     47      http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/ch03s03.html
 48      The following datasets: G4LEDATA, G4LEVEL     48      The following datasets: G4LEDATA, G4LEVELGAMMADATA, G4SAIDXSDATA and
 49      G4ENSDFSTATEDATA are mandatory for this e     49      G4ENSDFSTATEDATA are mandatory for this example.
 50                                                <<  50    
 51      In addition, the build-in interactive com     51      In addition, the build-in interactive command:
 52            /process/(in)activate processName       52            /process/(in)activate processName
 53      allows the user to activate/inactivate th     53      allows the user to activate/inactivate the processes one by one.
 54                                                    54 
 55  3- ACTION INITALIZATION                           55  3- ACTION INITALIZATION
 56                                                    56 
 57    A newly introduced class, B2::ActionInitial <<  57    A newly introduced class, B2ActionInitialization,
 58    instantiates and registers to Geant4 kernel     58    instantiates and registers to Geant4 kernel all user action classes.
 59                                                <<  59    
 60    While in sequential mode the action classes     60    While in sequential mode the action classes are instatiated just once,
 61    via invoking the method:                        61    via invoking the method:
 62       B2::ActionInitialization::Build()        <<  62       B2ActionInitialization::Build() 
 63    in multi-threading mode the same method is      63    in multi-threading mode the same method is invoked for each thread worker
 64    and so all user action classes are defined      64    and so all user action classes are defined thread-local.
 65                                                    65 
 66    A run action class is instantiated both thr <<  66    A run action class is instantiated both thread-local 
 67    and global that's why its instance has is c     67    and global that's why its instance has is created also in the method
 68       B2::ActionInitialization::BuildForMaster <<  68       B2ActionInitialization::BuildForMaster() 
 69    which is invoked only in multi-threading mo     69    which is invoked only in multi-threading mode.
 70                                                    70 
 71  4- PRIMARY GENERATOR                              71  4- PRIMARY GENERATOR
 72                                                    72 
 73      The primary generator action class employ <<  73      The primary generator action class employs the G4ParticleGun. 
 74      The primary kinematics consists of a sing <<  74      The primary kinematics consists of a single particle which starts at the world boundary
 75      to the world boundary and hits the target <<  75      and hits the target perpendicular to the entrance face. The type of the particle
 76      face. The type of the particle and its en <<  76      and its energy can be changed via the G4 built-in commands of 
 77      Geant4 built-in commands of the G4Particl <<  77      the G4ParticleGun class.
 78                                                <<  78      Note that this particular case of starting a primary particle on the world boundary
                                                   >>  79      requires shooting in a direction towards inside the world.
                                                   >>  80   
 79  5- RUNS and EVENTS                                81  5- RUNS and EVENTS
 80                                                <<  82  
 81      A run is a set of events.                     83      A run is a set of events.
 82                                                <<  84  
 83      The user has control:                         85      The user has control:
 84         - at Begin and End of each run (class  <<  86         - at Begin and End of each run (class B2RunAction)
 85         - at Begin and End of each event (clas <<  87         - at Begin and End of each event (class B2EventAction)
 86         - at Begin and End of each track (clas     88         - at Begin and End of each track (class TrackingAction, not used here)
 87   - at End of each step (class SteppingAction,     89   - at End of each step (class SteppingAction, not used here)
 88                                                <<  90         
 89      The event number is written to the log fi <<  91      The event number is written to the log file every requested number 
 90      of events in B2::EventAction::BeginOfEven <<  92      of events in B2EventAction::BeginOfEventAction() and 
 91      B2::EventAction::EndOfEventAction().      <<  93      B2EventAction::EndOfEventAction(). 
 92      Moreover, for the first 100 events and ev <<  94      Moreover, for the first 100 events and every 100 events thereafter 
 93      information about the number of stored tr <<  95      information about the number of stored trajectories in the event 
 94      is printed as well as the number of hits  <<  96      is printed as well as the number of hits stored in the G4VHitsCollection. 
 95                                                <<  97      
 96      The run number is printed at B2::RunActio <<  98      The run number is printed at B2RunAction::BeginOfRunAction(), where the 
 97      G4RunManager is also informed how to SetR <<  99      G4RunManager is also informed how to SetRandomNumberStore for storing 
 98      initial random number seeds per run or pe << 100      initial random number seeds per run or per event.         
 99                                                   101 
100  6- USER LIMITS                                   102  6- USER LIMITS
101                                                << 103  
102     This example also illustrates how to intro    104     This example also illustrates how to introduce tracking constraints
103     like maximum step length, minimum kinetic     105     like maximum step length, minimum kinetic energy etc. via the G4UserLimits
104     class and associated G4StepLimiter and G4U << 106     class and associated G4StepLimiter and G4UserSpecialCuts processes.    
105     See B2a::DetectorConstruction (or B2b::Det << 107     See B2aDetectorConstruction (or B2bDetectorConstruction).
106                                                   108 
107     The maximum step limit in the tracker regi    109     The maximum step limit in the tracker region can be set by the interactive
108     command (see B2a::DetectorMessenger, B2b:: << 110     command (see B2aDetectorMessenger, B2bDetectorMessenger classes). 
109     For example:                                  111     For example:
110                                                   112 
111     /B2/det/stepMax 1.0 mm                        113     /B2/det/stepMax 1.0 mm
112                                                   114 
113  7- DETECTOR RESPONSE                             115  7- DETECTOR RESPONSE
114                                                << 116  
115      A HIT is a step per step record of all th    117      A HIT is a step per step record of all the information needed to
116      simulate and analyse the detector respons    118      simulate and analyse the detector response.
117                                                << 119  
118      In this example the Tracker chambers are     120      In this example the Tracker chambers are considered to be the detector.
119      Therefore, the chambers are declared 'sen    121      Therefore, the chambers are declared 'sensitive detectors' (SD) in
120      the B2a::DetectorConstruction (or B2b::De << 122      the B2aDetectorConstruction (or B2bDetectorConstruction) class.
121      They are associated with an instance of t << 123      They are associated with an instance of the B2TrackerSD class.
122                                                << 124  
123      Then, a Hit is defined as a set of 4 info    125      Then, a Hit is defined as a set of 4 informations per step, inside
124      the chambers, namely:                        126      the chambers, namely:
125         - the track identifier (an integer),      127         - the track identifier (an integer),
126   - the chamber number,                           128   - the chamber number,
127   - the total energy deposit in this step, and    129   - the total energy deposit in this step, and
128   - the position of the energy deposit.           130   - the position of the energy deposit.
129                                                   131 
130      A given hit is an instance of the class B << 132      A given hit is an instance of the class B2TrackerHit which is created
131      during the tracking of a particle, step b    133      during the tracking of a particle, step by step, in the method
132      B2::TrackerSD::ProcessHits(). This hit is << 134      B2TrackerSD::ProcessHits(). This hit is inserted in a HitsCollection. 
133                                                   135 
134      The HitsCollection is printed at the end     136      The HitsCollection is printed at the end of each event (via the method
135      B2::TrackerSD::EndOfEvent()), under the c << 137      B2TrackerSD::EndOfEvent()), under the control of the command:
136      /hits/verbose 2                              138      /hits/verbose 2
137                                                   139 
138  The following paragraphs are common to all ba    140  The following paragraphs are common to all basic examples
139                                                   141 
140  A- VISUALISATION                                 142  A- VISUALISATION
141                                                   143 
142    The visualization manager is set via the G4    144    The visualization manager is set via the G4VisExecutive class
143    in the main() function in exampleB2a.cc (or << 145    in the main() function in exampleB2a.cc (or exampleB2b.cc).    
144    The initialisation of the drawing is done v    146    The initialisation of the drawing is done via a set of /vis/ commands
145    in the macro vis.mac. This macro is automat    147    in the macro vis.mac. This macro is automatically read from
146    the main function when the example is used     148    the main function when the example is used in interactive running mode.
147                                                   149 
148    By default, vis.mac opens an OpenGL viewer     150    By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
149    The user can change the initial viewer by c    151    The user can change the initial viewer by commenting out this line
150    and instead uncommenting one of the other /    152    and instead uncommenting one of the other /vis/open statements, such as
151    HepRepFile or DAWNFILE (which produce files    153    HepRepFile or DAWNFILE (which produce files that can be viewed with the
152    HepRApp and DAWN viewers, respectively).  N    154    HepRApp and DAWN viewers, respectively).  Note that one can always
153    open new viewers at any time from the comma    155    open new viewers at any time from the command line.  For example, if
154    you already have a view in, say, an OpenGL     156    you already have a view in, say, an OpenGL window with a name
155    "viewer-0", then                               157    "viewer-0", then
156       /vis/open DAWNFILE                          158       /vis/open DAWNFILE
157    then to get the same view                      159    then to get the same view
158       /vis/viewer/copyView viewer-0               160       /vis/viewer/copyView viewer-0
159    or to get the same view *plus* scene-modifi    161    or to get the same view *plus* scene-modifications
160       /vis/viewer/set/all viewer-0                162       /vis/viewer/set/all viewer-0
161    then to see the result                         163    then to see the result
162       /vis/viewer/flush                           164       /vis/viewer/flush
163                                                   165 
164    The DAWNFILE, HepRepFile drivers are always    166    The DAWNFILE, HepRepFile drivers are always available
165    (since they require no external libraries),    167    (since they require no external libraries), but the OGL driver requires
166    that the Geant4 libraries have been built w    168    that the Geant4 libraries have been built with the OpenGL option.
167                                                   169 
168    Since 11.1, the TSG visualization driver ca << 
169    file output in png, jpeg, gl2ps formats wit << 
170    It can be controlled via UI commands provid << 
171    demonstrated in the tsg_offscreen.mac macro << 
172                                                << 
173    For more information on visualization, incl    170    For more information on visualization, including information on how to
174    install and run DAWN, OpenGL and HepRApp, s    171    install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
175    for example,                                   172    for example,
176    http://geant4.slac.stanford.edu/Presentatio    173    http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
177    (where [VIS] can be replaced by DAWN, OpenG    174    (where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
178                                                   175 
179    The tracks are automatically drawn at the e    176    The tracks are automatically drawn at the end of each event, accumulated
180    for all events and erased at the beginning     177    for all events and erased at the beginning of the next run.
181                                                   178 
182  B- USER INTERFACES                               179  B- USER INTERFACES
183                                                << 180  
184    The user command interface is set via the G    181    The user command interface is set via the G4UIExecutive class
185    in the main() function in exampleB2a.cc     << 182    in the main() function in exampleB2a.cc 
186                                                << 183    The selection of the user command interface is then done automatically 
187    The selection of the user command interface << 184    according to the Geant4 configuration or it can be done explicitly via 
188    according to the Geant4 configuration or it << 185    the third argument of the G4UIExecutive constructor (see exampleB4a.cc). 
189    the third argument of the G4UIExecutive con << 186  
190                                                << 
191    The gui.mac macros are provided in examples << 
192    is automatically executed if Geant4 is buil << 
193    It is also possible to customise the icons  << 
194    demonstrated in the icons.mac macro in exam << 
195                                                << 
196  C- HOW TO RUN                                    187  C- HOW TO RUN
197                                                << 188  
198     - Execute exampleB2a in the 'interactive m    189     - Execute exampleB2a in the 'interactive mode' with visualization
199         % exampleB2a                              190         % exampleB2a
200       and type in the commands from run1.mac l << 191       and type in the commands from run1.mac line by line:  
201         Idle> /tracking/verbose 1              << 192         Idle> /tracking/verbose 1 
202         Idle> /run/beamOn 1                       193         Idle> /run/beamOn 1
203         Idle> ...                                 194         Idle> ...
204         Idle> exit                                195         Idle> exit
205       or                                          196       or
206         Idle> /control/execute run1.mac  or ru << 197         Idle> /control/execute run1.mac  or run2.mac 
207         ....                                      198         ....
208         Idle> exit                                199         Idle> exit
209                                                   200 
210     - Execute exampleB2a in the 'batch' mode f << 201     - Execute exampleB2a in the 'batch' mode from macro files 
211       (without visualization)                     202       (without visualization)
212         % exampleB2a run2.mac                     203         % exampleB2a run2.mac
213         % exampleB2a exampleB2.in > exampleB2.    204         % exampleB2a exampleB2.in > exampleB2.out
214                                                << 205