1 #include "ERRootSourceOld.h" 3 #include "FairRootManager.h" 6 #include "ERHe8EventHeader.h" 11 ERRootSourceOld::ERRootSourceOld():
23 ERRootSourceOld::~ERRootSourceOld(){
27 Bool_t ERRootSourceOld::Init(){
30 Fatal(
"ERRootSourceOld",
"No files for source ERRootSourceOld");
31 fFile =
new TFile(fPath);
33 Fatal(
"ERRootSourceOld",
"Can`t open file for source ERRootSourceOld");
35 fTree = (TTree*)fFile->Get(fTreeName);
37 Fatal(
"ERRootSourceOld",
"Can`t find tree in input file for source ERRootSourceOld");
39 if (fRawEvents.size() == 0)
40 Fatal(
"ERRootSourceOld",
"ERRootSourceOld without regiistered events");
42 FairRun* run = FairRun::Instance();
44 header->Register(fTree, fBranchName);
46 for (Int_t iREvent = 0; iREvent < fRawEvents.size(); iREvent++)
47 fRawEvents[iREvent]->Register(fTree, fBranchName);
51 Int_t ERRootSourceOld::ReadEvent(UInt_t
id){
52 FairRootManager* ioman = FairRootManager::Instance();
53 if ( ! ioman ) Fatal(
"Init",
"No FairRootManager");
55 if (fTree->GetEntriesFast() == ioman->GetEntryNr()+1)
58 fTree->GetEntry(ioman->GetEntryNr());
60 for (Int_t iREvent = 0; iREvent < fRawEvents.size(); iREvent++)
61 fRawEvents[iREvent]->Process();
65 void ERRootSourceOld::Close(){
72 void ERRootSourceOld::Reset(){
75 void ERRootSourceOld::SetFile(TString path, TString treeName, TString branchName){
78 fBranchName = branchName;
79 cout <<
"Input file " << path <<
" with tree name " << fTreeName <<
" and branch name " <<
80 fBranchName <<
" added to source ERRootSourceOld" << endl;