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