1 #include "AliHBTFunction.h"
5 //--------------------------------------------------------------------
7 //Author: Piotr Krzysztof Skowronski
8 //Piotr.Skowronski@cern.ch
9 //Base classes for HBT functions
11 OnePairFctn Function TwoPairFctn
15 | \ \ / \ |\ | \________________/__ | \
16 | \ \/ \ | \__|_____________ / \| \
17 | \ \ \_|____|__ \ / | \
18 | \ / \___ | | \ \/ |\ \
20 | / \ \| | \ / \ | \ \
21 | / \ /\ | \ / \ | \ |
22 | / \ / \ | \ / \ | \ |
23 | / \ / \ | \ / \ | \ |
25 OnePair1D OnePair2D OnePair3D TwoPair1D TwoPair2D TwoPair3D
28 four particle functions are intendent to be resolution functions:
29 it is mecessary to have simulated particle pair corresponding to given
30 recontructed track pair in order to calculate function simualted value
31 and recontructed value, to be further histogrammed
33 //---------------------------------------------------------------------
38 /******************************************************************/
39 /******************************************************************/
41 ClassImp( AliHBTFunction )
43 AliHBTFunction::AliHBTFunction():
44 fPairCut(new AliHBTEmptyPairCut()), //dummy cut
45 fWriteNumAndDen(kFALSE)
49 /******************************************************************/
51 AliHBTFunction::AliHBTFunction(const char* name,const char* title):
53 fPairCut(new AliHBTEmptyPairCut()), //dummy cut
54 fWriteNumAndDen(kFALSE)
58 /******************************************************************/
60 AliHBTFunction::AliHBTFunction(const AliHBTFunction & source):
62 fPairCut((AliHBTPairCut*)source.fPairCut->Clone()),
63 fWriteNumAndDen(source.fWriteNumAndDen)
65 // Copy constructor needed by the coding conventions
67 /******************************************************************/
69 AliHBTFunction::~AliHBTFunction()
72 if (AliHBTParticle::GetDebug() > 1)
74 Info("~AliHBTFunction","Deleting %s",GetName());
78 /******************************************************************/
79 AliHBTFunction & AliHBTFunction::operator= (const AliHBTFunction & source)
81 // Assignment needed by the coding conventions
83 fPairCut = (AliHBTPairCut*)source.fPairCut->Clone();
87 void AliHBTFunction::WriteFunction()
89 //writes result of the function to file
90 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","%s",GetName());
93 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Num & Den");
94 if (GetNumerator()) GetNumerator()->Write();
95 if (GetDenominator()) GetDenominator()->Write();
96 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Num & Den Done");
98 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Getting Result");
99 TH1* res = GetResult();
100 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Getting Result Done");
104 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Result");
106 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Result Done");
109 /******************************************************************/
111 TH1* AliHBTFunction::GetRatio(Double_t normfactor)
113 //returns ratio of numerator and denominator
115 if (AliHBTParticle::GetDebug()>0) Info("GetRatio","Norm. Factor is %f for %s",normfactor,GetName());
117 if (normfactor == 0.0)
119 Error("GetRatio","Scaling Factor is 0. Null poiner returned");
122 TString str = fName + " ratio";
123 TH1 *result = (TH1*)GetNumerator()->Clone(str.Data());
124 result->SetDirectory(0x0);
126 result->SetTitle(str.Data());
128 result->Divide(GetNumerator(),GetDenominator(),normfactor);
133 /******************************************************************/
134 void AliHBTFunction::SetPairCut(AliHBTPairCut* cut)
136 //Sets new Pair Cut. Old one is deleted
137 //Note that it is created new object instead of simple pointer set
138 //I do not want to have pointer
139 //to object created somewhere else
140 //because in that case I could not believe that
141 //it would always exist (sb could delete it)
142 //so we have always own copy
146 Error("AliHBTFunction::SetPairCut","argument is NULL");
150 fPairCut = (AliHBTPairCut*)cut->Clone();
154 /******************************************************************/
156 void AliHBTFunction::Rename(const Char_t * name)
158 //renames the function and histograms
162 TString numstr = fName + " Numerator"; //title and name of the
163 //numerator histogram
164 TString denstr = fName + " Denominator";//title and name of the
165 //denominator histogram
167 GetNumerator()->SetName(numstr.Data());
168 GetNumerator()->SetTitle(numstr.Data());
170 GetDenominator()->SetName(denstr.Data());
171 GetDenominator()->SetTitle(denstr.Data());
175 void AliHBTFunction::Rename(const Char_t * name, const Char_t * title)
177 //renames and retitle the function and histograms
182 TString numstrn = fName + " Numerator"; //name of the
183 //numerator histogram
185 TString numstrt = fTitle + " Numerator"; //title of the
186 //numerator histogram
188 TString denstrn = fName + " Denominator";//name of the
189 //denominator histogram
191 TString denstrt = fTitle + " Denominator";//title of the
192 //denominator histogram
195 GetNumerator()->SetName(numstrn.Data());
196 GetNumerator()->SetTitle(numstrt.Data());
198 GetDenominator()->SetName(denstrn.Data());
199 GetDenominator()->SetTitle(denstrt.Data());
203 /******************************************************************/
205 void AliHBTFunction::InitFunction()
207 //Iniotializes fctn.: Resets histograms
208 //In case histograms are not created in ctor, builds with default parameters
209 if (AliHBTParticle::GetDebug()>1) Info("InitFunction","%s",GetName());
210 if ( !(GetNumerator()&&GetDenominator()) ) BuildHistos();
211 GetNumerator()->Reset();
212 GetDenominator()->Reset();
214 GetNumerator()->SetDirectory(0x0);
215 GetDenominator()->SetDirectory(0x0);
216 if (AliHBTParticle::GetDebug()>1) Info("InitFunction","Done");
218 /******************************************************************/
219 /******************************************************************/
220 /******************************************************************/
221 ClassImp(AliHBTCorrelFunction)
222 //____________________________________________
223 //////////////////////////////////////////////
225 // class AliHBTCorrelFunction
227 // Base class for correlation fuctions, that is which returns ratio.
228 // Stores pointer the created ratio histogram and deletes it when function is deleted
229 // created in order to evoid memory leak
231 ////////////////////////////////////////////////////////
232 AliHBTCorrelFunction& AliHBTCorrelFunction::operator=(const AliHBTCorrelFunction& in)
235 if (&in == this) return *this;
237 fRatio=(in.fRatio)?(TH1*)in.fRatio->Clone():0x0;
238 fRatio->SetDirectory(0x0);
242 /******************************************************************/
243 /******************************************************************/
244 /******************************************************************/
246 ClassImp( AliHBTOnePairFctn )
248 /******************************************************************/
249 /******************************************************************/
250 /******************************************************************/
252 ClassImp( AliHBTTwoPairFctn)
254 /******************************************************************/
255 /******************************************************************/
256 /******************************************************************/
258 ClassImp( AliHBTFunction1D )
260 const Int_t AliHBTFunction1D::fgkDefaultNBins = 100;
261 const Float_t AliHBTFunction1D::fgkDefaultMin = 0.0;
262 const Float_t AliHBTFunction1D::fgkDefaultMax = 0.15;
263 const UInt_t AliHBTFunction1D::fgkDefaultNBinsToScale = 30;
266 AliHBTFunction1D::AliHBTFunction1D():
269 fNBinsToScale(fgkDefaultNBinsToScale)
270 {//default constructor
272 /******************************************************************/
274 AliHBTFunction1D::AliHBTFunction1D(Int_t nbins, Float_t maxXval, Float_t minXval):
277 fNBinsToScale(fgkDefaultNBinsToScale)
279 //Constructor of Two Part One Dimentional Function
280 // nbins: number of bins in histograms - default 100
281 // maxXval and minXval: range of histgram(s) default 0 - 0.15 (GeV)
282 BuildHistos(nbins,maxXval,minXval);
284 /******************************************************************/
285 AliHBTFunction1D::AliHBTFunction1D(const Char_t *name, const Char_t *title):
286 AliHBTFunction(name,title),
289 fNBinsToScale(fgkDefaultNBinsToScale)
292 /******************************************************************/
293 AliHBTFunction1D::AliHBTFunction1D(const Char_t *name, const Char_t *title,
294 Int_t nbins, Float_t maxXval, Float_t minXval):
295 AliHBTFunction(name,title),
298 fNBinsToScale(fgkDefaultNBinsToScale)
301 BuildHistos(nbins,maxXval,minXval);
303 /******************************************************************/
305 AliHBTFunction1D::AliHBTFunction1D(const AliHBTFunction1D& source):
306 AliHBTFunction(source)
308 // Copy constructor needed by the coding conventions byt not used
309 Fatal("AliHBTFunction1D(const AliHBTFunction1D&)","Cpy ctor not usable.");
311 /******************************************************************/
313 AliHBTFunction1D& AliHBTFunction1D::operator= (const AliHBTFunction1D & /*source*/)
315 // Assignment needed by the coding conventions byt not used
316 Fatal("Assignment operator","not implemented");
319 /******************************************************************/
321 AliHBTFunction1D::~AliHBTFunction1D()
327 /******************************************************************/
328 void AliHBTFunction1D::BuildHistos()
330 //builds histograms with default settings
331 BuildHistos(fgkDefaultNBins,fgkDefaultMax,fgkDefaultMin);
334 /******************************************************************/
336 void AliHBTFunction1D::BuildHistos(Int_t nbins, Float_t max, Float_t min)
338 //builds numarator and denominator hitograms
339 TString numstr = fName + " Numerator"; //title and name of the
340 //numerator histogram
341 TString denstr = fName + " Denominator";//title and name of the
342 //denominator histogram
343 fNumerator = new TH1D(numstr.Data(),numstr.Data(),nbins,min,max);
344 fDenominator = new TH1D(denstr.Data(),denstr.Data(),nbins,min,max);
347 fDenominator->Sumw2();
349 /******************************************************************/
351 Double_t AliHBTFunction1D::Scale()
353 //Calculates the factor that should be used to scale
354 //quatience of fNumerator and fDenominator to 1 at tail
355 return Scale(fNumerator,fDenominator);
357 /******************************************************************/
359 Double_t AliHBTFunction1D::Scale(TH1D* num,TH1D* den)
361 //Calculates the factor that should be used to scale
362 //quatience of num and den to 1 at tail
364 if (AliHBTParticle::GetDebug()>0) Info("Scale","Enetered Scale()");
367 Error("Scale","No numerator");
372 Error("Scale","No denominator");
376 if(fNBinsToScale < 1)
378 Error("Scale","Number of bins for scaling is smaller thnan 1");
381 UInt_t nbins = num->GetNbinsX();
382 if (fNBinsToScale > nbins)
384 Error("Scale","Number of bins for scaling is bigger thnan number of bins in histograms");
387 if (AliHBTParticle::GetDebug()>0) Info("Scale","No errors detected");
389 Double_t densum = 0.0;
390 Double_t numsum = 0.0;
392 Int_t offset = nbins - fNBinsToScale - 1;
394 for (UInt_t i = offset; i< nbins; i++)
396 if ( num->GetBinContent(i) > 0.0 )
398 densum += fDenominator->GetBinContent(i);
399 numsum += fNumerator->GetBinContent(i);
403 if(AliHBTParticle::GetDebug() > 0)
404 Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d",numsum,densum,fNBinsToScale);
406 if (numsum == 0) return 0.0;
407 Double_t ret = densum/numsum;
409 if(AliHBTParticle::GetDebug() > 0) Info("Scale","returning %f",ret);
413 /******************************************************************/
414 /******************************************************************/
415 /******************************************************************/
417 //____________________
418 ///////////////////////////////////////////////////////
420 // AliHBTFunction2D //
422 // Base Calss for 2-dimensinal Functions //
424 // Piotr.Skowronski@cern.ch //
425 // http://alisoft.cern.ch/people/skowron/analyzer //
427 ///////////////////////////////////////////////////////
429 ClassImp( AliHBTFunction2D )
431 const Int_t AliHBTFunction2D::fgkDefaultNBinsX = 200;//default number of Bins in X axis in histograms
432 const Float_t AliHBTFunction2D::fgkDefaultMinX = 0.0;//Default min value of X axis in histograms
433 const Float_t AliHBTFunction2D::fgkDefaultMaxX = 1.5;//Default max value of X axis inhistograms
435 const Int_t AliHBTFunction2D::fgkDefaultNBinsY = 200;//default number of Bins in histograms
436 const Float_t AliHBTFunction2D::fgkDefaultMinY = -0.15;//Default min value of histograms
437 const Float_t AliHBTFunction2D::fgkDefaultMaxY = 0.15;//Default max value of histograms
439 const UInt_t AliHBTFunction2D::fgkDefaultNBinsToScaleX = 30;//Default number of X bins used for scaling to tale
440 const UInt_t AliHBTFunction2D::fgkDefaultNBinsToScaleY = 30;//Default number of bins used for scaling to tale
442 /******************************************************************/
443 AliHBTFunction2D::AliHBTFunction2D():
446 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
447 fNBinsToScaleY(fgkDefaultNBinsToScaleY)
448 {//default constructor
450 /******************************************************************/
451 AliHBTFunction2D::AliHBTFunction2D(const Char_t *name, const Char_t *title):
452 AliHBTFunction(name,title),
455 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
456 fNBinsToScaleY(fgkDefaultNBinsToScaleY)
459 /******************************************************************/
461 AliHBTFunction2D::AliHBTFunction2D(Int_t nXbins, Double_t maxXval, Double_t minXval,
462 Int_t nYbins, Double_t maxYval, Double_t minYval):
465 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
466 fNBinsToScaleY(fgkDefaultNBinsToScaleY)
468 BuildHistos(nXbins,maxXval,minXval,nYbins,maxYval,minYval);
470 /******************************************************************/
472 AliHBTFunction2D::AliHBTFunction2D(const Char_t *name, const Char_t *title,
473 Int_t nXbins, Double_t maxXval, Double_t minXval,
474 Int_t nYbins, Double_t maxYval, Double_t minYval):
475 AliHBTFunction(name,title),
478 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
479 fNBinsToScaleY(fgkDefaultNBinsToScaleY)
481 BuildHistos(nXbins,maxXval,minXval,nYbins,maxYval,minYval);
483 /******************************************************************/
484 AliHBTFunction2D::AliHBTFunction2D(const AliHBTFunction2D & source):
485 AliHBTFunction(source)
487 // Copy constructor needed by the coding conventions byt not used
488 Fatal("AliHBTFunction2D(const AliHBTFunction2D&)","Cpy ctor not usable.");
490 /******************************************************************/
492 AliHBTFunction2D& AliHBTFunction2D::operator= (const AliHBTFunction2D& /*source*/) {
493 // Assignment needed by the coding conventions byt not used
494 Fatal("Assignment operator","not implemented");
497 /******************************************************************/
499 AliHBTFunction2D::~AliHBTFunction2D()
505 /******************************************************************/
507 void AliHBTFunction2D::BuildHistos()
509 //Creates default histograms
510 BuildHistos(fgkDefaultNBinsX,fgkDefaultMaxX,fgkDefaultMinX,
511 fgkDefaultNBinsY,fgkDefaultMaxY,fgkDefaultMinY);
513 /******************************************************************/
515 void AliHBTFunction2D::BuildHistos(Int_t nxbins, Float_t xmax, Float_t xmin,
516 Int_t nybins, Float_t ymax, Float_t ymin)
518 //Builds numerator and denominator histograms (2d-case)
519 TString numstr = fName + " Numerator"; //title and name of the
520 //numerator histogram
521 TString denstr = fName + " Denominator";//title and name of the
522 //denominator histogram
524 fNumerator = new TH2D(numstr.Data(),numstr.Data(),
525 nxbins,xmin,xmax,nybins,ymin,ymax);
527 fDenominator = new TH2D(denstr.Data(),denstr.Data(),
528 nxbins,xmin,xmax,nybins,ymin,ymax);
531 fDenominator->Sumw2();
533 /******************************************************************/
535 void AliHBTFunction2D::SetNumberOfBinsToScale(UInt_t xn, UInt_t yn)
537 //defines area used for scaling factor calculation
541 /******************************************************************/
543 Double_t AliHBTFunction2D::Scale()
545 // Calculates the factor that should be used to scale
546 // quatience of fNumerator and fDenominator to 1 at
548 if (AliHBTParticle::GetDebug()>0) Info("Scale","Enetered Scale()");
551 Error("Scale","No numerator");
556 Error("Scale","No denominator");
560 if( (fNBinsToScaleX < 1) || (fNBinsToScaleY < 1) )
562 Error("Scale","Number of bins for scaling is smaller thnan 1");
565 UInt_t nbinsX = fNumerator->GetNbinsX();
566 if (fNBinsToScaleX > nbinsX)
568 Error("Scale","Number of X bins for scaling is bigger thnan number of bins in histograms");
572 UInt_t nbinsY = fNumerator->GetNbinsX();
573 if (fNBinsToScaleY > nbinsY)
575 Error("Scale","Number of Y bins for scaling is bigger thnan number of bins in histograms");
579 if (AliHBTParticle::GetDebug()>0) Info("Scale","No errors detected");
581 Int_t offsetX = nbinsX - fNBinsToScaleX - 1; //bin that we start loop over bins in axis X
582 Int_t offsetY = nbinsY - fNBinsToScaleY - 1; //bin that we start loop over bins in axis X
584 Double_t densum = 0.0;
585 Double_t numsum = 0.0;
587 for (UInt_t j = offsetY; j< nbinsY; j++)
588 for (UInt_t i = offsetX; i< nbinsX; i++)
590 if ( fNumerator->GetBinContent(i,j) > 0.0 )
592 densum += fDenominator->GetBinContent(i,j);
593 numsum += fNumerator->GetBinContent(i,j);
597 if(AliHBTParticle::GetDebug() > 0)
598 Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d fNBinsToScaleY=%d",numsum,densum,fNBinsToScaleX,fNBinsToScaleY);
600 if (numsum == 0) return 0.0;
601 Double_t ret = densum/numsum;
603 if(AliHBTParticle::GetDebug() > 0) Info("Scale","returning %f",ret);
607 /******************************************************************/
608 /******************************************************************/
609 /******************************************************************/
611 //____________________
612 ///////////////////////////////////////////////////////
614 // AliHBTFunction3D //
616 // Base Calss for 3-dimensinal Functions //
618 // Piotr.Skowronski@cern.ch //
619 // http://alisoft.cern.ch/people/skowron/analyzer //
621 ///////////////////////////////////////////////////////
623 ClassImp( AliHBTFunction3D)
625 const Int_t AliHBTFunction3D::fgkDefaultNBinsX = 200;//default number of Bins in X axis in histograms
626 const Float_t AliHBTFunction3D::fgkDefaultMinX = 0.0;//Default min value of X axis in histograms
627 const Float_t AliHBTFunction3D::fgkDefaultMaxX = 1.5;//Default max value of X axis inhistograms
629 const Int_t AliHBTFunction3D::fgkDefaultNBinsY = 200;//default number of Bins in histograms
630 const Float_t AliHBTFunction3D::fgkDefaultMinY = -0.15;//Default min value of histograms
631 const Float_t AliHBTFunction3D::fgkDefaultMaxY = 0.15;//Default max value of histograms
633 const Int_t AliHBTFunction3D::fgkDefaultNBinsZ = 200;//default number of Bins in histograms
634 const Float_t AliHBTFunction3D::fgkDefaultMinZ = -0.15;//Default min value of histograms
635 const Float_t AliHBTFunction3D::fgkDefaultMaxZ = 0.15;//Default max value of histograms
637 const UInt_t AliHBTFunction3D::fgkDefaultNBinsToScaleX = 30;//Default number of X bins used for scaling to tale
638 const UInt_t AliHBTFunction3D::fgkDefaultNBinsToScaleY = 30;//Default number of bins used for scaling to tale
639 const UInt_t AliHBTFunction3D::fgkDefaultNBinsToScaleZ = 30;//Default number of bins used for scaling to tale
641 AliHBTFunction3D::AliHBTFunction3D():
644 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
645 fNBinsToScaleY(fgkDefaultNBinsToScaleY),
646 fNBinsToScaleZ(fgkDefaultNBinsToScaleZ)
650 /******************************************************************/
652 AliHBTFunction3D::AliHBTFunction3D(const Char_t *name, const Char_t *title):
653 AliHBTFunction(name,title),
656 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
657 fNBinsToScaleY(fgkDefaultNBinsToScaleY),
658 fNBinsToScaleZ(fgkDefaultNBinsToScaleZ)
662 /******************************************************************/
664 AliHBTFunction3D::AliHBTFunction3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
665 Int_t nYbins, Double_t maxYval, Double_t minYval,
666 Int_t nZbins, Double_t maxZval, Double_t minZval):
669 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
670 fNBinsToScaleY(fgkDefaultNBinsToScaleY),
671 fNBinsToScaleZ(fgkDefaultNBinsToScaleZ)
674 BuildHistos( nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval);
676 /******************************************************************/
678 AliHBTFunction3D::AliHBTFunction3D(const Char_t *name, const Char_t *title,
679 Int_t nXbins, Double_t maxXval, Double_t minXval,
680 Int_t nYbins, Double_t maxYval, Double_t minYval,
681 Int_t nZbins, Double_t maxZval, Double_t minZval):
682 AliHBTFunction(name,title),
685 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
686 fNBinsToScaleY(fgkDefaultNBinsToScaleY),
687 fNBinsToScaleZ(fgkDefaultNBinsToScaleZ)
690 BuildHistos( nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval);
692 /******************************************************************/
694 AliHBTFunction3D::AliHBTFunction3D(const AliHBTFunction3D& source):
695 AliHBTFunction(source)
697 // Copy constructor needed by the coding conventions byt not used
698 Fatal("AliHBTFunction3D(const AliHBTFunction3D&)","Cpy ctor not usable.");
700 /******************************************************************/
702 AliHBTFunction3D& AliHBTFunction3D::operator= (const AliHBTFunction3D & /*source*/)
704 // Assignment needed by the coding conventions byt not used
705 Fatal("Assignment operator","not implemented");
708 /******************************************************************/
711 AliHBTFunction3D::~AliHBTFunction3D()
716 /******************************************************************/
718 void AliHBTFunction3D::BuildHistos()
720 //Creates default histograms
721 BuildHistos(fgkDefaultNBinsX,fgkDefaultMaxX,fgkDefaultMinX,
722 fgkDefaultNBinsY,fgkDefaultMaxY,fgkDefaultMinY,
723 fgkDefaultNBinsZ,fgkDefaultMaxZ,fgkDefaultMinZ);
725 /******************************************************************/
727 void AliHBTFunction3D::BuildHistos(Int_t nxbins, Float_t xmax, Float_t xmin,
728 Int_t nybins, Float_t ymax, Float_t ymin,
729 Int_t nzbins, Float_t zmax, Float_t zmin)
731 //Builds numerator and denominator histograms (3d-case)
732 TString numstr = fName + " Numerator"; //title and name of the
733 //numerator histogram
734 TString denstr = fName + " Denominator";//title and name of the
735 //denominator histogram
737 fNumerator = new TH3F(numstr.Data(),numstr.Data(),
738 nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax);
740 fDenominator = new TH3F(denstr.Data(),denstr.Data(),
741 nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax);
744 fDenominator->Sumw2();
747 /******************************************************************/
749 Double_t AliHBTFunction3D::Scale()
751 // Calculates the factor that should be used to scale
752 // quatience of fNumerator and fDenominator to 1 at
754 if (AliHBTParticle::GetDebug()>0) Info("Scale","Enetered Scale()");
757 Error("Scale","No numerator");
762 Error("Scale","No denominator");
766 if( (fNBinsToScaleX < 1) || (fNBinsToScaleY < 1) || (fNBinsToScaleZ < 1))
768 Error("Scale","Number of bins for scaling is smaller thnan 1");
771 UInt_t nbinsX = fNumerator->GetNbinsX();
772 if (fNBinsToScaleX > nbinsX)
774 Error("Scale","Number of X bins for scaling is bigger thnan number of bins in histograms");
778 UInt_t nbinsY = fNumerator->GetNbinsX();
779 if (fNBinsToScaleY > nbinsY)
781 Error("Scale","Number of Y bins for scaling is bigger thnan number of bins in histograms");
785 UInt_t nbinsZ = fNumerator->GetNbinsZ();
786 if (fNBinsToScaleZ > nbinsZ)
788 Error("Scale","Number of Z bins for scaling is bigger thnan number of bins in histograms");
792 if (AliHBTParticle::GetDebug()>0) Info("Scale","No errors detected");
794 Int_t offsetX = nbinsX - fNBinsToScaleX - 1; //bin that we start loop over bins in axis X
795 Int_t offsetY = nbinsY - fNBinsToScaleY - 1; //bin that we start loop over bins in axis Y
796 Int_t offsetZ = nbinsZ - fNBinsToScaleZ - 1; //bin that we start loop over bins in axis Z
798 Double_t densum = 0.0;
799 Double_t numsum = 0.0;
801 for (UInt_t k = offsetZ; k<nbinsZ; k++)
802 for (UInt_t j = offsetY; j<nbinsY; j++)
803 for (UInt_t i = offsetX; i<nbinsX; i++)
805 if ( fNumerator->GetBinContent(i,j,k) > 0.0 )
808 densum += fDenominator->GetBinContent(i,j,k);
809 numsum += fNumerator->GetBinContent(i,j,k);
813 if(AliHBTParticle::GetDebug() > 0)
814 Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d fNBinsToScaleY=%d fNBinsToScaleZ=%d",
815 numsum,densum,fNBinsToScaleX,fNBinsToScaleY,fNBinsToScaleZ);
817 if (numsum == 0) return 0.0;
818 Double_t ret = densum/numsum;
820 if(AliHBTParticle::GetDebug() > 0) Info("Scale","returning %f",ret);
823 /******************************************************************/
825 void AliHBTFunction3D::SetNumberOfBinsToScale(UInt_t xn, UInt_t yn,UInt_t zn)
827 //sets up the volume to be used for scaling to tail
833 /******************************************************************/
834 /******************************************************************/
835 /******************************************************************/
836 /******************************************************************/
837 /******************************************************************/
838 /******************************************************************/
839 /******************************************************************/
840 /******************************************************************/
841 /******************************************************************/
843 //____________________
844 ///////////////////////////////////////////////////////
846 // AliHBTOnePairFctn1D //
848 // Base Calss for 1-dimensinal Functions that need //
849 // one pair to fill function //
851 // Piotr.Skowronski@cern.ch //
852 // http://alisoft.cern.ch/people/skowron/analyzer //
854 ///////////////////////////////////////////////////////
856 ClassImp( AliHBTOnePairFctn1D )
857 /******************************************************************/
859 AliHBTOnePairFctn1D::AliHBTOnePairFctn1D(Int_t nbins, Float_t maxXval, Float_t minXval):
860 AliHBTFunction1D(nbins,maxXval,minXval)
864 /******************************************************************/
866 AliHBTOnePairFctn1D::AliHBTOnePairFctn1D(const Char_t *name, const Char_t *title):
867 AliHBTFunction1D(name,title)
871 /******************************************************************/
873 AliHBTOnePairFctn1D::AliHBTOnePairFctn1D(const Char_t *name, const Char_t *title,
874 Int_t nbins, Float_t maxXval, Float_t minXval):
875 AliHBTFunction1D(name,title,nbins,maxXval,minXval)
879 /******************************************************************/
881 void AliHBTOnePairFctn1D::ProcessSameEventParticles(AliHBTPair* pair)
883 //Fills the numerator using pair from the same event
884 pair = CheckPair(pair);
885 if(pair) fNumerator->Fill(GetValue(pair));
887 /******************************************************************/
888 void AliHBTOnePairFctn1D::ProcessDiffEventParticles(AliHBTPair* pair)
890 //Fills the denumerator using mixed pairs
891 pair = CheckPair(pair);
892 if(pair) fDenominator->Fill(GetValue(pair));
895 /******************************************************************/
896 /******************************************************************/
897 /******************************************************************/
899 //____________________
900 ///////////////////////////////////////////////////////
902 // AliHBTOnePairFctn2D //
904 // Base Calss for 2-dimensinal Functions that need //
905 // one pair to fill function //
907 // Piotr.Skowronski@cern.ch //
908 // http://alisoft.cern.ch/people/skowron/analyzer //
910 ///////////////////////////////////////////////////////
912 ClassImp( AliHBTOnePairFctn2D )
913 /******************************************************************/
915 AliHBTOnePairFctn2D::AliHBTOnePairFctn2D(const Char_t *name, const Char_t *title):
916 AliHBTFunction2D(name,title)
920 /******************************************************************/
922 AliHBTOnePairFctn2D::AliHBTOnePairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval,
923 Int_t nYbins, Double_t maxYval, Double_t minYval):
924 AliHBTFunction2D(nXbins, maxXval, minXval, nYbins, maxYval, minYval)
928 /******************************************************************/
930 AliHBTOnePairFctn2D::AliHBTOnePairFctn2D(const Char_t *name, const Char_t *title,
931 Int_t nXbins, Double_t maxXval, Double_t minXval,
932 Int_t nYbins, Double_t maxYval, Double_t minYval):
933 AliHBTFunction2D(name,title, nXbins, maxXval, minXval, nYbins, maxYval, minYval)
937 /******************************************************************/
939 void AliHBTOnePairFctn2D::ProcessSameEventParticles(AliHBTPair* pair)
941 // Fills the numerator using pairs from the same event
942 pair = CheckPair(pair);
947 fNumerator->Fill(x,y);
950 /******************************************************************/
952 void AliHBTOnePairFctn2D::ProcessDiffEventParticles(AliHBTPair* pair)
954 // Fills the denumerator using mixed pairs
955 pair = CheckPair(pair);
960 fDenominator->Fill(x,y);
963 /******************************************************************/
964 /******************************************************************/
965 /******************************************************************/
966 /******************************************************************/
967 //____________________
968 ///////////////////////////////////////////////////////
970 // AliHBTOnePairFctn3D //
972 // Base Calss for 3-dimensinal Functions that need //
973 // one pair to fill function //
975 // Piotr.Skowronski@cern.ch //
976 // http://alisoft.cern.ch/people/skowron/analyzer //
978 ///////////////////////////////////////////////////////
979 ClassImp( AliHBTOnePairFctn3D)
981 /******************************************************************/
983 AliHBTOnePairFctn3D::AliHBTOnePairFctn3D(const Char_t *name, const Char_t *title):
984 AliHBTFunction3D(name,title)
988 /******************************************************************/
990 AliHBTOnePairFctn3D::AliHBTOnePairFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
991 Int_t nYbins, Double_t maxYval, Double_t minYval,
992 Int_t nZbins, Double_t maxZval, Double_t minZval):
993 AliHBTFunction3D(nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval)
997 /******************************************************************/
999 AliHBTOnePairFctn3D::AliHBTOnePairFctn3D(const Char_t *name, const Char_t *title,
1000 Int_t nXbins, Double_t maxXval, Double_t minXval,
1001 Int_t nYbins, Double_t maxYval, Double_t minYval,
1002 Int_t nZbins, Double_t maxZval, Double_t minZval):
1003 AliHBTFunction3D(name,title,nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval)
1007 /******************************************************************/
1009 void AliHBTOnePairFctn3D::ProcessSameEventParticles(AliHBTPair* pair)
1011 //Reacts on pair coming from same event (real pairs)
1012 //and fills numerator histogram
1013 pair = CheckPair(pair);
1017 GetValues(pair,x,y,z);
1018 fNumerator->Fill(x,y,z);
1021 /******************************************************************/
1023 void AliHBTOnePairFctn3D::ProcessDiffEventParticles(AliHBTPair* pair)
1025 //Reacts on pair coming from different events (mixed pairs)
1026 //and fills denominator histogram
1027 pair = CheckPair(pair);
1031 GetValues(pair,x,y,z);
1032 fDenominator->Fill(x,y,z);
1036 /******************************************************************/
1037 /******************************************************************/
1038 /******************************************************************/
1040 //____________________
1041 ///////////////////////////////////////////////////////
1043 // AliHBTTwoPairFctn1D //
1045 // Base Calss for 1-dimensinal Functions that need //
1046 // two pair (simulated and reconstructed) //
1047 // to fill function //
1049 // Piotr.Skowronski@cern.ch //
1050 // http://alisoft.cern.ch/people/skowron/analyzer //
1052 ///////////////////////////////////////////////////////
1053 ClassImp(AliHBTTwoPairFctn1D)
1054 /******************************************************************/
1056 AliHBTTwoPairFctn1D::AliHBTTwoPairFctn1D(Int_t nbins, Float_t maxXval, Float_t minXval):
1057 AliHBTFunction1D(nbins,maxXval,minXval)
1061 /******************************************************************/
1063 AliHBTTwoPairFctn1D::AliHBTTwoPairFctn1D(const Char_t *name, const Char_t *title):
1064 AliHBTFunction1D(name,title)
1068 /******************************************************************/
1070 AliHBTTwoPairFctn1D::AliHBTTwoPairFctn1D(const Char_t *name, const Char_t *title,
1071 Int_t nbins, Float_t maxXval, Float_t minXval):
1072 AliHBTFunction1D(name,title,nbins,maxXval,minXval)
1076 /******************************************************************/
1078 void AliHBTTwoPairFctn1D::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1080 // Fills the numerator using pairs from the same event
1081 partpair = CheckPair(partpair);
1082 if( partpair == 0x0) return;
1084 if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair
1085 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1087 Double_t x = GetValue(trackpair,partpair);
1088 fNumerator->Fill(x);
1090 /******************************************************************/
1092 void AliHBTTwoPairFctn1D::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1094 // Fills the denumerator usin mixed pairs
1095 partpair = CheckPair(partpair);
1096 if( partpair == 0x0) return;
1098 if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair
1099 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1101 Double_t x = GetValue(trackpair,partpair);
1102 fDenominator->Fill(x);
1104 /******************************************************************/
1105 /******************************************************************/
1106 /******************************************************************/
1108 //____________________
1109 ///////////////////////////////////////////////////////
1111 // AliHBTTwoPairFctn2D //
1113 // Base Calss for 2-dimensinal Functions that need //
1114 // two pair (simulated and reconstructed) //
1115 // to fill function //
1117 // Piotr.Skowronski@cern.ch //
1118 // http://alisoft.cern.ch/people/skowron/analyzer //
1120 ///////////////////////////////////////////////////////
1122 ClassImp(AliHBTTwoPairFctn2D)
1124 /******************************************************************/
1126 AliHBTTwoPairFctn2D::AliHBTTwoPairFctn2D(const Char_t *name, const Char_t *title):
1127 AliHBTFunction2D(name,title)
1131 /******************************************************************/
1133 AliHBTTwoPairFctn2D::AliHBTTwoPairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval,
1134 Int_t nYbins, Double_t maxYval, Double_t minYval):
1135 AliHBTFunction2D(nXbins, maxXval, minXval, nYbins, maxYval, minYval)
1139 /******************************************************************/
1141 AliHBTTwoPairFctn2D::AliHBTTwoPairFctn2D(const Char_t *name, const Char_t *title,
1142 Int_t nXbins, Double_t maxXval, Double_t minXval,
1143 Int_t nYbins, Double_t maxYval, Double_t minYval):
1144 AliHBTFunction2D(name,title,nXbins, maxXval, minXval, nYbins, maxYval, minYval)
1148 /******************************************************************/
1150 void AliHBTTwoPairFctn2D::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1152 //processes pair of particles coming from a same events (real pair)
1153 partpair = CheckPair(partpair); //check cuts
1154 if (partpair == 0x0) return;
1156 if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair
1157 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1160 GetValues(trackpair,partpair,x,y);
1161 fNumerator->Fill(x,y);
1163 /******************************************************************/
1165 void AliHBTTwoPairFctn2D::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1167 //processes pair of particles coming from a different events (mixed pair)
1168 partpair = CheckPair(partpair);
1169 if (partpair == 0x0) return;
1171 if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair
1172 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1175 GetValues(trackpair,partpair,x,y);
1176 fDenominator->Fill(x,y);
1179 /******************************************************************/
1180 /******************************************************************/
1181 /******************************************************************/
1183 //____________________
1184 ///////////////////////////////////////////////////////
1186 // AliHBTTwoPairFctn3D //
1188 // Base Calss for 3-dimensinal Functions that need //
1189 // two pair (simulated and reconstructed) //
1190 // to fill function //
1192 // Piotr.Skowronski@cern.ch //
1193 // http://alisoft.cern.ch/people/skowron/analyzer //
1195 ///////////////////////////////////////////////////////
1197 ClassImp(AliHBTTwoPairFctn3D)
1199 /******************************************************************/
1201 AliHBTTwoPairFctn3D::AliHBTTwoPairFctn3D(const Char_t *name, const Char_t *title):
1202 AliHBTFunction3D(name,title)
1206 /******************************************************************/
1208 AliHBTTwoPairFctn3D::AliHBTTwoPairFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
1209 Int_t nYbins, Double_t maxYval, Double_t minYval,
1210 Int_t nZbins, Double_t maxZval, Double_t minZval):
1211 AliHBTFunction3D(nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval)
1215 /******************************************************************/
1217 AliHBTTwoPairFctn3D::AliHBTTwoPairFctn3D(const Char_t *name, const Char_t *title,
1218 Int_t nXbins, Double_t maxXval, Double_t minXval,
1219 Int_t nYbins, Double_t maxYval, Double_t minYval,
1220 Int_t nZbins, Double_t maxZval, Double_t minZval):
1221 AliHBTFunction3D(name,title,nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval)
1225 /******************************************************************/
1227 void AliHBTTwoPairFctn3D::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1229 // Fills th numerator using pairs from the same event
1230 partpair = CheckPair(partpair);
1231 if( partpair == 0x0) return;
1233 if (partpair->GetSwapedPair() == 0x0)//it means that CheckPair returned swapped pair
1234 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1237 GetValues(trackpair,partpair,x,y,z);
1238 fNumerator->Fill(x,y,z);
1241 /******************************************************************/
1243 void AliHBTTwoPairFctn3D::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1245 // Fills the denumerator using mixed pairs
1246 partpair = CheckPair(partpair);
1247 if( partpair == 0x0) return;
1249 if (partpair->GetSwapedPair() == 0x0)//it means that CheckPair returned swapped pair
1250 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1253 GetValues(trackpair,partpair,x,y,z);
1254 fDenominator->Fill(x,y,z);
1257 /******************************************************************/
1258 /******************************************************************/
1259 /******************************************************************/