GGS(GenericGEANT4Simulation)Software  2.99.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Macros
GGSTHitsReader.cpp
Go to the documentation of this file.
1 /*
2  * GGSTHitsReader.cpp
3  *
4  * Created on: Nov 8, 2010
5  * Author: Elena Vannuccini
6  * Reworked on: 17 Aug 2011
7  * Author: Nicola Mori
8  * Content: MC truth stripped out. File opening removed.
9  */
10 
15 
16 #include "TFile.h"
17 #include "TFriendElement.h"
18 #include "utils/GGSSmartLog.h"
19 
20 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
21 
22 GGSTHitsReader::GGSTHitsReader() : _chain(nullptr), _firstEntryOfCurrentFile(-1), _detInfo(nullptr) {
23  _detectors.reserve(50);
24  // The elements of these vectors will be used as output buffers for branches,
25  // so their location in memory must not change. The instructions below
26  // guarantee correct behavior for a number of detectors up to 50.
27  _intHitArrays.reserve(50);
28  _partHitArrays.reserve(50);
29  _posHitArrays.reserve(50);
30 }
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
33 
35  for (unsigned int i = 0; i < _intHitArrays.size(); i++)
36  delete _intHitArrays[i];
37  for (unsigned int i = 0; i < _partHitArrays.size(); i++)
38  delete _partHitArrays[i];
39  for (unsigned int i = 0; i < _posHitArrays.size(); i++)
40  delete _posHitArrays[i];
41  delete _detInfo;
42 }
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
45 
46 bool GGSTHitsReader::SetChain(TChain *hitsChain) {
47  _chain = hitsChain;
48  delete _detInfo;
49  _detInfo = (TClonesArray *)(_chain->GetFile()->Get("GGSHitDetInfo"));
50 
51  // Search for hit branches in master chain
52  for (int iBranch = 0; iBranch < _chain->GetListOfBranches()->GetEntries(); iBranch++) {
53  if (TString(((TBranch *)(_chain->GetListOfBranches()->At(iBranch)))->GetName()).Contains("GGSIntHits")) {
54  return true;
55  }
56  }
57 
58  // Search for hit branches in friend chains
59  if (_chain->GetListOfFriends()) {
60  for (int iFriend = 0; iFriend < _chain->GetListOfFriends()->GetEntries(); iFriend++) {
61  TTree *currFriend = ((TFriendElement *)(_chain->GetListOfFriends()->At(iFriend)))->GetTree();
62  for (int iBranch = 0; iBranch < currFriend->GetListOfBranches()->GetEntries(); iBranch++) {
63  if (TString(((TBranch *)(currFriend->GetListOfBranches()->At(iBranch)))->GetName()).Contains("GGSIntHits")) {
64  return true;
65  }
66  }
67  }
68  }
69 
70  _chain = nullptr;
71  delete _detInfo;
72  _detInfo = nullptr;
73  _firstEntryOfCurrentFile = -1;
74 
75  return false;
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
79 
80 void GGSTHitsReader::GetEntry(Long64_t entry) {
81  static const std::string routineName("GGSTHitsReader::GetEntry");
82 
83  if (entry != _chain->GetReadEntry()) {
84  _chain->GetEntry(entry);
85  }
86 
87  if (_chain->GetChainEntryNumber(0) != _firstEntryOfCurrentFile) {
88  GGSCOUT(DEBUG) << "Switching to file " << _chain->GetFile()->GetName() << GGSENDL;
89  _firstEntryOfCurrentFile = _chain->GetChainEntryNumber(0);
90 
91  // Read the GGSHitDetInfo TClonesArray from the new file
92  delete _detInfo;
93  _detInfo = (TClonesArray *)(_chain->GetFile()->Get("GGSHitDetInfo"));
94 
95  // Update the detector indexes in _detectors
96  for (unsigned int iDet = 0; iDet < _detectors.size(); iDet++)
97  _detectors[iDet].detInfoArrayIndex = _GetDetectorIndexFromStorage(_detectors[iDet].logVolName.data());
98 
99  // Reload time bins and thresholds
100  _timeBins.clear();
101  _thresholds.clear();
102  for (unsigned int iDet = 0; iDet < _detectors.size(); iDet++) {
103  delete _timeBins[iDet];
104  _timeBins.push_back((TArrayF *)(_chain->GetFile()->Get(TString(_detectors[iDet].name) + "-GGSIntHits-TimeBins")));
105  delete _thresholds[iDet];
106  _thresholds.push_back(
107  (std::vector<float> *)(_chain->GetFile()->Get(TString(_detectors[iDet].name) + "-GGSIntHits-Thresholds")));
108  }
109  }
110 }
111 
112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
113 
114 void GGSTHitsReader::SetDetector(const char *detector, bool readPartHits, bool readPosHits) {
115  static const std::string routineName("GGSTHitsReader::SetDetector");
116 
117  if (!_chain)
118  return;
119 
120  if (readPosHits) {
121  readPartHits = true;
122  }
123 
124  TString detBranchName = detector;
125  detBranchName.Append("-GGSIntHits");
126  TBranch *branches[3] = {nullptr, nullptr, nullptr}; // New branches (for integrated, particle and position hits)
127  if (_CheckBranch(detBranchName) == 0) {
128  int detIndex = GetDetectorIndex(detector); // detIndex == -1 if the detector has not been set
129  std::string partHitsBranchName{std::string(detector).append("-GGSPartHits")};
130  std::string posHitsBranchName{std::string(detector).append("-GGSPartHits")};
131  TBranch *partHitsBranch = _chain->GetBranch(partHitsBranchName.c_str());
132  TBranch *posHitsBranch = _chain->GetBranch(posHitsBranchName.c_str());
133 
134  std::string infoString("Set detector ");
135  infoString.append(detector);
136 
137  // Position hits
138  if (readPosHits) {
139  if (posHitsBranch) {
140  infoString.append(" (+PosHits)");
141  if (detIndex == -1) {
142  _posHitArrays.push_back(nullptr);
143  _chain->SetBranchAddress(posHitsBranchName.c_str(), &(_posHitArrays.back()));
144  _readPosHits.push_back(true);
145  } else {
146  _chain->SetBranchAddress(posHitsBranchName.c_str(), &(_posHitArrays[detIndex]));
147  _readPosHits[detIndex] = true;
148  }
149  branches[2] = posHitsBranch;
150  } else {
151  throw std::runtime_error(std::string("PosHits missing for detector ") + detector);
152  }
153  } else {
154  if (detIndex == -1) {
155  _posHitArrays.push_back(nullptr);
156  _readPosHits.push_back(false);
157  } else {
158  if (posHitsBranch) {
159  posHitsBranch->ResetAddress();
160  }
161  _posHitArrays[detIndex] = nullptr; // FIXME: should the element be deleted before this? Is it
162  // owned by the file/branch?
163  _readPosHits[detIndex] = false;
164  }
165  }
166 
167  // Particle hits
168  if (readPartHits) {
169  if (partHitsBranch) {
170  infoString.append(" (+PartHits)");
171  if (detIndex == -1) {
172  _partHitArrays.push_back(nullptr);
173  _chain->SetBranchAddress(partHitsBranchName.c_str(), &(_partHitArrays.back()));
174  _readPartHits.push_back(true);
175  } else {
176  _chain->SetBranchAddress(partHitsBranchName.c_str(), &(_partHitArrays[detIndex]));
177  _readPartHits[detIndex] = true;
178  }
179  branches[1] = partHitsBranch;
180  } else {
181  throw std::runtime_error(std::string("PartHits missing for detector ") + detector);
182  }
183  } else {
184  if (detIndex == -1) {
185  _partHitArrays.push_back(nullptr);
186  _readPartHits.push_back(false);
187  } else {
188  if (partHitsBranch) {
189  partHitsBranch->ResetAddress();
190  }
191  _partHitArrays[detIndex] = nullptr; // FIXME: should the element be deleted before this? Is it
192  // owned by the file/branch?
193  _readPartHits[detIndex] = false;
194  }
195  }
196 
197  if (detIndex == -1) {
198  _intHitArrays.push_back(nullptr);
199  _chain->SetBranchAddress(detBranchName, &(_intHitArrays.back()));
200  branches[0] = _chain->GetBranch(detBranchName);
201  delete _detInfo;
202  _detInfo = (TClonesArray *)(_chain->GetFile()->Get("GGSHitDetInfo"));
203  _timeBins.push_back((TArrayF *)(_chain->GetFile()->Get(TString(detector) + "-GGSIntHits-TimeBins")));
204  _thresholds.push_back(
205  (std::vector<float> *)(_chain->GetFile()->Get(TString(detector) + "-GGSIntHits-Thresholds")));
206 
207  Detector det;
208  det.name = detector;
209  det.logVolName = detector;
210  det.logVolName =
211  det.logVolName.substr(0, det.logVolName.find_first_of('.')); // remove names of scorer and sensitive detector
212  det.detInfoArrayIndex = _GetDetectorIndexFromStorage(det.logVolName.c_str());
213  _detectors.push_back(det);
214  }
215  GGSCOUT(INFO) << infoString << GGSENDL;
216  } else {
217  throw std::runtime_error(std::string("IntHits missing for detector ") + detector);
218  }
219 
220  // Synchronize the branches that have just been set for reading
221  if (_chain->GetReadEntry() != -1) {
222  for (int iBranch = 0; iBranch < 3; ++iBranch) {
223  if (branches[iBranch]) {
224  branches[iBranch]->GetEntry(_chain->GetReadEntry());
225  }
226  }
227  }
228 }
229 
230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
231 
232 bool GGSTHitsReader::DetectorExists(const char *detector, bool particleHits, bool positionHits) {
233  int type = -1;
234  if (_chain) {
235  std::string detectorString{detector};
236  detectorString += "-GGSIntHits";
237  type = _CheckBranch(detectorString.c_str());
238  }
239  if (type == 0 && particleHits) {
240  std::string detectorString{detector};
241  detectorString += "-GGSPartHits";
242  type = _CheckBranch(detectorString.c_str());
243  }
244  if (type == 1 && positionHits) {
245  std::string detectorString{detector};
246  detectorString += "-GGSPosHits";
247  type = _CheckBranch(detectorString.c_str());
248  }
249 
250  return (type != -1);
251 }
252 
253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
254 
256  static const std::string routineName("GGSTHitsReader::ListDetectors");
257 
258  if (_chain) {
259  TObjArray *branches = _chain->GetListOfBranches();
260  GGSCOUT(INFO) << "List of detectors in hits tree:" << GGSENDL;
261  for (int i = 0; i < branches->GetEntries(); i++) {
262  TBranch *branch = (TBranch *)(branches->At(i));
263  if (_CheckBranch(branch->GetName()) == 0) {
264  TString detName = branch->GetName();
265  detName.Remove(detName.Length() - 11); // Remove the trailing "-GGSIntHits"
266  std::string infoString(" ");
267  infoString.append(detName.Data());
268  if (_CheckBranch(detName + "-GGSPartHits") == 1)
269  infoString.append(" (PartHits)");
270  if (_CheckBranch(detName + "-GGSPosHits") == 2)
271  infoString.append(" (PosHits)");
272  GGSCCOUT(INFO) << infoString << GGSENDL;
273  }
274  }
275  }
276 }
277 
278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
279 
280 std::vector<TString> GGSTHitsReader::GetListOfDetectors() {
281  static const std::string routineName("GGSTHitsReader::GetListOfDetectors");
282 
283  std::vector<TString> _list;
284 
285  if (_chain) {
286  TObjArray *branches = _chain->GetListOfBranches();
287  for (int i = 0; i < branches->GetEntries(); i++) {
288  TBranch *branch = (TBranch *)(branches->At(i));
289  std::string branchName(branch->GetName());
290  if (_CheckBranch(branch->GetName()) == 0) {
291  TString detName = branch->GetName();
292  detName.Remove(detName.Length() - 11); // Remove the trailing "-GGSIntHits"
293  _list.emplace_back(detName);
294  }
295  }
296  }
297 
298  return _list;
299 }
300 
301 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
302 
303 Int_t GGSTHitsReader::GetNHits(const char *detector) {
304  static short int iHitArray;
305  iHitArray = GetDetectorIndex(detector);
306  if (iHitArray != -1)
307  return (_GetHitArray(iHitArray))->GetEntries();
308  else
309  return 0;
310 }
311 
312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
313 
314 Int_t GGSTHitsReader::GetNHits(int iDet) {
315  TClonesArray *detArray = _GetHitArray(iDet);
316  if (detArray)
317  return detArray->GetEntries();
318  else
319  return 0;
320 }
321 
322 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
323 
324 GGSTIntHitBase *GGSTHitsReader::GetHit(const char *detector, unsigned int iHit) {
325  int iDet = GetDetectorIndex(detector);
326  if (iDet != -1)
327  return GetHit(iDet, iHit);
328  else
329  return nullptr;
330 }
331 
332 GGSTIntHitBase *GGSTHitsReader::GetHit(int iDet, unsigned int iHit) {
333  static TClonesArray *hitArray = nullptr;
334  hitArray = _GetHitArray(iDet);
335  if (hitArray) {
336  GGSTIntHitBase *hit = (GGSTIntHitBase *)(hitArray->At(iHit));
337  if (hit) {
338  // Compute non-persistent informations
339  hit->eDep = hit->eDepTimeBin.GetSum();
340  hit->_hitDetInfo = _GetDetectorInfo(_detectors[iDet].detInfoArrayIndex);
341  hit->_timeBins = _timeBins[iDet];
342  if (hit->_hitDetInfo)
343  hit->_hitVolInfo = (GGSTHitVolInfo *)(hit->_hitDetInfo->volumes.At(hit->_volumeIndex));
344  else
345  hit->_hitVolInfo = nullptr;
346  if (_readPartHits[iDet]) {
347  hit->_partHits = (TClonesArray *)(_partHitArrays[iDet]->At(iHit));
348  }
349  if (_readPosHits[iDet]) {
350  // Set pointer to position hits collection for each particle hit
351  TClonesArray *partHits = hit->_partHits;
352  int nPartHits = partHits->GetEntries();
353  for (int iPartHit = 0; iPartHit < nPartHits; iPartHit++) {
354  GGSTPartHit *partHit = (GGSTPartHit *)(partHits->At(iPartHit));
355  partHit->_posHits = (TClonesArray *)(_posHitArrays[iDet]->At(partHit->_posHitIndex));
356  }
357  }
358  return hit;
359  }
360  }
361  return nullptr;
362 }
363 
364 std::string GGSTHitsReader::GetIntHitsClassName(const char *detector) {
365  int iDet = GetDetectorIndex(detector);
366  if (iDet >= 0) {
367  return GetIntHitsClassName(iDet);
368  } else {
369  return "";
370  }
371 }
372 
373 std::string GGSTHitsReader::GetIntHitsClassName(int iDet) {
374  TClonesArray *hitArray = _GetHitArray(iDet);
375  if (hitArray) {
376  std::string retValue = hitArray->GetName();
377  return retValue.substr(0, retValue.size() - 1);
378  } else {
379  return "";
380  }
381 }
382 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
383 
384 int GGSTHitsReader::GetDetectorIndex(const char *detector) {
385  for (UInt_t i = 0; i < _detectors.size(); i++) {
386  if (!strcmp(_detectors[i].name.data(), detector))
387  return i;
388  }
389  return -1;
390 }
391 
392 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
393 
394 bool GGSTHitsReader::HasPartHits(const char *detector) {
395  if (_chain) {
396  TString branchName(detector);
397  branchName.Append("-GGSPartHits");
398  TBranch *branch = _chain->GetBranch(branchName);
399  if (branch)
400  return true;
401  else
402  return false;
403  } else
404  return false;
405 }
406 
407 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
408 
409 bool GGSTHitsReader::HasPosHits(const char *detector) {
410  if (_chain) {
411  TString branchName(detector);
412  branchName.Append("-GGSPosHits");
413  TBranch *branch = _chain->GetBranch(branchName);
414  if (branch)
415  return true;
416  else
417  return false;
418  } else
419  return false;
420 }
421 
422 float GGSTHitsReader::GetIntHitThreshold(const std::string &detector) {
423  const std::string routineName("GSTHitsReader::GetIntHitThreshold");
424  int detIndex = GetDetectorIndex(detector.c_str());
425  if (detIndex == -1) {
426  throw std::range_error(routineName + ": detector " + detector + " not found");
427  }
428 
429  if (_thresholds[detIndex]) {
430  return (*(_thresholds[detIndex]))[0];
431  } else {
432  throw std::runtime_error(routineName + ": thresholds for integrated hits not available for detector " + detector);
433  }
434 }
435 
436 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
437 
438 float GGSTHitsReader::GetPartHitThreshold(const std::string &detector) {
439  const std::string routineName("GSTHitsReader::GetIntHitThreshold");
440  int detIndex = GetDetectorIndex(detector.c_str());
441  if (detIndex == -1) {
442  throw std::range_error(routineName + ": detector " + detector + " not found");
443  }
444 
445  if (_thresholds[detIndex]) {
446  return (*(_thresholds[detIndex]))[1];
447  } else {
448  throw std::runtime_error(routineName + ": thresholds for particle hits not available for detector " + detector);
449  }
450 }
451 
452 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
453 
454 float GGSTHitsReader::GetPosHitThreshold(const std::string &detector) {
455  const std::string routineName("GSTHitsReader::GetIntHitThreshold");
456  int detIndex = GetDetectorIndex(detector.c_str());
457  if (detIndex == -1) {
458  throw std::range_error(routineName + ": detector " + detector + " not found");
459  }
460 
461  if (_thresholds[detIndex]) {
462  return (*(_thresholds[detIndex]))[2];
463  } else {
464  throw std::runtime_error(routineName + ": thresholds for position hits not available for detector " + detector);
465  }
466 }
467 
468 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
469 
470 int GGSTHitsReader::_GetDetectorIndexFromStorage(const char *detector) {
471  if (_detInfo) {
472  for (int iDet = 0; iDet < _detInfo->GetEntries(); iDet++) {
473  static GGSTHitDetInfo *det = nullptr;
474  det = (GGSTHitDetInfo *)(_detInfo->At(iDet));
475  if (det && det->detectorName == detector)
476  return iDet;
477  }
478  }
479  return -1;
480 }
481 
482 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
483 
484 int GGSTHitsReader::_CheckBranch(const char *branchName) {
485  const std::string routineName("GGSTHitsReader::_CheckBranch");
486 
487  std::string branchNameStr{branchName};
488  int type = -1; // 0: integrated, 1: particle, 2: position
489  if (branchNameStr.find("-GGSIntHits") != std::string::npos) {
490  type = 0;
491 
492  } else if (branchNameStr.find("-GGSPartHits") != std::string::npos) {
493  type = 1;
494  } else if (branchNameStr.find("-GGSPosHits") != std::string::npos) {
495  type = 2;
496  } else {
497  return -1;
498  }
499 
500  TBranch *branch = _chain->GetBranch(branchName);
501 
502  // Check whether the branch exists or not
503  if (!branch) {
504  // GGSCOUT << routineName << "Warning: branch " << branchName << " not found."
505  // << GGSENDL;
506  return -1;
507  }
508 
509  // Check whether the branch is a TClonesArray or not
510  if (type == 0) {
511  if (strcmp(branch->GetClassName(), "TClonesArray")) {
512  return -1;
513  }
514  } else {
515  if (strcmp(branch->GetClassName(), "TObjArray")) {
516  return -1;
517  }
518  }
519 
520  if (type == 0) {
521  // Check whether the TClonesArray contains hit objects or not
522  TClonesArray **bufferAddr =
523  (TClonesArray **)(branch->GetAddress()); // See the documentation of TBranchElement::GetAddress
524  bool addressNotSet = false;
525  if (!bufferAddr) {
526  bufferAddr = new TClonesArray *;
527  *bufferAddr = nullptr;
528  branch->SetAddress(bufferAddr);
529  addressNotSet = true;
530  }
531 
532  auto oldReadEntry = branch->GetReadEntry();
533  branch->GetEntry(0);
534  std::string hitClassName((*bufferAddr)->GetName());
535  if (addressNotSet) {
536  branch->ResetAddress();
537  bufferAddr = nullptr;
538  } else {
539  branch->GetEntry(oldReadEntry);
540  assert(branch->GetReadEntry() == oldReadEntry);
541  }
542  hitClassName.erase(hitClassName.size() - 1); // Remove the trailing 's' that TClonesArray name
543  // places after the class name
544  TClass *clonesClass = TClass::GetClass(hitClassName.c_str());
545  if (!clonesClass) {
546  GGSCOUT(ERROR) << "No dictionary for class " << hitClassName << " inside the TCloneArray in branch " << branchName
547  << GGSENDL;
548  return -1;
549  }
550  if (!(clonesClass->GetBaseClass("GGSTIntHit"))) {
551  GGSCOUT(ERROR) << "Class " << hitClassName << " inside the TCloneArray in branch " << branchName
552  << " does not inherit from GGSTIntHit" << GGSENDL;
553  return -1;
554  }
555  }
556 
557  return type;
558 }
559 
560 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
561 
562 TClonesArray *GGSTHitsReader::_GetHitArray(int iHitArray) {
563  if (iHitArray > (int)(_intHitArrays.size() - 1) || iHitArray < 0)
564  return nullptr;
565  return _intHitArrays[iHitArray];
566 }
567 
568 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
569 
570 GGSTHitDetInfo *GGSTHitsReader::_GetDetectorInfo(int iDet) {
571  if (_detInfo) {
572  static GGSTHitDetInfo *det = nullptr;
573  det = (GGSTHitDetInfo *)(_detInfo->At(iDet));
574  return det;
575  }
576  return nullptr;
577 }
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.
#define GGSCCOUT(level)
Smart log utility which prints no header at the beginning of the line.
Definition: GGSSmartLog.h:126
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.
#define GGSENDL
Definition: GGSSmartLog.h:131
void ListDetectors()
Prints a list of detectors which are present in hits tree on standard output.
Class to store G4 particle hits.
Definition: GGSTHits.h:176
GGSTHitsReader()
Constructor.
TClonesArray volumes
Array of GGSTHitVolInfo objects.
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.
Float_t eDep
Deposited energy (transient).
Definition: GGSTHits.h:222
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.
TArrayF eDepTimeBin
Energy deposit in each time bin.
Definition: GGSTHits.h:223
GGSTHitVolInfo.h GGSTHitVolInfo class declaration.
TString detectorName
Name of detector associated to integrated hits.
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.