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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/B3/README (Version 11.3.0) and /examples/basic/B3/README (Version 10.4.p3)


                                                   >>   1 $Id$
  1 ----------------------------------------------      2 -------------------------------------------------------------------
  2                                                     3 
  3      =========================================      4      =========================================================
  4      Geant4 - an Object-Oriented Toolkit for S      5      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
  5      =========================================      6      =========================================================
  6                                                     7 
  7                             Example B3              8                             Example B3
  8                             ----------              9                             ----------
  9                                                    10 
 10  This example simulates schematically a Positr     11  This example simulates schematically a Positron Emitted Tomography system.
 11                                                <<  12   
 12  1- GEOMETRY DEFINITION                            13  1- GEOMETRY DEFINITION
 13                                                    14 
 14    The support of gamma detection are scintill     15    The support of gamma detection are scintillating crystals. A small number
 15    of such crystals are optically grouped in a     16    of such crystals are optically grouped in a matrix of crystals. In
 16    this example, individual crystals are not d     17    this example, individual crystals are not described; only the matrix of
 17    crystals is and it is still called 'Crystal     18    crystals is and it is still called 'Crystal' hereafter.
 18                                                    19 
 19    Crystals are circularly arranged to form a      20    Crystals are circularly arranged to form a ring. Few rings make up the full
 20    detector (gamma camera). This is done by po <<  21    detector (gamma camera). This is done by positionning Crystals in 
 21    Ring with an appropriate rotation matrix. S <<  22    Ring with an appropriate rotation matrix. Several copies of Ring are 
 22    then placed in the full detector.           <<  23    then placed in the full detector.  
 23                                                    24 
 24    The head of a patient is schematised as a h     25    The head of a patient is schematised as a homogeneous cylinder of brain
 25    tissue, placed at the center of full detect     26    tissue, placed at the center of full detector.
 26                                                <<  27   
 27    The Crystal material, Lu2SiO5, is not inclu <<  28    The Crystal material, Lu2SiO5, is not included in the G4Nist database. 
 28    Therefore, it is explicitly built in Define     29    Therefore, it is explicitly built in DefineMaterials().
 29                                                <<  30   
 30  2- PHYSICS LIST                                   31  2- PHYSICS LIST
 31                                                    32 
 32    The physics list contains standard electrom     33    The physics list contains standard electromagnetic processes and the
 33    radioactiveDecay module for GenericIon. It  <<  34    radioactiveDecay module for GenericIon. It is defined in the B3PhysicsList 
 34    class as a Geant4 modular physics list with <<  35    class as a Geant4 modular physics list with registered physics builders 
 35    provided in Geant4:                             36    provided in Geant4:
 36    - G4DecayPhysics - defines all particles an     37    - G4DecayPhysics - defines all particles and their decay processes
 37    - G4RadioactiveDecayPhysics - defines radio     38    - G4RadioactiveDecayPhysics - defines radioactiveDecay for GenericIon
 38    - G4EmStandardPhysics - defines all EM stan     39    - G4EmStandardPhysics - defines all EM standard processes
 39                                                <<  40    
 40    This physics list requires data files for:      41    This physics list requires data files for:
 41    - low energy electromagnetic processes whic <<  42    - low energy electromagnetic processes which path is defined via 
 42      the G4LEDATA envirnoment variable             43      the G4LEDATA envirnoment variable
 43    - nuclides properties which path is defined <<  44    - nuclides properties which path is defined via 
 44      the G4ENSDFSTATEDATA envirnoment variable     45      the G4ENSDFSTATEDATA envirnoment variable
 45    - radioactive decay hadronic processes whic <<  46    - radioactive decay hadronic processes which path is defined via 
 46      the G4RADIOACTIVEDATA envirnoment variabl     47      the G4RADIOACTIVEDATA envirnoment variable.
 47                                                <<  48    
 48    See more on installation of the datasets in     49    See more on installation of the datasets in Geant4 Installation Guide,
 49    Chapter 3.3: Note On Geant4 Datasets:           50    Chapter 3.3: Note On Geant4 Datasets:
 50    http://geant4.web.cern.ch/geant4/UserDocume     51    http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
 51                                           /Ins     52                                           /InstallationGuide/html/ch03s03.html
 52  3- ACTION INITALIZATION                           53  3- ACTION INITALIZATION
 53                                                    54 
 54    B3[a,b]::ActionInitialization class instant <<  55    B3[a,b]ActionInitialization class instantiates and registers to Geant4 kernel 
 55    all user action classes.                        56    all user action classes.
 56                                                    57 
 57    While in sequential mode the action classes     58    While in sequential mode the action classes are instatiated just once,
 58    via invoking the method:                        59    via invoking the method:
 59       B3[a,b]::ActionInitialization::Build()   <<  60       B3[a,b]ActionInitialization::Build() 
 60    in multi-threading mode the same method is      61    in multi-threading mode the same method is invoked for each thread worker
 61    and so all user action classes are defined      62    and so all user action classes are defined thread-local.
 62                                                    63 
 63    A run action class is instantiated both thr <<  64    A run action class is instantiated both thread-local 
 64    and global that's why its instance is creat     65    and global that's why its instance is created also in the method
 65       B3[a,b]::ActionInitialization::BuildForM <<  66       B3[a,b]ActionInitialization::BuildForMaster() 
 66    which is invoked only in multi-threading mo     67    which is invoked only in multi-threading mode.
 67                                                <<  68        
 68  4- PRIMARY GENERATOR                              69  4- PRIMARY GENERATOR
 69                                                <<  70   
 70    The default particle beam is an ion (F18),  <<  71    The default particle beam is an ion (F18), at rest, randomly distributed 
 71    within a zone inside a patient and is defin <<  72    within a zone inside a patient and is defined in 
 72    B3::PrimaryGeneratorAction::GeneratePrimari <<  73    B3PrimaryGeneratorAction::GeneratePrimaries().
 73    The type of a primary particle can be chang <<  74    The type of a primary particle can be changed with G4ParticleGun commands 
 74    (see run2.mac).                                 75    (see run2.mac).
 75                                                <<  76    
 76  5- DETECTOR RESPONSE:  scorers                    77  5- DETECTOR RESPONSE:  scorers
 77                                                    78 
 78    A 'good' event is an event in which an iden <<  79    A 'good' event is an event in which an identical energy of 511 keV is 
 79    deposited in two separate Crystals. A count <<  80    deposited in two separate Crystals. A count of the number of such events 
 80    corresponds to a measure of the efficiency  <<  81    corresponds to a measure of the efficiency of the PET system. 
 81    The total dose deposited in a patient durin <<  82    The total dose deposited in a patient during a run is also computed. 
 82                                                <<  83    
 83    Scorers are defined in B3::DetectorConstruc <<  84    Scorers are defined in B3DetectorConstruction::ConstructSDandField(). There are
 84    two G4MultiFunctionalDetector objects: one  <<  85    two G4MultiFunctionalDetector objects: one for the Crystal (EnergyDeposit), 
 85    and one for the Patient (DoseDeposit)           86    and one for the Patient (DoseDeposit)
 86                                                    87 
 87    The scorers hits are saved in form of ntupl <<  88    Two variants of accumulation event statistics in a run are demonstrated 
 88    analysis tools. This feature is activated i << 
 89    G4TScoreNtupleWriter.                       << 
 90                                                << 
 91    Two variants of accumulation event statisti << 
 92    in this example:                                89    in this example:
 93                                                    90 
 94    B3a:                                            91    B3a:
 95                                                <<  92    
 96    At the end of event, the values acummulated <<  93    At the end of event, the values acummulated in B3aEventAction are passed 
 97    in B3a::RunAction and summed over the whole <<  94    in B3aRunAction and summed over the whole run (see B3aEventAction::EndOfevent()). 
 98    In multi-threading mode the data accumulate     95    In multi-threading mode the data accumulated in G4Accumulable objects per
 99    workers is merged to the master in B3a::Run <<  96    workers is merged to the master in B3aRunAction::EndOfRunAction() and the final
100    result is printed on the screen.                97    result is printed on the screen.
101                                                <<  98    
102    G4Accumulable<> type instead of G4double an <<  99    G4Accumulable<> type instead of G4double and G4int types is used for the B3aRunAction
103    data members in order to facilitate merging << 100    data members in order to facilitate merging of the values accumulated on workers 
104    to the master.  Currently the accumulables     101    to the master.  Currently the accumulables have to be registered to G4AccumulablesManager
105    and G4AccumulablesManager::Merge() has to b    102    and G4AccumulablesManager::Merge() has to be called from the users code. This is planned
106    to be further simplified with a closer inte    103    to be further simplified with a closer integration of G4Accumulable classes in
107    the Geant4 kernel next year.                   104    the Geant4 kernel next year.
108                                                   105 
109    B3b:                                           106    B3b:
110                                                   107 
111    B3b::Run::RecordEvent(), called at end of e << 108    B3bRun::RecordEvent(), called at end of event, collects informations 
112    event per event from the hits collections,  << 109    event per event from the hits collections, and accumulates statistic for 
113    B3b::RunAction::EndOfRunAction().           << 110    B3bRunAction::EndOfRunAction().  
114    In addition, results for dose are accumulat << 111    
115    standard floating-point summation and using << 112    In multi-threading mode the statistics accumulated per workers is merged 
116    class called G4StatAnalysis. The G4StatAnal << 113    to the master in B3bRun::Merge().
117    (1) the sum, (2) sum^2, (3) number of entri << 114       
118    less than mean * machine-epsilon (the machi << 
119    between 1.0 and the next value representabl << 
120    From these 4 values, G4StatAnalysis provide << 
121    standard deviation, variance, coefficient o << 
122    and r2eff.                                  << 
123                                                << 
124    In multi-threading mode the statistics accu << 
125    to the master in B3b::Run::Merge().         << 
126                                                << 
127  6- STACKING ACTION                               115  6- STACKING ACTION
128                                                << 116  
129    Beta decay of Fluor generates a neutrino. O    117    Beta decay of Fluor generates a neutrino. One wishes not to track this
130    neutrino; therefore one kills it immediatel    118    neutrino; therefore one kills it immediately, before created particles
131    are put in a stack.                            119    are put in a stack.
132    The function B3::StackingAction::ClassifyNe << 120    The function B3StackingAction::ClassifyNewTrack() is invoked by G4 kernel
133    each time a new particle is created.        << 121    each time a new particle is created.       
134                                                   122 
135  The following paragraphs are common to all ba    123  The following paragraphs are common to all basic examples
136                                                   124 
137  A- VISUALISATION                                 125  A- VISUALISATION
138                                                   126 
139    The visualization manager is set via the G4    127    The visualization manager is set via the G4VisExecutive class
140    in the main() function in exampleB3.cc.     << 128    in the main() function in exampleB3.cc.    
141    The initialisation of the drawing is done v    129    The initialisation of the drawing is done via a set of /vis/ commands
142    in the macro vis.mac. This macro is automat    130    in the macro vis.mac. This macro is automatically read from
143    the main function when the example is used     131    the main function when the example is used in interactive running mode.
144                                                   132 
145    By default, vis.mac opens an OpenGL viewer     133    By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
146    The user can change the initial viewer by c    134    The user can change the initial viewer by commenting out this line
147    and instead uncommenting one of the other /    135    and instead uncommenting one of the other /vis/open statements, such as
148    HepRepFile or DAWNFILE (which produce files    136    HepRepFile or DAWNFILE (which produce files that can be viewed with the
149    HepRApp and DAWN viewers, respectively).  N    137    HepRApp and DAWN viewers, respectively).  Note that one can always
150    open new viewers at any time from the comma    138    open new viewers at any time from the command line.  For example, if
151    you already have a view in, say, an OpenGL     139    you already have a view in, say, an OpenGL window with a name
152    "viewer-0", then                               140    "viewer-0", then
153       /vis/open DAWNFILE                          141       /vis/open DAWNFILE
154    then to get the same view                      142    then to get the same view
155       /vis/viewer/copyView viewer-0               143       /vis/viewer/copyView viewer-0
156    or to get the same view *plus* scene-modifi    144    or to get the same view *plus* scene-modifications
157       /vis/viewer/set/all viewer-0                145       /vis/viewer/set/all viewer-0
158    then to see the result                         146    then to see the result
159       /vis/viewer/flush                           147       /vis/viewer/flush
160                                                   148 
161    The DAWNFILE, HepRepFile drivers are always    149    The DAWNFILE, HepRepFile drivers are always available
162    (since they require no external libraries),    150    (since they require no external libraries), but the OGL driver requires
163    that the Geant4 libraries have been built w    151    that the Geant4 libraries have been built with the OpenGL option.
164                                                   152 
165    Since 11.1, the TSG visualization driver ca << 
166    file output in png, jpeg, gl2ps formats wit << 
167    It can be controlled via UI commands provid << 
168    demonstrated in the tsg_offscreen.mac macro << 
169                                                << 
170    For more information on visualization, incl    153    For more information on visualization, including information on how to
171    install and run DAWN, OpenGL and HepRApp, s    154    install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
172    for example,                                   155    for example,
173    http://geant4.slac.stanford.edu/Presentatio    156    http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
174    (where [VIS] can be replaced by DAWN, OpenG    157    (where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
175                                                   158 
176    The tracks are automatically drawn at the e    159    The tracks are automatically drawn at the end of each event, accumulated
177    for all events and erased at the beginning     160    for all events and erased at the beginning of the next run.
178                                                   161 
179  B- USER INTERFACES                               162  B- USER INTERFACES
180                                                << 163  
181    The user command interface is set via the G    164    The user command interface is set via the G4UIExecutive class
182    in the main() function in exampleB3.cc      << 165    in the main() function in exampleB3.cc 
183                                                << 166    The selection of the user command interface is then done automatically 
184    The selection of the user command interface << 167    according to the Geant4 configuration or it can be done explicitly via 
185    according to the Geant4 configuration or it << 168    the third argument of the G4UIExecutive constructor (see exampleB4a.cc). 
186    the third argument of the G4UIExecutive con << 169  
187                                                << 
188    The gui.mac macros are provided in examples << 
189    is automatically executed if Geant4 is buil << 
190    It is also possible to customise the icons  << 
191    demonstrated in the icons.mac macro in exam << 
192                                                << 
193 C- HOW TO RUN                                     170 C- HOW TO RUN
194                                                   171 
195     - Execute exampleB3a in the 'interactive m    172     - Execute exampleB3a in the 'interactive mode' with visualization
196         % ./exampleB3a                         << 173         % exampleB3a
197       and type in the commands from run1.mac l << 174       and type in the commands from run1.mac line by line:  
198         Idle> /control/verbose 2                  175         Idle> /control/verbose 2
199         Idle> /tracking/verbose 2                 176         Idle> /tracking/verbose 2
200         Idle> /run/beamOn 1                    << 177         Idle> /run/beamOn 1 
201         Idle> ...                                 178         Idle> ...
202         Idle> exit                                179         Idle> exit
203       or                                          180       or
204         Idle> /control/execute run1.mac           181         Idle> /control/execute run1.mac
205         ....                                      182         ....
206         Idle> exit                                183         Idle> exit
207                                                   184 
208     - Execute exampleB3a in the 'batch' mode f << 185     - Execute exampleB3a in the 'batch' mode from macro files 
209      (without visualization)                      186      (without visualization)
210         % ./exampleB3a run2.mac                << 187         % exampleB3a run2.mac
211         % ./exampleB3a exampleB3.in > exampleB << 188         % exampleB3a exampleB3.in > exampleB3.out
212                                                << 
213                                                   189 
                                                   >> 190