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()
74 /******************************************************************/
75 AliHBTFunction & AliHBTFunction::operator= (const AliHBTFunction & source)
77 // Assignment needed by the coding conventions
79 fPairCut = (AliHBTPairCut*)source.fPairCut->Clone();
83 void AliHBTFunction::WriteFunction()
85 //writes result of the function to file
86 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","%s",GetName());
89 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Num & Den");
90 if (GetNumerator()) GetNumerator()->Write();
91 if (GetDenominator()) GetDenominator()->Write();
92 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Num & Den Done");
94 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Getting Result");
95 TH1* res = GetResult();
96 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Getting Result Done");
100 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Result");
102 if (AliHBTParticle::GetDebug()) Info("AliHBTFunction","Writing Result Done");
105 /******************************************************************/
107 TH1* AliHBTFunction::GetRatio(Double_t normfactor)
109 //returns ratio of numerator and denominator
111 if (AliHBTParticle::GetDebug()>0) Info("GetRatio","Norm. Factor is %f for %s",normfactor,GetName());
113 if (normfactor == 0.0)
115 Error("GetRatio","Scaling Factor is 0. Null poiner returned");
118 TString str = fName + " ratio";
119 TH1 *result = (TH1*)GetNumerator()->Clone(str.Data());
121 result->SetTitle(str.Data());
123 result->Divide(GetNumerator(),GetDenominator(),normfactor);
128 /******************************************************************/
129 void AliHBTFunction::SetPairCut(AliHBTPairCut* cut)
131 //Sets new Pair Cut. Old one is deleted
132 //Note that it is created new object instead of simple pointer set
133 //I do not want to have pointer
134 //to object created somewhere else
135 //because in that case I could not believe that
136 //it would always exist (sb could delete it)
137 //so we have always own copy
141 Error("AliHBTFunction::SetPairCut","argument is NULL");
145 fPairCut = (AliHBTPairCut*)cut->Clone();
149 /******************************************************************/
151 void AliHBTFunction::Rename(const Char_t * name)
153 //renames the function and histograms
157 TString numstr = fName + " Numerator"; //title and name of the
158 //numerator histogram
159 TString denstr = fName + " Denominator";//title and name of the
160 //denominator histogram
162 GetNumerator()->SetName(numstr.Data());
163 GetNumerator()->SetTitle(numstr.Data());
165 GetDenominator()->SetName(denstr.Data());
166 GetDenominator()->SetTitle(denstr.Data());
170 void AliHBTFunction::Rename(const Char_t * name, const Char_t * title)
172 //renames and retitle the function and histograms
177 TString numstrn = fName + " Numerator"; //name of the
178 //numerator histogram
180 TString numstrt = fTitle + " Numerator"; //title of the
181 //numerator histogram
183 TString denstrn = fName + " Denominator";//name of the
184 //denominator histogram
186 TString denstrt = fTitle + " Denominator";//title of the
187 //denominator histogram
190 GetNumerator()->SetName(numstrn.Data());
191 GetNumerator()->SetTitle(numstrt.Data());
193 GetDenominator()->SetName(denstrn.Data());
194 GetDenominator()->SetTitle(denstrt.Data());
198 /******************************************************************/
200 void AliHBTFunction::InitFunction()
202 //Iniotializes fctn.: Resets histograms
203 //In case histograms are not created in ctor, builds with default parameters
204 Info("InitFunction","%s",GetName());
205 if ( !(GetNumerator()&&GetDenominator()) ) BuildHistos();
206 GetNumerator()->Reset();
207 GetDenominator()->Reset();
209 GetNumerator()->SetDirectory(0x0);
210 GetDenominator()->SetDirectory(0x0);
211 Info("InitFunction","Done");
214 /******************************************************************/
215 /******************************************************************/
216 /******************************************************************/
218 ClassImp( AliHBTOnePairFctn )
220 /******************************************************************/
221 /******************************************************************/
222 /******************************************************************/
224 ClassImp( AliHBTTwoPairFctn)
226 /******************************************************************/
227 /******************************************************************/
228 /******************************************************************/
230 ClassImp( AliHBTFunction1D )
232 const Int_t AliHBTFunction1D::fgkDefaultNBins = 100;
233 const Float_t AliHBTFunction1D::fgkDefaultMin = 0.0;
234 const Float_t AliHBTFunction1D::fgkDefaultMax = 0.15;
235 const UInt_t AliHBTFunction1D::fgkDefaultNBinsToScale = 30;
238 AliHBTFunction1D::AliHBTFunction1D():
241 fNBinsToScale(fgkDefaultNBinsToScale)
242 {//default constructor
244 /******************************************************************/
246 AliHBTFunction1D::AliHBTFunction1D(Int_t nbins, Float_t maxXval, Float_t minXval):
249 fNBinsToScale(fgkDefaultNBinsToScale)
251 //Constructor of Two Part One Dimentional Function
252 // nbins: number of bins in histograms - default 100
253 // maxXval and minXval: range of histgram(s) default 0 - 0.15 (GeV)
254 BuildHistos(nbins,maxXval,minXval);
256 /******************************************************************/
257 AliHBTFunction1D::AliHBTFunction1D(const Char_t *name, const Char_t *title):
258 AliHBTFunction(name,title),
261 fNBinsToScale(fgkDefaultNBinsToScale)
264 /******************************************************************/
265 AliHBTFunction1D::AliHBTFunction1D(const Char_t *name, const Char_t *title,
266 Int_t nbins, Float_t maxXval, Float_t minXval):
267 AliHBTFunction(name,title),
270 fNBinsToScale(fgkDefaultNBinsToScale)
273 BuildHistos(nbins,maxXval,minXval);
275 /******************************************************************/
277 AliHBTFunction1D::AliHBTFunction1D(const AliHBTFunction1D& source):
278 AliHBTFunction(source)
280 // Copy constructor needed by the coding conventions byt not used
281 Fatal("AliHBTFunction1D(const AliHBTFunction1D&)","Cpy ctor not usable.");
283 /******************************************************************/
285 AliHBTFunction1D& AliHBTFunction1D::operator= (const AliHBTFunction1D & /*source*/)
287 // Assignment needed by the coding conventions byt not used
288 Fatal("Assignment operator","not implemented");
291 /******************************************************************/
293 AliHBTFunction1D::~AliHBTFunction1D()
299 /******************************************************************/
300 void AliHBTFunction1D::BuildHistos()
302 //builds histograms with default settings
303 BuildHistos(fgkDefaultNBins,fgkDefaultMax,fgkDefaultMin);
306 /******************************************************************/
308 void AliHBTFunction1D::BuildHistos(Int_t nbins, Float_t max, Float_t min)
310 //builds numarator and denominator hitograms
311 TString numstr = fName + " Numerator"; //title and name of the
312 //numerator histogram
313 TString denstr = fName + " Denominator";//title and name of the
314 //denominator histogram
315 fNumerator = new TH1D(numstr.Data(),numstr.Data(),nbins,min,max);
316 fDenominator = new TH1D(denstr.Data(),denstr.Data(),nbins,min,max);
319 fDenominator->Sumw2();
321 /******************************************************************/
323 Double_t AliHBTFunction1D::Scale()
325 //Calculates the factor that should be used to scale
326 //quatience of fNumerator and fDenominator to 1 at tail
327 return Scale(fNumerator,fDenominator);
329 /******************************************************************/
331 Double_t AliHBTFunction1D::Scale(TH1D* num,TH1D* den)
333 //Calculates the factor that should be used to scale
334 //quatience of num and den to 1 at tail
336 if (AliHBTParticle::GetDebug()>0) Info("Scale","Enetered Scale()");
339 Error("Scale","No numerator");
344 Error("Scale","No denominator");
348 if(fNBinsToScale < 1)
350 Error("Scale","Number of bins for scaling is smaller thnan 1");
353 UInt_t nbins = num->GetNbinsX();
354 if (fNBinsToScale > nbins)
356 Error("Scale","Number of bins for scaling is bigger thnan number of bins in histograms");
359 if (AliHBTParticle::GetDebug()>0) Info("Scale","No errors detected");
361 Double_t densum = 0.0;
362 Double_t numsum = 0.0;
364 Int_t offset = nbins - fNBinsToScale - 1;
366 for (UInt_t i = offset; i< nbins; i++)
368 if ( num->GetBinContent(i) > 0.0 )
370 densum = fDenominator->GetBinContent(i);
371 numsum = fNumerator->GetBinContent(i);
375 if(AliHBTParticle::GetDebug() > 0)
376 Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d",numsum,densum,fNBinsToScale);
378 if (numsum == 0) return 0.0;
379 Double_t ret = densum/numsum;
381 if(AliHBTParticle::GetDebug() > 0) Info("Scale","returning %f",ret);
385 /******************************************************************/
386 /******************************************************************/
387 /******************************************************************/
389 //____________________
390 ///////////////////////////////////////////////////////
392 // AliHBTFunction2D //
394 // Base Calss for 2-dimensinal Functions //
396 // Piotr.Skowronski@cern.ch //
397 // http://alisoft.cern.ch/people/skowron/analyzer //
399 ///////////////////////////////////////////////////////
401 ClassImp( AliHBTFunction2D )
403 const Int_t AliHBTFunction2D::fgkDefaultNBinsX = 200;//default number of Bins in X axis in histograms
404 const Float_t AliHBTFunction2D::fgkDefaultMinX = 0.0;//Default min value of X axis in histograms
405 const Float_t AliHBTFunction2D::fgkDefaultMaxX = 1.5;//Default max value of X axis inhistograms
407 const Int_t AliHBTFunction2D::fgkDefaultNBinsY = 200;//default number of Bins in histograms
408 const Float_t AliHBTFunction2D::fgkDefaultMinY = -0.15;//Default min value of histograms
409 const Float_t AliHBTFunction2D::fgkDefaultMaxY = 0.15;//Default max value of histograms
411 const UInt_t AliHBTFunction2D::fgkDefaultNBinsToScaleX = 30;//Default number of X bins used for scaling to tale
412 const UInt_t AliHBTFunction2D::fgkDefaultNBinsToScaleY = 30;//Default number of bins used for scaling to tale
414 /******************************************************************/
415 AliHBTFunction2D::AliHBTFunction2D():
418 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
419 fNBinsToScaleY(fgkDefaultNBinsToScaleY)
420 {//default constructor
422 /******************************************************************/
423 AliHBTFunction2D::AliHBTFunction2D(const Char_t *name, const Char_t *title):
424 AliHBTFunction(name,title),
427 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
428 fNBinsToScaleY(fgkDefaultNBinsToScaleY)
431 /******************************************************************/
433 AliHBTFunction2D::AliHBTFunction2D(Int_t nXbins, Double_t maxXval, Double_t minXval,
434 Int_t nYbins, Double_t maxYval, Double_t minYval):
437 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
438 fNBinsToScaleY(fgkDefaultNBinsToScaleY)
440 BuildHistos(nXbins,maxXval,minXval,nYbins,maxYval,minYval);
442 /******************************************************************/
444 AliHBTFunction2D::AliHBTFunction2D(const Char_t *name, const Char_t *title,
445 Int_t nXbins, Double_t maxXval, Double_t minXval,
446 Int_t nYbins, Double_t maxYval, Double_t minYval):
447 AliHBTFunction(name,title),
450 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
451 fNBinsToScaleY(fgkDefaultNBinsToScaleY)
453 BuildHistos(nXbins,maxXval,minXval,nYbins,maxYval,minYval);
455 /******************************************************************/
456 AliHBTFunction2D::AliHBTFunction2D(const AliHBTFunction2D & source):
457 AliHBTFunction(source)
459 // Copy constructor needed by the coding conventions byt not used
460 Fatal("AliHBTFunction2D(const AliHBTFunction2D&)","Cpy ctor not usable.");
462 /******************************************************************/
464 AliHBTFunction2D& AliHBTFunction2D::operator= (const AliHBTFunction2D& /*source*/) {
465 // Assignment needed by the coding conventions byt not used
466 Fatal("Assignment operator","not implemented");
469 /******************************************************************/
471 AliHBTFunction2D::~AliHBTFunction2D()
477 /******************************************************************/
479 void AliHBTFunction2D::BuildHistos()
481 //Creates default histograms
482 BuildHistos(fgkDefaultNBinsX,fgkDefaultMaxX,fgkDefaultMinX,
483 fgkDefaultNBinsY,fgkDefaultMaxY,fgkDefaultMinY);
485 /******************************************************************/
487 void AliHBTFunction2D::BuildHistos(Int_t nxbins, Float_t xmax, Float_t xmin,
488 Int_t nybins, Float_t ymax, Float_t ymin)
490 //Builds numerator and denominator histograms (2d-case)
491 TString numstr = fName + " Numerator"; //title and name of the
492 //numerator histogram
493 TString denstr = fName + " Denominator";//title and name of the
494 //denominator histogram
496 fNumerator = new TH2D(numstr.Data(),numstr.Data(),
497 nxbins,xmin,xmax,nybins,ymin,ymax);
499 fDenominator = new TH2D(denstr.Data(),denstr.Data(),
500 nxbins,xmin,xmax,nybins,ymin,ymax);
503 fDenominator->Sumw2();
505 /******************************************************************/
507 void AliHBTFunction2D::SetNumberOfBinsToScale(UInt_t xn, UInt_t yn)
509 //defines area used for scaling factor calculation
513 /******************************************************************/
515 Double_t AliHBTFunction2D::Scale()
517 // Calculates the factor that should be used to scale
518 // quatience of fNumerator and fDenominator to 1 at
520 if (AliHBTParticle::GetDebug()>0) Info("Scale","Enetered Scale()");
523 Error("Scale","No numerator");
528 Error("Scale","No denominator");
532 if( (fNBinsToScaleX < 1) || (fNBinsToScaleY < 1) )
534 Error("Scale","Number of bins for scaling is smaller thnan 1");
537 UInt_t nbinsX = fNumerator->GetNbinsX();
538 if (fNBinsToScaleX > nbinsX)
540 Error("Scale","Number of X bins for scaling is bigger thnan number of bins in histograms");
544 UInt_t nbinsY = fNumerator->GetNbinsX();
545 if (fNBinsToScaleY > nbinsY)
547 Error("Scale","Number of Y bins for scaling is bigger thnan number of bins in histograms");
551 if (AliHBTParticle::GetDebug()>0) Info("Scale","No errors detected");
553 Int_t offsetX = nbinsX - fNBinsToScaleX - 1; //bin that we start loop over bins in axis X
554 Int_t offsetY = nbinsY - fNBinsToScaleY - 1; //bin that we start loop over bins in axis X
556 Double_t densum = 0.0;
557 Double_t numsum = 0.0;
559 for (UInt_t j = offsetY; j< nbinsY; j++)
560 for (UInt_t i = offsetX; i< nbinsX; i++)
562 if ( fNumerator->GetBinContent(i,j) > 0.0 )
564 densum = fDenominator->GetBinContent(i,j);
565 numsum = fNumerator->GetBinContent(i,j);
569 if(AliHBTParticle::GetDebug() > 0)
570 Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d fNBinsToScaleY=%d",numsum,densum,fNBinsToScaleX,fNBinsToScaleY);
572 if (numsum == 0) return 0.0;
573 Double_t ret = densum/numsum;
575 if(AliHBTParticle::GetDebug() > 0) Info("Scale","returning %f",ret);
579 /******************************************************************/
580 /******************************************************************/
581 /******************************************************************/
583 //____________________
584 ///////////////////////////////////////////////////////
586 // AliHBTFunction3D //
588 // Base Calss for 3-dimensinal Functions //
590 // Piotr.Skowronski@cern.ch //
591 // http://alisoft.cern.ch/people/skowron/analyzer //
593 ///////////////////////////////////////////////////////
595 ClassImp( AliHBTFunction3D)
597 const Int_t AliHBTFunction3D::fgkDefaultNBinsX = 200;//default number of Bins in X axis in histograms
598 const Float_t AliHBTFunction3D::fgkDefaultMinX = 0.0;//Default min value of X axis in histograms
599 const Float_t AliHBTFunction3D::fgkDefaultMaxX = 1.5;//Default max value of X axis inhistograms
601 const Int_t AliHBTFunction3D::fgkDefaultNBinsY = 200;//default number of Bins in histograms
602 const Float_t AliHBTFunction3D::fgkDefaultMinY = -0.15;//Default min value of histograms
603 const Float_t AliHBTFunction3D::fgkDefaultMaxY = 0.15;//Default max value of histograms
605 const Int_t AliHBTFunction3D::fgkDefaultNBinsZ = 200;//default number of Bins in histograms
606 const Float_t AliHBTFunction3D::fgkDefaultMinZ = -0.15;//Default min value of histograms
607 const Float_t AliHBTFunction3D::fgkDefaultMaxZ = 0.15;//Default max value of histograms
609 const UInt_t AliHBTFunction3D::fgkDefaultNBinsToScaleX = 30;//Default number of X bins used for scaling to tale
610 const UInt_t AliHBTFunction3D::fgkDefaultNBinsToScaleY = 30;//Default number of bins used for scaling to tale
611 const UInt_t AliHBTFunction3D::fgkDefaultNBinsToScaleZ = 30;//Default number of bins used for scaling to tale
613 AliHBTFunction3D::AliHBTFunction3D():
616 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
617 fNBinsToScaleY(fgkDefaultNBinsToScaleY),
618 fNBinsToScaleZ(fgkDefaultNBinsToScaleZ)
622 /******************************************************************/
624 AliHBTFunction3D::AliHBTFunction3D(const Char_t *name, const Char_t *title):
625 AliHBTFunction(name,title),
628 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
629 fNBinsToScaleY(fgkDefaultNBinsToScaleY),
630 fNBinsToScaleZ(fgkDefaultNBinsToScaleZ)
634 /******************************************************************/
636 AliHBTFunction3D::AliHBTFunction3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
637 Int_t nYbins, Double_t maxYval, Double_t minYval,
638 Int_t nZbins, Double_t maxZval, Double_t minZval):
641 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
642 fNBinsToScaleY(fgkDefaultNBinsToScaleY),
643 fNBinsToScaleZ(fgkDefaultNBinsToScaleZ)
646 BuildHistos( nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval);
648 /******************************************************************/
650 AliHBTFunction3D::AliHBTFunction3D(const Char_t *name, const Char_t *title,
651 Int_t nXbins, Double_t maxXval, Double_t minXval,
652 Int_t nYbins, Double_t maxYval, Double_t minYval,
653 Int_t nZbins, Double_t maxZval, Double_t minZval):
654 AliHBTFunction(name,title),
657 fNBinsToScaleX(fgkDefaultNBinsToScaleX),
658 fNBinsToScaleY(fgkDefaultNBinsToScaleY),
659 fNBinsToScaleZ(fgkDefaultNBinsToScaleZ)
662 BuildHistos( nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval);
664 /******************************************************************/
666 AliHBTFunction3D::AliHBTFunction3D(const AliHBTFunction3D& source):
667 AliHBTFunction(source)
669 // Copy constructor needed by the coding conventions byt not used
670 Fatal("AliHBTFunction3D(const AliHBTFunction3D&)","Cpy ctor not usable.");
672 /******************************************************************/
674 AliHBTFunction3D& AliHBTFunction3D::operator= (const AliHBTFunction3D & /*source*/)
676 // Assignment needed by the coding conventions byt not used
677 Fatal("Assignment operator","not implemented");
680 /******************************************************************/
683 AliHBTFunction3D::~AliHBTFunction3D()
688 /******************************************************************/
690 void AliHBTFunction3D::BuildHistos()
692 //Creates default histograms
693 BuildHistos(fgkDefaultNBinsX,fgkDefaultMaxX,fgkDefaultMinX,
694 fgkDefaultNBinsY,fgkDefaultMaxY,fgkDefaultMinY,
695 fgkDefaultNBinsZ,fgkDefaultMaxZ,fgkDefaultMinZ);
697 /******************************************************************/
699 void AliHBTFunction3D::BuildHistos(Int_t nxbins, Float_t xmax, Float_t xmin,
700 Int_t nybins, Float_t ymax, Float_t ymin,
701 Int_t nzbins, Float_t zmax, Float_t zmin)
703 //Builds numerator and denominator histograms (3d-case)
704 TString numstr = fName + " Numerator"; //title and name of the
705 //numerator histogram
706 TString denstr = fName + " Denominator";//title and name of the
707 //denominator histogram
709 fNumerator = new TH3F(numstr.Data(),numstr.Data(),
710 nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax);
712 fDenominator = new TH3F(denstr.Data(),denstr.Data(),
713 nxbins,xmin,xmax,nybins,ymin,ymax,nzbins,zmin,zmax);
716 fDenominator->Sumw2();
719 /******************************************************************/
721 Double_t AliHBTFunction3D::Scale()
723 // Calculates the factor that should be used to scale
724 // quatience of fNumerator and fDenominator to 1 at
726 if (AliHBTParticle::GetDebug()>0) Info("Scale","Enetered Scale()");
729 Error("Scale","No numerator");
734 Error("Scale","No denominator");
738 if( (fNBinsToScaleX < 1) || (fNBinsToScaleY < 1) || (fNBinsToScaleZ < 1))
740 Error("Scale","Number of bins for scaling is smaller thnan 1");
743 UInt_t nbinsX = fNumerator->GetNbinsX();
744 if (fNBinsToScaleX > nbinsX)
746 Error("Scale","Number of X bins for scaling is bigger thnan number of bins in histograms");
750 UInt_t nbinsY = fNumerator->GetNbinsX();
751 if (fNBinsToScaleY > nbinsY)
753 Error("Scale","Number of Y bins for scaling is bigger thnan number of bins in histograms");
757 UInt_t nbinsZ = fNumerator->GetNbinsZ();
758 if (fNBinsToScaleZ > nbinsZ)
760 Error("Scale","Number of Z bins for scaling is bigger thnan number of bins in histograms");
764 if (AliHBTParticle::GetDebug()>0) Info("Scale","No errors detected");
766 Int_t offsetX = nbinsX - fNBinsToScaleX - 1; //bin that we start loop over bins in axis X
767 Int_t offsetY = nbinsY - fNBinsToScaleY - 1; //bin that we start loop over bins in axis Y
768 Int_t offsetZ = nbinsZ - fNBinsToScaleZ - 1; //bin that we start loop over bins in axis Z
770 Double_t densum = 0.0;
771 Double_t numsum = 0.0;
773 for (UInt_t k = offsetZ; k<nbinsZ; k++)
774 for (UInt_t j = offsetY; j<nbinsY; j++)
775 for (UInt_t i = offsetX; i<nbinsX; i++)
777 if ( fNumerator->GetBinContent(i,j,k) > 0.0 )
780 densum = fDenominator->GetBinContent(i,j,k);
781 numsum = fNumerator->GetBinContent(i,j,k);
785 if(AliHBTParticle::GetDebug() > 0)
786 Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d fNBinsToScaleY=%d fNBinsToScaleZ=%d",
787 numsum,densum,fNBinsToScaleX,fNBinsToScaleY,fNBinsToScaleZ);
789 if (numsum == 0) return 0.0;
790 Double_t ret = densum/numsum;
792 if(AliHBTParticle::GetDebug() > 0) Info("Scale","returning %f",ret);
795 /******************************************************************/
797 void AliHBTFunction3D::SetNumberOfBinsToScale(UInt_t xn, UInt_t yn,UInt_t zn)
799 //sets up the volume to be used for scaling to tail
805 /******************************************************************/
806 /******************************************************************/
807 /******************************************************************/
808 /******************************************************************/
809 /******************************************************************/
810 /******************************************************************/
811 /******************************************************************/
812 /******************************************************************/
813 /******************************************************************/
815 //____________________
816 ///////////////////////////////////////////////////////
818 // AliHBTOnePairFctn1D //
820 // Base Calss for 1-dimensinal Functions that need //
821 // one pair to fill function //
823 // Piotr.Skowronski@cern.ch //
824 // http://alisoft.cern.ch/people/skowron/analyzer //
826 ///////////////////////////////////////////////////////
828 ClassImp( AliHBTOnePairFctn1D )
829 /******************************************************************/
831 AliHBTOnePairFctn1D::AliHBTOnePairFctn1D(Int_t nbins, Float_t maxXval, Float_t minXval):
832 AliHBTFunction1D(nbins,maxXval,minXval)
836 /******************************************************************/
838 AliHBTOnePairFctn1D::AliHBTOnePairFctn1D(const Char_t *name, const Char_t *title):
839 AliHBTFunction1D(name,title)
843 /******************************************************************/
845 AliHBTOnePairFctn1D::AliHBTOnePairFctn1D(const Char_t *name, const Char_t *title,
846 Int_t nbins, Float_t maxXval, Float_t minXval):
847 AliHBTFunction1D(name,title,nbins,maxXval,minXval)
851 /******************************************************************/
853 void AliHBTOnePairFctn1D::ProcessSameEventParticles(AliHBTPair* pair)
855 //Fills the numerator using pair from the same event
856 pair = CheckPair(pair);
857 if(pair) fNumerator->Fill(GetValue(pair));
859 /******************************************************************/
860 void AliHBTOnePairFctn1D::ProcessDiffEventParticles(AliHBTPair* pair)
862 //Fills the denumerator using mixed pairs
863 pair = CheckPair(pair);
864 if(pair) fDenominator->Fill(GetValue(pair));
867 /******************************************************************/
868 /******************************************************************/
869 /******************************************************************/
871 //____________________
872 ///////////////////////////////////////////////////////
874 // AliHBTOnePairFctn2D //
876 // Base Calss for 2-dimensinal Functions that need //
877 // one pair to fill function //
879 // Piotr.Skowronski@cern.ch //
880 // http://alisoft.cern.ch/people/skowron/analyzer //
882 ///////////////////////////////////////////////////////
884 ClassImp( AliHBTOnePairFctn2D )
885 /******************************************************************/
887 AliHBTOnePairFctn2D::AliHBTOnePairFctn2D(const Char_t *name, const Char_t *title):
888 AliHBTFunction2D(name,title)
892 /******************************************************************/
894 AliHBTOnePairFctn2D::AliHBTOnePairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval,
895 Int_t nYbins, Double_t maxYval, Double_t minYval):
896 AliHBTFunction2D(nXbins, maxXval, minXval, nYbins, maxYval, minYval)
900 /******************************************************************/
902 AliHBTOnePairFctn2D::AliHBTOnePairFctn2D(const Char_t *name, const Char_t *title,
903 Int_t nXbins, Double_t maxXval, Double_t minXval,
904 Int_t nYbins, Double_t maxYval, Double_t minYval):
905 AliHBTFunction2D(name,title, nXbins, maxXval, minXval, nYbins, maxYval, minYval)
909 /******************************************************************/
911 void AliHBTOnePairFctn2D::ProcessSameEventParticles(AliHBTPair* pair)
913 // Fills the numerator using pairs from the same event
914 pair = CheckPair(pair);
919 fNumerator->Fill(x,y);
922 /******************************************************************/
924 void AliHBTOnePairFctn2D::ProcessDiffEventParticles(AliHBTPair* pair)
926 // Fills the denumerator using mixed pairs
927 pair = CheckPair(pair);
932 fDenominator->Fill(x,y);
935 /******************************************************************/
936 /******************************************************************/
937 /******************************************************************/
938 /******************************************************************/
939 //____________________
940 ///////////////////////////////////////////////////////
942 // AliHBTOnePairFctn3D //
944 // Base Calss for 3-dimensinal Functions that need //
945 // one pair to fill function //
947 // Piotr.Skowronski@cern.ch //
948 // http://alisoft.cern.ch/people/skowron/analyzer //
950 ///////////////////////////////////////////////////////
951 ClassImp( AliHBTOnePairFctn3D)
953 /******************************************************************/
955 AliHBTOnePairFctn3D::AliHBTOnePairFctn3D(const Char_t *name, const Char_t *title):
956 AliHBTFunction3D(name,title)
960 /******************************************************************/
962 AliHBTOnePairFctn3D::AliHBTOnePairFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
963 Int_t nYbins, Double_t maxYval, Double_t minYval,
964 Int_t nZbins, Double_t maxZval, Double_t minZval):
965 AliHBTFunction3D(nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval)
969 /******************************************************************/
971 AliHBTOnePairFctn3D::AliHBTOnePairFctn3D(const Char_t *name, const Char_t *title,
972 Int_t nXbins, Double_t maxXval, Double_t minXval,
973 Int_t nYbins, Double_t maxYval, Double_t minYval,
974 Int_t nZbins, Double_t maxZval, Double_t minZval):
975 AliHBTFunction3D(name,title,nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval)
979 /******************************************************************/
981 void AliHBTOnePairFctn3D::ProcessSameEventParticles(AliHBTPair* pair)
983 //Reacts on pair coming from same event (real pairs)
984 //and fills numerator histogram
985 pair = CheckPair(pair);
989 GetValues(pair,x,y,z);
990 fNumerator->Fill(x,y,z);
993 /******************************************************************/
995 void AliHBTOnePairFctn3D::ProcessDiffEventParticles(AliHBTPair* pair)
997 //Reacts on pair coming from different events (mixed pairs)
998 //and fills denominator histogram
999 pair = CheckPair(pair);
1003 GetValues(pair,x,y,z);
1004 fDenominator->Fill(x,y,z);
1008 /******************************************************************/
1009 /******************************************************************/
1010 /******************************************************************/
1012 //____________________
1013 ///////////////////////////////////////////////////////
1015 // AliHBTTwoPairFctn1D //
1017 // Base Calss for 1-dimensinal Functions that need //
1018 // two pair (simulated and reconstructed) //
1019 // to fill function //
1021 // Piotr.Skowronski@cern.ch //
1022 // http://alisoft.cern.ch/people/skowron/analyzer //
1024 ///////////////////////////////////////////////////////
1025 ClassImp(AliHBTTwoPairFctn1D)
1026 /******************************************************************/
1028 AliHBTTwoPairFctn1D::AliHBTTwoPairFctn1D(Int_t nbins, Float_t maxXval, Float_t minXval):
1029 AliHBTFunction1D(nbins,maxXval,minXval)
1033 /******************************************************************/
1035 AliHBTTwoPairFctn1D::AliHBTTwoPairFctn1D(const Char_t *name, const Char_t *title):
1036 AliHBTFunction1D(name,title)
1040 /******************************************************************/
1042 AliHBTTwoPairFctn1D::AliHBTTwoPairFctn1D(const Char_t *name, const Char_t *title,
1043 Int_t nbins, Float_t maxXval, Float_t minXval):
1044 AliHBTFunction1D(name,title,nbins,maxXval,minXval)
1048 /******************************************************************/
1050 void AliHBTTwoPairFctn1D::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1052 // Fills the numerator using pairs from the same event
1053 partpair = CheckPair(partpair);
1054 if( partpair == 0x0) return;
1056 if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair
1057 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1059 Double_t x = GetValue(trackpair,partpair);
1060 fNumerator->Fill(x);
1062 /******************************************************************/
1064 void AliHBTTwoPairFctn1D::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1066 // Fills the denumerator usin mixed pairs
1067 partpair = CheckPair(partpair);
1068 if( partpair == 0x0) return;
1070 if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair
1071 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1073 Double_t x = GetValue(trackpair,partpair);
1074 fDenominator->Fill(x);
1076 /******************************************************************/
1077 /******************************************************************/
1078 /******************************************************************/
1080 //____________________
1081 ///////////////////////////////////////////////////////
1083 // AliHBTTwoPairFctn2D //
1085 // Base Calss for 2-dimensinal Functions that need //
1086 // two pair (simulated and reconstructed) //
1087 // to fill function //
1089 // Piotr.Skowronski@cern.ch //
1090 // http://alisoft.cern.ch/people/skowron/analyzer //
1092 ///////////////////////////////////////////////////////
1094 ClassImp(AliHBTTwoPairFctn2D)
1096 /******************************************************************/
1098 AliHBTTwoPairFctn2D::AliHBTTwoPairFctn2D(const Char_t *name, const Char_t *title):
1099 AliHBTFunction2D(name,title)
1103 /******************************************************************/
1105 AliHBTTwoPairFctn2D::AliHBTTwoPairFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval,
1106 Int_t nYbins, Double_t maxYval, Double_t minYval):
1107 AliHBTFunction2D(nXbins, maxXval, minXval, nYbins, maxYval, minYval)
1111 /******************************************************************/
1113 AliHBTTwoPairFctn2D::AliHBTTwoPairFctn2D(const Char_t *name, const Char_t *title,
1114 Int_t nXbins, Double_t maxXval, Double_t minXval,
1115 Int_t nYbins, Double_t maxYval, Double_t minYval):
1116 AliHBTFunction2D(name,title,nXbins, maxXval, minXval, nYbins, maxYval, minYval)
1120 /******************************************************************/
1122 void AliHBTTwoPairFctn2D::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1124 //processes pair of particles coming from a same events (real pair)
1125 partpair = CheckPair(partpair); //check cuts
1126 if (partpair == 0x0) return;
1128 if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair
1129 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1132 GetValues(trackpair,partpair,x,y);
1133 fNumerator->Fill(x,y);
1135 /******************************************************************/
1137 void AliHBTTwoPairFctn2D::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1139 //processes pair of particles coming from a different events (mixed pair)
1140 partpair = CheckPair(partpair);
1141 if (partpair == 0x0) return;
1143 if (partpair->GetSwapedPair() == 0x0)//it means that Check pair returned swapped pair
1144 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1147 GetValues(trackpair,partpair,x,y);
1148 fDenominator->Fill(x,y);
1151 /******************************************************************/
1152 /******************************************************************/
1153 /******************************************************************/
1155 //____________________
1156 ///////////////////////////////////////////////////////
1158 // AliHBTTwoPairFctn3D //
1160 // Base Calss for 3-dimensinal Functions that need //
1161 // two pair (simulated and reconstructed) //
1162 // to fill function //
1164 // Piotr.Skowronski@cern.ch //
1165 // http://alisoft.cern.ch/people/skowron/analyzer //
1167 ///////////////////////////////////////////////////////
1169 ClassImp(AliHBTTwoPairFctn3D)
1171 /******************************************************************/
1173 AliHBTTwoPairFctn3D::AliHBTTwoPairFctn3D(const Char_t *name, const Char_t *title):
1174 AliHBTFunction3D(name,title)
1178 /******************************************************************/
1180 AliHBTTwoPairFctn3D::AliHBTTwoPairFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
1181 Int_t nYbins, Double_t maxYval, Double_t minYval,
1182 Int_t nZbins, Double_t maxZval, Double_t minZval):
1183 AliHBTFunction3D(nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval)
1187 /******************************************************************/
1189 AliHBTTwoPairFctn3D::AliHBTTwoPairFctn3D(const Char_t *name, const Char_t *title,
1190 Int_t nXbins, Double_t maxXval, Double_t minXval,
1191 Int_t nYbins, Double_t maxYval, Double_t minYval,
1192 Int_t nZbins, Double_t maxZval, Double_t minZval):
1193 AliHBTFunction3D(name,title,nXbins, maxXval, minXval, nYbins, maxYval, minYval, nZbins, maxZval, minZval)
1197 /******************************************************************/
1199 void AliHBTTwoPairFctn3D::ProcessSameEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1201 // Fills th numerator using pairs from the same event
1202 partpair = CheckPair(partpair);
1203 if( partpair == 0x0) return;
1205 if (partpair->GetSwapedPair() == 0x0)//it means that CheckPair returned swapped pair
1206 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1209 GetValues(trackpair,partpair,x,y,z);
1210 fNumerator->Fill(x,y,z);
1213 /******************************************************************/
1215 void AliHBTTwoPairFctn3D::ProcessDiffEventParticles(AliHBTPair* trackpair, AliHBTPair* partpair)
1217 // Fills the denumerator using mixed pairs
1218 partpair = CheckPair(partpair);
1219 if( partpair == 0x0) return;
1221 if (partpair->GetSwapedPair() == 0x0)//it means that CheckPair returned swapped pair
1222 trackpair = trackpair->GetSwapedPair();//so the track pair must be swapped as well
1225 GetValues(trackpair,partpair,x,y,z);
1226 fDenominator->Fill(x,y,z);
1229 /******************************************************************/
1230 /******************************************************************/
1231 /******************************************************************/