Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/extended/medical/electronScattering2/README is written in an unsupported language. File is not indexed.

0001 
0002      =========================================================
0003      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
0004      =========================================================
0005 
0006                             electronScattering2   
0007                             ------------------
0008 
0009  Electron scattering benchmark variant 2 (Joseph Perl)
0010 
0011 The two examples, electronScattering and electronScattering2 demonstrate how two alternate
0012 approaches can be taken to simulating the same electron scattering benchmark experiment.
0013 
0014 ElectronScattering2 simulates the experiment with a minimum of user code, whereas the other
0015 version of this example shows how to do more of the work directly as the user.
0016 In ElectronScattering2:
0017 Primary generation relies on the G4GeneralParticleSource.
0018 Material definitions are taken from the NIST database.
0019 Visualization uses the standard G4VisExective.
0020 Scoring is handled by the ready-made Geant4 scorer, G4PSCellFlux.
0021 
0022 Both electronScattering and electronScattering2 simulate a precision electron scattering benchmark
0023 experiment performed at NRCC Canada and published as:
0024 "Measurement of multiple scattering of 13 and 20 MeV electrons by thin foils,"
0025 by C. K. Ross, M. R. McEwen, A. F. McDonald, C. D. Cojocaru and B. A. Faddegon,
0026 Med. Phys. Volume 35, Issue 9, pp. 4121-4131 (September 2008), DOI: 10.1118/1.2968095
0027 
0028 The experiment represents the most accurate benchmark of its type.
0029 
0030 A schematic of the experimental setup is shown in NRCC_electron_scat.pdf
0031 
0032 The experimental data was itself published, as document number E-MPHYA6-35-034809 at http://www.aip.org/pubservs/epaps.html
0033 
0034 The testing of three Monte Carlo simulation codes against this experimental benchmark has been
0035 published as:
0036 "The accuracy of EGSnrc, Geant4 and PENELOPE Monte Carlo systems for the simulation of electron 
0037 scatter in external beam radiotherapy,"
0038 by Bruce A Faddegon, Iwan Kawrakow, Yuri Kubyshin, Joseph Perl, Josep Sempau and Laszlo Urban,
0039 Phys. Med. Biol. 54 (2009) 6151-6163, DOI:10.1088/0031-9155/54/20/008 
0040 
0041 This present example, electronScattering2, was the Geant4 code used for this publication.
0042 
0043         
0044  1- GEOMETRY DEFINITION
0045  
0046  The geometry is described in the enclosed documument: NRCC_electron_scat.pdf
0047  - A "World" volume contains an Exit Window, Primary Foil, Monitor Chamber and Helium Bag.
0048  - The Helium Bag contains a Gas volume, which in turn contains 2 aluminium Rings
0049  - A scoring cylinder is defined near the end of the World.
0050         
0051  The default geometry is constructed in the DetectorConstruction class.
0052  The parameters of the Primary Foil (material and thickness) are defined from macro commands.
0053  
0054 
0055  2- PHYSICS LIST
0056 
0057   Physics lists are based on modular design. Several modules are instantiated:
0058   1. Transportation
0059   2. EM physics
0060   3. Decays
0061   4. StepMax - for step limitation
0062 
0063   EM physics builders are from the G4 kernel physics_lists subdirectory.
0064    - "emstandard_opt0" recommended standard EM physics for LHC
0065    - "emstandard_opt1" best CPU performance standard physics for LHC
0066    - "emstandard_opt2" similar fast simulation
0067    - "emstandard_opt3" best standard EM options - analog to "local" above
0068    - "emstandard_opt4" best current advanced EM options standard + lowenergy
0069    - "emstandardSS"  standard EM physics and single scattering model
0070    - "emstandardWVI" standard EM physics and WentzelVI multiple scattering
0071    - "emstandardGS"  standard EM physics and Goudsmit-Saunderson multiple scatt.
0072    - "emlivermore"  low-energy EM physics using Livermore data
0073    - "empenelope"   low-energy EM physics implementing Penelope models
0074    - "emlowenergy"  low-energy EM physics implementing experimental
0075                     low-energy models
0076    
0077  Physics lists and options can be (re)set with UI commands.
0078         
0079  3- PRIMARY GENERATOR
0080  
0081  All of the work of the primary event generation is deferred to the G4GeneralParticleSource.
0082  The specific characteristics of the source are configured from the macro file, using
0083  /gps commands.
0084  Energy is set to either 13 or 20 MeV.
0085  Particle type is set to electron.
0086  Direction is set exactly orthogonal to the scattering foil.
0087  Source type is set to beam.
0088  Spatial distribution of the beam is set as a circle gassian sigma_r of 0.042 cm
0089 
0090  
0091  4- VISUALIZATION
0092  
0093  Visualization is controlled by the standard G4VisExecutive.
0094  The standard set of visualization options is supported.
0095  Example macros use HepRepFile.         
0096         
0097 
0098  5- SCORING
0099         
0100  All of the work of the scoring is done by the standard Geant4 scorers, G4PSCellFlux and G4PSPopulation.
0101  Flux and population are scored in concentric rings at the scoring surface.
0102  Flux is corrected for ring area just before output (as PSCellFlux assumes the area is the complete
0103  area of the face of the cylinder, not the area of the one ring).
0104 
0105  Because the geometry may need to be updated after various /primfoil commands,
0106  ElectronBenchmarkDetector is written in such a way that the sensitive detector can have its scorer ring
0107  logical volume updated after geometry changes. After any geometry change, ConstructSDandField is again
0108  called, setting the sensitive detector to use the logical volume of the updated scorer ring.
0109  The same sensitive detector is reused, but the manner in which the sensitive detector pointer
0110  is stored for this reuse is complicated by the fact that this example may be run in multi-threaded mode
0111  (in which each worker thread has its own sensitive detector).
0112  We therefore store the sensitive detector pointer in a G4Cache rather than in a direct pointer.
0113 
0114 
0115  6- MACROS
0116 
0117  Macros are provided for all of the 37 different combinations of scattering foils and beam energies
0118  that were used in the actual experiment.
0119  Separate directories of these macros are provided for the different EM Physics options, Opt0, 1, 2 and 3.
0120 
0121         
0122  7- HOW TO START
0123  
0124  - execute electornScattering2 in 'batch' mode from macro files:
0125         % electronScattering2 <macro_file> <starting_seed> <output_file>
0126 
0127  - for example, to run the Al1_13MeV case with physics option 2 and a starting random seed of 1:
0128         % electronScattering2 macros/Opt2/Al1_13MeV.mac 1  output/Opt2/Al1_13MeV_1
0129 
0130  - if macro_file is not specfied, the job starts and then just waits for interactive commands
0131  
0132  - if starting_seed is not specified, it defaults to 1.
0133    Precision benchmark studies often involve running multiple long batch jobs and then combining the results.
0134    If you plan to combine more than one job with the same primary foil and energy, be sure to use different
0135    random seeds for each of the jobs.
0136 
0137  - if output_file is not specified, it defaults to output.csv in the current directory
0138 
0139  - to simplify batch submission of large numbers of jobs, a shell script is given called run.csh.
0140    The above submission could be done, for example, by:
0141         run.csh Opt2/Al1_13MeV 1
0142 
0143  - to run a basic visualization job, producing output to a HepRep file, use vis.mac, as in:
0144         % electronScattering2 
0145   then:
0146   PreInit> /control/execute macros/vis.mac
0147 
0148 
0149  8- OUTPUT
0150         
0151   Results are given as comma-separated values (csv) files.
0152   The first column gives the CellFlux for all particles.
0153   The second column gives the CellFlux counting only electrons.
0154   The third column gives the population for all particles.
0155   The fourth column gives the population counting only electrons.
0156 
0157 
0158 9 - MULTITHREADING
0159 
0160   This example supports multi-threading.
0161   To run in multi-threaded mode, build your Geant4 with the cmake option:
0162   -DGEANT4_BUILD_MULTITHREADED=ON
0163   and then set the desired number of threads by inserting the /run/numberOfThreads command
0164   into your macro file just before /run/initialize, as in:
0165   /run/numberOfThreads 8
0166   You may also find the output more readable if you use the following command to make output from
0167   each thread be collected together:
0168   /control/cout/useBuffer
0169   The visualization macro, /macros/vis.mac demonstrates use of the above two commands.
0170   Output from the multiple worker threads is merged by the Merge method at the end of ElectronRun.cc