]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnExpression.h
Macro to add the energy distribution task to the train
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnExpression.h
1 //
2 // AliRsnExpresion class is used to
3 // handle operators &|!
4 // in AliRsnCut
5 //
6 // authors: Martin Vala (martin.vala@cern.ch)
7 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
8 //
9
10 #ifndef ALIRSNEXPRESSION_H
11 #define ALIRSNEXPRESSION_H
12
13 #include <TObject.h>
14
15 class TObjArray;
16 #include "AliRsnCutSet.h"
17 class AliRsnVariableExpression;
18
19 class AliRsnExpression : public TObject
20 {
21
22   public:
23
24     // operators for complex cut expressions
25     enum ECutOp {
26       kOpAND=1,   // AND '&'
27       kOpOR,      // OR '|'
28       kOpNOT      // Unary negation '!'
29     };
30
31     AliRsnExpression() : fVname(0), fArg1(0), fArg2(0), fOperator(0)  {}
32     AliRsnExpression(TString exp);
33     virtual    ~AliRsnExpression();
34     AliRsnExpression(const AliRsnExpression& exp);
35     AliRsnExpression&    operator= (const AliRsnExpression& exp);
36
37     virtual Bool_t     Value(TObjArray & vars);
38     virtual TString     Unparse() const;
39
40     void SetCutSet(AliRsnCutSet* const theValue) { fgCutSet = theValue; }
41     AliRsnCutSet* GetCutSet() const { return fgCutSet; }
42
43
44     TString                     fVname;   // Variable name
45     static AliRsnCutSet        *fgCutSet; // global cutset
46
47   private:
48     AliRsnExpression*           fArg1;         // left argument
49     AliRsnExpression*           fArg2;         // right argument
50     Int_t                       fOperator;     // operator
51
52     AliRsnExpression(int op, AliRsnExpression* a);
53     AliRsnExpression(int op, AliRsnExpression* a, AliRsnExpression* b);
54
55     TObjArray*    Tokenize(TString str) const;
56     static AliRsnExpression*    Element(TObjArray &st, Int_t &i);
57     static AliRsnExpression*    Primary(TObjArray &st, Int_t &i);
58     static AliRsnExpression*    Expression(TObjArray &st, Int_t &i);
59
60     ClassDef(AliRsnExpression, 1);    // Class to evaluate an expression
61 };
62
63 #endif