fChain = new TChain("RAW");
if (!fChain->AddFileInfoList((TCollection*)(collection.GetList()))) {
Error("AliRawReaderChain","Bad file list in collection, the chain is empty");
+ fIsValid = kFALSE;
return;
}
- fChain->SetBranchStatus("*",0);
- fChain->SetBranchStatus("rawevent",1);
-
- fEvent = new AliRawEvent;
- fChain->SetBranchAddress("rawevent", &fEvent);
+ fChain->SetBranchStatus("*",1);
+ fChain->SetBranchAddress("rawevent",&fEvent,&fBranch);
}
AliRawReaderChain::AliRawReaderChain(TFileCollection *collection) :
fChain = new TChain("RAW");
if (!fChain->AddFileInfoList((TCollection*)(collection->GetList()))) {
Error("AliRawReaderChain","Bad file list in collection, the chain is empty");
+ fIsValid = kFALSE;
return;
}
- fChain->SetBranchStatus("*",0);
- fChain->SetBranchStatus("rawevent",1);
+ fChain->SetBranchStatus("*",1);
+ fChain->SetBranchAddress("rawevent",&fEvent,&fBranch);
+}
- fEvent = new AliRawEvent;
- fChain->SetBranchAddress("rawevent", &fEvent);
+AliRawReaderChain::AliRawReaderChain(TChain *chain) :
+ AliRawReaderRoot(),
+ fChain(chain)
+{
+// create raw-reader objects which takes as an input a root chain
+// from a root file collection
+
+ if (!fChain) fIsValid = kFALSE;
+
+ fChain->SetBranchStatus("*",1);
+ fChain->SetBranchAddress("rawevent",&fEvent,&fBranch);
}
AliRawReaderChain::AliRawReaderChain(const AliRawReaderChain& rawReader) :
do {
delete fEvent;
fEvent = new AliRawEvent;
- if (fChain->GetEntry(fEventIndex+1) <= 0)
+ Long64_t treeEntry = fChain->LoadTree(fEventIndex+1);
+ if (!fBranch)
+ return kFALSE;
+ if (fBranch->GetEntry(treeEntry) <= 0)
return kFALSE;
fEventIndex++;
} while (!IsEventSelected());
fEventNumber = -1;
return Reset();
}
+
+Bool_t AliRawReaderChain::GotoEvent(Int_t event)
+{
+ // go to a particular event
+ // Uses the absolute event index inside the
+ // chain with raw data
+
+ if (!fChain || !fChain->GetListOfFiles()->GetEntriesFast()) return kFALSE;
+
+ delete fEvent;
+ fEvent = new AliRawEvent;
+ Long64_t treeEntry = fChain->LoadTree(event);
+ if (!fBranch)
+ return kFALSE;
+ if (fBranch->GetEntry(treeEntry) <= 0)
+ return kFALSE;
+ fEventIndex = event;
+ fEventNumber++;
+ return Reset();
+}
+
+Int_t AliRawReaderChain::GetNumberOfEvents() const
+{
+ // Get the total number of events in the chain
+ // of raw-data files
+
+ if (!fChain) return -1;
+
+ return fChain->GetEntries();
+}