Modifications to package - new classes added
[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
baca856a 17class AliRsnExpression : public TObject
18{
19
20 public:
e2bafbbc 21
22 // operators for complex cut expressions
23 enum ECutOp
24 {
25 kOpAND=1, // AND '&'
26 kOpOR, // OR '|'
27 kOpNOT // Unary negation '!'
28 };
29
baca856a 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* theValue ) { sCutSet = theValue; }
40 AliRsnCutSet* GetCutSet() const { return sCutSet; }
41
42
43 TString fVname; // Variable name
44 static AliRsnCutSet *sCutSet;
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
63///////////////////////////////////////////////////////////////////////////
64
65class AliRsnVariableExpression: public AliRsnExpression
66{
67 public:
68 AliRsnVariableExpression ( TString a) : AliRsnExpression() { fVname = a; };
69 ~AliRsnVariableExpression() {}
70 virtual Bool_t Value ( TObjArray& pgm );
71 virtual TString Unparse() const { return fVname; }
72
73 ClassDef ( AliRsnVariableExpression, 1 ); // Class to define a variable expression
74};
75
76#endif