Loading...
Searching...
No Matches
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 "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

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 38 of file readHits.cc.

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

Applications | User Support | Publications | Collaboration