AliESDInputHandlerRP::AliESDInputHandlerRP() :
AliESDInputHandler(),
fRTrees( new TObjArray()),
+ fRDirs ( new TObjArray()),
fRFiles( new TList()),
fDetectors(new TList()),
fDirR(0),
AliESDInputHandlerRP::AliESDInputHandlerRP(const char* name, const char* title):
AliESDInputHandler(name, title),
fRTrees( new TObjArray()),
+ fRDirs ( new TObjArray()),
fRFiles( new TList()),
fDetectors(new TList()),
fDirR(0),
} else {
file = TFile::Open(Form("%s#%s.RecPoints.root", fPathName->Data(), det->GetName()));
}
- if (!file) AliFatal(Form("AliESDInputHandlerRP: %s.RecPoints.root not found in %s ! \n", det->GetName(), fPathName->Data()));
+ if (!file) {
+ AliError(Form("AliESDInputHandlerRP: %s.RecPoints.root not found in %s ! \n", det->GetName(), fPathName->Data()));
+ return kFALSE;
+ }
fRFiles->Add(file);
}
if (file) {
fEventsPerFile = file->GetNkeys() - file->GetNProcessIDs();
} else {
- AliFatal(Form("AliESDInputHandlerRP: No file with RecPoints found in %s ! \n", fPathName->Data()));
+ AliError(Form("AliESDInputHandlerRP: No file with RecPoints found in %s ! \n", fPathName->Data()));
+ return kFALSE;
}
fFileNumber = 0;
// Get number of events from esd tree
printf("AliESDInputHandlerRP::Init() %d %d\n",__LINE__, fNEvents);
+ //
+ AliESDInputHandler::Init(opt);
+ //
return kTRUE;
}
Bool_t AliESDInputHandlerRP::BeginEvent(Long64_t entry)
{
// Begin the next event
- // Delegate first to base class
- AliESDInputHandler::BeginEvent(entry);
-//
+ //
if (entry == -1) {
fEventNumber++;
entry = fEventNumber;
}
if (entry >= fNEvents) {
- AliWarning(Form("AliESDInputHandlerRP: Event number out of range %5d %5d\n", entry, fNEvents));
+ AliWarning(Form("AliESDInputHandlerRP: Event number out of range %5lld %5d\n", entry, fNEvents));
return kFALSE;
}
- return LoadEvent(entry);
+
+ LoadEvent(entry);
+
+ // Delegate to base class
+ return AliESDInputHandler::BeginEvent(entry);
+
}
Bool_t AliESDInputHandlerRP::LoadEvent(Int_t iev)
// Load the event number iev
//
// Calculate the file number
+ if (fEventsPerFile<=0) return kFALSE;
Int_t inew = iev / fEventsPerFile;
if (inew != fFileNumber) {
fFileNumber = inew;
// Tree R
TIter next(fRFiles);
TFile* file;
- Int_t idx = 0;
+ Int_t idx = 0;
while ((file = (TFile*) next()))
{
file->GetObject(folder, fDirR);
+
if (!fDirR) {
AliWarning(Form("AliESDInputHandlerRP: Event #%5d not found\n", iev));
return kFALSE;
}
TTree* tree = 0;
fDirR->GetObject("TreeR", tree);
- fRTrees->AddAt(tree, idx++);
+ fRDirs ->AddAt(fDirR, idx );
+ fRTrees->AddAt(tree, idx++);
}
return kTRUE;
}
// Notify about directory change
// The directory is taken from the 'path' argument
//
- AliInfo(Form("Directory change %s \n", path));
+
// Get path to directory
TString fileName(path);
+ if (fileName.IsNull()) return kFALSE;
+ AliInfo(Form("Directory change %s \n", path));
if(fileName.Contains("#")){
// If this is an archive it will contain a #
TFile* file = TFile::Open(fPathName->Data());
TArchiveFile* arch = file->GetArchive();
members = arch->GetMembers();
+ fPathName->ReplaceAll("#AliESDs.root", "");
} else {
// Directory or alien archive
if (fileName.BeginsWith("alien:")) {
{
TString name(entry->GetName());
TObjArray* tokens = name.Tokenize(".");
- Int_t ntok = tokens->GetEntries();
+ Int_t ntok = 0;
+ if (tokens) {
+ ntok = tokens->GetEntries();
+ } else {
+ continue;
+ }
if (ntok <= 1) continue;
TString str = ((TObjString*) tokens->At(1))->GetString();
if (!(strcmp(str.Data(), "RecPoints"))){
ResetIO();
InitIO("");
// Some clean-up
- members->Delete();
+ if (members) members->Delete();
+ AliESDInputHandler::Notify(path);
+
return kTRUE;
}
Bool_t AliESDInputHandlerRP::FinishEvent()
{
// Clean-up after each event
- delete fDirR; fDirR = 0;
+ fRDirs->Delete();
AliESDInputHandler::FinishEvent();
return kTRUE;
}