]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- Files corresponding to output containers closed during Terminate()
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Dec 2007 14:06:33 +0000 (14:06 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Dec 2007 14:06:33 +0000 (14:06 +0000)
- In case no input handler is present the tree is loaded to avoid a crash in Notify()

ANALYSIS/AliAnalysisManager.cxx

index c96618341812e6aa4fecea7955aea92107b6207d..7b9bf0f0d32c0bc16bed6f8245f76fdaf1a737cf 100644 (file)
@@ -178,7 +178,12 @@ void AliAnalysisManager::Init(TTree *tree)
       } else {
          fInputEventHandler->Init(tree, "local");
       }
+   } else {
+      // If no input event handler we need to get the tree once
+      // for the chain
+      if(!tree->GetTree()) tree->LoadTree(0);
    }
+   
 
    if (fMCtruthEventHandler) {
       if (fMode == kProofAnalysis) {
@@ -432,6 +437,7 @@ void AliAnalysisManager::UnpackOutput(TList *source)
       
       if (!filename || !strlen(filename)) continue;
       TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
+      TDirectory *opwd = gDirectory;
       if (file) file->cd();
       else      file = new TFile(filename, "RECREATE");
       if (file->IsZombie()) continue;
@@ -444,6 +450,8 @@ void AliAnalysisManager::UnpackOutput(TList *source)
          callEnv.Execute(output->GetData());
       }
       output->GetData()->Write();
+      file->Close();
+      if (opwd) opwd->cd();
    }
    if (fDebug > 1) {
       cout << "<-AliAnalysisManager::UnpackOutput()" << endl;