ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
readHits.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file readHits.C
1 // Include files
2 #include "TROOT.h"
3 #include "TFile.h"
4 #include "TSystem.h"
5 #include "TKey.h"
6 //*****************************************************************************
7 // To run this macro in cint do (after replacing the location_of_your_libraries below):
8 // .include $G4INCLUDE
9 // gSystem->Load("<location_of_your_libraries>/libExP01ClassesDict.so");
10 // .L hits.C++
11 // hits();
12 //*****************************************************************************
14 
15 void hits()
16 {
17  TFile fo("hits.root");
18 
19  std::vector<ExP01TrackerHit*>* hits;
20  fo.GetListOfKeys()->Print();
21 
22  TIter next(fo.GetListOfKeys());
23  TKey *key;
24  double tot_en;
25  while ((key=(TKey*)next()))
26  {
27  fo.GetObject(key->GetName(), hits);
28 
29  tot_en = 0;
30  cout << "Collection: " << key->GetName() << endl;
31  cout << "Number of hits: " << hits->size() << endl;
32  for (int i=0;i!=hits->size();i++)
33  {
34  (*hits)[i]->Print();
35  }
36  }
37 }