Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
readHits.cc File Reference

Main program of the persistency/P01 example. More...

#include "TROOT.h"
#include "TFile.h"
#include "TSystem.h"
#include "TKey.h"
#include "include/ExP01TrackerHit.hh"
Include dependency graph for readHits.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the persistency/P01 example.

Definition in file readHits.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 39 of file readHits.cc.

40 {
41  // initialize ROOT
42  TSystem ts;
43  gSystem->Load("libExP01ClassesDict");
44  if(argc<2) G4cout << "Missing name of the file to read!" << G4endl;
45 
46  TFile fo(argv[1]);
47 
48  std::vector<ExP01TrackerHit*>* hits;
49  fo.GetListOfKeys()->Print();
50 
51  TIter next(fo.GetListOfKeys());
52  TKey *key;
53  //double tot_en;
54  while ((key=(TKey*)next()))
55  {
56  fo.GetObject(key->GetName(), hits);
57 
58  //tot_en = 0;
59  G4cout << "Collection: " << key->GetName() << G4endl;
60  G4cout << "Number of hits: " << hits->size() << G4endl;
61  for (size_t i=0;i!=hits->size();i++)
62  {
63  (*hits)[i]->Print();
64  }
65  }
66 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61