]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisTask.h
Compatibility with the trunk of root
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTask.h
index 37f93c65bf0571100cb6a06b1e176525f0d9c12b..cc3b89b515d14164f6566ec58c77a80e354fb69d 100644 (file)
@@ -21,6 +21,7 @@
 #endif
 
 class TClass;
+class TFile;
 class AliAnalysisDataSlot;
 class AliAnalysisDataContainer;
 
@@ -42,12 +43,12 @@ class AliAnalysisTask : public TTask {
   TObject                  *fPublishedData; //! published data
   TObjArray                *fInputs;        // Array of input slots
   TObjArray                *fOutputs;       // Array of output slots
+  TString                   fBranchNames;   // List of input branches that need to be loaded for this task
 
   // Define the input/output slots (called by user in the ctor of the derived class)
   //=== CALL IN THE CONSTRUCTOR OF DERIVED CLASS TO DEFINE INPUTS/OUTPUTS ===
   void                      DefineInput(Int_t islot, TClass *type);
   void                      DefineOutput(Int_t islot, TClass *type);
-  //=====================================================================
   
   //=====================================================================
   // === OVERLOAD THIS TO CONNECT TREE BRANCHES AT INPUT SLOTS. YOU
@@ -71,7 +72,7 @@ class AliAnalysisTask : public TTask {
   //=====================================================================
   // === CALL THIS IN CreateOutputObjects BEFORE CREATING THE OBJECT FOR EACH 
   // OUTPUT IOUT THAT HAS TO BE WRITTEN TO A FILE
-  void                      OpenFile(Int_t iout, Option_t *option="RECREATE") const;
+  TFile                    *OpenFile(Int_t iout, Option_t *option="RECREATE") const;
   
 public:  
   AliAnalysisTask();
@@ -86,8 +87,15 @@ public:
   virtual void              CreateOutputObjects();
   // === OVERLOAD THIS IF YOU NEED TO INITIALIZE YOUR CLASS ON THE CLIENT
   virtual void              LocalInit();
-  // === OVERLOAD THIS IF YOU NEED TO TREAT INPUT FILE CHANGE
+  // === OVERLOAD THIS IF YOU NEED TO TREAT INPUT FILE/TREE CHANGE
   virtual Bool_t            Notify();
+  // === OVERLOAD THIS IF YOU NEED TO TREAT BIN CHANGE IN EVENT MIXING
+  virtual Bool_t            NotifyBinChange();
+  //=====================================================================
+  // Optional method that will be called in SlaveTerminate phase for each task
+  // Warning: in PROOF mode this is called before merging so their cleanup is
+  //          not allowed - do output cleanup in class destructor.
+  virtual void              FinishTaskOutput();
   // Conect inputs/outputs to data containers (by AliAnalysisModule)
   Bool_t                    ConnectInput(Int_t islot, AliAnalysisDataContainer *cont);
   Bool_t                    ConnectOutput(Int_t islot, AliAnalysisDataContainer *cont);
@@ -97,7 +105,10 @@ public:
   void                      CheckNotify(Bool_t init=kFALSE);
   // Check if there are illegal circular dependencies
   Bool_t                    CheckCircularDeps();
+  virtual Bool_t            CheckPostData() const;
+  virtual Bool_t            CheckOwnership() const;
   // Getters
+  void                      GetBranches(const char *type, TString &result) const;
   Int_t                     GetNinputs() const  {return fNinputs;}
   Int_t                     GetNoutputs() const {return fNoutputs;}
   TObject                  *GetPublishedData() const {return fPublishedData;}
@@ -115,8 +126,10 @@ public:
   Bool_t                    IsReady() const  {return fReady;}
   Bool_t                    IsUsed() const   {return TObject::TestBit(kTaskUsed);}
   Bool_t                    IsZombie() const {return TObject::TestBit(kTaskZombie);}
-  void                      PrintTask(Option_t *option="all", Int_t indent=0) const;
+  Bool_t                    HasBranches() const {return !fBranchNames.IsNull();}
+  virtual void                      PrintTask(Option_t *option="all", Int_t indent=0) const;
   void                      PrintContainers(Option_t *option="all", Int_t indent=0) const;
+  void                      SetBranches(const char *names) {fBranchNames = names;}
   void                      SetChecked(Bool_t flag=kTRUE) {TObject::SetBit(kTaskChecked,flag);}
   void                      SetPostEventLoop(Bool_t flag=kTRUE);
   void                      SetUsed(Bool_t flag=kTRUE);
@@ -131,6 +144,6 @@ public:
   virtual void              Terminate(Option_t *option="");
   //=====================================================================
     
-  ClassDef(AliAnalysisTask,1)  // Class describing an analysis task
+  ClassDef(AliAnalysisTask,2)  // Class describing an analysis task
 };
 #endif