added missing files
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnExpression.h
CommitLineData
baca856a 1#ifndef ALIRSNEXPRESSION_H
2#define ALIRSNEXPRESSION_H
3
4#include <TObject.h>
5#include <TString.h>
6
7#include "AliRsnCutSet.h"
8
9class TObjArray;
10class AliRsnCutSet;
11/**
12 @author Martin Vala <Martin.Vala@cern.ch>
13 */
14
15// These are the valid operators types.
16
17enum { kOpAND=1, // AND '&'
18 kOpOR, // OR '|'
19 kOpNOT
20 }; // Unary negation '!'
21
22class AliRsnExpression : public TObject
23{
24
25 public:
26 AliRsnExpression() : fVname ( 0 ), fArg1 ( 0 ), fArg2 ( 0 ), fOperator ( 0 ) {}
27 AliRsnExpression ( TString exp );
28 virtual ~AliRsnExpression();
29 AliRsnExpression ( const AliRsnExpression& exp );
30 AliRsnExpression& operator= ( const AliRsnExpression& exp );
31
32 virtual Bool_t Value ( TObjArray & vars );
33 virtual TString Unparse() const;
34
35 void SetCutSet ( AliRsnCutSet* theValue ) { sCutSet = theValue; }
36 AliRsnCutSet* GetCutSet() const { return sCutSet; }
37
38
39 TString fVname; // Variable name
40 static AliRsnCutSet *sCutSet;
41
42 private:
43 AliRsnExpression* fArg1; // left argument
44 AliRsnExpression* fArg2; // right argument
45 Int_t fOperator; // operator
46
47 AliRsnExpression ( int op, AliRsnExpression* a );
48 AliRsnExpression ( int op, AliRsnExpression* a, AliRsnExpression* b );
49
50 TObjArray* Tokenize ( TString str ) const;
51 static AliRsnExpression* Element ( TObjArray &st, Int_t &i );
52 static AliRsnExpression* Primary ( TObjArray &st, Int_t &i );
53 static AliRsnExpression* Expression ( TObjArray &st, Int_t &i );
54
55 ClassDef ( AliRsnExpression, 1 ); // Class to evaluate an expression
56};
57
58
59///////////////////////////////////////////////////////////////////////////
60
61class AliRsnVariableExpression: public AliRsnExpression
62{
63 public:
64 AliRsnVariableExpression ( TString a) : AliRsnExpression() { fVname = a; };
65 ~AliRsnVariableExpression() {}
66 virtual Bool_t Value ( TObjArray& pgm );
67 virtual TString Unparse() const { return fVname; }
68
69 ClassDef ( AliRsnVariableExpression, 1 ); // Class to define a variable expression
70};
71
72#endif