To compile on your machine
- source
G4SONIKenv.sh
(making sure the directory paths to ROOT and Geant4 simulation match that of your machine). - delete GNUmakefile, this is no longer needed.
- enter the following command
cmake -DGeant4_DIR=/path/To/geant4.9.6 /path/To/G4SONIK
- compile with make.
- To compile simulation use commands (in
/local/astro/scat
)
source env.sh
make
- To run use command
scat config.dat SONIK.dat
-
Run settings are input from the
config.dat
andSONIK.dat
text files -
Output files are
Events0.root
,Table0.tsv
(or whatever specified inconfig.dat
),CS.root
(generated cross-section and beam profiles),Kin.root
(generated kinematics solutions), andcurrentEvent.rndm
,currentRun.rndm
(pseudoRNG seeds) -
To disable multiple scattering, comment out lines 234, 242 and 247 in
src/PhysicsList.cc
:
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
- Commences by generating a beam histogram through the target, and using the input cross section data it calulcates the number of scattering events
- Creates a scattering distribution to get a weighted energy and angle(cm) for each generated scattering event
- Kinematics are calculated by evaluating a histogram for a given θcm, this histogram is calculated at the beginning for a single energy(set to the beam energy at 20 cm)
- The Cross Section and Kinematics histograms are saved in the files
CS.root
andKin.root
- For each scattering event, Geant4 will generate a recoil particle and then an ejectile particle
- If a particle is detected it will fill the
TotalTree
branch and theRecoilTree
(orEjectileTree
) Detector Branch - Estimated time remaining is for current run only
- Run time depends on number of scattering events, which depends on probability of scattering, which depends on θ range and energy
- Target isotope may only be H, 3He, or 4He (although this could be changed in
CrossSectionManager.cc
andDetectorConstruction.cc
)
Source files are in directory src
, corresponding headers in directory include
. Some important source files are:
-
scat.cc
(in main directory)- Entry point of the application
-
CrossCalc.hxx
(in src directory)- Calculates the cross section for a given angle and energy from the input cross section data data
- Different (
CrossCalc_1.hxx
orCrossCalc_2.hxx
) are included in thesrc
directory for different format of input cross section data (format specified in source comments) - Input cross section is specified in the config.dat file
- Default format is: energy(MeV) angle(degrees) cross section(mb/sr)
-
CrossSectionManager.cc
- Generates beam histogram and calculates number of scattering events
- Generates
CS.root
and callsKinematicsManager
to generateKin.root
as well GenerateEvent()
called byPrimaryActionGenerator
to generate events details (angles, energies, positions) usingKinematicsManager
-
DetectorConstruction.cc
- Constructs SONIK geometry for use by Geant4
- This can be viewed by enabling the visualizer in
config.dat
- to use indirect rendering:
and defineexport LIBGL_ALWAYS_INDIRECT = 1
+iglx
when starting xTerm if problems are experienced
-
InputManager.cc
- Reads
config.dat
andSONIK.dat
variables into a string map - Can be called to copy individual variables to a declared variable
- Reads
-
KinManager.cc
- Generates kinematics histogram for a given energy
- Is called with a given θcm to evaluate histograms and return desired value(energy, lab angle)
-
PrimartyActionGenerator.cc
- Calls
CrossSectionManager
to generate event position, energy, and direction and useG4ParticleGun
to generate particles - Assigns values to
TreeManager
to be filled if particle is detected
- Calls
-
TrackerSD.cc
- Processes detector hits, and calls
TreeManager
to fill corresponding branches
- Processes detector hits, and calls
-
TreeManager.cc
- ROOT file is created, filled, and written here
-
ResultsManager.cc
- Opens ROOT file at end of run, and creates a table with summarized results