Geant4_10
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("libCintex.so");
10 // gSystem->Load("<location_of_your_libraries>/libExP01ClassesDict.so");
11 // ROOT::Cintex::Cintex::Enable();
12 // .L hits.C++
13 // hits();
14 //*****************************************************************************
16 
17 void hits()
18 {
19  TFile fo("hits.root");
20 
21  std::vector<ExP01TrackerHit*>* hits;
22  fo.GetListOfKeys()->Print();
23 
24  TIter next(fo.GetListOfKeys());
25  TKey *key;
26  double tot_en;
27  while ((key=(TKey*)next()))
28  {
29  fo.GetObject(key->GetName(), hits);
30 
31  tot_en = 0;
32  cout << "Collection: " << key->GetName() << endl;
33  cout << "Number of hits: " << hits->size() << endl;
34  for (int i=0;i!=hits->size();i++)
35  {
36  (*hits)[i]->Print();
37  }
38  }
39 }
void hits()
Definition: readHits.C:17
Definition of the ExP01TrackerHit class.