GGS(GenericGEANT4Simulation)Software  2.6.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
17 #include "utils/GGSNameDecoder.h"
18 #include "montecarlo/readers/GGSTChainReader.h"
20 
21 // ROOT headers
22 #include "TClonesArray.h"
23 #include "TArrayF.h"
24 class TBranch;
25 
26 #include <vector>
27 
38 
39 public:
40 
43 
46 
53  bool SetChain(TChain *hitsChain);
54 
62  void GetEntry(Long64_t entry);
63 
80  void SetDetector(const char* detector, bool readPartHits = false, bool readPosHits = false);
81 
91  bool DetectorExists(const char* detector);
92 
94  void ListDetectors();
95 
97  std::vector<TString> GetListOfDetectors();
98 
104  Int_t GetNHits(const char *detector);
105 
114  Int_t GetNHits(int iDet);
115 
128  GGSTIntHit *GetHit(const char *detector, unsigned int iHit);
129 
139  GGSTIntHit *GetHit(int iDet, unsigned int iHit);
140 
149  int GetDetectorIndex(const char* detector);
150 
156  bool HasPartHits(const char* detector);
157 
163  bool HasPosHits(const char* detector);
164 
172  float GetIntHitThreshold(const std::string &detector);
173 
182  float GetPartHitThreshold(const std::string &detector);
183 
191  float GetPosHitThreshold(const std::string &detector);
192 
193 private:
194 
195  TChain* _chain;
196  Long64_t _firstEntryOfCurrentFile;
197 
198  std::vector<TClonesArray*> _intHitArrays;
199  std::vector<TObjArray*> _partHitArrays;
200  std::vector<TObjArray*> _posHitArrays;
201  std::vector<TArrayF*> _timeBins;
202  std::vector<bool> _readPartHits;
203  std::vector<bool> _readPosHits;
204  TClonesArray *_detInfo;
205  std::vector<std::vector<float>*> _thresholds;
206 
207  struct Detector {
208  std::string name;
209  std::string logVolName;
210  int detInfoArrayIndex;
211  };
212  std::vector<Detector> _detectors;
213 
214  int _GetDetectorIndexFromStorage(const char* detector);
215  bool _CheckBranch(const char* branchName);
216  bool _CheckDetector(const char* detector);
217 
226  TClonesArray* _GetHitArray(int iHitArray);
227 
228  GGSTHitDetInfo *_GetDetectorInfo(int iDet);
229 
230 };
231 
232 #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.
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.
GGSTIntHit * GetHit(const char *detector, unsigned int iHit)
Get the specified hit.
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.
Class to store G4 position hits.
Definition: GGSTHits.h:160
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.
bool DetectorExists(const char *detector)
Checks the existence of a given detector within the hits tree.
void GetEntry(Long64_t entry)
std::vector< TString > GetListOfDetectors()
Returns the list of detectors which are present in hits tree on standard output.
void SetDetector(const char *detector, bool readPartHits=false, bool readPosHits=false)
Enables reading hit informations of the specified detector.