]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDInputHandlerRP.cxx
In AliMUONESDInterface:
[u/mrichter/AliRoot.git] / STEER / AliESDInputHandlerRP.cxx
index 3ad80c0a312f53efef3fd873af3c83b07fb2bb5d..6a9f9055d01c76daa4634d5782613e21721b56e3 100644 (file)
@@ -98,14 +98,18 @@ Bool_t AliESDInputHandlerRP::Init(Option_t* opt)
        } 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;
     }
     
 
@@ -114,6 +118,9 @@ Bool_t AliESDInputHandlerRP::Init(Option_t* opt)
     fFileNumber       =  0;
     // Get number of events from esd tree 
     printf("AliESDInputHandlerRP::Init() %d %d\n",__LINE__, fNEvents);
+    //
+    AliESDInputHandler::Init(opt);
+    //
     return kTRUE;
 }
 
@@ -129,7 +136,7 @@ Bool_t AliESDInputHandlerRP::BeginEvent(Long64_t entry)
     }
     
     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;
     }
     
@@ -145,6 +152,7 @@ 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;
@@ -208,9 +216,11 @@ Bool_t AliESDInputHandlerRP::Notify(const char *path)
   // 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 # 
@@ -233,6 +243,7 @@ Bool_t AliESDInputHandlerRP::Notify(const char *path)
       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:")) {
@@ -256,7 +267,12 @@ Bool_t AliESDInputHandlerRP::Notify(const char *path)
     {
        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"))){
@@ -278,8 +294,10 @@ Bool_t AliESDInputHandlerRP::Notify(const char *path)
     ResetIO();
     InitIO("");
     // Some clean-up
-    members->Delete();
+    if (members) members->Delete();
 
+    AliESDInputHandler::Notify(path);
+    
     return kTRUE;
 }