]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisManager.cxx
New trending info in AliTPCPerformanceSummary and AliPerformanceTPC (Weilin), PostDat...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisManager.cxx
index 5cd9de3777ee85cb212021708e036318355487ac..71e5049c00689fa9c3deb4d088595c200f15b74b 100644 (file)
@@ -345,6 +345,7 @@ void AliAnalysisManager::SlaveBegin(TTree *tree)
   // When running with PROOF SlaveBegin() is called on each slave server.
   // The tree argument is deprecated (on PROOF 0 is passed).
    if (fDebug > 1) printf("->AliAnalysisManager::SlaveBegin()\n");
+   if (!CheckTasks()) Fatal("SlaveBegin", "Not all needed libraries were loaded");
    static Bool_t isCalled = kFALSE;
    Bool_t init = kFALSE;
    Bool_t initOK = kTRUE;
@@ -409,6 +410,11 @@ void AliAnalysisManager::SlaveBegin(TTree *tree)
       // Start with memory as current dir and make sure by default histograms do not get attached to files.
       TH1::AddDirectory(kFALSE);
       task->CreateOutputObjects();
+      if (!task->CheckPostData()) {
+         Error("SlaveBegin","####### IMPORTANT! ####### \n\n\n\
+                Task %s (%s) did not call PostData() for all its outputs in (User)CreateOutputObjects()\n\n\
+                ####### FIX YOUR CODE, THIS WILL PRODUCE A FATAL ERROR IN FUTURE! ##########", task->GetName(), task->ClassName());
+      }
       if (getsysInfo) AliSysInfo::AddStamp(Form("%s_CREATEOUTOBJ",task->ClassName()), 0, itask, 0);
       itask++;
    }
@@ -1428,6 +1434,25 @@ void AliAnalysisManager::CheckBranches(Bool_t load)
   delete arr;
 }
 
+//______________________________________________________________________________
+Bool_t AliAnalysisManager::CheckTasks() const
+{
+// Check consistency of tasks.
+   // Get the pointer to AliAnalysisTaskSE::Class()
+   TClass *badptr = (TClass*)gROOT->ProcessLine("AliAnalysisTaskSE::Class()");
+   // Loop all tasks to check if their corresponding library was loaded
+   TIter next(fTasks);
+   TObject *obj;
+   while ((obj=next())) {
+      if (obj->IsA() == badptr) {
+         Error("CheckTasks", "##################\n \
+         Class for task %s NOT loaded. You probably forgot to load the library for this task (or compile it dynamically).\n###########################\n",obj->GetName());
+         return kFALSE;
+      }
+   }
+   return kTRUE;      
+}   
+
 //______________________________________________________________________________
 void AliAnalysisManager::PrintStatus(Option_t *option) const
 {
@@ -1495,6 +1520,7 @@ Long64_t AliAnalysisManager::StartAnalysis(const char *type, TTree * const tree,
       cdir->cd();
       return -1;
    }
+   if (!CheckTasks()) Fatal("StartAnalysis", "Not all needed libraries were loaded");
    if (fDebug > 1) printf("StartAnalysis %s\n",GetName());
    fMaxEntries = nentries;
    fIsRemote = kFALSE;
@@ -1591,6 +1617,11 @@ Long64_t AliAnalysisManager::StartAnalysis(const char *type, TTree * const tree,
             while ((task=(AliAnalysisTask*)nextT())) {
                TH1::AddDirectory(kFALSE);
                task->CreateOutputObjects();
+               if (!task->CheckPostData()) {
+                  Error("SlaveBegin","####### IMPORTANT! ####### \n\n\n\
+                        Task %s (%s) did not call PostData() for all its outputs in (User)CreateOutputObjects()\n\n\
+                        ########### FIX YOUR CODE, THIS WILL PRODUCE A FATAL ERROR IN FUTURE! ###########", task->GetName(), task->ClassName());
+               }
                if (getsysInfo) AliSysInfo::AddStamp(Form("%s_CREATEOUTOBJ",task->ClassName()), 0, itask, 0);
                gROOT->cd();
                itask++;