AliPhysics  8195daa (8195daa)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliHFInvMassFitter.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2019, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 #include <TH1F.h>
17 #include <TF1.h>
18 #include <TMath.h>
19 #include <TVirtualFitter.h>
20 #include <TDatabasePDG.h>
21 #include <TCanvas.h>
22 #include <TStyle.h>
23 #include <TPaveText.h>
24 
25 #include "AliLog.h"
26 #include "AliVertexingHFUtils.h"
27 #include "AliHFInvMassFitter.h"
28 
32 
48 
49 //__________________________________________________________________________
51  TNamed(),
52  fHistoInvMass(0x0),
53  fMinMass(0),
54  fMaxMass(5),
55  fTypeOfFit4Bkg(kExpo),
56  fPolDegreeBkg(4),
57  fCurPolDegreeBkg(-1),
58  fMassParticle(1.864),
59  fTypeOfFit4Sgn(kGaus),
60  fMass(1.865),
61  fMassErr(0.),
62  fSigmaSgn(0.012),
63  fSigmaSgnErr(0.),
64  fFixedMean(kFALSE),
65  fFixedSigma(kFALSE),
66  fFixedRawYield(-1.),
67  fNParsSig(3),
68  fNParsBkg(2),
69  fOnlySideBands(kFALSE),
70  fNSigma4SideBands(4.),
71  fFitOption("L,E"),
72  fRawYield(0.),
73  fRawYieldErr(0.),
74  fSigFunc(0x0),
75  fBkgFuncSb(0x0),
76  fBkgFunc(0x0),
77  fBkgFuncRefit(0x0),
78  fReflections(kFALSE),
79  fNParsRfl(0),
80  fRflOverSig(0),
81  fFixRflOverSig(kFALSE),
82  fHistoTemplRfl(0x0),
83  fSmoothRfl(kFALSE),
84  fRawYieldHelp(0),
85  fRflFunc(0x0),
86  fBkRFunc(0x0),
87  fSecondPeak(kFALSE),
88  fNParsSec(0),
89  fSecMass(-999.),
90  fSecWidth(9999.),
91  fFixSecMass(kFALSE),
92  fFixSecWidth(kFALSE),
93  fSecFunc(0x0),
94  fTotFunc(0x0)
95 {
97 }
98 
99 //__________________________________________________________________________
100 AliHFInvMassFitter::AliHFInvMassFitter(const TH1F *histoToFit, Double_t minvalue, Double_t maxvalue, Int_t fittypeb, Int_t fittypes):
101  TNamed(),
102  fHistoInvMass(0x0),
103  fMinMass(minvalue),
104  fMaxMass(maxvalue),
105  fTypeOfFit4Bkg(fittypeb),
106  fPolDegreeBkg(4),
107  fCurPolDegreeBkg(-1),
108  fMassParticle(1.864),
109  fTypeOfFit4Sgn(fittypes),
110  fMass(1.865),
111  fMassErr(0.),
112  fSigmaSgn(0.012),
113  fSigmaSgnErr(0.),
114  fFixedMean(kFALSE),
115  fFixedSigma(kFALSE),
116  fFixedRawYield(-1.),
117  fNParsSig(3),
118  fNParsBkg(2),
119  fOnlySideBands(kFALSE),
120  fNSigma4SideBands(4.),
121  fFitOption("L,E"),
122  fRawYield(0.),
123  fRawYieldErr(0.),
124  fSigFunc(0x0),
125  fBkgFuncSb(0x0),
126  fBkgFunc(0x0),
127  fBkgFuncRefit(0x0),
128  fReflections(kFALSE),
129  fNParsRfl(0),
130  fRflOverSig(0),
131  fFixRflOverSig(kFALSE),
132  fHistoTemplRfl(0x0),
133  fSmoothRfl(kFALSE),
134  fRawYieldHelp(0),
135  fRflFunc(0x0),
136  fBkRFunc(0x0),
137  fSecondPeak(kFALSE),
138  fNParsSec(0),
139  fSecMass(-999.),
140  fSecWidth(9999.),
141  fFixSecMass(kFALSE),
142  fFixSecWidth(kFALSE),
143  fSecFunc(0x0),
144  fTotFunc(0x0)
145 {
147  fHistoInvMass=(TH1F*)histoToFit->Clone("fHistoInvMass");
148  fHistoInvMass->SetDirectory(0);
150 }
151 //_________________________________________________________________________
153 
155 
156  delete fHistoInvMass;
157  delete fSigFunc;
158  delete fBkgFunc;
159  delete fBkgFuncSb;
160  delete fBkgFuncRefit;
161  delete fRflFunc;
162  delete fBkRFunc;
163  delete fSecFunc;
164  delete fTotFunc;
165  delete fHistoTemplRfl;
166 
167 }
168 //__________________________________________________________________________
172 
173  switch (fTypeOfFit4Bkg) {
174  case 0:
175  fNParsBkg=2;
176  break;
177  case 1:
178  fNParsBkg=2;
179  break;
180  case 2:
181  fNParsBkg=3;
182  break;
183  case 3:
184  fNParsBkg=1;
185  break;
186  case 4:
187  fNParsBkg=2;
188  break;
189  case 5:
190  fNParsBkg=3;
191  break;
192  case 6:
194  break;
195  default:
196  AliError("Error in computing fNParsBkg: check fTypeOfFit4Bkg");
197  break;
198  }
199 
200  switch (fTypeOfFit4Sgn) {
201  case 0:
202  fNParsSig=3;
203  break;
204  case 1:
205  fNParsSig=5;
206  break;
207  default:
208  AliError("Error in computing fNParsSig: check fTypeOfFit4Sgn");
209  break;
210  }
211 
212  if(fReflections) fNParsRfl=1;
213  else fNParsSec=0;
214 
215  if(fSecondPeak) fNParsSec=3;
216  else fNParsSec=0;
217 
218 }
219 //__________________________________________________________________________
223 
224  TVirtualFitter::SetDefaultFitter("Minuit");
225 
226  Double_t integralHisto=fHistoInvMass->Integral(fHistoInvMass->FindBin(fMinMass),fHistoInvMass->FindBin(fMaxMass),"width");
227 
228  fOnlySideBands = kTRUE;
229  fBkgFuncSb = CreateBackgroundFitFunction("funcbkgsb",integralHisto);
230  Int_t status=-1;
231  printf("\n--- First fit with only background on the side bands - Exclusion region = %.2f sigma ---\n",fNSigma4SideBands);
232  if(fTypeOfFit4Bkg==6){
234  fHistoInvMass->GetListOfFunctions()->Add(fBkgFuncSb);
235  fHistoInvMass->GetFunction(fBkgFuncSb->GetName())->SetBit(1<<9,kTRUE);
236  status=0;
237  }
238  }
239  else status=fHistoInvMass->Fit("funcbkgsb",Form("R,%s,+,0",fFitOption.Data()));
240  fBkgFuncSb->SetLineColor(kGray+1);
241  if (status != 0){
242  printf(" ---> Failed first fit with only background, minuit status = %d\n",status);
243  return kFALSE;
244  }
245 
246  fOnlySideBands = kFALSE;
247  if(!fBkgFunc){
248  fBkgFunc = CreateBackgroundFitFunction("funcbkg",integralHisto);
249  for(Int_t ipar=0; ipar<fNParsBkg; ipar++) fBkgFunc->SetParameter(ipar,fBkgFuncSb->GetParameter(ipar));
250  }
251  fBkgFunc->SetLineColor(kGray+1);
252 
253  printf("\n--- Estimate signal counts in the peak region ---\n");
254  Double_t estimSignal=CheckForSignal(fMass,fSigmaSgn);
255  if(estimSignal<0.){
256  if(draw) DrawFit();
257  return kTRUE;
258  }
259 
260  printf("\n--- Final fit with signal+background on the full range ---\n");
261  fRawYieldHelp=estimSignal; // needed for reflection normalization
262  if(!fBkgFuncRefit){
263  fBkgFuncRefit = CreateBackgroundFitFunction("funcbkgrefit",integralHisto);
264  for(Int_t ipar=0; ipar<fNParsBkg; ipar++) fBkgFuncRefit->SetParameter(ipar,fBkgFunc->GetParameter(ipar));
265  }
266  fBkgFuncRefit->SetLineColor(2);
267  fSigFunc = CreateSignalFitFunction("fsigfit",estimSignal);
268  if(fSecondPeak){
269  printf(" ---> Final fit includes a second inv. mass peak\n");
271  fSecFunc = CreateSecondPeakFunction("fsecpeak",estimSec);
272  }
273  if(fReflections){
274  printf(" ---> Final fit includes reflections\n");
275  fRflFunc = CreateReflectionFunction("freflect");
277  }
278  fTotFunc = CreateTotalFitFunction("funcmass");
279  status=fHistoInvMass->Fit("funcmass",Form("R,%s,+,0",fFitOption.Data()));
280  if (status != 0){
281  printf(" ---> Failed fit with signal+background, minuit status = %d\n",status);
282  return kFALSE;
283  }
284  for(Int_t ipar=0; ipar<fNParsBkg; ipar++) fBkgFuncRefit->SetParameter(ipar,fTotFunc->GetParameter(ipar));
285  for(Int_t ipar=0; ipar<fNParsSig; ipar++) fSigFunc->SetParameter(ipar,fTotFunc->GetParameter(ipar+fNParsBkg));
286  if(fSecondPeak){
287  for(Int_t ipar=0; ipar<fNParsSec; ipar++)fSecFunc->SetParameter(ipar,fTotFunc->GetParameter(ipar+fNParsBkg+fNParsSig));
288  fSecFunc->SetLineColor(kMagenta+1);
289  fSecFunc->SetLineStyle(3);
290  }
291  if(fReflections){
292  for(Int_t ipar=0; ipar<fNParsRfl; ipar++){
293  fRflFunc->SetParameter(ipar,fTotFunc->GetParameter(ipar+fNParsBkg+fNParsSig+fNParsSec));
294  fRflFunc->SetParError(ipar,fTotFunc->GetParError(ipar+fNParsBkg+fNParsSig+fNParsSec));
295  fBkRFunc->SetParameter(ipar+fNParsBkg,fTotFunc->GetParameter(ipar+fNParsBkg+fNParsSig+fNParsSec));
296  }
297  for(Int_t ipar=0; ipar<fNParsBkg; ipar++) fBkRFunc->SetParameter(ipar,fTotFunc->GetParameter(ipar));
298  fRflFunc->SetLineColor(kGreen+1);
299  fBkRFunc->SetLineColor(kRed+1);
300  fBkRFunc->SetLineStyle(7);
301  }
302  fMass=fSigFunc->GetParameter(1);
303  fMassErr=fSigFunc->GetParError(1);
304  fSigmaSgn=fSigFunc->GetParameter(2);
305  fSigmaSgnErr=fSigFunc->GetParError(2);
306  fTotFunc->SetLineColor(4);
307  fRawYield=fTotFunc->GetParameter(fNParsBkg)/fHistoInvMass->GetBinWidth(1);
308  fRawYieldErr=fTotFunc->GetParError(fNParsBkg)/fHistoInvMass->GetBinWidth(1);
310  if(draw) DrawFit();
311  return kTRUE;
312 }
313 //______________________________________________________________________________
317 
318  TCanvas* c0=new TCanvas("c0");
319  DrawHere(c0);
320 }
321 //______________________________________________________________________________
322 void AliHFInvMassFitter::DrawHere(TVirtualPad* c){
325 
326  gStyle->SetOptStat(0);
327  gStyle->SetCanvasColor(0);
328  gStyle->SetFrameFillColor(0);
329  c->cd();
330  fHistoInvMass->GetXaxis()->SetRangeUser(fMinMass,fMaxMass);
331  fHistoInvMass->SetMarkerStyle(20);
332  fHistoInvMass->SetMinimum(0.);
333  fHistoInvMass->Draw("PE");
334  if(fBkgFunc) fBkgFunc->Draw("same");
335  if(fBkgFuncRefit) fBkgFuncRefit->Draw("same");
336  if(fBkRFunc) fBkRFunc->Draw("same");
337  if(fRflFunc) fRflFunc->Draw("same");
338  if(fSecFunc) fSecFunc->Draw("same");
339  if(fTotFunc) fTotFunc->Draw("same");
340  TPaveText *pinfos=new TPaveText(0.12,0.65,0.47,0.89,"NDC");
341  TPaveText *pinfom=new TPaveText(0.6,0.7,1.,.87,"NDC");
342  pinfos->SetBorderSize(0);
343  pinfos->SetFillStyle(0);
344  pinfom->SetBorderSize(0);
345  pinfom->SetFillStyle(0);
346  if(fTotFunc){
347  pinfom->SetTextColor(kBlue);
348  for(Int_t ipar=1; ipar<fNParsSig; ipar++){
349  pinfom->AddText(Form("%s = %.3f #pm %.3f",fTotFunc->GetParName(ipar+fNParsBkg),fTotFunc->GetParameter(ipar+fNParsBkg),fTotFunc->GetParError(ipar+fNParsBkg)));
350  }
351  pinfom->Draw();
352 
353  Double_t nsigma=3;
354  Double_t bkg,errbkg;
355  Background(nsigma,bkg,errbkg);
356  Double_t signif,errsignif;
357  Significance(nsigma,signif,errsignif);
358 
359  pinfos->AddText(Form("S = %.0f #pm %.0f ",fRawYield,fRawYieldErr));
360  pinfos->AddText(Form("B (%.0f#sigma) = %.0f #pm %.0f",nsigma,bkg,errbkg));
361  pinfos->AddText(Form("S/B = (%.0f#sigma) %.4f ",nsigma,fRawYield/bkg));
362  if(fRflFunc) pinfos->AddText(Form("Refl/Sig = %.3f #pm %.3f ",fRflFunc->GetParameter(0),fRflFunc->GetParError(0)));
363  pinfos->AddText(Form("Signif (%.0f#sigma) = %.1f #pm %.1f ",nsigma,signif,errsignif));
364  pinfos->Draw();
365  }
366  c->Update();
367  return;
368 }
369 //______________________________________________________________________________
373 
374  Double_t minForSig=mean-4.*sigma;
375  Double_t maxForSig=mean+4.*sigma;
376  Int_t binForMinSig=fHistoInvMass->FindBin(minForSig);
377  Int_t binForMaxSig=fHistoInvMass->FindBin(maxForSig);
378  Double_t sum=0.;
379  Double_t sumback=0.;
380  fBkgFunc->Print();
381  for(Int_t ibin=binForMinSig; ibin<=binForMaxSig; ibin++){
382  sum+=fHistoInvMass->GetBinContent(ibin);
383  sumback+=fBkgFunc->Eval(fHistoInvMass->GetBinCenter(ibin));
384  }
385  Double_t diffUnderPeak=(sum-sumback);
386  printf(" ---> IntegralUnderFitFunc=%f IntegralUnderHisto=%f EstimatedSignal=%f\n",sum,sumback,diffUnderPeak);
387  if(diffUnderPeak/TMath::Sqrt(sum)<1.){
388  printf(" ---> (Tot-Bkg)/sqrt(Tot)=%f ---> Likely no signal/\n",diffUnderPeak/TMath::Sqrt(sum));
389  return -1;
390  }
391  return diffUnderPeak*fHistoInvMass->GetBinWidth(1);
392 }
393 
394 //______________________________________________________________________________
398 
400  TF1* funcbkg = new TF1(fname.Data(),this,&AliHFInvMassFitter::FitFunction4Bkg,fMinMass,fMaxMass,fNParsBkg,"AliHFInvMassFitter","FitFunction4Bkg");
401  switch (fTypeOfFit4Bkg) {
402  case 0: //gaus+expo
403  funcbkg->SetParNames("BkgInt","Slope");
404  funcbkg->SetParameters(integral,-2.);
405  break;
406  case 1:
407  funcbkg->SetParNames("BkgInt","Slope");
408  funcbkg->SetParameters(integral,-100.);
409  break;
410  case 2:
411  funcbkg->SetParNames("BkgInt","Coef1","Coef2");
412  funcbkg->SetParameters(integral,-10.,5);
413  break;
414  case 3:
415  funcbkg->SetParNames("Const");
416  funcbkg->SetParameter(0,0.);
417  funcbkg->FixParameter(0,0.);
418  break;
419  case 4:
420  funcbkg->SetParNames("BkgInt","Coef1");
421  funcbkg->SetParameters(integral,0.5);
422  break;
423  case 5:
424  funcbkg->SetParNames("BkgInt","Coef1","Coef2");
425  funcbkg->SetParameters(integral,-10.,5.);
426  break;
427  case 6:
428  for(Int_t j=0;j<fNParsBkg; j++){
429  funcbkg->SetParName(j,Form("Coef%d",j));
430  funcbkg->SetParameter(j,0);
431  }
432  funcbkg->SetParameter(0,integral);
433  break;
434  default:
435  AliError(Form("Wrong choice of fTypeOfFit4Bkg (%d)",fTypeOfFit4Bkg));
436  delete funcbkg;
437  return 0x0;
438  break;
439  }
440  funcbkg->SetLineColor(kBlue+3);
441  return funcbkg;
442 }
443 //______________________________________________________________________________
447 
448  TF1* funcsec = new TF1(fname.Data(),this,&AliHFInvMassFitter::FitFunction4SecPeak,fMinMass,fMaxMass,3,"AliHFInvMassFitter","FitFunction4SecPeak");
449  funcsec->SetParameter(0,integsig);
450  funcsec->SetParameter(1,fSecMass);
451  if(fFixSecMass) funcsec->FixParameter(1,fSecMass);
452  funcsec->SetParameter(2,fSecWidth);
453  if(fFixSecWidth) funcsec->FixParameter(2,fSecWidth);
454  funcsec->SetParNames("SecPeakInt","SecMean","SecSigma");
455  return funcsec;
456 }
457 //______________________________________________________________________________
461  TF1* funcrfl = new TF1(fname.Data(),this,&AliHFInvMassFitter::FitFunction4Refl,fMinMass,fMaxMass,1,"AliHFInvMassFitter","FitFunction4Refl");
462  funcrfl->SetParameter(0,fRflOverSig);
463  funcrfl->SetParLimits(0,0.,1.);
464  if(fFixRflOverSig) funcrfl->FixParameter(0,fRflOverSig);
465  funcrfl->SetParNames("ReflOverS");
466  return funcrfl;
467 }
468 //______________________________________________________________________________
473  Int_t totParams=fNParsBkg+fNParsRfl;
474  TF1* fbr=new TF1(fname.Data(),this,&AliHFInvMassFitter::FitFunction4BkgAndRefl,fMinMass,fMaxMass,totParams,"AliHFInvMassFitter","FitFunction4BkgAndRefl");
475  for(Int_t ipar=0; ipar<fNParsBkg; ipar++){
476  fbr->SetParameter(ipar,fBkgFunc->GetParameter(ipar));
477  fbr->SetParName(ipar,fBkgFunc->GetParName(ipar));
478  }
479  for(Int_t ipar=0; ipar<fNParsRfl; ipar++){
480  fbr->SetParameter(ipar+fNParsBkg,fRflFunc->GetParameter(ipar));
481  fbr->SetParName(ipar+fNParsBkg,fRflFunc->GetParName(ipar));
482  // par limits not set because this function is not used for fitting but only for drawing
483  }
484  return fbr;
485 }
486 //______________________________________________________________________________
490 
492  TF1* funcsig = new TF1(fname.Data(),this,&AliHFInvMassFitter::FitFunction4Sgn,fMinMass,fMaxMass,fNParsSig,"AliHFInvMassFitter","FitFunction4Sgn");
493  if(fTypeOfFit4Sgn==kGaus){
494  funcsig->SetParameter(0,integsig);
495  if(fFixedRawYield>-0.1) funcsig->FixParameter(0,fFixedRawYield);
496  funcsig->SetParameter(1,fMass);
497  if(fFixedMean) funcsig->FixParameter(1,fMass);
498  funcsig->SetParameter(2,fSigmaSgn);
499  if(fFixedSigma) funcsig->FixParameter(2,fSigmaSgn);
500  funcsig->SetParNames("SgnInt","Mean","Sigma");
501  }
502  if(fTypeOfFit4Sgn==k2Gaus){
503  funcsig->SetParameter(0,integsig);
504  if(fFixedRawYield>-0.1) funcsig->FixParameter(0,fFixedRawYield);
505  funcsig->SetParameter(1,fMass);
506  if(fFixedMean) funcsig->FixParameter(1,fMass);
507  funcsig->SetParameter(2,fSigmaSgn);
508  funcsig->SetParLimits(2,0.004,0.05);
509  if(fFixedSigma) funcsig->FixParameter(2,fSigmaSgn);
510  funcsig->SetParameter(3,0.2);
511  funcsig->SetParLimits(3,0.,1.);
512  funcsig->SetParameter(4,fSigmaSgn);
513  funcsig->SetParLimits(4,0.004,0.05);
514  funcsig->SetParNames("SgnInt","Mean","Sigma1","Frac","Sigma2");
515  }
516  return funcsig;
517 }
518 
519 //______________________________________________________________________________
523 
526  TF1* ftot=ftot=new TF1(fname.Data(),this,&AliHFInvMassFitter::FitFunction4Mass,fMinMass,fMaxMass,totParams,"AliHFInvMassFitter","FitFunction4Mass");
527  for(Int_t ipar=0; ipar<fNParsBkg; ipar++){
528  ftot->SetParameter(ipar,fBkgFunc->GetParameter(ipar));
529  ftot->SetParName(ipar,fBkgFunc->GetParName(ipar));
530  }
531  for(Int_t ipar=0; ipar<fNParsSig; ipar++){
532  ftot->SetParameter(ipar+fNParsBkg,fSigFunc->GetParameter(ipar));
533  ftot->SetParName(ipar+fNParsBkg,fSigFunc->GetParName(ipar));
534  Double_t parmin,parmax;
535  fSigFunc->GetParLimits(ipar,parmin,parmax);
536  ftot->SetParLimits(ipar+fNParsBkg,parmin,parmax);
537  }
538  if(fSecondPeak && fSecFunc){
539  for(Int_t ipar=0; ipar<fNParsSec; ipar++){
540  ftot->SetParameter(ipar+fNParsBkg+fNParsSig,fSecFunc->GetParameter(ipar));
541  ftot->SetParName(ipar+fNParsBkg+fNParsSig,fSecFunc->GetParName(ipar));
542  Double_t parmin,parmax;
543  fSecFunc->GetParLimits(ipar,parmin,parmax);
544  ftot->SetParLimits(ipar+fNParsBkg+fNParsSig,parmin,parmax);
545  }
546  }
547  if(fReflections && fRflFunc){
548  for(Int_t ipar=0; ipar<fNParsRfl; ipar++){
549  ftot->SetParameter(ipar+fNParsBkg+fNParsSig+fNParsSec,fRflFunc->GetParameter(ipar));
550  ftot->SetParName(ipar+fNParsBkg+fNParsSig+fNParsSec,fRflFunc->GetParName(ipar));
551  Double_t parmin,parmax;
552  fRflFunc->GetParLimits(ipar,parmin,parmax);
553  ftot->SetParLimits(ipar+fNParsBkg+fNParsSig+fNParsSec,parmin,parmax);
554  }
555  }
556  return ftot;
557 }
558 //__________________________________________________________________________
562 
564  if(fOnlySideBands && TMath::Abs(x[0]-fMass) < maxDeltaM) {
565  TF1::RejectPoint();
566  return 0;
567  }
568  if(fOnlySideBands && fSecondPeak && TMath::Abs(x[0]-fSecMass) < (fNSigma4SideBands*fSecWidth)){
569  TF1::RejectPoint();
570  return 0;
571  }
572  Double_t total=0;
573 
574  switch (fTypeOfFit4Bkg){
575  case 0:
576  //exponential
577  //exponential = A*exp(B*x) -> integral(exponential)=A/B*exp(B*x)](min,max)
578  //-> A = B*integral/(exp(B*max)-exp(B*min)) where integral can be written
579  //as integralTot- integralGaus (=par [2])
580  //Par:
581  // * [0] = integralBkg;
582  // * [1] = B;
583  //exponential = [1]*[0]/(exp([1]*max)-exp([1]*min))*exp([1]*x)
584  total = par[0]*par[1]/(TMath::Exp(par[1]*fMaxMass)-TMath::Exp(par[1]*fMinMass))*TMath::Exp(par[1]*x[0]);
585  // AliInfo("Background function set to: exponential");
586  break;
587  case 1:
588  //linear
589  //y=a+b*x -> integral = a(max-min)+1/2*b*(max^2-min^2) -> a = (integral-1/2*b*(max^2-min^2))/(max-min)=integral/(max-min)-1/2*b*(max+min)
590  // * [0] = integralBkg;
591  // * [1] = b;
592  total= par[0]/(fMaxMass-fMinMass)+par[1]*(x[0]-0.5*(fMaxMass+fMinMass));
593  // AliInfo("Background function set to: linear");
594  break;
595  case 2:
596  //parabola
597  //y=a+b*x+c*x**2 -> integral = a(max-min) + 1/2*b*(max^2-min^2) +
598  //+ 1/3*c*(max^3-min^3) ->
599  //a = (integral-1/2*b*(max^2-min^2)-1/3*c*(max^3-min^3))/(max-min)
600  // * [0] = integralBkg;
601  // * [1] = b;
602  // * [2] = c;
603  total = par[0]/(fMaxMass-fMinMass)+par[1]*(x[0]-0.5*(fMaxMass+fMinMass))+par[2]*(x[0]*x[0]-1/3.*(fMaxMass*fMaxMass*fMaxMass-fMinMass*fMinMass*fMinMass)/(fMaxMass-fMinMass));
604  // AliInfo("Background function set to: polynomial");
605  break;
606  case 3:
607  total=par[0];
608  break;
609  case 4:
610  //power function
611  //y=a(x-m_pi)^b -> integral = a/(b+1)*((max-m_pi)^(b+1)-(min-m_pi)^(b+1))
612  //
613  //a = integral*(b+1)/((max-m_pi)^(b+1)-(min-m_pi)^(b+1))
614  // * [0] = integralBkg;
615  // * [1] = b;
616  // a(power function) = [0]*([1]+1)/((max-m_pi)^([1]+1)-(min-m_pi)^([1]+1))*(x-m_pi)^[1]
617  {
618  Double_t mpi = TDatabasePDG::Instance()->GetParticle(211)->Mass();
619 
620  total = par[0]*(par[1]+1.)/(TMath::Power(fMaxMass-mpi,par[1]+1.)-TMath::Power(fMinMass-mpi,par[1]+1.))*TMath::Power(x[0]-mpi,par[1]);
621  // AliInfo("Background function set to: powerlaw");
622  }
623  break;
624  case 5:
625  //power function wit exponential
626  //y=a*Sqrt(x-m_pi)*exp(-b*(x-m_pi))
627  {
628  Double_t mpi = TDatabasePDG::Instance()->GetParticle(211)->Mass();
629 
630  total = par[1]*TMath::Sqrt(x[0] - mpi)*TMath::Exp(-1.*par[2]*(x[0]-mpi));
631  // AliInfo("Background function set to: wit exponential");
632  }
633  break;
634  case 6:
635  // the following comment must be removed
636  // // pol 3, following convention for pol 2
637  // //y=a+b*x+c*x**2+d*x**3 -> integral = a(max-min) + 1/2*b*(max^2-min^2) +
638  // //+ 1/3*c*(max^3-min^3) + 1/4 d * (max^4-min^4) ->
639  // //a = (integral-1/2*b*(max^2-min^2)-1/3*c*(max^3-min^3) - 1/4 d * (max^4-min^4) )/(max-min)
640  // // * [0] = integralBkg;
641  // // * [1] = b;
642  // // * [2] = c;
643  // // * [3] = d;
644  {
645  total=par[0];
646  for(Int_t it=1;it<=fPolDegreeBkg;it++){
647  total+=par[it]*TMath::Power(x[0]-fMassParticle,it)/TMath::Factorial(it);
648  }
649  }
650  break;
651  }
652  return total;
653 }
654 //_________________________________________________________________________
658 
659  // AliInfo("Signal function set to: Gaussian");
660  Double_t sigval=0;
661  switch (fTypeOfFit4Sgn){
662  case 0:
663  //gaussian = A/(sigma*sqrt(2*pi))*exp(-(x-mean)^2/2/sigma^2)
664  //Par:
665  // * [0] = integralSgn
666  // * [1] = mean
667  // * [2] = sigma
668  //gaussian = [0]/TMath::Sqrt(2.*TMath::Pi())/[2]*exp[-(x-[1])*(x-[1])/(2*[2]*[2])]
669  sigval=par[0]/TMath::Sqrt(2.*TMath::Pi())/par[2]*TMath::Exp(-(x[0]-par[1])*(x[0]-par[1])/2./par[2]/par[2]);
670  break;
671  case 1:
672  //double gaussian = A/(sigma*sqrt(2*pi))*exp(-(x-mean)^2/2/sigma^2)
673  //Par:
674  // * [0] = integralSgn
675  // * [1] = mean
676  // * [2] = sigma1
677  // * [3] = 2nd gaussian ratio
678  // * [4] = deltaSigma
679  //gaussian = [0]/TMath::Sqrt(2.*TMath::Pi())/[2]*exp[-(x-[1])*(x-[1])/(2*[2]*[2])]
680  Double_t g1=(1.-par[3])/TMath::Sqrt(2.*TMath::Pi())/par[2]*TMath::Exp(-(x[0]-par[1])*(x[0]-par[1])/2./par[2]/par[2]);
681  Double_t g2=par[3]/TMath::Sqrt(2.*TMath::Pi())/par[4]*TMath::Exp(-(x[0]-par[1])*(x[0]-par[1])/2./par[4]/par[4]);
682  sigval=par[0]*(g1+g2);
683  break;
684  }
685  fRawYieldHelp=par[0]/fHistoInvMass->GetBinWidth(1);
686  return sigval;
687 }
688 //_________________________________________________________________________
692  if(!fHistoTemplRfl) return 0;
693 
694  Int_t bin =fHistoTemplRfl->FindBin(x[0]);
695  Double_t value=fHistoTemplRfl->GetBinContent(bin);
696  Int_t binmin=fHistoTemplRfl->FindBin(fMinMass*1.00001);
697  Int_t binmax=fHistoTemplRfl->FindBin(fMaxMass*0.99999);
698  Double_t norm=fHistoTemplRfl->Integral(binmin,binmax)*fHistoTemplRfl->GetBinWidth(bin);
699  if(TMath::Abs(value)<1.e-14&&fSmoothRfl){// very rough, assume a constant trend, much better would be a pol1 or pol2 over a broader range
700  value+=fHistoTemplRfl->GetBinContent(bin-1)+fHistoTemplRfl->GetBinContent(bin+1);
701  value/=3.;
702  }
703  return par[0]*value/norm*fRawYieldHelp*fHistoInvMass->GetBinWidth(1);
704 }
705 //_________________________________________________________________________
709  Double_t bkg=FitFunction4Bkg(x,par);
710  Double_t refl=0;
711  if(fReflections) refl=FitFunction4Refl(x,&par[fNParsBkg]);
712  return bkg+refl;
713 }
714 //_________________________________________________________________________
718 
719  //gaussian = A/(sigma*sqrt(2*pi))*exp(-(x-mean)^2/2/sigma^2)
720  //Par:
721  // * [0] = integralSgn
722  // * [1] = mean
723  // * [2] = sigma
724  Double_t secgaval=par[0]/TMath::Sqrt(2.*TMath::Pi())/par[2]*TMath::Exp(-(x[0]-par[1])*(x[0]-par[1])/2./par[2]/par[2]);
725  return secgaval;
726 }
727 //_________________________________________________________________________
731 
732  Double_t bkg=FitFunction4Bkg(x,par);
733  Double_t sig=FitFunction4Sgn(x,&par[fNParsBkg]);
734  Double_t sec=0.;
735  if(fSecondPeak) sec=FitFunction4SecPeak(x,&par[fNParsBkg+fNParsSig]);
736  Double_t refl=0;
737  if(fReflections) refl=FitFunction4Refl(x,&par[fNParsBkg+fNParsSig+fNParsSec]);
738  return bkg+sig+sec+refl;
739 }
740 
741 //_________________________________________________________________________
742 void AliHFInvMassFitter::Signal(Double_t nOfSigma,Double_t &signal,Double_t &errsignal) const {
745 
746  Double_t min=fMass-nOfSigma*fSigmaSgn;
747  Double_t max=fMass+nOfSigma*fSigmaSgn;
748  Signal(min,max,signal,errsignal);
749  return;
750 }
751 
752 //_________________________________________________________________________
753 void AliHFInvMassFitter::Signal(Double_t min, Double_t max, Double_t &signal,Double_t &errsignal) const {
756 
757  signal=fSigFunc->Integral(min, max)/(Double_t)fHistoInvMass->GetBinWidth(1);
758  errsignal=(fRawYieldErr/fRawYield)*signal;/*assume relative error is the same as for total integral*/
759  return;
760 }
761 
762 //___________________________________________________________________________
763 void AliHFInvMassFitter::Background(Double_t nOfSigma,Double_t &background,Double_t &errbackground) const {
766 
767  Double_t min=fMass-nOfSigma*fSigmaSgn;
768  Double_t max=fMass+nOfSigma*fSigmaSgn;
769  Background(min,max,background,errbackground);
770  return;
771 
772 }
773 //___________________________________________________________________________
774 void AliHFInvMassFitter::Background(Double_t min, Double_t max, Double_t &background,Double_t &errbackground) const {
777 
778  TF1 *funcbkg=0x0;
779  if(fBkgFuncRefit) funcbkg=fBkgFuncRefit;
780  else if(fBkgFunc) funcbkg=fBkgFunc;
781  if(!funcbkg){
782  AliError("Bkg function not found!");
783  return;
784  }
785 
786  Double_t intB=funcbkg->GetParameter(0);
787  Double_t intBerr=funcbkg->GetParError(0);
788 
789  //relative error evaluation: from histo
790 
792  Int_t rightBand=fHistoInvMass->FindBin(fMass+fNSigma4SideBands*fSigmaSgn);
793  intB=fHistoInvMass->Integral(1,leftBand)+fHistoInvMass->Integral(rightBand,fHistoInvMass->GetNbinsX());
794  Double_t sum2=0;
795  for(Int_t i=1;i<=leftBand;i++){
796  sum2+=fHistoInvMass->GetBinError(i)*fHistoInvMass->GetBinError(i);
797  }
798  for(Int_t i=rightBand; i<=fHistoInvMass->GetNbinsX();i++){
799  sum2+=fHistoInvMass->GetBinError(i)*fHistoInvMass->GetBinError(i);
800  }
801 
802  intBerr=TMath::Sqrt(sum2);
803 
804  background=funcbkg->Integral(min,max)/(Double_t)fHistoInvMass->GetBinWidth(1);
805  errbackground=intBerr/intB*background;
806 
807  return;
808 
809 }
810 //__________________________________________________________________________
811 
812 void AliHFInvMassFitter::Significance(Double_t nOfSigma,Double_t &significance,Double_t &errsignificance) const {
815 
816  Double_t min=fMass-nOfSigma*fSigmaSgn;
817  Double_t max=fMass+nOfSigma*fSigmaSgn;
818  Significance(min, max, significance, errsignificance);
819 
820  return;
821 }
822 
823 //__________________________________________________________________________
824 
825 void AliHFInvMassFitter::Significance(Double_t min, Double_t max, Double_t &significance,Double_t &errsignificance) const {
828 
829  Double_t background,errbackground;
830  Background(min,max,background,errbackground);
831 
832  if (fRawYield+background <= 0.){
833  significance=-1;
834  errsignificance=0;
835  return;
836  }
837 
838  AliVertexingHFUtils::ComputeSignificance(fRawYield,fRawYieldErr,background,errbackground,significance,errsignificance);
839 
840  return;
841 }
842 //________________________________________________________________________
846 
847  TH1F *hCp=(TH1F*)fHistoInvMass->Clone("htemp");
848  Double_t estimatecent=0.5*(hCp->GetBinContent(hCp->FindBin(fMass-3.5*fSigmaSgn))+hCp->GetBinContent(hCp->FindBin(fMass+3.5*fSigmaSgn)));// just a first rough estimate
849  Double_t estimateslope=(hCp->GetBinContent(hCp->FindBin(fMass+3.5*fSigmaSgn))-hCp->GetBinContent(hCp->FindBin(fMass-3.5*fSigmaSgn)))/(7*fSigmaSgn);// first rough estimate
850 
852  TF1 *funcbkg,*funcPrev=0x0;
854  funcbkg = new TF1(Form("temp%d",fCurPolDegreeBkg),this,&AliHFInvMassFitter::BackFitFuncPolHelper,fMinMass,fMaxMass,fCurPolDegreeBkg+1,"AliHFInvMassFitter","BackFitFuncPolHelper");
855  if(funcPrev){
856  for(Int_t j=0;j<fCurPolDegreeBkg;j++){// now is +1 degree w.r.t. previous fit funct
857  funcbkg->SetParameter(j,funcPrev->GetParameter(j));
858  }
859  delete funcPrev;
860  }
861  else{
862  funcbkg->SetParameter(0,estimatecent);
863  funcbkg->SetParameter(1,estimateslope);
864  }
865  printf(" ---> Pre-fit of background with pol degree %d ---\n",fCurPolDegreeBkg);
866  hCp->Fit(funcbkg,"REMN","");
867  funcPrev=(TF1*)funcbkg->Clone("ftemp");
868  delete funcbkg;
870  }
871 
872  for(Int_t j=0;j<=fPolDegreeBkg;j++){
873  fback->SetParameter(j,funcPrev->GetParameter(j));
874  fback->SetParError(j,funcPrev->GetParError(j));
875  }
876  printf(" ---> Final background fit with pol degree %d ---\n",fPolDegreeBkg);
877  hCp->Fit(fback,"REMN","");// THIS IS JUST TO SET NOT ONLY THE PARAMETERS BUT ALSO chi2, etc...
878 
879 
880  // The following lines might be useful for debugging
881  // TCanvas *cDebug=new TCanvas();
882  // cDebug->cd();
883  // hCp->Draw();
884  // TString strout=Form("Test%d.root",(Int_t)fhistoInvMass->GetBinContent(fhistoInvMass->FindBin(fMass)));
885  // cDebug->Print(strout.Data());
886  // delete cDebug;
887 
888  delete funcPrev;
889  delete hCp;
890  return kTRUE;
891 
892 }
893 // _______________________________________________________________________
897 
899  if(fOnlySideBands && TMath::Abs(x[0]-fMass) < maxDeltaM) {
900  TF1::RejectPoint();
901  return 0;
902  }
903  Double_t back=par[0];
904  for(Int_t it=1;it<=fCurPolDegreeBkg;it++){
905  back+=par[it]*TMath::Power(x[0]-fMassParticle,it)/TMath::Factorial(it);
906  }
907  return back;
908 }
909 // _______________________________________________________________________
918 
919  if(!h){
920  fReflections=kFALSE;
921  return 0x0;
922  }
923  fHistoTemplRfl=(TH1F*)h->Clone("hTemplRfl");
924  opt.ToLower();
925  fReflections=kTRUE;
926  printf("\n--- Reflection templates from simulation ---\n");
927  if(opt.Contains("templ")){
928  printf(" ---> Reflection contribution using directly the histogram from simulation\n");
929  return fHistoTemplRfl;
930  }
931 
932  TF1 *f=0x0;
933  Bool_t isPoissErr=kTRUE;
934  Double_t xMinForFit=h->GetBinLowEdge(1);
935  Double_t xMaxForFit=h->GetXaxis()->GetBinUpEdge(h->GetNbinsX());
936  if(minRange>=0 && maxRange>=0){
937  xMinForFit=TMath::Max(minRange,h->GetBinLowEdge(1));
938  xMaxForFit=TMath::Min(maxRange,h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()));
939  }
940  if(opt.EqualTo("1gaus") || opt.EqualTo("singlegaus")){
941  printf(" ---> Reflection contribution from single-Gaussian fit to histogram from simulation\n");
942  f=new TF1("mygaus","gaus",xMinForFit,xMaxForFit);
943  f->SetParameter(0,h->GetMaximum());
944  // f->SetParLimits(0,0,100.*h->Integral());
945  f->SetParameter(1,1.865);
946  f->SetParameter(2,0.050);
947  fHistoTemplRfl->Fit(f,"REM","");//,h->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()));
948  }
949  else if(opt.EqualTo("2gaus") || opt.EqualTo("doublegaus")){
950  printf(" ---> Reflection contribution from double-Gaussian fit to histogram from simulation\n");
951  f=new TF1("my2gaus","[0]*([3]/( TMath::Sqrt(2.*TMath::Pi())*[2])*TMath::Exp(-(x-[1])*(x-[1])/(2.*[2]*[2]))+(1.-[3])/( TMath::Sqrt(2.*TMath::Pi())*[5])*TMath::Exp(-(x-[4])*(x-[4])/(2.*[5]*[5])))",xMinForFit,xMaxForFit);
952  f->SetParameter(0,h->GetMaximum());
953  // f->SetParLimits(0,0,100.*h->Integral());
954  f->SetParLimits(3,0.,1.);
955  f->SetParameter(3,0.5);
956  f->SetParameter(1,1.84);
957  f->SetParameter(2,0.050);
958  f->SetParameter(4,1.88);
959  f->SetParameter(5,0.050);
960  fHistoTemplRfl->Fit(f,"REM","");//,h->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()));
961  }
962  else if(opt.EqualTo("pol3")){
963  printf(" ---> Reflection contribution from pol3 fit to histogram from simulation\n");
964  f=new TF1("mypol3","pol3",xMinForFit,xMaxForFit);
965  f->SetParameter(0,h->GetMaximum());
966  // f->SetParLimits(0,0,100.*h->Integral());
967  // Hard to initialize the other parameters...
968  fHistoTemplRfl->Fit(f,"REM","");
969  // Printf("We USED %d POINTS in the Fit",f->GetNumberFitPoints());
970  }
971  else if(opt.EqualTo("pol6")){
972  printf(" ---> Reflection contribution from pol6 fit to histogram from simulation\n");
973  f=new TF1("mypol6","pol6",xMinForFit,xMaxForFit);
974  f->SetParameter(0,h->GetMaximum());
975  // f->SetParLimits(0,0,100.*h->Integral());
976  // Hard to initialize the other parameters...
977  fHistoTemplRfl->Fit(f,"RLEMI","");//,h->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()));
978  }
979  else{
980  // no good option passed
981  printf(" ---> Bad option for reflection configuration -> reflections will not be included in the fit\n");
982  fReflections=kFALSE;
983  delete fHistoTemplRfl;
984  fHistoTemplRfl=0x0;
985  return 0x0;
986  }
987 
988  // Fill fHistoTemplRfl with values of fit function
989  if(f){
990  for(Int_t j=1;j<=fHistoTemplRfl->GetNbinsX();j++){
991  fHistoTemplRfl->SetBinContent(j,f->Integral(fHistoTemplRfl->GetBinLowEdge(j),fHistoTemplRfl->GetXaxis()->GetBinUpEdge(j))/fHistoTemplRfl->GetBinWidth(j));
992  if(fHistoTemplRfl->GetBinContent(j)>=0.&&TMath::Abs(h->GetBinError(j)*h->GetBinError(j)-h->GetBinContent(j))>0.1*h->GetBinContent(j))isPoissErr=kFALSE;
993  }
994  for(Int_t j=1;j<=fHistoTemplRfl->GetNbinsX();j++){
995  if(isPoissErr){
996  fHistoTemplRfl->SetBinError(j,TMath::Sqrt(fHistoTemplRfl->GetBinContent(j)));
997  }
998  else fHistoTemplRfl->SetBinError(j,0.001*fHistoTemplRfl->GetBinContent(j));
999  }
1000  fReflections=kTRUE;
1001  return fHistoTemplRfl;
1002  }else{
1003  printf(" ---> Fit to MC template for reflection failed -> reflections will not be included in the fit\n");
1004  fReflections=kFALSE;
1005  delete fHistoTemplRfl;
1006  fHistoTemplRfl=0x0;
1007  return 0x0;
1008  }
1009  return 0x0;
1010 }
1011 // _______________________________________________________________________
1015  if(fBkgFunc){
1016  printf("--- Background function in 1st step fit to side bands ---\n");
1017  fBkgFunc->Print();
1018  }
1019  if(fTotFunc){
1020  printf("--- Total fit function from 2nd step fit ---\n");
1021  fTotFunc->Print();
1022  }
1023  if(fBkgFuncRefit){
1024  printf("--- Background function in 2nd step fit ---\n");
1025  fBkgFuncRefit->Print();
1026  }
1027  if(fRflFunc){
1028  printf("--- Reflections ---\n");
1029  fRflFunc->Print();
1030  }
1031  if(fBkRFunc){
1032  printf("--- Background + reflections ---\n");
1033  fBkRFunc->Print();
1034  }
1035  if(fSecFunc){
1036  printf("--- Additional Gaussian peak ---\n");
1037  fSecFunc->Print();
1038  }
1039 }
Int_t fTypeOfFit4Sgn
pdg value of particle mass
Double_t fSigmaSgnErr
signal gaussian sigma
Bool_t fFixSecWidth
flag to fix the position of the 2nd peak
Double_t fRawYieldHelp
switch for smoothing of reflection template
double Double_t
Definition: External.C:58
Double_t fRawYield
L, LW or Chi2.
TF1 * CreateReflectionFunction(TString fname)
Int_t fCurPolDegreeBkg
degree of polynomial expansion for back fit (option 6 for back)
Bool_t PrepareHighPolFit(TF1 *fback)
Bool_t fOnlySideBands
fit parameters in background fit function
virtual void Signal(Double_t nOfSigma, Double_t &signal, Double_t &errsignal) const
Double_t FitFunction4SecPeak(Double_t *x, Double_t *par)
Double_t fMass
signal fit func
TF1 * CreateTotalFitFunction(TString fname)
Double_t fRawYieldErr
signal gaussian integral
Int_t fNParsBkg
fit parameters in signal fit function
AliHFInvMassFitter class for the fit of invariant mass distribution of charm hadrons.
Int_t fNParsRfl
flag use/not use reflections
TCanvas * c
Definition: TestFitELoss.C:172
TF1 * CreateSecondPeakFunction(TString fname, Double_t integral)
TF1 * fTotFunc
fit function for second peak
Double_t fFixedRawYield
switch for fix Sigma of gaussian
Double_t FitFunction4Bkg(Double_t *x, Double_t *par)
Double_t fSigmaSgn
unc on signal gaussian mean value
Double_t fSecMass
fit parameters in 2nd peak fit function
Bool_t fFixSecMass
width of the 2nd peak
TF1 * fSecFunc
flag to fix the width of the 2nd peak
Double_t * sigma
int Int_t
Definition: External.C:63
Double_t fSecWidth
position of the 2nd peak
TString fFitOption
number of sigmas to veto the signal peak
TF1 * fBkRFunc
fit function for reflections
Int_t fNParsSec
switch off/on second peak (for D+->KKpi in Ds)
TF1 * CreateSignalFitFunction(TString fname, Double_t integral)
Bool_t fFixedMean
unc on signal gaussian sigma
Double_t fMassParticle
help variable
Double_t FitFunction4Refl(Double_t *x, Double_t *par)
TH1F * SetTemplateReflections(const TH1 *h, TString opt, Double_t minRange, Double_t maxRange)
Double_t nsigma
Int_t fTypeOfFit4Bkg
upper mass limit
TH1F * fHistoTemplRfl
switch for fix refl/signal
TF1 * fBkgFunc
background fit function (1st step, side bands only)
Double_t fMassErr
signal gaussian mean value
Double_t fRflOverSig
fit parameters in reflection fit function
Double_t fMinMass
histogram to fit
Bool_t fFixRflOverSig
reflection/signal
static void ComputeSignificance(Double_t signal, Double_t errsignal, Double_t background, Double_t errbackground, Double_t &significance, Double_t &errsignificance)
Significance calculator.
Double_t FitFunction4Mass(Double_t *x, Double_t *par)
void Significance(Double_t nOfSigma, Double_t &significance, Double_t &errsignificance) const
Double_t BackFitFuncPolHelper(Double_t *x, Double_t *par)
Bool_t MassFitter(Bool_t draw=kTRUE)
Bool_t draw[nPtBins]
Double_t fMaxMass
lower mass limit
TF1 * CreateBackgroundFitFunction(TString fname, Double_t integral)
TF1 * fRflFunc
internal variable for fit with reflections
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Double_t fNSigma4SideBands
kTRUE = only side bands considered
void Background(Double_t nOfSigma, Double_t &background, Double_t &errbackground) const
Double_t FitFunction4Sgn(Double_t *x, Double_t *par)
Int_t fPolDegreeBkg
background fit func
bool Bool_t
Definition: External.C:53
TF1 * fBkgFuncRefit
background fit function (1st step, extended in peak region)
Double_t CheckForSignal(Double_t mean, Double_t sigma)
TF1 * fSigFunc
err on signal gaussian integral
TF1 * fBkgFuncSb
Signal fit function.
Bool_t fSecondPeak
fit function for reflections
void DrawHere(TVirtualPad *c)
Bool_t fSmoothRfl
histogram with reflection template
Definition: External.C:196
TF1 * CreateBackgroundPlusReflectionFunction(TString fname)
Double_t FitFunction4BkgAndRefl(Double_t *x, Double_t *par)
Int_t fNParsSig
initialization for wa yield
Bool_t fReflections
background fit function (2nd step)
Bool_t fFixedSigma
switch for fix mean of gaussian