GGS(GenericGEANT4Simulation)Software
2.7.0
|
Class for reading output of GGSHitsAction. More...
#include <GGSTHitsReader.h>
Public Member Functions | |
GGSTHitsReader () | |
Constructor. | |
~GGSTHitsReader () | |
Destructor. | |
bool | SetChain (TChain *hitsChain) |
Sets the chain. More... | |
void | GetEntry (Long64_t entry) |
void | SetDetector (const char *detector, bool readPartHits=false, bool readPosHits=false) |
Enables reading hit informations of the specified detector. More... | |
bool | DetectorExists (const char *detector, bool particleHits=false, bool positionHits=false) |
Checks the existence of a given detector within the hits tree. More... | |
void | ListDetectors () |
Prints a list of detectors which are present in hits tree on standard output. | |
std::vector< TString > | GetListOfDetectors () |
Returns the list of detectors which are present in hits tree on standard output. | |
Int_t | GetNHits (const char *detector) |
Gets the number of hits for the specified detector. More... | |
Int_t | GetNHits (int iDet) |
Gets the number of hits for the specified detector. More... | |
GGSTIntHitBase * | GetHit (const char *detector, unsigned int iHit) |
Get the specified hit. More... | |
GGSTIntHitBase * | GetHit (int iDet, unsigned int iHit) |
Get the specified hit. More... | |
std::string | GetIntHitsClassName (const char *detector) |
Gets the name of the class of the integrated hits for the given detector. More... | |
std::string | GetIntHitsClassName (int iDet) |
Gets the name of the class of the integrated hits for the given detector. More... | |
int | GetDetectorIndex (const char *detector) |
Retrieves the index of requested detector. More... | |
bool | HasPartHits (const char *detector) |
Check if particle hits data is available for the specified detector. More... | |
bool | HasPosHits (const char *detector) |
Check if position hits data is available for the specified detector. More... | |
float | GetIntHitThreshold (const std::string &detector) |
Retrieves the thresholds used when saving the integrated hits. More... | |
float | GetPartHitThreshold (const std::string &detector) |
Retrieves the thresholds used when saving the particle hits. More... | |
float | GetPosHitThreshold (const std::string &detector) |
Retrieves the thresholds used when saving the position hits. More... | |
![]() | |
virtual | ~GGSTChainReader () |
Destructor. | |
Class for reading output of GGSHitsAction.
This class provides methods to read the information about hits in sensitive detectors as saved by GGSHitsAction. Since the hits tree has a branch for every sensitive detector, the user must specify which branches are to be read by calling SetDetector. The hits can be retrieved using GetHit.
Definition at line 37 of file GGSTHitsReader.h.
bool GGSTHitsReader::DetectorExists | ( | const char * | detector, |
bool | particleHits = false , |
||
bool | positionHits = false |
||
) |
Checks the existence of a given detector within the hits tree.
Checks whether the given detector exists inside the hits tree. Note that this routine does not check whether the detector has been set for hit reading or not.
detector | The detector to search for. |
particleHits | if true then the existence of particle hits for the given detector will also be checked. |
positionHits | if true then the existence of position hits for the given detector will also be checked. |
Definition at line 228 of file GGSTHitsReader.cpp.
int GGSTHitsReader::GetDetectorIndex | ( | const char * | detector | ) |
Retrieves the index of requested detector.
This index can be used to quickly retrieve hits using the GetHit(int, unsigned int) overload of GetHit.
detector | The name of the detector. |
Definition at line 380 of file GGSTHitsReader.cpp.
|
virtual |
@ brief Reads the specified entry from the hit branches.
Only detectors specified by SetDetector will be read (and only those hits specified in SetDetector call).
entry | The desired entry. |
Implements GGSTChainReader.
Definition at line 78 of file GGSTHitsReader.cpp.
GGSTIntHitBase * GGSTHitsReader::GetHit | ( | const char * | detector, |
unsigned int | iHit | ||
) |
Get the specified hit.
This method searches for the desired hit in the specified detector. The detector will be fetched from the detectors internal index by means of a comparison of the name passed as first argument with the stored detector names. This involves a std::string comparison which might hurt performance when done inside the hit loop. If needed, to improve performance use the GetHit(int, unsigned int) overload.
detector | The desired detector. |
iHit | The desired hit of the specified detector |
Definition at line 320 of file GGSTHitsReader.cpp.
GGSTIntHitBase * GGSTHitsReader::GetHit | ( | int | iDet, |
unsigned int | iHit | ||
) |
Get the specified hit.
The detector index to be passed as first argument can be retrieved by calling GetDetectorIndex.
iDet | The detector index. |
iHit | The desired hit of the specified detector |
Definition at line 328 of file GGSTHitsReader.cpp.
std::string GGSTHitsReader::GetIntHitsClassName | ( | const char * | detector | ) |
Gets the name of the class of the integrated hits for the given detector.
detector | The name of the detector; |
Definition at line 360 of file GGSTHitsReader.cpp.
std::string GGSTHitsReader::GetIntHitsClassName | ( | int | iDet | ) |
Gets the name of the class of the integrated hits for the given detector.
iDet | The index of the detector; |
Definition at line 369 of file GGSTHitsReader.cpp.
float GGSTHitsReader::GetIntHitThreshold | ( | const std::string & | detector | ) |
Retrieves the thresholds used when saving the integrated hits.
detector | The name of the detector. |
std::range_error | if the given detector is not present. |
std::runtime_error | if thresholds are not available in the input file. |
Definition at line 418 of file GGSTHitsReader.cpp.
Int_t GGSTHitsReader::GetNHits | ( | const char * | detector | ) |
Gets the number of hits for the specified detector.
detector | The desired detector. |
Definition at line 299 of file GGSTHitsReader.cpp.
Int_t GGSTHitsReader::GetNHits | ( | int | iDet | ) |
Gets the number of hits for the specified detector.
The detector index to be passed as first parameter can be retrieved by calling GetDetectorIndex.
iDet | Index of the desired detector. |
Definition at line 310 of file GGSTHitsReader.cpp.
float GGSTHitsReader::GetPartHitThreshold | ( | const std::string & | detector | ) |
Retrieves the thresholds used when saving the particle hits.
detector | The name of the detector. |
std::range_error | if the given detector is not present. |
std::runtime_error | if thresholds are not available in the input file. |
Definition at line 434 of file GGSTHitsReader.cpp.
float GGSTHitsReader::GetPosHitThreshold | ( | const std::string & | detector | ) |
Retrieves the thresholds used when saving the position hits.
detector | The name of the detector. |
std::range_error | if the given detector is not present. |
std::runtime_error | if thresholds are not available in the input file. |
Definition at line 450 of file GGSTHitsReader.cpp.
bool GGSTHitsReader::HasPartHits | ( | const char * | detector | ) |
Check if particle hits data is available for the specified detector.
detector | The name of the detector. |
Definition at line 390 of file GGSTHitsReader.cpp.
bool GGSTHitsReader::HasPosHits | ( | const char * | detector | ) |
Check if position hits data is available for the specified detector.
detector | The name of the detector. |
Definition at line 405 of file GGSTHitsReader.cpp.
|
virtual |
Sets the chain.
This method sets the hits chain, from which the informations will be read.
hitsChain | The chain containing the hits. |
Implements GGSTChainReader.
Definition at line 46 of file GGSTHitsReader.cpp.
void GGSTHitsReader::SetDetector | ( | const char * | detector, |
bool | readPartHits = false , |
||
bool | readPosHits = false |
||
) |
Enables reading hit informations of the specified detector.
This routine will enable the reading of hits for the specified detector. Hits of other detector will not be read to improve I/O performance. The flags allow for reading particle and/or position hits if available (by default they will not be read from ROOT file, again to maximize I/O performance). Reading of position hits requires reading particle hits, so a true value for readPosHits will force also readPartHits to true. This method throws a std::runtime_exception if the given detector does not exist or if the requested particle and/or position hits are not available, and provides the strong exception guarantee (i.e. no modification to the reader is done if an exception is thrown).
detector | The detector name. |
readPartHits | if true, particle hits will be read (if available). |
readPosHits | if true, position hits will be read (if available). |
std::runtime_error | if the requested detector+hits combination is not available. |
Definition at line 111 of file GGSTHitsReader.cpp.