]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveMacro.h
From Pawel Debski.
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveMacro.h
1 // @(#)root/eve:$Id$
2 // Author: Matevz Tadel 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #ifndef AliEveMacro_H
11 #define AliEveMacro_H
12
13 #include <TObject.h>
14 #include <TString.h>
15
16 class TEveElement;
17
18 //______________________________________________________________________________
19 // Short description of AliEveMacro
20 //
21
22 class AliEveMacro : public TObject
23 {
24   friend class AliEveMacroEditor;
25
26 public:
27   enum DataSource_e { kNone      = 0,
28                       kRunLoader = 1,
29                       kESD       = 2,
30                       kESDfriend = 4,
31                       kRawReader = 8,
32                       kAOD       = 16 };
33
34   enum ExecStatus_e { kNotRun    = -2,
35                       kNoData    = -1,
36                       kOK        =  0,
37                       kException =  1,
38                       kError     =  2 };
39
40   AliEveMacro(Int_t src, const TString& tags, const TString& mac, const TString& foo,
41               const TString& args="", Bool_t act=kTRUE);
42   virtual ~AliEveMacro() {}
43
44   Int_t          GetSources() const         { return fSources; }
45   void           SetSources(Int_t x)        { fSources = x; }
46   const TString& GetTags() const            { return fTags; }
47   void           SetTags(const TString& x)  { fTags = x; }
48   const TString& GetMacro() const           { return fMacro; }
49   void           SetMacro(const TString& x) { fMacro = x; }
50   const TString& GetFunc() const            { return fFunc; }
51   void           SetFunc(const TString& x)  { fFunc = x; }
52   const TString& GetArgs() const            { return fArgs; }
53   void           SetArgs(const TString& x)  { fArgs = x; }
54   Bool_t         GetActive() const          { return fActive; }
55   void           SetActive(Bool_t x)        { fActive = x; }
56
57   Bool_t         RequiresRunLoader() const { return fSources & kRunLoader; }
58   Bool_t         RequiresESD()       const { return fSources & kESD;       }
59   Bool_t         RequiresESDfriend() const { return fSources & kESDfriend; }
60   Bool_t         RequiresRawReader() const { return fSources & kRawReader; }
61   Bool_t         RequiresAOD()       const { return fSources & kAOD;       }
62
63   void           ResetExecState();
64
65   void           SetExecNoData();
66   void           SetExecOK(TEveElement* result);
67   void           SetExecException(const TString& exception);
68   void           SetExecError();
69
70   ExecStatus_e   GetExecStatus()    const { return fExecStatus;    }
71   const TString& GetExecException() const { return fExecExcString; }
72   TEveElement*   GetExecResult()    const { return fExecResult;    }
73
74   Bool_t         WasExecTried()     const { return fExecStatus >= kOK; }
75   Bool_t         WasExecOK()        const { return fExecStatus == kOK; }
76
77   TString        FormForExec() const;
78   TString        FormForDisplay() const;
79
80 protected:
81   Int_t   fSources; // Source of data, bitwise or of DataSource_e entries.
82   TString fTags;    // Tags describing the macro (for selection).
83   TString fMacro;   // Macro where func is defined; if null, assume it is there.
84   TString fFunc;    // Function to call.
85   TString fArgs;    // Arguments for the function.
86   Bool_t  fActive;  // Flag if macro is active.
87
88   ExecStatus_e  fExecStatus;
89   TString       fExecExcString;
90   TEveElement  *fExecResult;
91
92 private:
93   AliEveMacro(const AliEveMacro&);            // Not implemented
94   AliEveMacro& operator=(const AliEveMacro&); // Not implemented
95
96   ClassDef(AliEveMacro, 0); // Encapsulation of data reqired for execution of a CINT macro and the result of its last execution.
97 };
98
99 #endif