GGS(GenericGEANT4Simulation)Software
2.7.0
|
An action which saves hits in sensitive volumes on ROOT file. More...
#include <GGSHitsAction.h>
Public Member Functions | |
GGSHitsAction () | |
Constructor. | |
~GGSHitsAction () | |
Destructor. | |
void | BeginOfRunAction (const G4Run *run) |
Actions executed at beginning of run. More... | |
void | EndOfRunAction (const G4Run *run) |
Actions executed at end of run. More... | |
void | BeginOfEventAction (const G4Event *event) |
Actions executed at beginning of event. More... | |
void | EndOfEventAction (const G4Event *event) |
Actions executed at end of event. More... | |
void | SetOutputFileBase (const std::string &outFileBase) |
Sets the output file base name. More... | |
void | SetOutputTreeName (const std::string &outTreeName) |
Sets the output tree name. More... | |
void | SetOutputIntHitClass (std::string detectorName, const std::string &className) |
Sets the name of the integrated hit class to be used for output of a given detector. More... | |
void | SetOutputPartHitClass (std::string detectorName, const std::string &className) |
Sets the name of the particle hit class to be used for output. More... | |
void | SetOutputPosHitClass (std::string detectorName, const std::string &className) |
Sets the name of the position hit class to be used for output. More... | |
void | SetHitThreshold (const std::string &detectorName, const std::string &hitType, const std::string &valueStr, const std::string &unit) |
Sets a lower energy deposit threshold for hits. More... | |
![]() | |
GGSUserAction () | |
Constructor. More... | |
virtual | ~GGSUserAction () |
Destructor. | |
G4ClassificationOfNewTrack | ClassifyNewTrack (const G4Track *) |
Override of the ClassifyNewTrack method. More... | |
Friends | |
class | GGSHitsActionPrivateMessenger |
An action which saves hits in sensitive volumes on ROOT file.
This action reads the hits in sensitive volumes, as defined by GGS sensitive logical volumes naming convention. It then converts the hits in ROOT format and saves them on a ROOT file. For each sensitive logical volume, a branch will be created whose name is equal to that of logical volume. This branch is made by a TClonesArray containing all the hits in physical sensitive volumes associated to the logical. This action can handle different kind of output hit classes derived from standard GGS ones (GGSTIntHitBase, GGSTPartHitBase and GGSTPosHitBase).The actual classes to be used is specified by calling the related setter methods (e.g. SetOutputIntHitClass); the hit classes must have a Root dictionary. If no class is specified then the standard GGS hit classes (GGSTIntHit, GGSTPartHit, GGSTPosHit) will be used.
Definition at line 64 of file GGSHitsAction.h.
void GGSHitsAction::BeginOfEventAction | ( | const G4Event * | event | ) |
Actions executed at beginning of event.
Method executed at the beginning of each event. Hits buffers are cleared.
event | Pointer to a G4Event |
Definition at line 250 of file GGSHitsAction.cpp.
void GGSHitsAction::BeginOfRunAction | ( | const G4Run * | run | ) |
Actions executed at beginning of run.
Method executed at the beginning of each run. A new ROOT file is created for each run.
run | Pointer to the G4Run |
Definition at line 73 of file GGSHitsAction.cpp.
void GGSHitsAction::EndOfEventAction | ( | const G4Event * | event | ) |
Actions executed at end of event.
Method executed at the end of each event. Hits are read, converted to ROOT format and filled into output tree.
event | Pointer to a G4Event |
Definition at line 281 of file GGSHitsAction.cpp.
void GGSHitsAction::EndOfRunAction | ( | const G4Run * | run | ) |
Actions executed at end of run.
Method executed at the end of each run. The ROOT tree is written to file and the file is closed.
run | Pointer to a G4Run |
Definition at line 211 of file GGSHitsAction.cpp.
void GGSHitsAction::SetHitThreshold | ( | const std::string & | detectorName, |
const std::string & | hitType, | ||
const std::string & | valueStr, | ||
const std::string & | unit | ||
) |
Sets a lower energy deposit threshold for hits.
Hits with a total energy deposit lower than the corresponding threshold will not be saved in the output file. If a finer-grained hit is above its threshold then the parent hit will be saved regardless of its value. For example, if particle hits have threshold 1 and position hits 0.1, then a particle hit with a total release of 0.2 containing a single position hit with release 0.2 will be saved (since position hits are contained inside particle hits, so the particle hit is necessary to store the above-threshold position hit). The energy deposit of parent hits will be the total one computed by the MC simulation, irrespective of the total energy deposit of above-threshold children hits. Extending the example above, if the particle hit have a release of 1.05 due to five position hits with release 0.2 and one position hit with release 0.05 then only the five position hits with release 0.2 will be saved; but the energy deposit of the particle hit will still be 1.05 although the sum of stored position hits is 1. The above consideration apply also to integrated-particle hits hierarchy. In case custom hits are used, which eventually customize the meaning of energy deposit, then the thresholds will be relative to the customized deposits.
detectorName | The name of the detector. |
hitType | The type of the hit (integrated, particle or position). |
valueStr | The threshold value. |
unit | The unit of the threshold value. |
Definition at line 512 of file GGSHitsAction.cpp.
|
inline |
Sets the output file base name.
The file base name can be with or without extension (.root will be automatically used as extension). For each run, the run number will be appended to the base name before the .root extension. If no value is provided the file base name will fallback to the default value set in GSRootFileservice.
outFileBase | The output file base name. |
Definition at line 117 of file GGSHitsAction.h.
void GGSHitsAction::SetOutputIntHitClass | ( | std::string | detectorName, |
const std::string & | className | ||
) |
Sets the name of the integrated hit class to be used for output of a given detector.
detectorName | name of the detector |
className | name of the output class for integrated hits |
Definition at line 446 of file GGSHitsAction.cpp.
void GGSHitsAction::SetOutputPartHitClass | ( | std::string | detectorName, |
const std::string & | className | ||
) |
Sets the name of the particle hit class to be used for output.
detectorName | name of the detector |
className | name of the output class for particle hits |
Definition at line 468 of file GGSHitsAction.cpp.
void GGSHitsAction::SetOutputPosHitClass | ( | std::string | detectorName, |
const std::string & | className | ||
) |
Sets the name of the position hit class to be used for output.
detectorName | name of the detector |
className | name of the output class for position hits |
Definition at line 490 of file GGSHitsAction.cpp.
|
inline |
Sets the output tree name.
This name will be used for the TTree object where th hits for each event will be stored. By default, this value is set to "Hits" in constructor.
outTreeName | The output tree name. |
Definition at line 126 of file GGSHitsAction.h.