readHits.C
Go to the documentation of this file.
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 //*****************************************************************************
13 #include "include/ExP01TrackerHit.hh"
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 }
void hits()
Definition: readHits.C:15
OStream cout
Definition: OStream.cxx:6
void next()
Definition: show_event.C:84