]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnExpression.h
Updated treatment of TOF PID in QA task (Francesco+Pietro)
[u/mrichter/AliRoot.git] / PWGLF / 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 public:
22
23    // operators for complex cut expressions
24    enum ECutOp {
25       kOpAND = 1, // AND '&'
26       kOpOR,      // OR '|'
27       kOpNOT      // Unary negation '!'
28    };
29
30    AliRsnExpression() : fVname(0), fArg1(0), fArg2(0), fOperator(0)  {}
31    AliRsnExpression(TString exp);
32    virtual    ~AliRsnExpression();
33    AliRsnExpression(const AliRsnExpression &exp);
34    AliRsnExpression    &operator= (const AliRsnExpression &exp);
35
36    virtual Bool_t     Value(TObjArray &vars);
37    virtual TString     Unparse() const;
38
39    void SetCutSet(AliRsnCutSet *const theValue) { fgCutSet = theValue; }
40    AliRsnCutSet *GetCutSet() const { return fgCutSet; }
41
42
43    TString                     fVname;   // Variable name
44    static AliRsnCutSet        *fgCutSet; // global cutset
45
46 private:
47    AliRsnExpression           *fArg1;         // left argument
48    AliRsnExpression           *fArg2;         // right argument
49    Int_t                       fOperator;     // operator
50
51    AliRsnExpression(int op, AliRsnExpression *a);
52    AliRsnExpression(int op, AliRsnExpression *a, AliRsnExpression *b);
53
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);
58
59    ClassDef(AliRsnExpression, 1);    // Class to evaluate an expression
60 };
61
62 #endif