]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
File opening for local and grid execution mode.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Jun 2007 13:25:46 +0000 (13:25 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Jun 2007 13:25:46 +0000 (13:25 +0000)
AliAnalysisDataContainer must be used with output file name "default"
if output is aod tree.

STEER/AliAODHandler.cxx
STEER/AliAODHandler.h
STEER/AliVirtualEventHandler.h

index 1657963da49a351749f68bb57cabaa7bec3ed4d8..b6360e215ea06a2c91e2e796582eb1bb1e2cf391 100644 (file)
@@ -22,6 +22,8 @@
 
 
 #include <TTree.h>
+#include <TFile.h>
+
 #include "AliAODHandler.h"
 #include "AliAODEvent.h"
 
@@ -31,7 +33,9 @@ ClassImp(AliAODHandler)
 AliAODHandler::AliAODHandler() :
     AliVirtualEventHandler(),
     fAODEvent(NULL),
-    fTreeA(NULL)
+    fTreeA(NULL),
+    fFileA(NULL),
+    fName("")
 {
   // default constructor
 }
@@ -40,7 +44,9 @@ AliAODHandler::AliAODHandler() :
 AliAODHandler::AliAODHandler(const char* name, const char* title):
     AliVirtualEventHandler(name, title),
     fAODEvent(NULL),
-    fTreeA(NULL)
+    fTreeA(NULL),
+    fFileA(NULL),
+    fName("")
 {
 }
 
@@ -51,11 +57,24 @@ AliAODHandler::~AliAODHandler()
 }
 
 
-Bool_t AliAODHandler::InitIO()
+Bool_t AliAODHandler::InitIO(Option_t* opt)
 {
     // Initialize IO
+    //
+    // Create the AODevent object
     fAODEvent = new AliAODEvent();
     fAODEvent->CreateStdContent();
+    //
+    // File opening according to execution mode
+
+    if (!(strcmp(opt, "proof"))) {
+       // proof
+    } else {
+       // local and grid
+       fFileA = new TFile(fName, "RECREATE");
+    }
+    //
+    // Create the output tree
     CreateTree();
     
     return kTRUE;
index 2ec2030b3248321af495e69e9c477baf4332a116..fbdd54412dacee072e789342c2d7044e9fe353a9 100644 (file)
@@ -24,7 +24,9 @@ class AliAODHandler : public AliVirtualEventHandler {
     AliAODHandler();
     AliAODHandler(const char* name, const char* title);
     virtual ~AliAODHandler();
-    virtual Bool_t       InitIO();
+    virtual void         SetOutputFileName(char* fname) {fName = fname;}
+    virtual char*        GetOutputFileName() {return fName;}
+    virtual Bool_t       InitIO(Option_t* option);
     virtual Bool_t       Fill();
     virtual Bool_t       Terminate();
     virtual Bool_t       TerminateIO();
@@ -41,8 +43,8 @@ class AliAODHandler : public AliVirtualEventHandler {
  private:
     AliAODEvent             *fAODEvent;  //! Pointer to the AOD event
     TTree                   *fTreeA;     //! tree for AOD persistency
-
-    
+    TFile                   *fFileA;     //! Output file
+    char                    *fName;      //! Output file name
     ClassDef(AliAODHandler, 1);
 };
 
index 69001b9c6bda44e00f9d7080d0430cbd18e159e7..860443c8b84be77ff55586b0f0508756e0fde57d 100644 (file)
@@ -19,10 +19,12 @@ class AliVirtualEventHandler : public TNamed {
     AliVirtualEventHandler();
     AliVirtualEventHandler(const char* name, const char* title);
     virtual ~AliVirtualEventHandler();
-    virtual Bool_t       InitIO()             = 0;
-    virtual Bool_t       Fill()               = 0;
-    virtual Bool_t       Terminate()          = 0;
-    virtual Bool_t       TerminateIO()        = 0;
+    virtual void         SetOutputFileName(char* fname)  = 0;
+    virtual char*        GetOutputFileName()             = 0;
+    virtual Bool_t       InitIO(Option_t* opt)           = 0;
+    virtual Bool_t       Fill()                          = 0;
+    virtual Bool_t       Terminate()                     = 0;
+    virtual Bool_t       TerminateIO()                   = 0;
  private :
   ClassDef(AliVirtualEventHandler, 1);
 };