Standarized naming schema for cuts
[u/mrichter/AliRoot.git] / ANALYSIS / AliAODParticleCut.h
CommitLineData
a5556ea5 1#ifndef ALIAODPARTICLECUT_H
2#define ALIAODPARTICLECUT_H
3//__________________________________________________________________________
4////////////////////////////////////////////////////////////////////////////
5// //
6// class AliAODParticleCut //
7// //
8// Classes for single particle cuts //
9// User should use only AliAODParticleCut, eventually //
10// EmptyCut which passes all particles //
11// There is all interface for setting cuts on all particle properties //
12// The main method is Pass - which returns //
13// True to reject particle //
14// False in case it meets all the criteria of the given cut //
15// //
16// User should create (and also destroy) cuts himself //
17// and then pass them to the Analysis And Function by a proper method //
18// //
19// //
20// more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html //
78d7c6d3 21// responsible: Piotr Skowronski@cern.ch //
a5556ea5 22// //
23////////////////////////////////////////////////////////////////////////////
24
25
26#include <TObject.h>
afa8b37b 27#include "AliVAODParticle.h"
a5556ea5 28
29
b4fb427e 30class AliAODParticleEmptyCut;
a5556ea5 31class AliAODParticleCut;
b4fb427e 32class AliAODParticleBaseCut;
a5556ea5 33
34
35/******************************************************************/
36/******************************************************************/
37/******************************************************************/
38
39enum AliAODCutProperty
40 {
41//codes particle property
42 kAODP, //Momentum
43 kAODPt, //Transverse momentum
44 kAODE, //Energy
45 kAODRapidity, //
46 kAODPseudoRapidity,
47 kAODPx, //X coAnddinate of the momentum
48 kAODPy, //Y coAnddinate of the momentum
49 kAODPz, //Z coAnddinate of the momentum
50 kAODPhi,//angle
51 kAODTheta,//angle
52 kAODVx, // vertex X coAnddinate
53 kAODVy, // vertex Y coAnddinate
54 kAODVz, // vertex Z coAnddinate
55 kAODPid, // vertex Z coAnddinate
56//_____________________________
57 kAODNone
58 };
59
60/******************************************************************/
61/******************************************************************/
62/******************************************************************/
63
64class AliAODParticleCut: public TObject
65{
66//Class describing cut on particle
67 public:
68 AliAODParticleCut();
69 AliAODParticleCut(const AliAODParticleCut& in);
70 virtual ~AliAODParticleCut();
71 AliAODParticleCut& operator = (const AliAODParticleCut& in);
72
afa8b37b 73 virtual Bool_t Pass(AliVAODParticle* p) const;
a5556ea5 74 Bool_t IsEmpty() const {return kFALSE;}
75
b4fb427e 76 void AddBasePartCut(AliAODParticleBaseCut* basecut);
a5556ea5 77
78 Int_t GetPID() const { return fPID;}
79 void SetPID(Int_t pid){fPID=pid;}
80 void SetMomentumRange(Double_t min, Double_t max);
81 void SetPRange(Double_t min, Double_t max){SetMomentumRange(min,max);}
82 void SetPtRange(Double_t min, Double_t max);
83 void SetEnergyRange(Double_t min, Double_t max);
84 void SetRapidityRange(Double_t min, Double_t max);
85 void SetYRange(Double_t min, Double_t max){SetRapidityRange(min,max);}
86 void SetPseudoRapidityRange(Double_t min, Double_t max);
87 void SetPxRange(Double_t min, Double_t max);
88 void SetPyRange(Double_t min, Double_t max);
89 void SetPzRange(Double_t min, Double_t max);
90 void SetPhiRange(Double_t min, Double_t max);
91 void SetThetaRange(Double_t min, Double_t max);
92 void SetVxRange(Double_t min, Double_t max);
93 void SetVyRange(Double_t min, Double_t max);
94 void SetVzRange(Double_t min, Double_t max);
95
96 void Print(void) const;
97 protected:
98
b4fb427e 99 AliAODParticleBaseCut* FindCut(AliAODCutProperty property);
a5556ea5 100
b4fb427e 101 AliAODParticleBaseCut ** fCuts;//! Array with cuts
a5556ea5 102 Int_t fNCuts; //number of base cuts stored in fCuts
103
104 Int_t fPID; //particle PID - if=0 (rootino) all pids are accepted
105
106 private:
107 static const Int_t fgkMaxCuts; //Size of the fCuts array
108
109 ClassDef(AliAODParticleCut,1)
110};
111/******************************************************************/
112/******************************************************************/
113/******************************************************************/
114
b4fb427e 115class AliAODParticleEmptyCut: public AliAODParticleCut
a5556ea5 116{
117//Empty - it passes possitively all particles - it means returns always False
118//Class describing cut on particles
119 public:
b4fb427e 120 AliAODParticleEmptyCut(){};
121 virtual ~AliAODParticleEmptyCut(){};
a5556ea5 122
afa8b37b 123 Bool_t Pass(AliVAODParticle*) const {return kFALSE;} //accept everything
a5556ea5 124 Bool_t IsEmpty() const {return kTRUE;}
125
b4fb427e 126 ClassDef(AliAODParticleEmptyCut,1)
a5556ea5 127
128};
129
130/******************************************************************/
131/******************************************************************/
132/******************************************************************/
133
b4fb427e 134class AliAODParticleBaseCut: public TObject
a5556ea5 135 {
136 //This class defines the range of some property - pure virtual
137 //Property is coded by AliAODCutTypes type
138
139 public:
140
b4fb427e 141 AliAODParticleBaseCut(Double_t min = 0.0, Double_t max = 0.0,AliAODCutProperty prop = kAODNone):
a5556ea5 142 fProperty(prop),fMin(min),fMax(max){}
143
b4fb427e 144 virtual ~AliAODParticleBaseCut(){}
a5556ea5 145
afa8b37b 146 virtual Bool_t Pass(AliVAODParticle *p) const;
a5556ea5 147
148 void SetRange(Double_t min, Double_t max){fMin = min; fMax = max;}
149
150 void SetMinimum(Double_t min){fMin = min;}
151 void SetMaximum(Double_t max){fMax = max;}
152
153 Double_t GetMinimum() const {return fMin;}
154 Double_t GetMaximum() const {return fMax;}
155
156 AliAODCutProperty GetProperty() const {return fProperty;}
157 virtual void Print(void) const;
158
159 protected:
afa8b37b 160 virtual Double_t GetValue(AliVAODParticle *) const = 0;
a5556ea5 161
162 AliAODCutProperty fProperty; //property that this cut describes
163 Double_t fMin;//minimum value
164 Double_t fMax;//maximum value
165
166 private:
167 void PrintProperty(void) const;
b4fb427e 168 ClassDef(AliAODParticleBaseCut,1)
a5556ea5 169
170 };
171
172inline Bool_t
b4fb427e 173AliAODParticleBaseCut::Pass(AliVAODParticle *p) const
a5556ea5 174{
175 //cjecks if particle property fits in range
176 if ( (GetValue(p) < fMin) || (GetValue(p) > fMax ) ) return kTRUE; //rejected
177 else return kFALSE; //accepted
178}
179/******************************************************************/
180/******************************************************************/
181/******************************************************************/
182
183
b4fb427e 184class AliAODMomentumCut: public AliAODParticleBaseCut
a5556ea5 185 {
186 public:
b4fb427e 187 AliAODMomentumCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODP){}
a5556ea5 188 virtual ~AliAODMomentumCut(){}
189 protected:
afa8b37b 190 Double_t GetValue(AliVAODParticle * p)const{return p->P();}
a5556ea5 191 ClassDef(AliAODMomentumCut,1)
192 };
193
b4fb427e 194class AliAODPtCut: public AliAODParticleBaseCut
a5556ea5 195 {
196 public:
b4fb427e 197 AliAODPtCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPt){}
a5556ea5 198 virtual ~AliAODPtCut(){}
199 protected:
afa8b37b 200 Double_t GetValue(AliVAODParticle * p)const{return p->Pt();}
a5556ea5 201 ClassDef(AliAODPtCut,1)
202 };
203
204
b4fb427e 205class AliAODEnergyCut: public AliAODParticleBaseCut
a5556ea5 206 {
207 public:
b4fb427e 208 AliAODEnergyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODE){}
a5556ea5 209 virtual ~AliAODEnergyCut(){}
210 protected:
afa8b37b 211 Double_t GetValue(AliVAODParticle * p)const {return p->E();}
a5556ea5 212 ClassDef(AliAODEnergyCut,1)
213 };
214
b4fb427e 215class AliAODRapidityCut: public AliAODParticleBaseCut
a5556ea5 216 {
217 public:
b4fb427e 218 AliAODRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODRapidity){}
a5556ea5 219 virtual ~AliAODRapidityCut(){}
220 protected:
afa8b37b 221 Double_t GetValue(AliVAODParticle * p)const{return p->Y();}
a5556ea5 222 ClassDef(AliAODRapidityCut,1)
223 };
224
b4fb427e 225class AliAODPseudoRapidityCut: public AliAODParticleBaseCut
a5556ea5 226 {
227 public:
b4fb427e 228 AliAODPseudoRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPseudoRapidity){}
a5556ea5 229 virtual ~AliAODPseudoRapidityCut(){}
230 protected:
afa8b37b 231 Double_t GetValue(AliVAODParticle * p)const{return p->Eta();}
a5556ea5 232 ClassDef(AliAODPseudoRapidityCut,1)
233 };
234
b4fb427e 235class AliAODPxCut: public AliAODParticleBaseCut
a5556ea5 236 {
237 public:
b4fb427e 238 AliAODPxCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPx){}
a5556ea5 239 virtual ~AliAODPxCut(){}
240 protected:
afa8b37b 241 Double_t GetValue(AliVAODParticle * p)const{return p->Px();}
a5556ea5 242 ClassDef(AliAODPxCut,1)
243 };
244
b4fb427e 245class AliAODPyCut: public AliAODParticleBaseCut
a5556ea5 246 {
247 public:
b4fb427e 248 AliAODPyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPy){}
a5556ea5 249 virtual ~AliAODPyCut(){}
250 protected:
afa8b37b 251 Double_t GetValue(AliVAODParticle * p)const{return p->Py();}
a5556ea5 252 ClassDef(AliAODPyCut,1)
253 };
254
255
b4fb427e 256class AliAODPzCut: public AliAODParticleBaseCut
a5556ea5 257 {
258 public:
b4fb427e 259 AliAODPzCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPz){}
a5556ea5 260 virtual ~AliAODPzCut(){}
261 protected:
afa8b37b 262 Double_t GetValue(AliVAODParticle * p)const{return p->Pz();}
a5556ea5 263 ClassDef(AliAODPzCut,1)
264 };
265
b4fb427e 266class AliAODPhiCut: public AliAODParticleBaseCut
a5556ea5 267 {
268 public:
b4fb427e 269 AliAODPhiCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPhi){}
a5556ea5 270 virtual ~AliAODPhiCut(){}
271 protected:
afa8b37b 272 Double_t GetValue(AliVAODParticle * p)const{return p->Phi();}
a5556ea5 273 ClassDef(AliAODPhiCut,1)
274
275 };
276
b4fb427e 277class AliAODThetaCut: public AliAODParticleBaseCut
a5556ea5 278 {
279 public:
b4fb427e 280 AliAODThetaCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODTheta){}
a5556ea5 281 virtual ~AliAODThetaCut(){}
282 protected:
afa8b37b 283 Double_t GetValue(AliVAODParticle * p)const{return p->Theta();}
a5556ea5 284 ClassDef(AliAODThetaCut,1)
285
286 };
287
b4fb427e 288class AliAODVxCut: public AliAODParticleBaseCut
a5556ea5 289 {
290 //Cut of the X coAnddinate of the vertex position
291 public:
b4fb427e 292 AliAODVxCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVx){}
a5556ea5 293 virtual ~AliAODVxCut(){}
294 protected:
afa8b37b 295 Double_t GetValue(AliVAODParticle * p)const{return p->Vx();} //retruns value of the vertex
a5556ea5 296 ClassDef(AliAODVxCut,1)
297
298 };
299
300
b4fb427e 301class AliAODVyCut: public AliAODParticleBaseCut
a5556ea5 302 {
303 //Cut of the X coAnddinate of the vertex position
304 public:
b4fb427e 305 AliAODVyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVy){}
a5556ea5 306 virtual ~AliAODVyCut(){}
307 protected:
afa8b37b 308 Double_t GetValue(AliVAODParticle * p)const{return p->Vy();} //retruns value of the vertex
a5556ea5 309 ClassDef(AliAODVyCut,1)
310
311 };
312
b4fb427e 313class AliAODVzCut: public AliAODParticleBaseCut
a5556ea5 314 {
315 //Cut of the X coAnddinate of the vertex position
316 public:
b4fb427e 317 AliAODVzCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVz){}
a5556ea5 318 virtual ~AliAODVzCut(){}
319 protected:
afa8b37b 320 Double_t GetValue(AliVAODParticle * p)const{return p->Vz();} //retruns value of the vertex
a5556ea5 321
322 ClassDef(AliAODVzCut,1)
323
324 };
325
b4fb427e 326class AliAODPIDCut: public AliAODParticleBaseCut
a5556ea5 327 {
328 public:
b4fb427e 329 AliAODPIDCut():AliAODParticleBaseCut(0.0,0.0,kAODPid),fPID(0){}
330 AliAODPIDCut(Int_t pid, Double_t min = 0.0, Double_t max = 1.0):AliAODParticleBaseCut(min,max,kAODPid),fPID(pid){}
a5556ea5 331 virtual ~AliAODPIDCut(){}
332
333 void SetPID(Int_t pid){fPID = pid;}
334 void Print(void) const;
335 protected:
afa8b37b 336 Double_t GetValue(AliVAODParticle * p)const{return p->GetProbability(fPID);}
a5556ea5 337 Int_t fPID; //pid of particle that the pid is set
338 ClassDef(AliAODPIDCut,1)
339 };
340//___________________________________________________
341/////////////////////////////////////////////////////
342// //
343// class AliAODLogicalOperCut //
344// //
345// This cut is base class fAnd class that perfAndms //
346// logical operations on cuts //
347// //
348/////////////////////////////////////////////////////
b4fb427e 349class AliAODLogicalOperCut: public AliAODParticleBaseCut
a5556ea5 350 {
351 public:
352 AliAODLogicalOperCut();
b4fb427e 353 AliAODLogicalOperCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second);
a5556ea5 354 virtual ~AliAODLogicalOperCut();
355 protected:
afa8b37b 356 Double_t GetValue(AliVAODParticle * /*part*/) const {MayNotUse("GetValue");return 0.0;}
a5556ea5 357
b4fb427e 358 AliAODParticleBaseCut* fFirst; //second cut
359 AliAODParticleBaseCut* fSecond; //first cut
a5556ea5 360 private:
b4fb427e 361 class AliAODDummyBaseCut: public AliAODParticleBaseCut
a5556ea5 362 {
afa8b37b 363 Double_t GetValue(AliVAODParticle * /*part*/) const {return 0.0;}
364 Bool_t Pass(AliVAODParticle* /*part*/) const;
a5556ea5 365 };
366
367 ClassDef(AliAODLogicalOperCut,1)
368 };
369
370class AliAODOrCut: public AliAODLogicalOperCut
371{
372 public:
373 AliAODOrCut(){}
b4fb427e 374 AliAODOrCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):AliAODLogicalOperCut(first,second){}
a5556ea5 375 virtual ~AliAODOrCut(){}
afa8b37b 376 Bool_t Pass(AliVAODParticle *p) const;
a5556ea5 377 ClassDef(AliAODOrCut,1)
378};
379
380class AliAODAndCut: public AliAODLogicalOperCut
381{
382 public:
383 AliAODAndCut(){}
b4fb427e 384 AliAODAndCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):AliAODLogicalOperCut(first,second){}
a5556ea5 385 virtual ~AliAODAndCut(){}
afa8b37b 386 Bool_t Pass(AliVAODParticle *p) const;
a5556ea5 387 ClassDef(AliAODAndCut,1)
388};
389
390#endif