Added support for retrieving and merging dAOD's. The producer task has to call AliAna...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisManager.h
index 2d982c7..32e3d05 100644 (file)
 
 class TClass;
 class TTree;
+class TFile;
+class AliAnalysisSelector;
 class AliAnalysisDataContainer;
 class AliAnalysisTask;
-class AliVirtualEventHandler;
+class AliVEventHandler;
+class AliVEventPool;
+class AliAnalysisGrid;
 
 
 class AliAnalysisManager : public TNamed {
@@ -37,30 +41,33 @@ enum EAliAnalysisContType {
 enum EAliAnalysisExecMode {
    kLocalAnalysis    = 0,
    kProofAnalysis    = 1,
-   kGridAnalysis     = 2
+   kGridAnalysis     = 2,
+   kMixingAnalysis   = 3
 };
 
 enum EAliAnalysisFlags {
    kEventLoop        = BIT(14),
-   kDisableBranches  = BIT(15)
+   kDisableBranches  = BIT(15),
+   kUseDataSet       = BIT(16)
 };   
 
-   AliAnalysisManager();
-   AliAnalysisManager(const char *name, const char *title="");
+   AliAnalysisManager(const char *name = "mgr", const char *title="");
    virtual            ~AliAnalysisManager();
 
    AliAnalysisManager(const AliAnalysisManager& other);
    AliAnalysisManager& operator=(const AliAnalysisManager& other);
    
-   void                StartAnalysis(const char *type="local", TTree *tree=0);
+   // Management methods called by the framework
+   void                StartAnalysis(const char *type="local", TTree *tree=0, Long64_t nentries=1234567890, Long64_t firstentry=0);
+   void                StartAnalysis(const char *type, const char *dataset, Long64_t nentries=1234567890, Long64_t firstentry=0);
 
-   virtual void        Init(TTree *tree);   
-   virtual void        Begin(TTree *tree);
+   virtual Bool_t      Init(TTree *tree);   
    virtual Bool_t      Notify();
    virtual void        SlaveBegin(TTree *tree);
    virtual Bool_t      ProcessCut(Long64_t entry) {return Process(entry);}
    virtual Bool_t      Process(Long64_t entry);
    virtual Int_t       GetEntry(Long64_t entry, Int_t getall = 0);
+   TFile              *OpenProofFile(const char *name, const char *option);
    void                PackOutput(TList *target);
    void                UnpackOutput(TList *source);
    virtual void        Terminate();
@@ -78,17 +85,31 @@ enum EAliAnalysisFlags {
    Long64_t            GetCurrentEntry() const {return fCurrentEntry;}
    EAliAnalysisExecMode 
                        GetAnalysisType() const {return fMode;}
+   Bool_t              IsUsingDataSet() const  {return TObject::TestBit(kUseDataSet);}
 
+   void                RegisterExtraFile(const char *fname);
    void                SetAnalysisType(EAliAnalysisExecMode mode) {fMode = mode;}
    void                SetCurrentEntry(Long64_t entry) {fCurrentEntry = entry;}
    void                SetDebugLevel(UInt_t level) {fDebug = level;}
+   void                SetSpecialOutputLocation(const char *location) {fSpecialOutputLocation = location;}
    void                SetDisableBranches(Bool_t disable=kTRUE) {TObject::SetBit(kDisableBranches,disable);}
-   void                SetOutputEventHandler(AliVirtualEventHandler*  handler) {fOutputEventHandler  = handler;}
-   void                SetMCtruthEventHandler(AliVirtualEventHandler* handler) {fMCtruthEventHandler = handler;}
-   AliVirtualEventHandler*
-       GetOutputEventHandler()  {return fOutputEventHandler;}
-   AliVirtualEventHandler*
-       GetMCtruthEventHandler() {return fMCtruthEventHandler;}
+   void                SetCollectSysInfoEach(Int_t nevents=0) {fNSysInfo = nevents;}
+   void                SetInputEventHandler(AliVEventHandler*  handler);
+   void                SetOutputEventHandler(AliVEventHandler*  handler);
+   void                SetMCtruthEventHandler(AliVEventHandler* handler) {fMCtruthEventHandler = handler;}
+   void                SetGridHandler(AliAnalysisGrid *handler) {fGridHandler = handler;}
+   void                SetEventPool(AliVEventPool* epool) {fEventPool = epool;}
+   void                SetNSysInfo(Long64_t nevents) {fNSysInfo = nevents;}
+   void                SetSelector(AliAnalysisSelector *sel) {fSelector = sel;}
+   AliVEventHandler*   GetInputEventHandler()   {return fInputEventHandler;}
+   AliVEventHandler*   GetOutputEventHandler()  {return fOutputEventHandler;}
+   AliVEventHandler*   GetMCtruthEventHandler() {return fMCtruthEventHandler;}
+   AliAnalysisDataContainer *GetCommonInputContainer() {return fCommonInput;}
+   AliAnalysisDataContainer *GetCommonOutputContainer() {return fCommonOutput;}
+   AliAnalysisGrid*    GetGridHandler()         {return fGridHandler;}
+   AliVEventPool*      GetEventPool()           {return fEventPool;}
+   Bool_t              GetFileFromWrapper(const char *filename, TList *source);
+   TString             GetExtraFiles() const {return fExtraFiles;}
 
    // Container handling
    AliAnalysisDataContainer *CreateContainer(const char *name, TClass *datatype, 
@@ -122,20 +143,29 @@ protected:
 
 private:
    TTree                  *fTree;                //! Input tree in case of TSelector model
-   AliVirtualEventHandler *fOutputEventHandler;  //  Optional common output event handler
-   AliVirtualEventHandler *fMCtruthEventHandler; //  Optional common MC Truth event handler
+   AliVEventHandler       *fInputEventHandler;   //  Optional common input  event handler
+   AliVEventHandler       *fOutputEventHandler;  //  Optional common output event handler
+   AliVEventHandler       *fMCtruthEventHandler; //  Optional common MC Truth event handler
+   AliVEventPool          *fEventPool;           //  Event pool for mixing analysis
    Long64_t                fCurrentEntry;        //! Current processed entry in the tree
+   Long64_t                fNSysInfo;            // Event frequency for collecting system information
    EAliAnalysisExecMode    fMode;                // Execution mode
    Bool_t                  fInitOK;              // Initialisation done
    UInt_t                  fDebug;               // Debug level
+   TString                 fSpecialOutputLocation; // URL/path where the special outputs will be copied
    TObjArray              *fTasks;               // List of analysis tasks
    TObjArray              *fTopTasks;            // List of top tasks
    TObjArray              *fZombies;             // List of zombie tasks
    TObjArray              *fContainers;          // List of all containers
    TObjArray              *fInputs;              // List of containers with input data
    TObjArray              *fOutputs;             // List of containers with results
+   AliAnalysisDataContainer *fCommonInput;       // Common input container
+   AliAnalysisDataContainer *fCommonOutput;      // Common output container
+   AliAnalysisSelector    *fSelector;            //! Current selector
+   AliAnalysisGrid        *fGridHandler;         //! Grid handler plugin
+   TString                 fExtraFiles;          //! List of extra files to be merged
 
    static AliAnalysisManager *fgAnalysisManager; //! static pointer to object instance
-   ClassDef(AliAnalysisManager,1)  // Analysis manager class
+   ClassDef(AliAnalysisManager,4)  // Analysis manager class
 };   
 #endif