reverting to prev.
[u/mrichter/AliRoot.git] / HBTAN / AliHBTParticleCut.h
CommitLineData
c0956fc6 1#ifndef ALIHBTPARTICLECUT_H
2#define ALIHBTPARTICLECUT_H
87fcb86d 3//__________________________________________________________________________
4////////////////////////////////////////////////////////////////////////////
5// //
6// class AliHBTParticleCut //
7// //
8// Classes for single particle cuts //
9// User should use only AliHBTParticleCut, 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 //
21// resonsible: Piotr Skowronski@cern.ch //
22// //
23////////////////////////////////////////////////////////////////////////////
1b446896 24
25
1b446896 26#include <TObject.h>
27#include "AliHBTParticle.h"
28
29
30class AliHBTEmptyParticleCut;
31class AliHBTParticleCut;
32class AliHBTPairCut;
33class AliHBTPair;
34class AliHbtBaseCut;
35
36
37/******************************************************************/
38/******************************************************************/
39/******************************************************************/
40
41enum AliHBTCutProperty
42 {
43//codes particle property
44 kHbtP, //Momentum
45 kHbtPt, //Transverse momentum
46 kHbtE, //Energy
47 kHbtRapidity, //
48 kHbtPseudoRapidity,
4617f71a 49 kHbtPx, //X coAnddinate of the momentum
50 kHbtPy, //Y coAnddinate of the momentum
51 kHbtPz, //Z coAnddinate of the momentum
1b446896 52 kHbtPhi,//angle
53 kHbtTheta,//angle
4617f71a 54 kHbtVx, // vertex X coAnddinate
55 kHbtVy, // vertex Y coAnddinate
56 kHbtVz, // vertex Z coAnddinate
57 kHbtPid, // vertex Z coAnddinate
1b446896 58//_____________________________
4617f71a 59 kHbtNone
1b446896 60 };
61
62/******************************************************************/
63/******************************************************************/
64/******************************************************************/
65
66class AliHBTParticleCut: public TObject
67{
68//Class describing cut on pairs of particles
69 public:
70 AliHBTParticleCut();
87fcb86d 71 AliHBTParticleCut(const AliHBTParticleCut& in);
1b446896 72 virtual ~AliHBTParticleCut();
c0956fc6 73 AliHBTParticleCut& operator = (const AliHBTParticleCut& in);
87fcb86d 74
c0956fc6 75 virtual Bool_t Pass(AliHBTParticle* p) const;
87fcb86d 76 Bool_t IsEmpty() const {return kFALSE;}
1b446896 77
87fcb86d 78 void AddBasePartCut(AliHbtBaseCut* basecut);
1b446896 79
80 Int_t GetPID() const { return fPID;}
81 void SetPID(Int_t pid){fPID=pid;}
82 void SetMomentumRange(Double_t min, Double_t max);
83 void SetPRange(Double_t min, Double_t max){SetMomentumRange(min,max);}
84 void SetPtRange(Double_t min, Double_t max);
85 void SetEnergyRange(Double_t min, Double_t max);
86 void SetRapidityRange(Double_t min, Double_t max);
87 void SetYRange(Double_t min, Double_t max){SetRapidityRange(min,max);}
88 void SetPseudoRapidityRange(Double_t min, Double_t max);
89 void SetPxRange(Double_t min, Double_t max);
90 void SetPyRange(Double_t min, Double_t max);
91 void SetPzRange(Double_t min, Double_t max);
92 void SetPhiRange(Double_t min, Double_t max);
93 void SetThetaRange(Double_t min, Double_t max);
94 void SetVxRange(Double_t min, Double_t max);
95 void SetVyRange(Double_t min, Double_t max);
96 void SetVzRange(Double_t min, Double_t max);
97
87fcb86d 98 void Print(void) const;
1b446896 99 protected:
100
87fcb86d 101 AliHbtBaseCut* FindCut(AliHBTCutProperty property);
1b446896 102
87fcb86d 103 AliHbtBaseCut ** fCuts;//! Array with cuts
104 Int_t fNCuts; //number of base cuts stored in fCuts
105
106 Int_t fPID; //particle PID - if=0 (rootino) all pids are accepted
1b446896 107
108 private:
87fcb86d 109 static const Int_t fgkMaxCuts; //Size of the fCuts array
110
1b446896 111 ClassDef(AliHBTParticleCut,1)
1b446896 112};
113/******************************************************************/
114/******************************************************************/
115/******************************************************************/
116
117class AliHBTEmptyParticleCut: public AliHBTParticleCut
118{
119//Empty - it passes possitively all particles - it means returns always False
120//Class describing cut on pairs of particles
121 public:
122 AliHBTEmptyParticleCut(){};
123 virtual ~AliHBTEmptyParticleCut(){};
124
c0956fc6 125 Bool_t Pass(AliHBTParticle*) const {return kFALSE;} //accept everything <<CAN NOT BE const!!!!>>
87fcb86d 126 Bool_t IsEmpty() const {return kTRUE;}
1b446896 127
128 ClassDef(AliHBTEmptyParticleCut,1)
129
130};
131
132/******************************************************************/
133/******************************************************************/
134/******************************************************************/
135
136class AliHbtBaseCut: public TObject
137 {
138 //This class defines the range of some property - pure virtual
139 //Property is coded by AliHBTCutTypes type
140
141 public:
142
143 AliHbtBaseCut(Double_t min = 0.0, Double_t max = 0.0,AliHBTCutProperty prop = kHbtNone):
144 fProperty(prop),fMin(min),fMax(max){}
145
4617f71a 146 virtual ~AliHbtBaseCut(){}
1b446896 147
c0956fc6 148 virtual Bool_t Pass(AliHBTParticle *p) const;
1b446896 149
4617f71a 150 void SetRange(Double_t min, Double_t max){fMin = min; fMax = max;}
1b446896 151
4617f71a 152 void SetMinimum(Double_t min){fMin = min;}
153 void SetMaximum(Double_t max){fMax = max;}
1b446896 154
4617f71a 155 Double_t GetMinimum() const {return fMin;}
156 Double_t GetMaximum() const {return fMax;}
1b446896 157
158 AliHBTCutProperty GetProperty() const {return fProperty;}
87fcb86d 159 virtual void Print(void) const;
4617f71a 160
1b446896 161 protected:
87fcb86d 162 virtual Double_t GetValue(AliHBTParticle *) const = 0;
1b446896 163
87fcb86d 164 AliHBTCutProperty fProperty; //property that this cut describes
165 Double_t fMin;//minimum value
166 Double_t fMax;//maximum value
4617f71a 167
1b446896 168 private:
87fcb86d 169 void PrintProperty(void) const;
1b446896 170 ClassDef(AliHbtBaseCut,1)
171
172 };
173
174inline Bool_t
c0956fc6 175AliHbtBaseCut::Pass(AliHBTParticle *p) const
87fcb86d 176{
177 //cjecks if particle property fits in range
178 if ( (GetValue(p) < fMin) || (GetValue(p) > fMax ) ) return kTRUE; //rejected
179 else return kFALSE; //accepted
180}
1b446896 181/******************************************************************/
182/******************************************************************/
183/******************************************************************/
184
185
186class AliHBTMomentumCut: public AliHbtBaseCut
187 {
188 public:
189 AliHBTMomentumCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtP){}
190 virtual ~AliHBTMomentumCut(){}
191 protected:
87fcb86d 192 Double_t GetValue(AliHBTParticle * p)const{return p->P();}
1b446896 193 ClassDef(AliHBTMomentumCut,1)
1b446896 194 };
195
1b446896 196class AliHBTPtCut: public AliHbtBaseCut
197 {
198 public:
199 AliHBTPtCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtPt){}
200 virtual ~AliHBTPtCut(){}
201 protected:
87fcb86d 202 Double_t GetValue(AliHBTParticle * p)const{return p->Pt();}
1b446896 203 ClassDef(AliHBTPtCut,1)
1b446896 204 };
205
206
207class AliHBTEnergyCut: public AliHbtBaseCut
208 {
209 public:
210 AliHBTEnergyCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtE){}
211 virtual ~AliHBTEnergyCut(){}
212 protected:
c0956fc6 213 Double_t GetValue(AliHBTParticle * p)const {return p->Energy();}
1b446896 214 ClassDef(AliHBTEnergyCut,1)
1b446896 215 };
216
217class AliHBTRapidityCut: public AliHbtBaseCut
218 {
219 public:
220 AliHBTRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtRapidity){}
221 virtual ~AliHBTRapidityCut(){}
222 protected:
87fcb86d 223 Double_t GetValue(AliHBTParticle * p)const{return p->Y();}
1b446896 224 ClassDef(AliHBTRapidityCut,1)
1b446896 225 };
226
227class AliHBTPseudoRapidityCut: public AliHbtBaseCut
228 {
229 public:
230 AliHBTPseudoRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtPseudoRapidity){}
231 virtual ~AliHBTPseudoRapidityCut(){}
232 protected:
87fcb86d 233 Double_t GetValue(AliHBTParticle * p)const{return p->Eta();}
1b446896 234 ClassDef(AliHBTPseudoRapidityCut,1)
1b446896 235 };
236
237class AliHBTPxCut: public AliHbtBaseCut
238 {
239 public:
240 AliHBTPxCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtPx){}
241 virtual ~AliHBTPxCut(){}
242 protected:
87fcb86d 243 Double_t GetValue(AliHBTParticle * p)const{return p->Px();}
1b446896 244 ClassDef(AliHBTPxCut,1)
1b446896 245 };
246
247class AliHBTPyCut: public AliHbtBaseCut
248 {
249 public:
250 AliHBTPyCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtPy){}
251 virtual ~AliHBTPyCut(){}
252 protected:
87fcb86d 253 Double_t GetValue(AliHBTParticle * p)const{return p->Py();}
1b446896 254 ClassDef(AliHBTPyCut,1)
1b446896 255 };
256
257
258class AliHBTPzCut: public AliHbtBaseCut
259 {
260 public:
261 AliHBTPzCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtPz){}
262 virtual ~AliHBTPzCut(){}
263 protected:
87fcb86d 264 Double_t GetValue(AliHBTParticle * p)const{return p->Pz();}
1b446896 265 ClassDef(AliHBTPzCut,1)
1b446896 266 };
267
268class AliHBTPhiCut: public AliHbtBaseCut
269 {
270 public:
271 AliHBTPhiCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtPhi){}
272 virtual ~AliHBTPhiCut(){}
273 protected:
87fcb86d 274 Double_t GetValue(AliHBTParticle * p)const{return p->Phi();}
1b446896 275 ClassDef(AliHBTPhiCut,1)
276
277 };
278
279class AliHBTThetaCut: public AliHbtBaseCut
280 {
281 public:
282 AliHBTThetaCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtTheta){}
283 virtual ~AliHBTThetaCut(){}
284 protected:
87fcb86d 285 Double_t GetValue(AliHBTParticle * p)const{return p->Theta();}
1b446896 286 ClassDef(AliHBTThetaCut,1)
287
288 };
289
290class AliHBTVxCut: public AliHbtBaseCut
291 {
4617f71a 292 //Cut of the X coAnddinate of the vertex position
1b446896 293 public:
294 AliHBTVxCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtVx){}
295 virtual ~AliHBTVxCut(){}
296 protected:
87fcb86d 297 Double_t GetValue(AliHBTParticle * p)const{return p->Vx();} //retruns value of the vertex
1b446896 298 ClassDef(AliHBTVxCut,1)
299
300 };
301
302
303class AliHBTVyCut: public AliHbtBaseCut
304 {
4617f71a 305 //Cut of the X coAnddinate of the vertex position
1b446896 306 public:
307 AliHBTVyCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtVy){}
308 virtual ~AliHBTVyCut(){}
309 protected:
87fcb86d 310 Double_t GetValue(AliHBTParticle * p)const{return p->Vy();} //retruns value of the vertex
1b446896 311 ClassDef(AliHBTVyCut,1)
312
313 };
314
315class AliHBTVzCut: public AliHbtBaseCut
316 {
4617f71a 317 //Cut of the X coAnddinate of the vertex position
1b446896 318 public:
319 AliHBTVzCut(Double_t min = 0.0, Double_t max = 0.0):AliHbtBaseCut(min,max,kHbtVz){}
320 virtual ~AliHBTVzCut(){}
321 protected:
87fcb86d 322 Double_t GetValue(AliHBTParticle * p)const{return p->Vz();} //retruns value of the vertex
4617f71a 323
1b446896 324 ClassDef(AliHBTVzCut,1)
325
326 };
327
4617f71a 328class AliHBTPIDCut: public AliHbtBaseCut
329 {
330 public:
641c8b86 331 AliHBTPIDCut():AliHbtBaseCut(0.0,0.0,kHbtPid),fPID(0){}
4617f71a 332 AliHBTPIDCut(Int_t pid, Double_t min = 0.0, Double_t max = 1.0):AliHbtBaseCut(min,max,kHbtPid),fPID(pid){}
333 virtual ~AliHBTPIDCut(){}
334 protected:
87fcb86d 335 Double_t GetValue(AliHBTParticle * p)const{return p->GetPIDprobability(fPID);}
4617f71a 336 Int_t fPID; //pid of particle that the pid is set
337 ClassDef(AliHBTPIDCut,1)
338 };
339//___________________________________________________
340/////////////////////////////////////////////////////
341// //
342// class AliHBTLogicalOperCut //
343// //
344// This cut is base class fAnd class that perfAndms //
345// logical operations on cuts //
346// //
347/////////////////////////////////////////////////////
348class AliHBTLogicalOperCut: public AliHbtBaseCut
349 {
350 public:
351 AliHBTLogicalOperCut();
352 AliHBTLogicalOperCut(AliHbtBaseCut* first, AliHbtBaseCut* second);
353 virtual ~AliHBTLogicalOperCut();
354 protected:
87fcb86d 355 Double_t GetValue(AliHBTParticle * /*part*/) const {MayNotUse("GetValue");return 0.0;}
4617f71a 356
357 AliHbtBaseCut* fFirst; //second cut
358 AliHbtBaseCut* fSecond; //first cut
359 private:
360 class AliHBTDummyBaseCut: public AliHbtBaseCut
361 {
87fcb86d 362 Double_t GetValue(AliHBTParticle * /*part*/) const {return 0.0;}
c0956fc6 363 Bool_t Pass(AliHBTParticle* /*part*/) const;
4617f71a 364 };
365
366 ClassDef(AliHBTLogicalOperCut,1)
367 };
1b446896 368
4617f71a 369class AliHBTOrCut: public AliHBTLogicalOperCut
370{
371 public:
372 AliHBTOrCut(){}
373 AliHBTOrCut(AliHbtBaseCut* first, AliHbtBaseCut* second):AliHBTLogicalOperCut(first,second){}
374 virtual ~AliHBTOrCut(){}
c0956fc6 375 Bool_t Pass(AliHBTParticle *p) const;
4617f71a 376 ClassDef(AliHBTOrCut,1)
377};
1b446896 378
4617f71a 379class AliHBTAndCut: public AliHBTLogicalOperCut
380{
381 public:
382 AliHBTAndCut(){}
383 AliHBTAndCut(AliHbtBaseCut* first, AliHbtBaseCut* second):AliHBTLogicalOperCut(first,second){}
384 virtual ~AliHBTAndCut(){}
c0956fc6 385 Bool_t Pass(AliHBTParticle *p) const;
4617f71a 386 ClassDef(AliHBTAndCut,1)
387};
1b446896 388
389#endif