Back to home page

EIC code displayed by LXR

 
 

    


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

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