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.
|
int | main (int argc, char **argv) |
|
Main program of the persistency/P01 example.
Definition in file readHits.cc.
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 38 of file readHits.cc.
39{
40
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
53 while ((key=(TKey*)next()))
54 {
55 fo.GetObject(key->GetName(), hits);
56
57
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}