hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HpsEventFile.cxx
Go to the documentation of this file.
1#include "HpsEventFile.h"
2
3HpsEventFile::HpsEventFile(const std::string ifilename, const std::string& ofilename){
4 rootfile_ = new TFile(ifilename.c_str());
5 //ttree_reader = new ("HPS_Event",_rootfile);
6 intree_ = (TTree*)rootfile_->Get("HPS_Event");
7 ofile_ = new TFile(ofilename.c_str(),"recreate");
8
9}
10
12
14 event_ = static_cast<HpsEvent*>(ievent);
15 //TODO protect the tree pointer
16 if (intree_) {
17 event_ -> setTree(intree_);
18 maxEntries_ = intree_->GetEntriesFast();
19 }
20
21 entry_ = 0;
22}
23
25 rootfile_->cd();
26 rootfile_->Close();
27 ofile_->cd();
28 ofile_->Close();
29
30}
31
33
34 if (entry_ > maxEntries_ - 1)
35 return false;
36
37 //TODO Really don't like having the tree associated to the event object. Should be associated to the EventFile.
38 intree_->GetEntry(entry_++);
39
40 return true;
41}
int entry_
description
TTree * intree_
description
HpsEvent * event_
description
TFile * rootfile_
description
virtual ~HpsEventFile()
void close()
description
int maxEntries_
description
TFile * ofile_
description
HpsEventFile(const std::string ifilename, const std::string &ofilename)
Constructor.
virtual bool nextEvent()
description
void setupEvent(IEvent *ievent)
description
Definition IEvent.h:7