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