GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSTHitsReader.h
Go to the documentation of this file.
1 /*
2  * GGSTHitsReader.h
3  *
4  * Created on: Nov 8, 2010
5  * Author: Elena Vanuccini
6  * Reworked on: 17 Aug 2011
7  * Author: Nicola Mori
8  * Content: MC truth stripped out. File opening removed.
9  */
10 
13 #ifndef GGSTHITSREADER_H_
14 #define GGSTHITSREADER_H_
15 
16 // GGS headers
18 #include "montecarlo/readers/GGSTChainReader.h"
19 #include "utils/GGSNameDecoder.h"
20 
21 // ROOT headers
22 #include "TArrayF.h"
23 #include "TClonesArray.h"
24 class TBranch;
25 
26 #include <vector>
27 
38 
39 public:
42 
45 
52  bool SetChain(TChain *hitsChain);
53 
61  void GetEntry(Long64_t entry);
62 
79  void SetDetector(const char *detector, bool readPartHits = false, bool readPosHits = false);
80 
92  bool DetectorExists(const char *detector, bool particleHits = false, bool positionHits = false);
93 
95  void ListDetectors();
96 
98  std::vector<TString> GetListOfDetectors();
99 
105  Int_t GetNHits(const char *detector);
106 
115  Int_t GetNHits(int iDet);
116 
129  GGSTIntHitBase *GetHit(const char *detector, unsigned int iHit);
130 
140  GGSTIntHitBase *GetHit(int iDet, unsigned int iHit);
141 
147  std::string GetIntHitsClassName(const char *detector);
148 
154  std::string GetIntHitsClassName(int iDet);
155 
164  int GetDetectorIndex(const char *detector);
165 
171  bool HasPartHits(const char *detector);
172 
178  bool HasPosHits(const char *detector);
179 
187  float GetIntHitThreshold(const std::string &detector);
188 
197  float GetPartHitThreshold(const std::string &detector);
198 
206  float GetPosHitThreshold(const std::string &detector);
207 
208 private:
209  TChain *_chain;
210  Long64_t _firstEntryOfCurrentFile;
211 
212  std::vector<TClonesArray *> _intHitArrays;
213  std::vector<TObjArray *> _partHitArrays;
214  std::vector<TObjArray *> _posHitArrays;
215  std::vector<TArrayF *> _timeBins;
216  std::vector<bool> _readPartHits;
217  std::vector<bool> _readPosHits;
218  TClonesArray *_detInfo;
219  std::vector<std::vector<float> *> _thresholds;
220 
221  struct Detector {
222  std::string name;
223  std::string logVolName;
224  int detInfoArrayIndex;
225  };
226  std::vector<Detector> _detectors;
227 
228  int _GetDetectorIndexFromStorage(const char *detector);
229 
242  int _CheckBranch(const char *branchName);
243 
252  TClonesArray *_GetHitArray(int iHitArray);
253 
254  GGSTHitDetInfo *_GetDetectorInfo(int iDet);
255 };
256 
257 #endif /* GGSTHITSREADER_H_ */
bool HasPartHits(const char *detector)
Check if particle hits data is available for the specified detector.
float GetIntHitThreshold(const std::string &detector)
Retrieves the thresholds used when saving the integrated hits.
Class for reading output of GGSHitsAction.
Class to store detector informations.
GGSTIntHitBase * GetHit(const char *detector, unsigned int iHit)
Get the specified hit.
float GetPartHitThreshold(const std::string &detector)
Retrieves the thresholds used when saving the particle hits.
Abstract class defining the interface for tree readers.
void ListDetectors()
Prints a list of detectors which are present in hits tree on standard output.
GGSTHitsReader()
Constructor.
std::string GetIntHitsClassName(const char *detector)
Gets the name of the class of the integrated hits for the given detector.
bool DetectorExists(const char *detector, bool particleHits=false, bool positionHits=false)
Checks the existence of a given detector within the hits tree.
Int_t GetNHits(const char *detector)
Gets the number of hits for the specified detector.
~GGSTHitsReader()
Destructor.
bool HasPosHits(const char *detector)
Check if position hits data is available for the specified detector.
float GetPosHitThreshold(const std::string &detector)
Retrieves the thresholds used when saving the position hits.
bool SetChain(TChain *hitsChain)
Sets the chain.
int GetDetectorIndex(const char *detector)
Retrieves the index of requested detector.
void GetEntry(Long64_t entry)
std::vector< TString > GetListOfDetectors()
Returns the list of detectors which are present in hits tree on standard output.
Base class for storing G4 integrated hits.
Definition: GGSTHits.h:218
void SetDetector(const char *detector, bool readPartHits=false, bool readPosHits=false)
Enables reading hit informations of the specified detector.