Last fixes (hopefully) for the kParamContainer mode. Tested in "full", "terminate...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Jul 2010 09:55:01 +0000 (09:55 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Jul 2010 09:55:01 +0000 (09:55 +0000)
ANALYSIS/AliAnalysisAlien.cxx
ANALYSIS/AliAnalysisManager.cxx
ANALYSIS/AliAnalysisManager.h

index d72a199..23d479b 100644 (file)
@@ -1805,7 +1805,9 @@ Bool_t AliAnalysisAlien::MergeOutputs()
       if (!merged) {
          Error("MergeOutputs", "Terminate() will  NOT be executed");
          return kFALSE;
-      }   
+      }
+      TFile *fileOpened = (TFile*)gROOT->GetListOfFiles()->FindObject(outputFile);
+      if (fileOpened) fileOpened->Close();
    } 
    return kTRUE;
 }   
index 5c5670c..05fc5cf 100644 (file)
@@ -816,7 +816,12 @@ void AliAnalysisManager::Terminate()
              if (fDebug>0) printf("Opening file: %s  option=%s\n",filename, openoption.Data());
          file = new TFile(filename, openoption);
       } else {
-         if (fDebug>0) printf("File already opened: %s\n", filename);
+         if (fDebug>0) printf("File <%s> already opened with option: <%s> \n", filename, file->GetOption());
+         openoption = file->GetOption();
+         if (openoption == "READ") {
+            if (fDebug>0) printf("...reopening in UPDATE mode\n");
+            file->ReOpen("UPDATE");            
+         }
       }   
       if (file->IsZombie()) {
          Error("Terminate", "Cannot open output file %s", filename);
index b773669..bd0bfeb 100644 (file)
@@ -100,6 +100,7 @@ enum EAliAnalysisFlags {
    AliVEventHandler*   GetMCtruthEventHandler() const {return fMCtruthEventHandler;}
    AliVEventHandler*   GetOutputEventHandler() const  {return fOutputEventHandler;}
    TObjArray          *GetOutputs() const         {return fOutputs;}
+   TObjArray          *GetParamOutputs() const    {return fParamCont;}
    TObjArray          *GetTasks() const           {return fTasks;}
    TObjArray          *GetTopTasks() const        {return fTopTasks;}
    TTree              *GetTree() const            {return fTree;}
@@ -176,7 +177,7 @@ private:
    TObjArray              *fContainers;          // List of all containers
    TObjArray              *fInputs;              // List of containers with input data
    TObjArray              *fOutputs;             // List of containers with results
-   TObjArray              *fParamCont;           //! List of containers with results
+   TObjArray              *fParamCont;           // List of containers with results
    AliAnalysisDataContainer *fCommonInput;       // Common input container
    AliAnalysisDataContainer *fCommonOutput;      // Common output container
    AliAnalysisSelector    *fSelector;            //! Current selector
@@ -185,6 +186,6 @@ private:
 
    static TString          fgCommonFileName;     //! Common output file name (not streamed)
    static AliAnalysisManager *fgAnalysisManager; //! static pointer to object instance
-   ClassDef(AliAnalysisManager,6)  // Analysis manager class
+   ClassDef(AliAnalysisManager,7)  // Analysis manager class
 };   
 #endif