LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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"

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.

References hits().

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 }
void hits()
Definition: readHits.C:15