Including stdlib.h (HP)
[u/mrichter/AliRoot.git] / HBTAN / AliHBTFunction.h
CommitLineData
1b446896 1//Piotr Skowronski@cern.ch
2
3#ifndef ALIHBTFUNCTION_H
4#define ALIHBTFUNCTION_H
5
6#include "AliHBTParticleCut.h"
7#include "AliHBTPairCut.h"
8#include "AliHBTPair.h"
9
10#include <TH2.h>
11#include <TH3.h>
12
1b446896 13class AliHBTAnalysis;
14
26f1270c 15//____________________
16///////////////////////////////////////////////////////
17// //
18// AliHBTFunction //
19// //
20// Abstract Base Calss for all the function classes //
21// //
22// Piotr.Skowronski@cern.ch //
23// http://alisoft.cern.ch/people/skowron/analyzer //
24// //
25///////////////////////////////////////////////////////
26
1b446896 27class AliHBTFunction: public TNamed
1b446896 28{
29 public:
30 AliHBTFunction();
ba95ae3f 31 AliHBTFunction(const char* name,const char* title);
856180e9 32 virtual ~AliHBTFunction();
1b446896 33
26f1270c 34 virtual TH1* GetNumerator() const = 0;
35 virtual TH1* GetDenominator() const = 0;
1b446896 36 virtual TH1* GetResult() = 0;
976183fd 37
1b446896 38 virtual void Write();
26f1270c 39 virtual void Init();
1b446896 40
41 TH1* GetRatio(Double_t normfactor = 1.0);
42 void Rename(const Char_t * name); //renames the function and histograms ==title is the same that name
43 void Rename(const Char_t * name, const Char_t * title); //renames and retitle the function and histograms
44
45 void SetPairCut(AliHBTPairCut*);
46
47 virtual AliHBTPair* CheckPair(AliHBTPair* pair);
48
49 protected:
26f1270c 50 virtual void BuildHistos() = 0;//builds default histograms
1b446896 51 AliHBTPairCut* fPairCut;
52
53 public:
26f1270c 54 ClassDef(AliHBTFunction,2)
1b446896 55};
976183fd 56/******************************************************************/
1b446896 57inline AliHBTPair* AliHBTFunction::CheckPair(AliHBTPair* pair)
58{
59 //check if pair and both particles meets the cut criteria
60 if(fPairCut->Pass(pair)) //if the pair is BAD
61 {//it is BAD
62 pair = pair->GetSwapedPair();
89bacf42 63 if(pair)
64 if(fPairCut->Pass(pair)) //so try reverse combination
65 {
66 return 0x0;//it is BAD as well - so return
67 }
1b446896 68 }
69 return pair;
70}
71
1b446896 72/******************************************************************/
73/******************************************************************/
74/******************************************************************/
26f1270c 75
76//____________________
77///////////////////////////////////////////////////////
78// //
79// AliHBTOnePairFctn //
80// //
81// Abstract Base Calss for Functions that need //
82// one pair to fill function //
83// //
84// Piotr.Skowronski@cern.ch //
85// http://alisoft.cern.ch/people/skowron/analyzer //
86// //
87///////////////////////////////////////////////////////
88
89class AliHBTOnePairFctn
1b446896 90{
91 public:
27b3fe5d 92 AliHBTOnePairFctn(){}
93 virtual ~AliHBTOnePairFctn(){}
1b446896 94
95 virtual void ProcessSameEventParticles(AliHBTPair* pair) = 0;
96 virtual void ProcessDiffEventParticles(AliHBTPair* pair) = 0;
976183fd 97
26f1270c 98 virtual void Init() = 0;
99 virtual void Write() = 0;
1b446896 100
101 protected:
102 public:
26f1270c 103 ClassDef(AliHBTOnePairFctn,2)
1b446896 104};
105/******************************************************************/
106/******************************************************************/
107/******************************************************************/
26f1270c 108
109//____________________
110///////////////////////////////////////////////////////
111// //
112// AliHBTTwoPairFctn //
113// //
114// Abstract Base Calss for Functions that need //
115// two pairs to fill function, //
116// one reconstructed track and corresponding //
117// simulated pair //
118// Basically resolution functions //
119// Lednicky's algorithm uses that as well //
120// //
121// Piotr.Skowronski@cern.ch //
122// http://alisoft.cern.ch/people/skowron/analyzer //
123// //
124///////////////////////////////////////////////////////
125
126class AliHBTTwoPairFctn
1b446896 127{
128 public:
27b3fe5d 129 AliHBTTwoPairFctn(){};
130 virtual ~AliHBTTwoPairFctn(){};
1b446896 131
132 virtual void
133 ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) = 0;
134 virtual void
135 ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair) = 0;
26f1270c 136
137 virtual void Init() = 0;
138 virtual void Write() = 0;
1b446896 139
140 protected:
141 public:
26f1270c 142 ClassDef(AliHBTTwoPairFctn,2)
1b446896 143
144};
145/******************************************************************/
146/******************************************************************/
147/******************************************************************/
148
26f1270c 149//____________________
150///////////////////////////////////////////////////////
151// //
152// AliHBTFunction1D //
153// //
154// Base Calss for 1-dimensinal Functions //
155// //
156// Piotr.Skowronski@cern.ch //
157// http://alisoft.cern.ch/people/skowron/analyzer //
158// //
159///////////////////////////////////////////////////////
1b446896 160
26f1270c 161
162class AliHBTFunction1D: public AliHBTFunction
1b446896 163{
26f1270c 164 private:
165 //this must be declared before constructors because they are used as a default arguments
166 static const Int_t fgkDefaultNBins;//default number of Bins in histograms
167 static const Float_t fgkDefaultMin;//Default min value of histograms
168 static const Float_t fgkDefaultMax;//Default max value of histograms
169 static const UInt_t fgkDefaultNBinsToScale;//Default number of bins used for scaling to tale
170
1b446896 171 public:
26f1270c 172 AliHBTFunction1D();//default conmstructor
173 AliHBTFunction1D(Int_t nbins, Float_t maxXval, Float_t minXval);
174 AliHBTFunction1D(const Char_t *name, const Char_t *title);
175 AliHBTFunction1D(const Char_t *name, const Char_t *title,
176 Int_t nbins, Float_t maxXval, Float_t minXval);
177 virtual ~AliHBTFunction1D();
1b446896 178
26f1270c 179 TH1* GetNumerator() const {return fNumerator;}//returns numerator histogram
180 TH1* GetDenominator() const {return fDenominator;}//returns denominator histogram
181
182 Double_t Scale();
183 void SetNumberOfBinsToScale(Int_t n = fgkDefaultNBinsToScale){fNBinsToScale = n;}
1b446896 184
1b446896 185 protected:
186 //retruns velue to be histogrammed
26f1270c 187 virtual void BuildHistos(Int_t nbins, Float_t max, Float_t min);
188 virtual void BuildHistos();
189 Double_t Scale(TH1D* num,TH1D* den);
190
1b446896 191 TH1D* fNumerator;
192 TH1D* fDenominator;
26f1270c 193 UInt_t fNBinsToScale;
194
1b446896 195 public:
26f1270c 196 ClassDef(AliHBTFunction1D,2)
1b446896 197};
198
1b446896 199/******************************************************************/
200/******************************************************************/
201/******************************************************************/
26f1270c 202
203//____________________
204///////////////////////////////////////////////////////
205// //
206// AliHBTFunction2D //
207// //
208// Base Calss for 2-dimensinal Functions //
209// //
210// Piotr.Skowronski@cern.ch //
211// http://alisoft.cern.ch/people/skowron/analyzer //
212// //
213///////////////////////////////////////////////////////
ba95ae3f 214
26f1270c 215class AliHBTFunction2D: public AliHBTFunction
1b446896 216{
26f1270c 217 private:
218 //this must be declared before constructors because they are used as a default arguments
219 static const Int_t fgkDefaultNBinsX;//default number of Bins in X axis in histograms
220 static const Float_t fgkDefaultMinX;//Default min value of X axis in histograms
221 static const Float_t fgkDefaultMaxX;//Default max value of X axis inhistograms
222 static const Int_t fgkDefaultNBinsY;//default number of Bins in histograms
223 static const Float_t fgkDefaultMinY;//Default min value of histograms
224 static const Float_t fgkDefaultMaxY;//Default max value of histograms
225
226 static const UInt_t fgkDefaultNBinsToScaleX;//Default number of X bins used for scaling to tale
227 static const UInt_t fgkDefaultNBinsToScaleY;//Default number of bins used for scaling to tale
228
1b446896 229 public:
26f1270c 230 AliHBTFunction2D();
231
232 AliHBTFunction2D(const Char_t *name, const Char_t *title);
233
234 AliHBTFunction2D(Int_t nXbins, Double_t maxXval, Double_t minXval,
235 Int_t nYbins, Double_t maxYval, Double_t minYval);
236
237 AliHBTFunction2D(const Char_t *name, const Char_t *title,
238 Int_t nXbins, Double_t maxXval, Double_t minXval,
239 Int_t nYbins, Double_t maxYval, Double_t minYval);
240
241 virtual ~AliHBTFunction2D();
1b446896 242
26f1270c 243 TH1* GetNumerator() const {return fNumerator;}
244 TH1* GetDenominator() const {return fDenominator;}
1b446896 245
26f1270c 246 void SetNumberOfBinsToScale(UInt_t xn = fgkDefaultNBinsToScaleX,
247 UInt_t yn = fgkDefaultNBinsToScaleY);
248
249 Double_t Scale();
1b446896 250 protected:
26f1270c 251 virtual void BuildHistos(Int_t nxbins, Float_t xmax, Float_t xmin,
252 Int_t nybins, Float_t ymax, Float_t ymin);
253 virtual void BuildHistos();
254
1b446896 255 TH2D* fNumerator;
256 TH2D* fDenominator;
257
26f1270c 258 //definition of area used for scaling -> Scale is calculated this
259 //way that after division tale is on 1
260 UInt_t fNBinsToScaleX;//number of bins on X axis
261 UInt_t fNBinsToScaleY;//number of bins on Y axis
262
1b446896 263 public:
26f1270c 264 ClassDef(AliHBTFunction2D,2)
1b446896 265};
266/******************************************************************/
267/******************************************************************/
268/******************************************************************/
269
26f1270c 270//____________________
271///////////////////////////////////////////////////////
272// //
273// AliHBTFunction3D //
274// //
275// Base Calss for 3-dimensinal Functions that need //
276// one pair to fill function //
277// //
278// Piotr.Skowronski@cern.ch //
279// http://alisoft.cern.ch/people/skowron/analyzer //
280// //
281///////////////////////////////////////////////////////
282
283class AliHBTFunction3D: public AliHBTFunction
1b446896 284{
26f1270c 285 private:
286 //this must be declared before constructors because they are used as a default arguments
287 static const Int_t fgkDefaultNBinsX;//default number of Bins in X axis in histograms
288 static const Float_t fgkDefaultMinX;//Default min value of X axis in histograms
289 static const Float_t fgkDefaultMaxX;//Default max value of X axis inhistograms
290 static const Int_t fgkDefaultNBinsY;//default number of Bins in Y axis in histograms
291 static const Float_t fgkDefaultMinY;//Default min value of Y axis in histograms
292 static const Float_t fgkDefaultMaxY;//Default max value of Y axis inhistograms
293 static const Int_t fgkDefaultNBinsZ;//default number of Bins in Z axis in histograms
294 static const Float_t fgkDefaultMinZ;//Default min value of Z axis in histograms
295 static const Float_t fgkDefaultMaxZ;//Default max value of Z axis inhistograms
296
297 static const UInt_t fgkDefaultNBinsToScaleX;//Default number of X bins used for scaling to tale
298 static const UInt_t fgkDefaultNBinsToScaleY;//Default number of Y bins used for scaling to tale
299 static const UInt_t fgkDefaultNBinsToScaleZ;//Default number of Z bins used for scaling to tale
300
1b446896 301 public:
26f1270c 302 AliHBTFunction3D();
303
304 AliHBTFunction3D(const Char_t *name, const Char_t *title);
305
306 AliHBTFunction3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
307 Int_t nYbins, Double_t maxYval, Double_t minYval,
308 Int_t nZbins, Double_t maxZval, Double_t minZval);
309
310 AliHBTFunction3D(const Char_t *name, const Char_t *title,
311 Int_t nXbins, Double_t maxXval, Double_t minXval,
312 Int_t nYbins, Double_t maxYval, Double_t minYval,
313 Int_t nZbins, Double_t maxZval, Double_t minZval);
314
315 virtual ~AliHBTFunction3D();//destructor
316
317 TH1* GetNumerator() const {return fNumerator;}
318 TH1* GetDenominator() const {return fDenominator;}
1b446896 319
26f1270c 320
321 void SetNumberOfBinsToScale(UInt_t xn = fgkDefaultNBinsToScaleX,
322 UInt_t yn = fgkDefaultNBinsToScaleY,
323 UInt_t zn = fgkDefaultNBinsToScaleZ);
324
325 Double_t Scale();
1b446896 326
327 protected:
26f1270c 328 virtual void BuildHistos(Int_t nxbins, Float_t xmax, Float_t xmin,
329 Int_t nybins, Float_t ymax, Float_t ymin,
330 Int_t nzbins, Float_t zmax, Float_t zmin);
331 virtual void BuildHistos();
332
1b446896 333 TH3D* fNumerator;
334 TH3D* fDenominator;
26f1270c 335
336 //definition of area used for scaling -> Scale is calculated this
337 //way that after division tale is on 1
338 UInt_t fNBinsToScaleX;//number of bins on X axis
339 UInt_t fNBinsToScaleY;//number of bins on Y axis
340 UInt_t fNBinsToScaleZ;//number of bins on Z axis
341
1b446896 342 public:
26f1270c 343 ClassDef(AliHBTFunction3D,2)
1b446896 344};
345/******************************************************************/
346/******************************************************************/
347/******************************************************************/
348
26f1270c 349//____________________
350///////////////////////////////////////////////////////
351// //
352// AliHBTOnePairFctn1D //
353// //
354// Base Calss for 1-dimensinal Functions that need //
355// one pair to fill function //
356// //
357// Piotr.Skowronski@cern.ch //
358// http://alisoft.cern.ch/people/skowron/analyzer //
359// //
360///////////////////////////////////////////////////////
361
362class AliHBTOnePairFctn1D: public AliHBTOnePairFctn, public AliHBTFunction1D
ba95ae3f 363{
364 public:
26f1270c 365 AliHBTOnePairFctn1D(){}//default conmstructor
366 AliHBTOnePairFctn1D(Int_t nbins, Float_t maxXval, Float_t minXval);
367 AliHBTOnePairFctn1D(const Char_t *name, const Char_t *title);
368 AliHBTOnePairFctn1D(const Char_t *name, const Char_t *title,
369 Int_t nbins, Float_t maxXval, Float_t minXval);
370 virtual ~AliHBTOnePairFctn1D(){}
371
372 void ProcessSameEventParticles(AliHBTPair* pair);
373 void ProcessDiffEventParticles(AliHBTPair* pair);
374 void Write(){AliHBTFunction::Write();}
375 void Init(){AliHBTFunction::Init();}
ba95ae3f 376 protected:
26f1270c 377 //retruns velue to be histogrammed
378 virtual Double_t GetValue(AliHBTPair* pair) = 0;
379 ClassDef(AliHBTOnePairFctn1D,2)
380};
381/******************************************************************/
382/******************************************************************/
383/******************************************************************/
ba95ae3f 384
26f1270c 385//____________________
386///////////////////////////////////////////////////////
387// //
388// AliHBTOnePairFctn2D //
389// //
390// Base Calss for 2-dimensinal Functions that need //
391// one pair to fill function //
392// //
393// Piotr.Skowronski@cern.ch //
394// http://alisoft.cern.ch/people/skowron/analyzer //
395// //
396///////////////////////////////////////////////////////
397
398class AliHBTOnePairFctn2D: public AliHBTOnePairFctn, public AliHBTFunction2D
399{
400 public:
401 AliHBTOnePairFctn2D(){}
4e871a8a 402
26f1270c 403 AliHBTOnePairFctn2D(const Char_t *name, const Char_t *title);
4e871a8a 404
26f1270c 405 AliHBTOnePairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval,
406 Int_t nYbins, Double_t maxYval, Double_t minYval);
407
408 AliHBTOnePairFctn2D(const Char_t *name, const Char_t *title,
409 Int_t nXbins, Double_t maxXval, Double_t minXval,
410 Int_t nYbins, Double_t maxYval, Double_t minYval);
411
412 virtual ~AliHBTOnePairFctn2D(){}
413
414 void ProcessSameEventParticles(AliHBTPair* pair);
415 void ProcessDiffEventParticles(AliHBTPair* pair);
416 void Write(){AliHBTFunction::Write();}
417 void Init(){AliHBTFunction::Init();}
418 protected:
419 virtual void GetValues(AliHBTPair* pair, Double_t& x, Double_t& y) = 0;
420 ClassDef(AliHBTOnePairFctn2D,2)
ba95ae3f 421};
26f1270c 422/******************************************************************/
423/******************************************************************/
424/******************************************************************/
1b446896 425
26f1270c 426//____________________
427///////////////////////////////////////////////////////
428// //
429// AliHBTOnePairFctn3D //
430// //
431// Base Calss for 3-dimensinal Functions that need //
432// one pair to fill function //
433// //
434// Piotr.Skowronski@cern.ch //
435// http://alisoft.cern.ch/people/skowron/analyzer //
436// //
437///////////////////////////////////////////////////////
438
439class AliHBTOnePairFctn3D: public AliHBTOnePairFctn, public AliHBTFunction3D
440{
441 public:
442 AliHBTOnePairFctn3D(){}
1b446896 443
26f1270c 444 AliHBTOnePairFctn3D(const Char_t *name, const Char_t *title);
445
446 AliHBTOnePairFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
447 Int_t nYbins, Double_t maxYval, Double_t minYval,
448 Int_t nZbins, Double_t maxZval, Double_t minZval);
449
450 AliHBTOnePairFctn3D(const Char_t *name, const Char_t *title,
451 Int_t nXbins, Double_t maxXval, Double_t minXval,
452 Int_t nYbins, Double_t maxYval, Double_t minYval,
453 Int_t nZbins, Double_t maxZval, Double_t minZval);
454
455 virtual ~AliHBTOnePairFctn3D(){}//destructor
456
457 void ProcessSameEventParticles(AliHBTPair* pair);
458 void ProcessDiffEventParticles(AliHBTPair* pair);
459 void Write(){AliHBTFunction::Write();}
460 void Init(){AliHBTFunction::Init();}
461 protected:
462 virtual void GetValues(AliHBTPair* pair, Double_t& x, Double_t& y, Double_t& z) = 0;
463 ClassDef(AliHBTOnePairFctn3D,2)
464};
1b446896 465/******************************************************************/
466/******************************************************************/
467/******************************************************************/
26f1270c 468
469//____________________
470///////////////////////////////////////////////////////
471// //
472// AliHBTTwoPairFctn1D //
473// //
474// Base Calss for 1-dimensinal Functions that need //
475// two pair (simulated and reconstructed) //
476// to fill function //
477// //
478// Piotr.Skowronski@cern.ch //
479// http://alisoft.cern.ch/people/skowron/analyzer //
480// //
481///////////////////////////////////////////////////////
482
483class AliHBTTwoPairFctn1D: public AliHBTTwoPairFctn, public AliHBTFunction1D
1b446896 484{
485 public:
26f1270c 486 AliHBTTwoPairFctn1D(){}//default conmstructor
487 AliHBTTwoPairFctn1D(Int_t nbins, Float_t maxXval, Float_t minXval);
488 AliHBTTwoPairFctn1D(const Char_t *name, const Char_t *title);
489 AliHBTTwoPairFctn1D(const Char_t *name, const Char_t *title,
490 Int_t nbins, Float_t maxXval, Float_t minXval);
491 virtual ~AliHBTTwoPairFctn1D(){}
492
1b446896 493 void ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair);
494 void ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair);
26f1270c 495 void Write(){AliHBTFunction::Write();}
496 void Init(){AliHBTFunction::Init();}
1b446896 497 protected:
26f1270c 498 virtual Double_t GetValue(AliHBTPair* trackpair, AliHBTPair* partpair) = 0;
499 public:
500 ClassDef(AliHBTTwoPairFctn1D,2)
1b446896 501};
1b446896 502/******************************************************************/
503/******************************************************************/
504/******************************************************************/
26f1270c 505
506//____________________
507///////////////////////////////////////////////////////
508// //
509// AliHBTTwoPairFctn2D //
510// //
511// Base Calss for 2-dimensinal Functions that need //
512// two pair (simulated and reconstructed) //
513// to fill function //
514// //
515// Piotr.Skowronski@cern.ch //
516// http://alisoft.cern.ch/people/skowron/analyzer //
517// //
518///////////////////////////////////////////////////////
519
520class AliHBTTwoPairFctn2D: public AliHBTTwoPairFctn, public AliHBTFunction2D
ba95ae3f 521{
522 public:
26f1270c 523 AliHBTTwoPairFctn2D(){}
524
525 AliHBTTwoPairFctn2D(const Char_t *name, const Char_t *title);
526
527 AliHBTTwoPairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval,
528 Int_t nYbins, Double_t maxYval, Double_t minYval);
529
530 AliHBTTwoPairFctn2D(const Char_t *name, const Char_t *title,
531 Int_t nXbins, Double_t maxXval, Double_t minXval,
532 Int_t nYbins, Double_t maxYval, Double_t minYval);
533
534 virtual ~AliHBTTwoPairFctn2D(){}
ba95ae3f 535
536 void ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair);
537 void ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair);
26f1270c 538 void Write(){AliHBTFunction::Write();}
539 void Init(){AliHBTFunction::Init();}
540
ba95ae3f 541 protected:
26f1270c 542 virtual void GetValues(AliHBTPair* trackpair, AliHBTPair* partpair, Double_t& x, Double_t& y) = 0;
ba95ae3f 543
ba95ae3f 544 public:
26f1270c 545 ClassDef(AliHBTTwoPairFctn2D,2)
ba95ae3f 546};
1b446896 547/******************************************************************/
548/******************************************************************/
549/******************************************************************/
550
26f1270c 551//____________________
552///////////////////////////////////////////////////////
553// //
554// AliHBTTwoPairFctn3D //
555// //
556// Base Calss for 3-dimensinal Functions that need //
557// two pair (simulated and reconstructed) //
558// to fill function //
559// //
560// Piotr.Skowronski@cern.ch //
561// http://alisoft.cern.ch/people/skowron/analyzer //
562// //
563///////////////////////////////////////////////////////
564
565class AliHBTTwoPairFctn3D: public AliHBTTwoPairFctn, public AliHBTFunction3D
566{
567 public:
568 AliHBTTwoPairFctn3D(){}
569
570 AliHBTTwoPairFctn3D(const Char_t *name, const Char_t *title);
571
572 AliHBTTwoPairFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
573 Int_t nYbins, Double_t maxYval, Double_t minYval,
574 Int_t nZbins, Double_t maxZval, Double_t minZval);
575
576 AliHBTTwoPairFctn3D(const Char_t *name, const Char_t *title,
577 Int_t nXbins, Double_t maxXval, Double_t minXval,
578 Int_t nYbins, Double_t maxYval, Double_t minYval,
579 Int_t nZbins, Double_t maxZval, Double_t minZval);
580
581 virtual ~AliHBTTwoPairFctn3D(){}//destructor
1b446896 582
26f1270c 583 void ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair);
584 void ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair);
585 void Write(){AliHBTFunction::Write();}
586 void Init(){AliHBTFunction::Init();}
587
588 protected:
589 virtual void GetValues(AliHBTPair* trackpair, AliHBTPair* partpair, Double_t& x, Double_t& y, Double_t& z) = 0;
590
591 public:
592 ClassDef(AliHBTTwoPairFctn3D,2)
593};
1b446896 594
595#endif