]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisSelector.cxx
AliAnalysisTaskMuonTrackingEff: removal of warnings, passing the AliCheckDetElementRe...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisSelector.cxx
index f7da20dd04560485f9405eab8d33e6218180b185..580c322940ad53bfd19aecd9f652f1f09b7d1142 100644 (file)
@@ -56,18 +56,27 @@ void AliAnalysisSelector::Init(TTree *tree)
 // Is Init called on workers in case of PROOF.
    if (!fAnalysis) {
       Error("Init", "Analysis manager NULL !");
+      Abort("Cannot initialize without analysis manager. Aborting.");
+      SetStatus(-1);
       return;
    }
-   if (fAnalysis->GetDebugLevel()>1) {
+   if (fAnalysis->GetDebugLevel()>0) {
       cout << "->AliAnalysisSelector->Init()" << endl;
    }   
    if (!tree) {
       Error("Init", "Input tree is NULL !");
+      Abort("Cannot initialize without tree. Aborting.");
+      SetStatus(-1);
       return;
    }
-   fAnalysis->Init(tree);
-   fInitialized = kTRUE;
-   if (fAnalysis->GetDebugLevel()>1) {
+   fInitialized = fAnalysis->Init(tree);
+   if (!fInitialized) {
+      Error("Init", "Some error occured during analysis manager initialization. Aborting.");
+      Abort("Error during AliAnalysisManager::Init()");
+      SetStatus(-1);
+      return;
+   }   
+   if (fAnalysis->GetDebugLevel()>0) {
       cout << "<-AliAnalysisSelector->Init()" << endl;
    }   
 }
@@ -77,7 +86,7 @@ void AliAnalysisSelector::Begin(TTree *)
 {
 // Assembly the input list.
    RestoreAnalysisManager();
-   if (fAnalysis && fAnalysis->GetDebugLevel()>1) {
+   if (fAnalysis && fAnalysis->GetDebugLevel()>0) {
       cout << "->AliAnalysisSelector->Begin: Analysis manager restored" << endl;
    }
 }
@@ -88,11 +97,11 @@ void AliAnalysisSelector::SlaveBegin(TTree *tree)
 // Called on each worker. We "unpack" analysis manager here and call InitAnalysis.
    RestoreAnalysisManager();
    if (fAnalysis) {
-      if (fAnalysis->GetDebugLevel()>1) {
+      if (fAnalysis->GetDebugLevel()>0) {
          cout << "->AliAnalysisSelector->SlaveBegin() after Restore" << endl;
       }   
       fAnalysis->SlaveBegin(tree);   
-      if (fAnalysis->GetDebugLevel()>1) {
+      if (fAnalysis->GetDebugLevel()>0) {
          cout << "<-AliAnalysisSelector->SlaveBegin()" << endl;
       }   
    }   
@@ -114,14 +123,14 @@ Bool_t AliAnalysisSelector::Notify()
 Bool_t AliAnalysisSelector::Process(Long64_t entry)
 {
 // Event loop.
-   if (fAnalysis->GetDebugLevel() >) {
+   if (fAnalysis->GetDebugLevel() > 0) {
       cout << "->AliAnalysisSelector::Process()" << endl;
    }
    Int_t nobjCount = TProcessID::GetObjectCount();
    fAnalysis->GetEntry(entry);
    fAnalysis->ExecAnalysis();
    TProcessID::SetObjectCount(nobjCount);
-   if (fAnalysis->GetDebugLevel() >) {
+   if (fAnalysis->GetDebugLevel() > 0) {
       cout << "<-AliAnalysisSelector::Process()" << endl;
    }   
    return kTRUE;
@@ -137,7 +146,8 @@ void AliAnalysisSelector::RestoreAnalysisManager()
       while ((obj=next())) {
          if (obj->IsA() == AliAnalysisManager::Class()) {
             fAnalysis = (AliAnalysisManager*)obj;
-            if (fAnalysis->GetDebugLevel()>1) {
+            fAnalysis->SetSelector(this);
+            if (fAnalysis->GetDebugLevel()>0) {
                cout << "->AliAnalysisSelector->RestoreAnalysisManager: Analysis manager restored" << endl;
             }   
             break;
@@ -156,11 +166,13 @@ void AliAnalysisSelector::SlaveTerminate()
   // The SlaveTerminate() function is called after all entries or objects
   // have been processed. When running with PROOF SlaveTerminate() is called
   // on each slave server.
-   if (fAnalysis->GetDebugLevel() >1 ) {
+   if (fStatus == -1) return;  // TSelector won't abort...
+   if (fAnalysis->GetAnalysisType() == AliAnalysisManager::kMixingAnalysis) return;
+   if (fAnalysis->GetDebugLevel() > 0) {
       cout << "->AliAnalysisSelector::SlaveTerminate()" << endl;
    }   
    fAnalysis->PackOutput(fOutput);
-   if (fAnalysis->GetDebugLevel() >) {
+   if (fAnalysis->GetDebugLevel() > 0) {
       cout << "<-AliAnalysisSelector::SlaveTerminate()" << endl;
    }   
 }  
@@ -171,16 +183,19 @@ void AliAnalysisSelector::Terminate()
   // The Terminate() function is the last function to be called during
   // a query. It always runs on the client, it can be used to present
   // the results graphically or save the results to file.
+   if (fStatus == -1) return;  // TSelector won't abort...
    if (!fAnalysis) {
       Error("Terminate","AliAnalysisSelector::Terminate: No analysis manager!!!");
       return;
    }   
-   if (fAnalysis->GetDebugLevel() >1 ) {
+   // No Terminate() in case of event mixing
+   if (fAnalysis->GetAnalysisType() == AliAnalysisManager::kMixingAnalysis) return;
+   if (fAnalysis->GetDebugLevel() > 0) {
       cout << "->AliAnalysisSelector::Terminate()" << endl;
    }   
    fAnalysis->UnpackOutput(fOutput);
    fAnalysis->Terminate();   
-   if (fAnalysis->GetDebugLevel() >) {
+   if (fAnalysis->GetDebugLevel() > 0) {
       cout << "<-AliAnalysisSelector::Terminate()" << endl;
    }   
 }