Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/basic/B3/README is written in an unsupported language. File is not indexed.

0001 -------------------------------------------------------------------
0002 
0003      =========================================================
0004      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
0005      =========================================================
0006 
0007                             Example B3
0008                             ----------
0009 
0010  This example simulates schematically a Positron Emitted Tomography system.
0011 
0012  1- GEOMETRY DEFINITION
0013 
0014    The support of gamma detection are scintillating crystals. A small number
0015    of such crystals are optically grouped in a matrix of crystals. In
0016    this example, individual crystals are not described; only the matrix of
0017    crystals is and it is still called 'Crystal' hereafter.
0018 
0019    Crystals are circularly arranged to form a ring. Few rings make up the full
0020    detector (gamma camera). This is done by positionning Crystals in
0021    Ring with an appropriate rotation matrix. Several copies of Ring are
0022    then placed in the full detector.
0023 
0024    The head of a patient is schematised as a homogeneous cylinder of brain
0025    tissue, placed at the center of full detector.
0026 
0027    The Crystal material, Lu2SiO5, is not included in the G4Nist database.
0028    Therefore, it is explicitly built in DefineMaterials().
0029 
0030  2- PHYSICS LIST
0031 
0032    The physics list contains standard electromagnetic processes and the
0033    radioactiveDecay module for GenericIon. It is defined in the B3::PhysicsList
0034    class as a Geant4 modular physics list with registered physics builders
0035    provided in Geant4:
0036    - G4DecayPhysics - defines all particles and their decay processes
0037    - G4RadioactiveDecayPhysics - defines radioactiveDecay for GenericIon
0038    - G4EmStandardPhysics - defines all EM standard processes
0039 
0040    This physics list requires data files for:
0041    - low energy electromagnetic processes which path is defined via
0042      the G4LEDATA envirnoment variable
0043    - nuclides properties which path is defined via
0044      the G4ENSDFSTATEDATA envirnoment variable
0045    - radioactive decay hadronic processes which path is defined via
0046      the G4RADIOACTIVEDATA envirnoment variable.
0047 
0048    See more on installation of the datasets in Geant4 Installation Guide,
0049    Chapter 3.3: Note On Geant4 Datasets:
0050    http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
0051                                           /InstallationGuide/html/ch03s03.html
0052  3- ACTION INITALIZATION
0053 
0054    B3[a,b]::ActionInitialization class instantiates and registers to Geant4 kernel
0055    all user action classes.
0056 
0057    While in sequential mode the action classes are instatiated just once,
0058    via invoking the method:
0059       B3[a,b]::ActionInitialization::Build()
0060    in multi-threading mode the same method is invoked for each thread worker
0061    and so all user action classes are defined thread-local.
0062 
0063    A run action class is instantiated both thread-local
0064    and global that's why its instance is created also in the method
0065       B3[a,b]::ActionInitialization::BuildForMaster()
0066    which is invoked only in multi-threading mode.
0067 
0068  4- PRIMARY GENERATOR
0069 
0070    The default particle beam is an ion (F18), at rest, randomly distributed
0071    within a zone inside a patient and is defined in
0072    B3::PrimaryGeneratorAction::GeneratePrimaries().
0073    The type of a primary particle can be changed with G4ParticleGun commands
0074    (see run2.mac).
0075 
0076  5- DETECTOR RESPONSE:  scorers
0077 
0078    A 'good' event is an event in which an identical energy of 511 keV is
0079    deposited in two separate Crystals. A count of the number of such events
0080    corresponds to a measure of the efficiency of the PET system.
0081    The total dose deposited in a patient during a run is also computed.
0082 
0083    Scorers are defined in B3::DetectorConstruction::ConstructSDandField(). There are
0084    two G4MultiFunctionalDetector objects: one for the Crystal (EnergyDeposit),
0085    and one for the Patient (DoseDeposit)
0086 
0087    The scorers hits are saved in form of ntuples in a Root file using Geant4
0088    analysis tools. This feature is activated in the main () function with instantiating
0089    G4TScoreNtupleWriter.
0090 
0091    Two variants of accumulation event statistics in a run are demonstrated
0092    in this example:
0093 
0094    B3a:
0095 
0096    At the end of event, the values acummulated in B3a::EventAction are passed
0097    in B3a::RunAction and summed over the whole run (see B3a::EventAction::EndOfevent()).
0098    In multi-threading mode the data accumulated in G4Accumulable objects per
0099    workers is merged to the master in B3a::RunAction::EndOfRunAction() and the final
0100    result is printed on the screen.
0101 
0102    G4Accumulable<> type instead of G4double and G4int types is used for the B3a::RunAction
0103    data members in order to facilitate merging of the values accumulated on workers
0104    to the master.  Currently the accumulables have to be registered to G4AccumulablesManager
0105    and G4AccumulablesManager::Merge() has to be called from the users code. This is planned
0106    to be further simplified with a closer integration of G4Accumulable classes in
0107    the Geant4 kernel next year.
0108 
0109    B3b:
0110 
0111    B3b::Run::RecordEvent(), called at end of event, collects informations
0112    event per event from the hits collections, and accumulates statistic for
0113    B3b::RunAction::EndOfRunAction().
0114    In addition, results for dose are accumulated in a
0115    standard floating-point summation and using a new lightweight statistical
0116    class called G4StatAnalysis. The G4StatAnalysis class records four values:
0117    (1) the sum, (2) sum^2, (3) number of entries, and (4) the number of entries
0118    less than mean * machine-epsilon (the machine epsilon is the difference
0119    between 1.0 and the next value representable by the floating-point type).
0120    From these 4 values, G4StatAnalysis provides the mean, FOM, relative error,
0121    standard deviation, variance, coefficient of variation, efficiency, r2int,
0122    and r2eff.
0123 
0124    In multi-threading mode the statistics accumulated per workers is merged
0125    to the master in B3b::Run::Merge().
0126 
0127  6- STACKING ACTION
0128 
0129    Beta decay of Fluor generates a neutrino. One wishes not to track this
0130    neutrino; therefore one kills it immediately, before created particles
0131    are put in a stack.
0132    The function B3::StackingAction::ClassifyNewTrack() is invoked by G4 kernel
0133    each time a new particle is created.
0134 
0135  The following paragraphs are common to all basic examples
0136 
0137  A- VISUALISATION
0138 
0139    The visualization manager is set via the G4VisExecutive class
0140    in the main() function in exampleB3.cc.
0141    The initialisation of the drawing is done via a set of /vis/ commands
0142    in the macro vis.mac. This macro is automatically read from
0143    the main function when the example is used in interactive running mode.
0144 
0145    By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
0146    The user can change the initial viewer by commenting out this line
0147    and instead uncommenting one of the other /vis/open statements, such as
0148    HepRepFile or DAWNFILE (which produce files that can be viewed with the
0149    HepRApp and DAWN viewers, respectively).  Note that one can always
0150    open new viewers at any time from the command line.  For example, if
0151    you already have a view in, say, an OpenGL window with a name
0152    "viewer-0", then
0153       /vis/open DAWNFILE
0154    then to get the same view
0155       /vis/viewer/copyView viewer-0
0156    or to get the same view *plus* scene-modifications
0157       /vis/viewer/set/all viewer-0
0158    then to see the result
0159       /vis/viewer/flush
0160 
0161    The DAWNFILE, HepRepFile drivers are always available
0162    (since they require no external libraries), but the OGL driver requires
0163    that the Geant4 libraries have been built with the OpenGL option.
0164 
0165    For more information on visualization, including information on how to
0166    install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
0167    for example,
0168    http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
0169    (where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
0170 
0171    The tracks are automatically drawn at the end of each event, accumulated
0172    for all events and erased at the beginning of the next run.
0173 
0174  B- USER INTERFACES
0175 
0176    The user command interface is set via the G4UIExecutive class
0177    in the main() function in exampleB3.cc
0178    The selection of the user command interface is then done automatically
0179    according to the Geant4 configuration or it can be done explicitly via
0180    the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
0181 
0182 C- HOW TO RUN
0183 
0184     - Execute exampleB3a in the 'interactive mode' with visualization
0185         % ./exampleB3a
0186       and type in the commands from run1.mac line by line:
0187         Idle> /control/verbose 2
0188         Idle> /tracking/verbose 2
0189         Idle> /run/beamOn 1
0190         Idle> ...
0191         Idle> exit
0192       or
0193         Idle> /control/execute run1.mac
0194         ....
0195         Idle> exit
0196 
0197     - Execute exampleB3a in the 'batch' mode from macro files
0198      (without visualization)
0199         % ./exampleB3a run2.mac
0200         % ./exampleB3a exampleB3.in > exampleB3.out
0201 
0202