Base Particle Cuts moved to the separate file. Property eneum defined namespace of...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAODParticleBaseCut.h
1 #ifndef ALIAODPARTICLEBASECUT_H
2 #define ALIAODPARTICLEBASECUT_H
3
4 #include <TObject.h>
5 #include "AliVAODParticle.h"
6
7
8 class AliAODParticleBaseCut: public TObject
9  {
10    //This class defines the range of some property - pure virtual
11    //Property is coded by AliAODCutTypes type
12    
13    public:
14
15      enum EAODCutProperty
16       {
17      //codes of particle properties
18        kAODP,  //Momentum
19        kAODPt, //Transverse momentum
20        kAODE,  //Energy
21        kAODRapidity, //
22        kAODPseudoRapidity,
23        kAODPx, //X coAnddinate of the momentum
24        kAODPy, //Y coAnddinate of the momentum
25        kAODPz, //Z coAnddinate of the momentum
26        kAODPhi,//angle
27        kAODTheta,//angle
28        kAODVx,  // vertex X coAnddinate
29        kAODVy,  // vertex Y coAnddinate
30        kAODVz,  // vertex Z coAnddinate
31        kAODPid, // vertex Z coAnddinate
32      //_____________________________
33        kAODNone
34       };
35
36      
37      AliAODParticleBaseCut(Double_t min = 0.0, Double_t max = 0.0,EAODCutProperty prop = kAODNone):
38                    fProperty(prop),fMin(min),fMax(max){}
39
40      virtual           ~AliAODParticleBaseCut(){}
41      
42      virtual Bool_t    Rejected(AliVAODParticle *p) const;
43      
44      void              SetRange(Double_t min, Double_t max){fMin = min; fMax = max;}
45
46      void              SetMinimum(Double_t min){fMin = min;}
47      void              SetMaximum(Double_t max){fMax = max;}
48      
49      Double_t          GetMinimum() const {return fMin;}
50      Double_t          GetMaximum() const {return fMax;}
51      
52      EAODCutProperty   GetProperty() const {return fProperty;}
53      virtual void Print(void) const;
54      
55    protected:
56      virtual Double_t  GetValue(AliVAODParticle *) const = 0;
57
58      EAODCutProperty fProperty; //property that this cut describes
59      Double_t fMin;//minimum value
60      Double_t fMax;//maximum value
61      
62    private:
63      void PrintProperty(void) const;
64      ClassDef(AliAODParticleBaseCut,1)
65    
66  };
67
68 inline Bool_t
69 AliAODParticleBaseCut::Rejected(AliVAODParticle *p) const
70 {
71   //cjecks if particle property fits in range
72   if ( (GetValue(p) < fMin) || (GetValue(p) > fMax ) ) return kTRUE; //rejected
73   else return kFALSE; //accepted
74 }
75 /******************************************************************/
76 /******************************************************************/
77 /******************************************************************/
78
79  
80 class AliAODMomentumCut: public AliAODParticleBaseCut
81  {
82   public: 
83     AliAODMomentumCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODP){}
84     virtual ~AliAODMomentumCut(){}
85   protected:
86     Double_t  GetValue(AliVAODParticle * p)const{return p->P();}
87     ClassDef(AliAODMomentumCut,1)
88  };
89
90 class AliAODPtCut: public AliAODParticleBaseCut
91  {
92   public: 
93     AliAODPtCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPt){}
94     virtual ~AliAODPtCut(){}
95   protected:
96     Double_t  GetValue(AliVAODParticle * p)const{return p->Pt();}
97     ClassDef(AliAODPtCut,1)
98  };
99
100
101 class AliAODEnergyCut: public AliAODParticleBaseCut
102  {
103   public: 
104     AliAODEnergyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODE){}
105     virtual ~AliAODEnergyCut(){}
106   protected:
107     Double_t  GetValue(AliVAODParticle * p)const {return p->E();}
108     ClassDef(AliAODEnergyCut,1)
109  };
110
111 class AliAODRapidityCut: public AliAODParticleBaseCut
112  {
113   public: 
114     AliAODRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODRapidity){}
115     virtual ~AliAODRapidityCut(){}
116   protected:
117     Double_t  GetValue(AliVAODParticle * p)const{return p->Y();}
118     ClassDef(AliAODRapidityCut,1)
119  };
120
121 class AliAODPseudoRapidityCut: public AliAODParticleBaseCut
122  {
123   public: 
124     AliAODPseudoRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPseudoRapidity){}
125     virtual ~AliAODPseudoRapidityCut(){}
126   protected:
127     Double_t  GetValue(AliVAODParticle * p)const{return p->Eta();}
128     ClassDef(AliAODPseudoRapidityCut,1)
129  };
130
131 class AliAODPxCut: public AliAODParticleBaseCut
132  {
133   public: 
134     AliAODPxCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPx){}
135     virtual ~AliAODPxCut(){}
136   protected:
137     Double_t  GetValue(AliVAODParticle * p)const{return p->Px();}
138     ClassDef(AliAODPxCut,1)
139  };
140
141 class AliAODPyCut: public AliAODParticleBaseCut
142  {
143   public: 
144     AliAODPyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPy){}
145     virtual ~AliAODPyCut(){}
146   protected:
147     Double_t  GetValue(AliVAODParticle * p)const{return p->Py();}
148     ClassDef(AliAODPyCut,1)
149  };
150
151
152 class AliAODPzCut: public AliAODParticleBaseCut
153  {
154   public: 
155     AliAODPzCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPz){}
156     virtual ~AliAODPzCut(){}
157   protected:
158     Double_t  GetValue(AliVAODParticle * p)const{return p->Pz();}
159     ClassDef(AliAODPzCut,1)
160  };
161
162 class AliAODPhiCut: public AliAODParticleBaseCut
163  {
164   public: 
165     AliAODPhiCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPhi){}
166     virtual ~AliAODPhiCut(){}
167   protected:
168     Double_t  GetValue(AliVAODParticle * p)const{return p->Phi();}
169     ClassDef(AliAODPhiCut,1)
170   
171  };
172
173 class AliAODThetaCut: public AliAODParticleBaseCut
174  {
175   public: 
176     AliAODThetaCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODTheta){}
177     virtual ~AliAODThetaCut(){}
178   protected:
179     Double_t  GetValue(AliVAODParticle * p)const{return p->Theta();}
180     ClassDef(AliAODThetaCut,1)
181   
182  };
183
184 class AliAODVxCut: public AliAODParticleBaseCut
185  {
186  //Cut of the X coAnddinate of the vertex position
187   public: 
188     AliAODVxCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVx){}
189     virtual ~AliAODVxCut(){}
190   protected:
191     Double_t  GetValue(AliVAODParticle * p)const{return p->Vx();} //retruns value of the vertex
192     ClassDef(AliAODVxCut,1)
193   
194  };
195
196
197 class AliAODVyCut: public AliAODParticleBaseCut
198  {
199  //Cut of the X coAnddinate of the vertex position
200   public: 
201     AliAODVyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVy){}
202     virtual ~AliAODVyCut(){}
203   protected:
204     Double_t  GetValue(AliVAODParticle * p)const{return p->Vy();} //retruns value of the vertex
205     ClassDef(AliAODVyCut,1)
206   
207  };
208
209 class AliAODVzCut: public AliAODParticleBaseCut
210  {
211  //Cut of the X coAnddinate of the vertex position
212   public: 
213     AliAODVzCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVz){}
214     virtual ~AliAODVzCut(){}
215   protected:
216     Double_t  GetValue(AliVAODParticle * p)const{return p->Vz();} //retruns value of the vertex
217     
218     ClassDef(AliAODVzCut,1)
219   
220  };
221
222 class AliAODPIDCut:  public AliAODParticleBaseCut
223  {
224    public:
225      AliAODPIDCut():AliAODParticleBaseCut(0.0,0.0,kAODPid),fPID(0){}
226      AliAODPIDCut(Int_t pid, Double_t min = 0.0, Double_t max = 1.0):AliAODParticleBaseCut(min,max,kAODPid),fPID(pid){}
227      virtual ~AliAODPIDCut(){}
228      
229      void SetPID(Int_t pid){fPID = pid;}
230      void Print(void) const;
231    protected:
232      Double_t  GetValue(AliVAODParticle * p)const{return p->GetProbability(fPID);}
233      Int_t     fPID; //pid of particle that the pid is set 
234      ClassDef(AliAODPIDCut,1)
235  };
236 //___________________________________________________
237 /////////////////////////////////////////////////////
238 //                                                 //
239 // class AliAODLogicalOperCut                      //
240 //                                                 //
241 // This cut is base class fAnd class that perfAndms  //
242 // logical operations on cuts                      //
243 //                                                 //
244 /////////////////////////////////////////////////////
245 class AliAODLogicalOperCut:  public AliAODParticleBaseCut
246  {
247    public:
248      AliAODLogicalOperCut();
249      AliAODLogicalOperCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second);
250      virtual   ~AliAODLogicalOperCut();
251    protected:
252      Double_t  GetValue(AliVAODParticle * /*part*/) const {MayNotUse("GetValue");return 0.0;}
253      
254      AliAODParticleBaseCut* fFirst;   //second cut
255      AliAODParticleBaseCut* fSecond;  //first cut
256    private:  
257     class  AliAODDummyBaseCut: public AliAODParticleBaseCut 
258      {
259        Double_t  GetValue(AliVAODParticle * /*part*/) const {return 0.0;}
260        Bool_t    Rejected(AliVAODParticle* /*part*/) const;
261      };
262      
263     ClassDef(AliAODLogicalOperCut,1)
264  };
265
266 class AliAODOrCut: public AliAODLogicalOperCut
267 {
268    public:
269      AliAODOrCut(){}
270      AliAODOrCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):AliAODLogicalOperCut(first,second){}
271      virtual   ~AliAODOrCut(){}
272      Bool_t    Rejected(AliVAODParticle *p) const;
273      ClassDef(AliAODOrCut,1)
274 };
275
276 class AliAODAndCut: public AliAODLogicalOperCut
277 {
278    public:
279      AliAODAndCut(){}
280      AliAODAndCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):AliAODLogicalOperCut(first,second){}
281      virtual   ~AliAODAndCut(){}
282      Bool_t    Rejected(AliVAODParticle *p) const;
283      ClassDef(AliAODAndCut,1)
284 };
285
286 #endif