Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
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 "Cintex/Cintex.h"
#include "include/ExP01TrackerHit.hh"

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 42 of file readHits.cc.

References G4cout, and G4endl.

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