New class describing how to run a given analysis task
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskCfg.h
CommitLineData
4579e070 1#ifndef ALIANALYSISTASKCFG_H
2#define ALIANALYSISTASKCFG_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6// Author: Andrei Gheata, 12/08/2011
7
8//==============================================================================
9// AliAnalysysTaskCfg - Class embedding the configuration needed to run
10// a given analysis task: libraries to be loaded, location and name of the macro
11// used to add the task to the analysis manager, dependencies.
12//==============================================================================
13
14#ifndef ROOT_TNamed
15#include "TNamed.h"
16#endif
17
18class TMacro;
19class TObjArray;
20
21class AliAnalysisTaskCfg : public TNamed {
22protected:
23 TString fMacroName; // Full path to AddTask macro
24 TString fMacroArgs; // Arguments to run the macro
25 TString fLibs; // List of custom libs needed to run the task (comma separated)
26 TString fDeps; // List of tasks this module depends on
27 TString fDataTypes; // List of supported data types (ESD, AOD, MC)
28 TMacro *fMacro; // Embedded AddTask macro
29 TMacro *fConfigDeps; // Macro used to configure the dependecies
30 // (utility tasks or input handlers). The data type is passed as argument.
31public:
32 AliAnalysisTaskCfg();
33 AliAnalysisTaskCfg(const char *name);
34 AliAnalysisTaskCfg(const AliAnalysisTaskCfg &other);
35 virtual ~AliAnalysisTaskCfg();
36
37 // Assignment
38 AliAnalysisTaskCfg& operator=(const AliAnalysisTaskCfg &other);
39
40 // AddTask macro handling
41 const char *GetMacroName() const {return fMacroName;}
42 const char *GetMacroArgs() const {return fMacroArgs;}
43 void SetMacroName(const char *name) {fMacroName = name;}
44 void SetMacroArgs(const char *args) {fMacroArgs = args;}
45 TMacro *OpenMacro(const char *name="");
46 void SetMacro(TMacro *macro);
47 TMacro *GetMacro() const {return fMacro;}
48 Long64_t ExecuteMacro(const char *newargs="");
49
50 // Libraries
51 const char *GetLibs() const {return fLibs;}
52 Int_t GetNlibs() const;
53 const char * GetLibrary(Int_t i) const;
54 Bool_t NeedsLibrary(const char *lib) const;
55 void SetLibraries(const char *libs) {fLibs = libs;}
56
57 // Dependencies
58 const char *GetDeps() const {return fDeps;}
59 Int_t GetNdeps() const;
60 const char * GetDependency(Int_t i) const;
61 Bool_t NeedsDependency(const char *dep) const;
62 void SetDependencies(const char *deps) {fDeps = deps;}
63
64 // Customized macro to handle dependencies
65 TMacro *OpenConfigMacro(const char *name);
66 void SetConfigMacro(TMacro *macro);
67 Long64_t ExecuteConfigMacro();
68 TMacro *GetConfigMacro() const {return fConfigDeps;}
69
70 // Supported data types
71 const char *GetDataTypes() const {return fDataTypes;}
72 Bool_t SupportsData(const char *type) const;
73 void SetDataTypes(const char *types);
74
75 // Extra utilities
76 Bool_t CheckLoadLibraries() const;
77 static const char *DecodeValue(TString &line);
78 void Print(Option_t *option="") const;
79 void SaveAs(const char *filename, Option_t *option = "") const;
80 static TObjArray *ExtractModulesFrom(const char *filename);
81
82 ClassDef(AliAnalysisTaskCfg,1) // Class describing how to run a analysis task
83};
84#endif