Added new static method AliAnalysisManager::GetRunFromAlienPath() that extracts the...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisManager.h
index b13a1c5..53bb19b 100644 (file)
@@ -16,6 +16,9 @@
 #ifndef ROOT_TNamed
 #include <TNamed.h>
 #endif
+#ifndef ROOT_THashTable
+#include <THashTable.h>
+#endif
 
 class TClass;
 class TTree;
@@ -53,7 +56,8 @@ enum EAliAnalysisFlags {
    kUseDataSet       = BIT(16),
    kSaveCanvases     = BIT(17),
    kExternalLoop     = BIT(18),
-   kSkipTerminate    = BIT(19)
+   kSkipTerminate    = BIT(19),
+   kUseProgressBar   = BIT(20)
 };   
 
    AliAnalysisManager(const char *name = "mgr", const char *title="");
@@ -72,8 +76,9 @@ enum EAliAnalysisFlags {
    static TFile       *OpenFile(AliAnalysisDataContainer *cont, const char *option, Bool_t ignoreProof=kFALSE);
    void                PackOutput(TList *target);
    void                RegisterExtraFile(const char *fname);
-   Long64_t            StartAnalysis(const char *type="local", TTree *tree=0, Long64_t nentries=1234567890, Long64_t firstentry=0);
+   Long64_t            StartAnalysis(const char *type, TTree * const tree, Long64_t nentries=1234567890, Long64_t firstentry=0);
    Long64_t            StartAnalysis(const char *type, const char *dataset, Long64_t nentries=1234567890, Long64_t firstentry=0);
+   Long64_t            StartAnalysis(const char *type, Long64_t nentries=1234567890, Long64_t firstentry=0);
    virtual void        SlaveBegin(TTree *tree);
    virtual void        Terminate();
    void                UnpackOutput(TList *source);
@@ -83,44 +88,54 @@ enum EAliAnalysisFlags {
    EAliAnalysisExecMode 
                        GetAnalysisType() const    {return fMode;}
    void                GetAnalysisTypeString(TString &type) const;                    
+   Bool_t              GetAutoBranchLoading() const {return fAutoBranchHandling;} 
    static const char  *GetCommonFileName()        {return fgCommonFileName.Data();}
    AliAnalysisDataContainer *
-                       GetCommonInputContainer()  {return fCommonInput;}
+                       GetCommonInputContainer() const  {return fCommonInput;}
    AliAnalysisDataContainer *
-                       GetCommonOutputContainer() {return fCommonOutput;}
+                       GetCommonOutputContainer() const {return fCommonOutput;}
    TObjArray          *GetContainers() const      {return fContainers;}
    Long64_t            GetCurrentEntry() const    {return fCurrentEntry;}
    UInt_t              GetDebugLevel() const      {return fDebug;}
    TString             GetExtraFiles() const      {return fExtraFiles;}
-   AliVEventPool*      GetEventPool()             {return fEventPool;}
-   Bool_t              GetFileFromWrapper(const char *filename, TList *source);
+   AliVEventPool*      GetEventPool()  const      {return fEventPool;}
+   Bool_t              GetFileFromWrapper(const char *filename, const TList *source);
+   static Int_t        GetRunFromAlienPath(const char *path);
    AliAnalysisGrid*    GetGridHandler()           {return fGridHandler;}
    TObjArray          *GetInputs() const          {return fInputs;}
-   AliVEventHandler*   GetInputEventHandler()     {return fInputEventHandler;}
-   AliVEventHandler*   GetMCtruthEventHandler()   {return fMCtruthEventHandler;}
-   AliVEventHandler*   GetOutputEventHandler()    {return fOutputEventHandler;}
+   AliVEventHandler*   GetInputEventHandler() const   {return fInputEventHandler;}
+   AliVEventHandler*   GetMCtruthEventHandler() const {return fMCtruthEventHandler;}
+   AliVEventHandler*   GetOutputEventHandler() const  {return fOutputEventHandler;}
    TObjArray          *GetOutputs() const         {return fOutputs;}
+   TObjArray          *GetParamOutputs() const    {return fParamCont;}
+   Int_t               GetRunFromPath() const     {return fRunFromPath;}
    TObjArray          *GetTasks() const           {return fTasks;}
    TObjArray          *GetTopTasks() const        {return fTopTasks;}
    TTree              *GetTree() const            {return fTree;}
    TObjArray          *GetZombieTasks() const     {return fZombies;}
+   Bool_t              IsProofMode() const        {return (fMode==kProofAnalysis)?kTRUE:kFALSE;}
+   Bool_t              IsRemote() const           {return fIsRemote;}
    Bool_t              IsUsingDataSet() const     {return TObject::TestBit(kUseDataSet);}
+   void                LoadBranch(const char *n)  { if(fAutoBranchHandling) return; DoLoadBranch(n); }
    void                SetAnalysisType(EAliAnalysisExecMode mode) {fMode = mode;}
+   void                SetAutoBranchLoading(Bool_t b) { fAutoBranchHandling = b; }
    void                SetCurrentEntry(Long64_t entry)            {fCurrentEntry = entry;}
    void                SetCollectSysInfoEach(Int_t nevents=0)     {fNSysInfo = nevents;}
    static void         SetCommonFileName(const char *name)        {fgCommonFileName = name;}
    void                SetDebugLevel(UInt_t level)                {fDebug = level;}
    void                SetDisableBranches(Bool_t disable=kTRUE)   {TObject::SetBit(kDisableBranches,disable);}
    void                SetExternalLoop(Bool_t flag)               {TObject::SetBit(kExternalLoop,flag);}
-   void                SetEventPool(AliVEventPool* epool)         {fEventPool = epool;}
-   void                SetGridHandler(AliAnalysisGrid *handler)   {fGridHandler = handler;}
-   void                SetInputEventHandler(AliVEventHandler*  handler);
-   void                SetMCtruthEventHandler(AliVEventHandler* handler) {fMCtruthEventHandler = handler;}
+   void                SetEventPool(AliVEventPool* const epool)   {fEventPool = epool;}
+   void                SetGridHandler(AliAnalysisGrid * const handler) {fGridHandler = handler;}
+   void                SetInputEventHandler(AliVEventHandler* const handler);
+   void                SetMCtruthEventHandler(AliVEventHandler* const handler) {fMCtruthEventHandler = handler;}
    void                SetNSysInfo(Long64_t nevents)              {fNSysInfo = nevents;}
-   void                SetOutputEventHandler(AliVEventHandler*  handler);
-   void                SetSelector(AliAnalysisSelector *sel)      {fSelector = sel;}
+   void                SetOutputEventHandler(AliVEventHandler* const handler);
+   void                SetRunFromPath(Int_t run)                  {fRunFromPath = run;}
+   void                SetSelector(AliAnalysisSelector * const sel)      {fSelector = sel;}
    void                SetSaveCanvases(Bool_t flag=kTRUE)         {TObject::SetBit(kSaveCanvases,flag);}
    void                SetSkipTerminate(Bool_t flag)              {TObject::SetBit(kSkipTerminate,flag);}
+   void                SetUseProgressBar(Bool_t flag)             {TObject::SetBit(kUseProgressBar,flag);}
    void                SetSpecialOutputLocation(const char *loc)  {fSpecialOutputLocation = loc;}
 
    // Container handling
@@ -148,16 +163,16 @@ enum EAliAnalysisFlags {
    Bool_t               IsSkipTerminate() const {return TObject::TestBit(kSkipTerminate);}
    void                 ResetAnalysis();
    void                 ExecAnalysis(Option_t *option="");
-   void                 FinishAnalysis();
    void                 PrintStatus(Option_t *option="all") const;
    void                 ProfileTask(const char *name, const char *option="VM") const;
    void                 ProfileTask(Int_t itop, const char *option="VM") const;
-   static void          ProgressBar(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch=0, Bool_t last=kFALSE, Bool_t refresh=kFALSE);
+   static void          ProgressBar(const char *opname, Long64_t current, Long64_t size, TStopwatch * const watch=0, Bool_t last=kFALSE, Bool_t refresh=kFALSE);
    Bool_t               ValidateOutputFiles() const;
 
 protected:
    void                 ImportWrappers(TList *source);
    void                 SetEventLoop(Bool_t flag=kTRUE) {TObject::SetBit(kEventLoop,flag);}
+   void                 DoLoadBranch(const char *name);
 
 private:
    TTree                  *fTree;                //! Input tree in case of TSelector model
@@ -169,6 +184,7 @@ private:
    Long64_t                fNSysInfo;            // Event frequency for collecting system information
    EAliAnalysisExecMode    fMode;                // Execution mode
    Bool_t                  fInitOK;              // Initialisation done
+   Bool_t                  fIsRemote;            //! Flag is set for remote analysis
    UInt_t                  fDebug;               // Debug level
    TString                 fSpecialOutputLocation; // URL/path where the special outputs will be copied
    TObjArray              *fTasks;               // List of analysis tasks
@@ -177,15 +193,18 @@ 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
    AliAnalysisGrid        *fGridHandler;         //! Grid handler plugin
    TString                 fExtraFiles;          // List of extra files to be merged
+   Bool_t                  fAutoBranchHandling;  // def=kTRUE, turn off if you use LoadBranch
+   THashTable              fTable;               // keep branch ptrs in case of manual branch loading
+   Int_t                   fRunFromPath;         // Run number retrieved from path to input data
 
    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,8)  // Analysis manager class
 };   
 #endif