Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/basic/B1/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 B1
0008                             -----------
0009 
0010  This example demonstrates a very simple application where an energy
0011  deposit is accounted in user actions and their associated objects
0012  and a dose in a selected volume is calculated.
0013 
0014 
0015  1- GEOMETRY DEFINITION
0016 
0017    The geometry is constructed in the B1::DetectorConstruction class.
0018    The setup consists of a an envelope of box shape containing two
0019    volumes: a spherical cone and a trapezoid.
0020 
0021    In this example we use  some common materials materials for medical
0022    applications. The envelope is made of water and the two inner volumes
0023    are made from tissue and bone materials.
0024    The materials are created with the help of the G4NistManager class,
0025    which allows to build a material from the NIST database using their
0026    names. All available materials can be found in the Geant4 User's Guide
0027    for Application Developers, Appendix 10: Geant4 Materials Database.
0028 
0029  2- PHYSICS LIST
0030 
0031    The particle's type and the physic processes which will be available
0032    in this example are set in the QBBC physics list. This physics list
0033    requires data files for electromagnetic and hadronic processes.
0034    See more on installation of the datasets in Geant4 Installation Guide,
0035    Chapter 3.3: Note On Geant4 Datasets:
0036    http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
0037                                            /InstallationGuide/html/ch03s03.html
0038    The following datasets: G4LEDATA, G4LEVELGAMMADATA, G4NEUTRONXSDATA,
0039    G4SAIDXSDATA and G4ENSDFSTATEDATA are mandatory for this example.
0040 
0041    In addition the build-in interactive command:
0042                /process/(in)activate processName
0043    allows to activate/inactivate the processes one by one.
0044 
0045  3- ACTION INITALIZATION
0046 
0047    A newly introduced class, B1::ActionInitialization, instantiates and registers
0048    to Geant4 kernel all user action classes.
0049 
0050    While in sequential mode the action classes are instatiated just once,
0051    via invoking the method:
0052       B1::ActionInitialization::Build()
0053    in multi-threading mode the same method is invoked for each thread worker
0054    and so all user action classes are defined thread-local.
0055 
0056    A run action class is instantiated both thread-local
0057    and global that's why its instance is created also in the method
0058       B1::ActionInitialization::BuildForMaster()
0059    which is invoked only in multi-threading mode.
0060 
0061  4- PRIMARY GENERATOR
0062 
0063    The primary generator is defined in the B1::PrimaryGeneratorAction class.
0064    The default kinematics is a 6 MeV gamma, randomly distributed in front
0065    of the envelope across 80% of the transverse (X,Y) envelope size.
0066    This default setting can be changed via the Geant4 built-in commands
0067    of the G4ParticleGun class.
0068 
0069  5- DETECTOR RESPONSE
0070 
0071    This example demonstrates a simple scoring implemented directly
0072    in the user action classes.  Alternative ways of scoring via Geant4 classes
0073    can be found in the other examples.
0074 
0075    The energy deposited is collected step by step for a selected volume
0076    in B1::SteppingAction and accumulated event by event in B1::EventAction.
0077 
0078    At end of event, the value acummulated in B1::EventAction is added in B1::RunAction
0079    and summed over the whole run (see B1::EventAction::EndOfevent()).
0080 
0081    Total dose deposited is computed at B1::RunAction::EndOfRunAction(),
0082    and printed together with informations about the primary particle.
0083    In multi-threading mode the energy accumulated in G4Accumulable objects per
0084    workers is merged to the master in B1::RunAction::EndOfRunAction() and the final
0085    result is printed on the screen.
0086 
0087    G4Parameter<G4double> type instead of G4double type is used for the B1::RunAction
0088    data members in order to facilitate merging of the values accumulated on workers
0089    to the master.  Currently the accumulables have to be registered to G4AccumulablesManager
0090    and G4AccumulablesManager::Merge() has to be called from the users code. This is planned
0091    to be further simplified with a closer integration of G4Accumulable classes in
0092    the Geant4 kernel next year.
0093 
0094    An example of creating and computing new units (e.g., dose) is also shown
0095    in the class constructor.
0096 
0097  The following paragraphs are common to all basic examples
0098 
0099  A- VISUALISATION
0100 
0101    The visualization manager is set via the G4VisExecutive class
0102    in the main() function in exampleB1.cc.
0103    The initialisation of the drawing is done via a set of /vis/ commands
0104    in the macro vis.mac. This macro is automatically read from
0105    the main function when the example is used in interactive running mode.
0106 
0107    By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
0108    The user can change the initial viewer by commenting out this line
0109    and instead uncommenting one of the other /vis/open statements, such as
0110    HepRepFile or DAWNFILE (which produce files that can be viewed with the
0111    HepRApp and DAWN viewers, respectively).  Note that one can always
0112    open new viewers at any time from the command line.  For example, if
0113    you already have a view in, say, an OpenGL window with a name
0114    "viewer-0", then
0115       /vis/open DAWNFILE
0116    then to get the same view
0117       /vis/viewer/copyView viewer-0
0118    or to get the same view *plus* scene-modifications
0119       /vis/viewer/set/all viewer-0
0120    then to see the result
0121       /vis/viewer/flush
0122 
0123    The DAWNFILE, HepRepFile drivers are always available
0124    (since they require no external libraries), but the OGL driver requires
0125    that the Geant4 libraries have been built with the OpenGL option.
0126 
0127    From Release 9.6 the vis.mac macro in example B1 has additional commands
0128    that demonstrate additional functionality of the vis system, such as
0129    displaying text, axes, scales, date, logo and shows how to change
0130    viewpoint and style.  Consider copying these to other examples or
0131    your application.  To see even more commands use help or
0132    ls or browse the available UI commands in the Application
0133    Developers Guide, Section 7.1.
0134 
0135    Since 11.1, the TSG visualization driver can also produce the "offscrean"
0136    file output in png, jpeg, gl2ps formats without drawing on the screen.
0137    It can be controlled via UI commands provided in '/vis/tsg' which are
0138    demonstrated in the tsg_offscreen.mac macro in example B5.
0139 
0140    For more information on visualization, including information on how to
0141    install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
0142    for example,
0143    http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
0144    (where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
0145 
0146    The tracks are automatically drawn at the end of each event, accumulated
0147    for all events and erased at the beginning of the next run.
0148 
0149  B- USER INTERFACES
0150 
0151    The user command interface is set via the G4UIExecutive class
0152    in the main() function in exampleB1.cc
0153 
0154    The selection of the user command interface is then done automatically
0155    according to the Geant4 configuration or it can be done explicitly via
0156    the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
0157 
0158    The gui.mac macros are provided in examples B2, B4 and B5. This macro
0159    is automatically executed if Geant4 is built with any GUI session.
0160    It is also possible to customise the icons menu bar which is
0161    demonstrated in the icons.mac macro in example B5.
0162 
0163  C- HOW TO RUN
0164 
0165     - Execute exampleB1 in the 'interactive mode' with visualization:
0166         % ./exampleB1
0167       and type in the commands from run1.mac line by line:
0168         Idle> /control/verbose 2
0169         Idle> /tracking/verbose 1
0170         Idle> /run/beamOn 10
0171         Idle> ...
0172         Idle> exit
0173       or
0174         Idle> /control/execute run1.mac
0175         ....
0176         Idle> exit
0177 
0178     - Execute exampleB1  in the 'batch' mode from macro files
0179       (without visualization)
0180         % ./exampleB1 run2.mac
0181         % ./exampleB1 exampleB1.in > exampleB1.out
0182 
0183