HepEmShow code documentation
The main of the HepEmShow application
The main simulation application
The main funtion of the HepEmShow simulation application.
The main of the HepEmShow application is responsible for setting up the environment, lunch the simulation and write the results. This is done by:
reading the input arguments provided at the execution of the application into an
InputParametersobject. (Note, these arguments provide configuration options).loading the
G4HepEmdata and parameters from file into aG4HepEmState(see the note below)constructing a
G4HepEmTLData(also required byG4HepEmand encapsulates the random number generator and some track buffers) with its random number generator (utilising the localURandomgenerator)constructing and setting up the application
Geometryaccording to the provided configuration input arguments (inInputParameters)constructing and setting up the
PrimaryGeneratorof the application according to the provided configuration input arguments (inInputParameters)constructing and setting up a
Resultsstructure that will be used to collect some data during the simulationthe
EventLoop::ProcessEventsmethod is invoked then to perform the simulationthe simulation results are witten to file (and to the standard output) by invoking
WriteResults()(from theResults)
- Author
M. Novak
- Date
July 2023
Note
The G4HepEm data file is either the one included in the HepEmShow repository (under hepemshow/data/) or generated by the auxiliary HepEmShow-DataGeneration application. In the former case, the data file contains all data that G4HepEm needs for the simulation for the 3 default ({"G4_Galactic", "G4_PbWO4", "G4_lAr"}) materials, i.e. those used in the default Geometry configuration.
Functions
-
int main(int argc, char *argv[])
The main function of the
HepEmShowsimulation application (see more in the description).
The auxiliary application for data generation
The main funtion of the auxiliary HepEmShow-DataGeneration application.
The physics of the HepEmShow simulation application is provided by G4HepEm. While the run time of G4HepEm is independent from Geant4, the G4HepEm data initialisation relies and strongly depends on Geant4. However, the initialised state, which is manly physics related data such as cross sections, stopping power, range, etc., can be exported into a single file. G4HepEm can then be re-initialised solely from this file making possible to skipp its entire Geant4 dependent initialisation part. This is exactly how G4HepEm is initialised in the HepEmShow simulation application, i.e. by utilising the provided data file. Therefore, the HepEmShow simulation application is independent from Geant4. Furthermore, its single dependence, G4HepEm can also be built without Geant4 (optionally, then its Geant4 dependent initialisation part is not included). This makes possible to build the HepEmShow simulation with a Geant4 independent build of G4HepEm.
- Author
M. Novak
- Date
July 2023
However, the generated and provided G4HepEm data file is specific for a given (default) material configuration of the application geometry. The HepEmShow-DataGeneration application was used to generate and can be used to re-gerenate such a G4HepEm data file for the HepEmShow simulation e.g. with a different material configuration if needed (see more in the Geometry and Physics component documentations).
See more in the documentation.
Note
As the G4HepEm data generation requires its initialisation, that heavily depends on Geant4, this HepEmShow-DataGeneration application requires a complete, Geant4 dependent build of G4HepEm. Moreover, as this data generation application builds and pre-initialises a Geant4 geometry (with the given list of materials and secondary production threshold value) to be ready for the physics initialisation (using G4Setup), the application itself depends on Geant4. Therefore, the corresponding executable will be available only if HepEmShow show is built with Geant4 dependence and with a complete, Geant4 dependent built of G4HepEm.
Functions
-
int main()
-
class G4Setup
Provides a pre-initialised
Geant4detector ready for the physics initialisation.This builds a fake Geant4 geometry having the given list of NIST materials in the geometry with the given production threshold. The corresponding material-cuts couples will be built that are needed for a Geant4 initialisation state from which the physics initialisation can be started. This will be the
G4HepEmdata initialisation in our case in the corresponding auxiliaryHepEmShow-DataGenerationapplication.- Author
M. Novak
- Date
July 2023
The Physics code documentation
-
class Physics
The entire physics of the simulation is provided by
G4HepEm[1] and pulled-in to theHepEmShowapplication by thePhysics.hhandPhysics.ccfiles.The
Physics.hhheader file includes theG4HepEmRunheaders that give the complete set of run-time functioinalities required for the EM physics modelling. The corresponding implementations are pulled-in all together in thePhysics.ccimplentation file.- Author
M. Novak
- Date
July 2023
The only ingredient of
G4HepEmRun, that a client application (such asHepEmShow), needs to provide is an implementation of a uniform random number generator. An object from such genertor must be plugged-in to theG4HepEmRandomEngineby implementing the two missingG4HepEmRandomEngine::flat()andG4HepEmRandomEngine::flatArray(const int, double *)methods. This is also done in thePhysics.ccimplementation file that completes the implementation ofG4HepEmRun.URandomis the uniform random number generator implemented inHepEmShowbased on the 64-bit verson of the Mersenne Twister generator provided by c++11. An obejct of this is utilised in thePhysics.ccfile to complete the implementation of theG4HepEmRandomEngineas mentioned above. Then the actual uniform random number generator and the random engine objects are constructed (and set to theG4HepEmTLDataobejct) in theHepEmShow.ccmain function of the application.G4HepEmimplements two top level methods,HowFarandPerform, in itsG4HepEmGammaManagerandG4HepEmElectronManager:to provide the information on
HowFara given input \(\gamma\) or \(e^-/e^+\) track goes according to their physics related constraints (e.g. till their next physics interaction takes place or other physics related constraints).to
Performall necessary physics related updates on the given input \(\gamma\) or \(e^-/e^+\) track, including the production of secondary tracks in the given physics interaction (if any).
The first (
HowFar) is invoked at the pre-step point while the second (Perform) is at the post-step point of each individual simulation step computation inside theSteppingLoop::GammaStepper()andSteppingLoop::ElectronStepper().
-
class URandom
A uniform random number generator.
This is the uniform random number generator, i.e. the only thing that is need to make the
G4HepEmphysics implementation complete (see more at thePhysicsdocumentation). This random number generator relies on the c++11 implementation of the 64-bit Mersenne Twister engine. TheURandom::flat()method can be used to provide uniform random numbers on the \((0,1)\). An object from this class is constructed in theHepEmShowmain and set to be used in theG4HepEmRandomEngine.- Author
M. Novak
- Date
July 2023
Note
This random number generator can be replaced with anything that can provide uniform fandom numbers on \((0,1)\). One need to modify the corresponding implementations in
Physics(namely, one line in theG4HepEmRandomEngine::flat()andG4HepEmRandomEngine::flatArray()implementations inPhysics.cc) and replace theURandomobject construction in theHepEmShowmain.
The PrimaryGenerator code documentation
-
class PrimaryGenerator
Generates primary particles for an event.
This is a simple primary particle generator. The kinetic energy, position, direction and the particle type (through its charge) can be configured. Note, that we simulate only \(e^-/e^+\) and \(\gamma\) particles with -1, +1 and 0 charge respectively.
- Author
M. Novak
- Date
July 2023
The
GenerateOne()method is invoked at the beginning of each event. This generates one primary particle/track by setting the properties of the providedG4HepEmTrackbased on the stored configuration.Public Functions
-
PrimaryGenerator()
Constructor.
-
inline ~PrimaryGenerator()
Destructor (nothing to do).
-
void GenerateOne(G4HepEmTrack &primTrack)
Generates one primary particle into the provided track.
The
GenerateOne()method is invoked at the beginning of each event. This generates one primary particle/track by setting the properties of the providedG4HepEmTrackbased on the stored configuration.- Parameters:
primTrack – [inout] a track to fill in the primary particle properties
-
inline void SetKinEnergy(double ekin)
Sets kinetic energy of the primary particle.
- Parameters:
ekin – [in] kinetic energy of the primary particle in [MeV] units.
-
inline double GetKinEnergy() const
Privides the kinetic energy of the primary particle.
- Returns:
kinetic energy in [MeV] units.
-
void SetPosition(double *pos)
Sets the position of the primary particle.
- Parameters:
pos – [in] pointer to a 3D (global) position vector (legth is in [mm])
-
void SetPosition(double x, double y, double z)
Sets the position of the primary particle.
- Parameters:
x – [in] x-coordinate of the positon vector.
y – [in] y-coordinate of the positon vector.
z – [in] z-coordinate of the positon vector.
-
inline const double *GetPosition() const
Provides the 3D position vector of the primary particle.
- Returns:
pointer to a 3D array that stores the x, y and z-coordinates of the position vector.
-
void SetDirection(double *dir)
Sets the direction of the primary particle.
- Parameters:
dir – [in] pointer to a 3D normalised direction vector
-
void SetDirection(double x, double y, double z)
Sets the direction of the primary particle.
- Parameters:
x – [in] x-coordinate of the normalised direction vector.
y – [in] y-coordinate of the normalised direction vector.
z – [in] z-coordinate of the normalised direction vector.
-
inline const double *GetDirection() const
Provides the 3D normalised direction vector of the primary particle.
- Returns:
pointer to a 3D array that stores the x, y and z-coordinates of the normalised direction.
-
inline void SetCharge(double ch)
Sets the charge of the primary particle that also determines its type.
- Parameters:
ch – [in] the charge in e+ change units: -1 e-; 0 gamma; +1 e+.
-
inline double GetCharge() const
Privides the charge of the primary particle.
- Returns:
charge: -1 e-; 0 gamma; +1 e+.
Private Members
-
double fKinEnergy
Kinetic energy of the primary particle in [MeV] units.
-
double fPosition[3]
Position of the primary particles in (global) coordinates (legth is in [mm]).
-
double fDirection[3]
Normalised direction of the primary particles.
-
double fCharge
Charge of the primary particle in units of e+ charge: -1 e-; 0 gamma; +1 e+.
Event loop, stepping loop and the track stack
-
class EventLoop
Event loop for simulating the required number of primary tracks/events.
The
EventLoop::ProcessEvents()method is responsible to generate track(s) for the required number of events and simulate the histories of all primary and their secondary tracks.- Author
M. Novak
- Date
July 2023
Public Static Functions
-
static void ProcessEvents(G4HepEmTLData &theTLData, G4HepEmState &theState, PrimaryGenerator &thePrimaryGenerator, Geometry &theGeometry, Results &theResult, int numEventToSimulate, int verbosity)
Generates and simulates the required number of events.
Events, i.e. primary track(s) are generated by using the input
PrimaryGenerator. At the beginning of each event, thePrimaryGeneratoris used to generate the primary track(s) that belong to the actual event. Note, that we have only one primary track per-event at the moment. The generated primary track(s) is inserted/pushed into theTrackStackas the very first track and the simulation of the event starts. During the simulation of the event:one track is popped from the stack and the appropriate
SteppingLoopis called to simulate its entire history in a step-by-step wayat the end of each simulation step, secondary tracks that are created in that step in the related physics interaction (if any), are inserted/pushed into the
TrackStackSimulation of the event is completed when theTrackStackbecomes empty. See the implementation for more details.
In order to be able to collect some infomation during the event processing, the
BeginOfEventAction()/EndOfEventAction()methods are invoked before/after each event processing while theBeginOfTrackingAction()/EndOfTrackingAction()methods are invoked before/after tracking each new track.- Parameters:
theTLData – a
G4HepEmspecific (thread local) object primarily used to obtain all physics related information fromG4HepEmneeded to compute a simulation steptheState – a
G4HepEmspecific object that stores pointers to the top levelG4HepEmdata structure and parameters that are used byG4HepEmto provide all physics related infomation needed to compute a simulation stepthePrimaryGenerator – the primary generator that is used to generate primary track(s) at the beginning of each event (only one primary track per event in our case now)
theGeometry – the geometry of the application in which the input track history is simulated
theResult – the data structure that holds all the infomation needs to be collected during the simulation.
numEventToSimulate – number of events required to be simulated
verbosity – to control the verbosity of printouts reporting progress and state of the event processing
Private Static Functions
-
static void BeginOfEventAction(Results &theResult, int eventID, const G4HepEmTrack &thePrimaryTrack)
Method invoked at the beginning of each event by passing the (single) primary track of the event.
-
static void EndOfEventAction(Results &theResult, int eventID)
Method invoked at the end of each event.
-
class SteppingLoop
Stepping loops for simulating \(e^-\), \(e^+\) and \(\gamma\) particle histories.
The stepping loops can calculate a given \(\gamma\) or \(e^-/e^+\) particle simulation history from their initial state till the end in a step-by-step way (by the
SteppingLoop::GammaStepper(G4HepEmTLData&, G4HepEmState&, TrackStack&, Geometry&, Results&, int)andSteppingLoop::ElectronStepper(G4HepEmTLData&, G4HepEmState&, TrackStack&, Geometry&, Results&, int)respectively). At each step:the actual step length is calculated (accounting both the geometrical and the physics related constraints)
the track is moved to its post-step position
all physics related actions, happening along and/or at the post-step point, are performed on the track
secondary tracks, generated in the given step by a physics interaction (if any), are insterted into the track stack (by calling the
SteppingLoop::StackSecondaries(G4HepEmTLData&, TrackStack&, G4HepEmTrack&)method)information (e.g. energy deposit) might be collected at the end of each simulation step (by calling the
SteppingLoop::SteppingAction(Results&, const G4HepEmTrack&, const Box*, double, int, int, int, int)method )
- Author
M. Novak
- Date
July 2023
A bit more details:
A simulation history is terminated when:
the particle kinetic energy becomes zero (e.g. an \(e^-\) lost all its kinetic energy along its last step)
the particle participated in a destructive interaction (e.g. photoelectric absorption of a \(\gamma\) photon or conversion to \(e^-/e^+\) pairs)
the particle leaves the calorimeter (in a normal
Geant4simulation the the history is terminated when the particle leaves the world)
The physics related step length constraints as well as the actions (including the secondary track production) are provided by the
G4HepEmimplementation of the EM physics simulation.G4HepEmimplements two top level methods, in its Gamma and Electron managers:to provide the information on
HowFara given input \(\gamma\) or \(e^-/e^+\) track goes according to their physics related constraints (e.g. till their next physics interaction takes place or due to other physics related constraints).to
Performall necessary physics related updates on the given input \(\gamma\) or \(e^-/e^+\) track and produce all secondary tracks in the given physics interaction (if any).
The first (
HowFar) is invoked at the pre-step point while the second (Perform) is at the post-step point of each individual simulation step computation inside theSteppingLoop::GammaStepper()andSteppingLoop::ElectronStepper().In
G4HepEmit’s theG4HepEmTLData(thread local data) that is used in the top level, two sided communication between the consumer andG4HepEm. It encapsulates the (primary and secondary) tracks and the random number generator dedicated for one particular thread. Its primary Gamma/Electron track field is used to store the actual state of the \(\gamma\) or \(e^-/e^+\) track that is under tracking. The step limit, imposed by all physics related constraints on the actual track, is calculated at each pre-step point by calling the bove-mentionedHowFartop level method provided byG4HepEm. Then thePerformmethod needs to be invoked at the post-step point that performs all necessary physics related updates on the input primary track while produces all scondary tracks related to the given physics interaction (if any). The secondary tracks are delivered back to the caller in the appropriate seondary track fields of theG4HepEmTLDataobject.More infomation and details, on how a \(\gamma\) and \(e^-/e^+\) simulation step is computed, might be found by inspecting the implementations of the top level
HowFarandPerformG4HepEmmethods in the correspondingG4HepEmGammaManager/G4HepEmElectronManager.Public Static Functions
-
static void GammaStepper(G4HepEmTLData &theTLData, G4HepEmState &theState, TrackStack &theTrackStack, Geometry &theGeometry, Results &theResult, int eventID)
Stepping loop for simulating the entire history of a \(\gamma\) track.
The initial state of the \(\gamma\) track is provided in the
G4HepEmGammaTrackfield oftheTLDatainput argument by the caller. The history is simulated then till the end, the state of the \(\gamma\) track is updated while secondary tracks, produced in the physics interactions, are pushed totheTrackStack(if any) and the required simulation results are collected/updated intotheResultstructure after each individual simulation step.- Parameters:
theTLData – a
G4HepEmspecific (thread local) object primarily used to obtain all physics related information fromG4HepEmneeded to compute a simulation steptheState – a
G4HepEmspecific object that stores pointers to the top levelG4HepEmdata structure and parameters that are used byG4HepEmto provide all physics related infomation needed to compute a simulation steptheTrackStack – the track stack that is used to store the secondary tracks produced while simulating the entire history o fthe input \(\gamma\) track
theGeometry – the geometry of the application in which the input track history is simulated
theResult – the data structure that holds all the infomation needs to be collected during the simulation. It might be updated after each simulation step by calling the
SteppingActionmethod.eventID – ID of the currently simulated event, i.e. the one to which the given input \(\gamma\) track belongs to
-
static void ElectronStepper(G4HepEmTLData &theTLData, G4HepEmState &theState, TrackStack &theTrackStack, Geometry &theGeometry, Results &theResult, int eventID)
Stepping loop for simulating the entire history of a \(e^-/e^+\) track.
The initial state of the \(e^-/e^+\) track is provided in the
G4HepEmGammaTrackfield oftheTLDatainput argument by the caller. The history is simulated then till the end, the state of the \(e^-/e^+\) track is updated while secondary tracks, produced in the physics interactions, are pushed totheTrackStack(if any) and the required simulation results are collected/updated intotheResultstructure after each individual simulation step.- Parameters:
theTLData – a
G4HepEmspecific (thread local) object primarily used to obtain all physics related information fromG4HepEmneeded to compute a simulation steptheState – a
G4HepEmspecific object that stores pointers to the top levelG4HepEmdata structure and parameters that are used byG4HepEmto provide all physics related infomation needed to compute a simulation steptheTrackStack – the track stack that is used to store the secondary tracks produced while simulating the entire history o fthe input \(e^-/e^+\) track
theGeometry – the geometry of the application in which the input track history is simulated
theResult – the data structure that holds all the infomation needs to be collected during the simulation. It might be updated after each simulation step by calling the
SteppingActionmethod.eventID – ID of the currently simulated event, i.e. the one to which the given input \(e^-/e^+\) track belongs to
Private Static Functions
-
static void StackSecondaries(G4HepEmTLData &theTLData, TrackStack &theTrackStack, G4HepEmTrack &thePrimary)
Auxiliary method that pushes the secondary track(s), produced by physics interactions at the post-step point (if any), into the track stack.
- Parameters:
theTLData – the
G4HepEmspecific (thread local) object that is used byG4HepEmto deliver the secondary tracks to the caller after calling the itsPerformtop level methodtheTrackStack – the track stack that is used to store the secondary tracks produced while simulating the entire history of the input track in the steppers
thePrimary – the primary track, in its post interaction state (after calling
G4HepEmtop levelPerformmethod), i.e. the one that underwent the physics interaction
-
static void SteppingAction(Results &theResult, const G4HepEmTrack &theTrack, const Box *currentVolume, double currentPhysStepLength, int indxLayer, int indxAbsorber, int eventID, int stepID)
This method is called at the end of each simulation steps to collect some data during the simulation.
This method provides the possibility of collecting some data after each simulation steps (e.g. energy deposit or length of the step). Among the
Geant4user actions this corresponds to theG4UserSteppingAction- Parameters:
theResult – the data structure that holds all the infomation needs to be collected during the simulation (some fields might be updated)
theTrack – the primary track, in its post interaction state, i.e. at the end of the step
currentVolume – pointer to the volume (
absorber/gap) in which the simulation step was donecurrentPhysStepLength – real (physical) length of the step
indxLayer – index of the layer in which the step was done
indxAbsorber – indicates if the step was done in the
absorber(0) or in thegap(1)eventID – ID of the event to which the particle under tracking belongs to
stepID – ID of this step that was just performed, i.e. number of steps cmpleted so far with with the current track
-
class TrackStack
A simple track-stack to handle both primary and secondary particle tracks.
This stack holds tracks (all belonging to the same event), that are still to be tracking (i.e. still need to call/instert to the appropriate
SteppingLoop):at the begining of each event, (a) primary track is inserted into the stack (inside the
EventLoop::ProcessEvents()) as the very first track (NOTE: assumed to have only one primary per event for simplicity)all secondaries, generated by the entire simulation of the event, are inserted when created (inside the appropriate
SteppingLoop), i.e. pushed and later popped for trackingthe event is completed when the track-stack becomes empty again
- Author
M. Novak
- Date
July 2023
A new event can be started then.
Public Functions
-
TrackStack()
CTR.
-
inline ~TrackStack()
DTR.
-
int PopInto(G4HepEmTrack &track)
Pops a secondary track from the stack and writes to the input address.
This method is called from
EventLoop::ProcessEvents()before start tracking a new track. It returns with the original index of the popped track or -1 when the track is actually empty, i.e. no more track to pop.- Parameters:
track – [inout] the address of the
G4HepEmTrackwhere the next track should be popped, i.e. copied.- Returns:
returns with the original index of the popped track or -1 if the there are no more tracks in the track
-
int GetTypeOfNextTrack()
Can provide the type of the next track.
Returns with an integer that encodes the type of the next track in the stack, i.e. the type of the track that will be popped when calling
PopInto()next time.- Returns:
an integer indicating the type of the next track:
-1 in case of \(e^-\)
0 in case of \(\gamma\)
+1 in case of \(e^+\)
-999 if the stack is empty
-
G4HepEmTrack &Insert()
Returns a reference to a secondary track that can be used to push a new track into the stack.
This method is called whenever a new track needs to be inseted into the stack. The provided reference can be used to fill the track infomation (the referenced track is re-set).
- Returns:
A reference to a
G4HepEmTrackthat can be used to add a new track to the stack (by filling in its filed).
-
void Copy(G4HepEmTrack &from, G4HepEmTrack &to)
Copying the content of the
fromto thetotrack.
-
inline int GetNextTrackID()
Returns with the next track ID (track ID is incremented whenever this method is invoked).
-
inline void ReSetTrackID()
Resets the track ID to zero.
Auxiliary code documentation
Collecting data during the simulation
A collection of data that are recorded during the simulation.
The following data is recorded during the simulation (mean is per event):
mean values in the individual layers of the calorimeter for energy deposit, neutral (gamma) and charged (electron/positron) particle simulation steps
mean number of energy deposited in the
absorberandgapmean number of secondary gamma, electron and positrons produced
mean number of neutral (gamma) and charged (electron/positron)
- Author
M. Novak
- Date
July 2023
Quantities, recorded in the individual layers are stored in histograms and written to files at the end of the simulation while the others are reported in the screen. An example looks like
--- Results::WriteResults ----------------------------------
Absorber: mean Edep = 6722.95 [MeV] and Std-dev = 309.636 [MeV]
Gap : mean Edep = 2571.75 [MeV] and Std-dev = 118.507 [MeV]
Mean number of gamma 4457.043
Mean number of e- 7957.899
Mean number of e+ 428.922
Mean number of e-/e+ steps 36097
Mean number of gamma steps 40436.2
------------------------------------------------------------
Functions
-
struct ResultsPerEvent
- #include <Results.hh>
Data that needs to be accumulated during one
event(the scope is one event):at the beginning of an
event: usually reset (to zero)at the end of an
event: usually written to the run scope data (see theResultsbelow)
Public Members
-
double fEdepAbs = {0.0}
energy deposit in the absorber during one event
-
double fEdepGap = {0.0}
energy deposit in the gap during one event
-
double fNumSecGamma = {0.0}
number of seconday \(\gamma\) particles generated during one event
-
double fNumSecElectron = {0.0}
number of seconday \(e^-\) particles generated during one event
-
double fNumSecPositron = {0.0}
number of seconday \(e^+\) particles generated during one event
-
double fNumStepsGamma = {0.0}
number of \(\gamma\) simulation steps during one event
-
double fNumStepsElPos = {0.0}
number of \(e^-/e^+\) simulation steps during one event
-
struct Results
- #include <Results.hh>
Data that are collected during the entire
runof the simulation:at the beginning of the
run: need to be initialisedat the end of an
run: written out (to file or to the std output) Mean quantities are computed over the simulated events.
Public Members
-
double fEdepAbs = {0.0}
mean energy deposit in the
absorber
-
double fEdepAbs2 = {0.0}
mean of the squared energy deposit in the
absorber
-
double fEdepGap = {0.0}
mean energy deposit in the
gap
-
double fEdepGap2 = {0.0}
mean of the squared energy deposit in the
gap
-
double fNumSecGamma = {0.0}
mean number of the produced secondary \(\gamma\) particles
-
double fNumSecGamma2 = {0.0}
mean of the squared number of produced secondary \(\gamma\) particles
-
double fNumSecElectron = {0.0}
mean number of the produced secondary \(e^-\) particles
-
double fNumSecElectron2 = {0.0}
mean of the squared number of produced secondary \(e^-\) particles
-
double fNumSecPositron = {0.0}
mean number of the produced secondary \(e^+\) particles
-
double fNumSecPositron2 = {0.0}
mean of the squared number of produced secondary \(e^+\) particles
-
double fNumStepsGamma = {0.0}
mean number of \(\gamma\) steps in the entire calorimeter
-
double fNumStepsGamma2 = {0.0}
mean of the squared number of \(\gamma\) steps in the entire calorimeter
-
double fNumStepsElPos = {0.0}
mean number of \(e^-/e^+\) steps in the entire calorimeter
-
double fNumStepsElPos2 = {0.0}
mean of the squared number of \(e^-/e^+\) steps in the entire calorimeter
-
ResultsPerEvent fPerEventRes
data structure to accumulate results during a single event
-
class Hist
A simple histogram only to collect some data during the simulation.
- Author
M. Novak
- Date
July 2023
Public Functions
-
Hist(const std::string &filename, double min, double max, int numbin)
Constructor.
- Parameters:
filename – String to be used as file name when writing into file.
min – Minimum bin value.
max – Maximum bin value.
numbin – Number of bins required between
minandmax.
-
Hist(const std::string &filename, double min, double max, double delta)
Constructor.
- Parameters:
filename – String to be used as file name when writing into file.
min – Minimum bin value.
max – Maximum bin value.
delta – Required width of a bin.
-
Hist()
Default constructor.
-
inline ~Hist()
Destructor.
-
void Initialize()
Auxiliary method to setup the initial state of the histogram.
-
void ReSet(const std::string &filename, double min, double max, int numbins)
Method to modify the properties of the histogram.
- Parameters:
filename – The new name of the filename.
min – The new minimum bin value.
max – The new maximum bin value.
numbins – The new number of bins required between
minandmax.
-
void Fill(double x)
Method to populate the histogram with data: the corresponding bin content is increased by 1.
- Parameters:
x – Value to add.
-
void Fill(double x, double w)
Method to populate the histogram with data and a weight: the corresponding bin content is increased by the weight.
- Parameters:
x – Value to add.
w – The corresponding weight.
-
void Scale(double sc)
Method to scale all bin content by a constant.
- Parameters:
sc – Scaling factor.
-
inline int GetNumBins() const
Method to provide the number of bins.
- Returns:
Number of bins.
Providing input arguments to the HepEmShow application
To see all configuration option, run the application as:
./HepEmShow --help
=== Usage: HepEmShow [OPTIONS]
-l --number-of-layers (number of layers in the calorimeter) - default: 50
-a --absorber-thickness (in [mm] units) - default: 2.3
-g --gap-thickness (in [mm] units) - default: 5.7
-t --transverse-size (of the calorimeter in [mm] units) - default: 400
-p --primary-particle (possible particle names: e-, e+ and gamma) - default: e-
-e --primary-energy (in [MeV] units) - default: 10 000
-n --number-of-events (number of primary events to simulate) - default: 1000
-s --random-seed - default: 1234
-d --g4hepem-data-file (the pre-generated data file with its path) - default: ../data/hepem_data
-v --run-verbosity (verbosity of run information: nothing when 0) - default: 1
-h --help
-
struct InputParameters
A data structure that encapsulates all the possible input arguments of the
HepEmShowapplication.- Author
M. Novak
- Date
Aug 2023
Public Functions
-
inline InputParameters()
CTR with default values: default geometry, primary and event configuirations (see below) with pre-generated data files expected at
../data/hepem_datarelative to theHepEmShowexecutable.
Public Members
-
PrimaryAndEvents fPrimaryAndEvents
the primary partcile and events related configuration
-
std::string fG4HepEmDataFile
the pre-generated data file (with path)
-
int fRunVerbosity
level of printout verbosity duing setting up: nothing when < 1.
-
struct Geometry
The geometry related input arguments.
Public Functions
-
inline Geometry()
CTR with default values: 50 layers of 2.3 mm absorber and 5.7 mm gap with 400 mm transvers size.
Public Members
-
int fNumLayers
number of layers in the calorimeter
-
double fThicknessAbsorber
absorber thickness along X in [mm]
-
double fThicknessGap
gap thickness along X in [mm]
-
double fThicknessCalo
calorimeter thickness along X [mm] ONLY if number of layers is zero
-
double fSizeTransverse
calorimeter full size along YZ in [mm]
-
inline Geometry()