39 fNumOfFirstBinSteps(1),
40 fNumOfLowLimFitSteps(6),
42 fNumOfUpLimFitSteps(6),
44 fNumOfnSigmaBinCSteps(11),
45 fnSigmaBinCSteps(0x0),
48 fSigmaMCVariation(0.15),
58 fUsePowLawBkg(kFALSE),
59 fUsePowLawTimesExpoBkg(kFALSE),
60 fUseFixSigUpFreeMean(kTRUE),
61 fUseFixSigDownFreeMean(kTRUE),
63 fUseFixedMeanFreeS(kTRUE),
64 fUseFixSigFreeMean(kTRUE),
65 fUseFixSigFixMean(kTRUE),
66 fUseSecondPeak(kFALSE),
67 fMassSecondPeak(1.86958),
68 fSigmaSecondPeak(0.01),
69 fFixMassSecondPeak(kFALSE),
70 fFixSigmaSecondPeak(kFALSE),
72 fDrawIndividualFits(kFALSE),
73 fHistoRawYieldDistAll(0x0),
74 fHistoRawYieldTrialAll(0x0),
75 fHistoSigmaTrialAll(0x0),
76 fHistoMeanTrialAll(0x0),
77 fHistoChi2TrialAll(0x0),
78 fHistoSignifTrialAll(0x0),
79 fHistoBkgTrialAll(0x0),
80 fHistoBkgInBinEdgesTrialAll(0x0),
81 fHistoRawYieldDistBinC0All(0x0),
82 fHistoRawYieldTrialBinC0All(0x0),
83 fHistoRawYieldDistBinC1All(0x0),
84 fHistoRawYieldTrialBinC1All(0x0),
85 fHistoRawYieldDist(0x0),
86 fHistoRawYieldTrial(0x0),
87 fHistoSigmaTrial(0x0),
90 fHistoSignifTrial(0x0),
92 fHistoBkgInBinEdgesTrial(0x0),
93 fHistoRawYieldDistBinC0(0x0),
94 fHistoRawYieldTrialBinC0(0x0),
95 fHistoRawYieldDistBinC1(0x0),
96 fHistoRawYieldTrialBinC1(0x0),
100 fNtupleMultiTrials(0x0),
101 fNtupleBinCount(0x0),
107 Int_t rebinStep[4]={3,4,5,6};
108 Double_t minMassStep[6]={1.68,1.70,1.72,1.74,1.76,1.78};
109 Double_t maxMassStep[6]={2.06,2.04,2.02,2.00,1.98,1.96};
110 Double_t nSigmasBC[11]={2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0};
140 Int_t theCase=igs*kNBkgFuncCases+ib;
179 TString gausSig[
kNFitConfCases]={
"FixedS",
"FixedSp20",
"FixedSm20",
"FreeS",
"FixedMeanFixedS",
"FixedMeanFreeS"};
184 fHistoRawYieldTrialAll =
new TH1F(Form(
"hRawYieldTrialAll%s",
fSuffix.Data()),
" ; Trial # ; Raw Yield",nCases*totTrials,-0.5,nCases*totTrials-0.5);
185 fHistoSigmaTrialAll =
new TH1F(Form(
"hSigmaTrialAll%s",
fSuffix.Data()),
" ; Trial # ; Sigma (GeV/c^{2})",nCases*totTrials,-0.5,nCases*totTrials-0.5);
186 fHistoMeanTrialAll =
new TH1F(Form(
"hMeanTrialAll%s",
fSuffix.Data()),
" ; Trial # ; Mean (GeV/c^{2})",nCases*totTrials,-0.5,nCases*totTrials-0.5);
187 fHistoChi2TrialAll =
new TH1F(Form(
"hChi2TrialAll%s",
fSuffix.Data()),
" ; Trial # ; #chi^{2}",nCases*totTrials,-0.5,nCases*totTrials-0.5);
188 fHistoSignifTrialAll =
new TH1F(Form(
"hSignifTrialAll%s",
fSuffix.Data()),
" ; Trial # ; Significance",nCases*totTrials,-0.5,nCases*totTrials-0.5);
190 fHistoBkgTrialAll =
new TH1F(Form(
"hBkgTrialAll%s",
fSuffix.Data()),
" ; Background",nCases*totTrials,-0.5,nCases*totTrials-0.5);
218 Int_t theCase=igs*kNBkgFuncCases+ib;
222 fHistoRawYieldTrial[theCase]=
new TH1F(Form(
"hRawYieldTrial%s%s%s",funcBkg[ib].
Data(),gausSig[igs].
Data(),
fSuffix.Data()),
" ; Trial # ; Raw Yield",totTrials,-0.5,totTrials-0.5);
223 fHistoRawYieldTrialBinC0[theCase]=
new TH2F(Form(
"hRawYieldTrialBinC0%s%s%s",funcBkg[ib].
Data(),gausSig[igs].
Data(),
fSuffix.Data()),
" ; Trial # ; Range for count ; Raw Yield (bin count)",totTrials,-0.5,totTrials-0.5,
fNumOfnSigmaBinCSteps,-0.5,
fNumOfnSigmaBinCSteps-0.5);
224 fHistoRawYieldTrialBinC1[theCase]=
new TH2F(Form(
"hRawYieldTrialBinC1%s%s%s",funcBkg[ib].
Data(),gausSig[igs].
Data(),
fSuffix.Data()),
" ; Trial # ; Range for count ; Raw Yield (bin count)",totTrials,-0.5,totTrials-0.5,
fNumOfnSigmaBinCSteps,-0.5,
fNumOfnSigmaBinCSteps-0.5);
225 fHistoSigmaTrial[theCase]=
new TH1F(Form(
"hSigmaTrial%s%s%s",funcBkg[ib].
Data(),gausSig[igs].
Data(),
fSuffix.Data()),
" ; Trial # ; Sigma (GeV/c^{2})",totTrials,-0.5,totTrials-0.5);
226 fHistoMeanTrial[theCase]=
new TH1F(Form(
"hMeanTrial%s%s%s",funcBkg[ib].
Data(),gausSig[igs].
Data(),
fSuffix.Data()),
" ; Trial # ; Mean (GeV/c^{2})",totTrials,-0.5,totTrials-0.5);
227 fHistoChi2Trial[theCase]=
new TH1F(Form(
"hChi2Trial%s%s%s",funcBkg[ib].
Data(),gausSig[igs].
Data(),
fSuffix.Data()),
" ; Trial # ; #chi^{2}",totTrials,-0.5,totTrials-0.5);
228 fHistoSignifTrial[theCase]=
new TH1F(Form(
"hSignifTrial%s%s%s",funcBkg[ib].
Data(),gausSig[igs].
Data(),
fSuffix.Data()),
" ; Trial # ; Significance",totTrials,-0.5,totTrials-0.5);
230 fHistoBkgTrial[theCase] =
new TH1F(Form(
"hBkgTrial%s%s%s",funcBkg[ib].
Data(),gausSig[igs].
Data(),
fSuffix.Data()),
" ; Background",totTrials,-0.5,totTrials-0.5);
231 fHistoBkgInBinEdgesTrial[theCase] =
new TH1F(Form(
"hBkgInBinEdgesTrial%s%s%s",funcBkg[ib].
Data(),gausSig[igs].
Data(),
fSuffix.Data()),
" ; Background in bin edges",totTrials,-0.5,totTrials-0.5);
245 fNtupleMultiTrials =
new TNtuple(Form(
"ntuMultiTrial%s",
fSuffix.Data()),Form(
"ntuMultiTrial%s",
fSuffix.Data()),
"rebin:firstb:minfit:maxfit:bkgfunc:confsig:confmean:chi2:signif:mean:emean:sigma:esigma:rawy:erawy",128000);
247 fNtupleBinCount =
new TNtuple(Form(
"ntuBinCount%s",
fSuffix.Data()),Form(
"ntuBinCount%s",
fSuffix.Data()),
"rebin:firstb:minfit:maxfit:bkgfunc:confsig:confmean:chi2:nSigmaBC:rawyBC0:erawyBC0:rawyBC1:erawyBC1",128000);
258 if(!hOK)
return kFALSE;
278 Double_t hmin=TMath::Max(minMassForFit,hRebinned->GetBinLowEdge(2));
281 Double_t hmax=TMath::Min(maxMassForFit,hRebinned->GetBinLowEdge(hRebinned->GetNbinsX()));
301 for(
Int_t j=0; j<15; j++) xnt[j]=0.;
303 Bool_t mustDeleteFitter = kTRUE;
327 Double_t fixSoverRefAt=
fFixRefloS*(hReflModif->Integral(hReflModif->FindBin(minMassForFit*1.0001),hReflModif->FindBin(maxMassForFit*0.999))/hSigModif->Integral(hSigModif->FindBin(minMassForFit*1.0001),hSigModif->FindBin(maxMassForFit*0.999)));
380 if(typeb<kNBkgFuncCases){
381 printf(
"****** START FIT OF HISTO %s WITH REBIN %d FIRST BIN %d MASS RANGE %f-%f BACKGROUND FIT FUNCTION=%d CONFIG SIGMA/MEAN=%d\n",hInvMassHisto->GetName(),
rebin,iFirstBin,
minMassForFit,
maxMassForFit,
typeb,igs);
388 if(esigma<0.00001) esigma=0.0001;
390 if(epos<0.00001) epos=0.0001;
396 fitter->
Background(minval,maxval,bkgBEdge,erbkgBEdge);
401 mustDeleteFitter = kFALSE;
403 thePad->SaveAs(Form(
"FitOutput_%s_Trial%d.%s",hInvMassHisto->GetName(),globBin,
format.c_str()));
479 for(
Int_t j=0; j<8; j++) xntBC[j]=xnt[j];
485 if(minMassBC>minMassForFit &&
486 maxMassBC<maxMassForFit &&
487 minMassBC>(hRebinned->GetXaxis()->GetXmin()) &&
488 maxMassBC<(hRebinned->GetXaxis()->GetXmax())){
515 if (mustDeleteFitter)
delete fitter;
530 TFile outHistos(fileName.Data(),option.Data());
531 if (outHistos.IsZombie()) {
532 Printf(
"Could not open file '%s'!", fileName.Data());
549 for(
Int_t ic=0; ic<nCases; ic++){
589 TLatex* tmax=
new TLatex(0.6,0.8,Form(
"max=%.1f",
fMaxYieldGlob));
592 TLatex* tmin=
new TLatex(0.6,0.72,Form(
"min=%.1f",
fMinYieldGlob));
605 TH1F *hCutTmp=(TH1F*)histoToFit->Clone(
"hCutTmp");
606 for(
Int_t ib=1; ib<=hCutTmp->GetNbinsX(); ib++){
607 Double_t xc=hCutTmp->GetBinCenter(ib);
609 hCutTmp->SetBinContent(ib,0.);
610 hCutTmp->SetBinError(ib,0.);
614 hCutTmp->Fit(
"pol2",
"E0",
"",hmin,hmax);
615 TF1* f2=(TF1*)hCutTmp->GetListOfFunctions()->FindObject(
"pol2");
616 TF1* f3=
new TF1(
"myPol3",
"pol3");
617 for(
Int_t i=0; i<3;i++) f3->SetParameter(i,f2->GetParameter(i));
618 hCutTmp->Fit(f3,
"E0",
"",hmin,hmax);
620 for(
Int_t ib=1; ib<=histoToFit->GetNbinsX(); ib++){
621 Double_t xc=hCutTmp->GetBinCenter(ib);
623 quickCount+=(histoToFit->GetBinContent(ib)-f3->Eval(xc));
626 TF1* fSB=
new TF1(
"fSB",
"[0]*1./(TMath::Sqrt(2.*TMath::Pi())*[2])*TMath::Exp(-(x-[1])*(x-[1])/(2.*[2]*[2]))+[3]+[4]*x+[5]*x*x+[6]*x*x*x");
627 fSB->SetParameter(0,quickCount);
628 fSB->SetParameter(1,
fMassD);
630 for(
Int_t j=0; j<4; j++) fSB->SetParameter(j+3,f3->GetParameter(j));
635 fSB->FixParameter(1,
fMassD);
638 fSB->FixParameter(1,
fMassD);
640 histoToFit->Fit(fSB,
"ME0",
"",hmin,hmax);
642 if(fSB->GetParError(0)<0.01*fSB->GetParameter(0))
return kFALSE;
643 if(fSB->GetParError(0)>0.6*fSB->GetParameter(0))
return kFALSE;
Bool_t fUsePol4Bkg
switch for pol3 background
Double_t GetMeanUncertainty() const
Int_t * fRebinSteps
number of rebin steps
static TH1D * RebinHisto(TH1 *hOrig, Int_t reb, Int_t firstUse=-1)
Rebinning of invariant mass histograms.
Bool_t fDrawIndividualFits
switch for saving bkg values in nsigma
TH1F ** fHistoChi2Trial
histo with gauss mean from subsamples of trials
TH1F * fHistoBkgInBinEdgesTrialAll
histo with bkg from all trials
Bool_t fUsePowLawTimesExpoBkg
switch for power law background
void SetFixReflOverS(Double_t rovers)
Bool_t fUseFixSigFixMean
switch for FixSigFreeMean
void DrawHere(TVirtualPad *c, Double_t nsigma=3, Int_t writeFitInfo=1)
void IncludeSecondGausPeak(Double_t mass, Bool_t fixm, Double_t width, Bool_t fixw)
Int_t fNumOfFirstBinSteps
Double_t fSigmaSecondPeak
position of the 2nd peak
Float_t fFixRefloS
template of signal contribution
TString format
file names tag, basically the trigger and calorimeter combination
Double_t fSigmaMCVariation
sigma of D meson peak from MC
TH1F ** fHistoRawYieldDist
histo with bin counts from all trials
TH2F ** fHistoRawYieldTrialBinC1
histo with bin counts from subsamples of trials
TH1F ** fHistoBkgInBinEdgesTrial
histo with bkg from subsamples of trials
Double_t * fnSigmaBinCSteps
number of steps on the bin counting
Int_t MassFitter(Bool_t draw=kTRUE)
TH1F * fHistoBkgTrialAll
histo with chi2 from all trials
TString fSuffix
mass of D meson
AliHFInvMassFitter class for the fit of invariant mass distribution of charm hadrons.
void ConfigureLowLimFitSteps(Int_t nSteps, Double_t *values)
std::vector< AliHFInvMassFitter * > fMassFitters
maximum yield
Double_t fnSigmaForBkgEval
virtual ~AliHFInvMassMultiTrialFit()
static TH1 * AdaptTemplateRangeAndBinning(const TH1 *hRef, TH1 *hData, Double_t minFit, Double_t maxFit)
TH1F * fHistoChi2TrialAll
histo with gauss mean from all trials
Double_t GetSigma() const
void SetPolDegreeForBackgroundFit(Int_t deg)
void ConfigureUpLimFitSteps(Int_t nSteps, Double_t *values)
TH1F ** fHistoSignifTrial
histo with chi2 from subsamples of trials
Double_t fMaxYieldGlob
minimum yield
Bool_t fUseFixSigFreeMean
switch for FixedMeanFreeS
TH1F ** fHistoRawYieldDistBinC0
histo with bkg in mass bin edges from subsamples of trials
Bool_t fUsePol3Bkg
switch for pol2 background
void SetFixGaussianSigma(Double_t sigma)
Bool_t fUseFixSigUpFreeMean
switch for power law background
TH1F * fHistoMeanTrialAll
histo with gauss sigma from all trials
Double_t fMassD
relative variation of the sigma
Bool_t fFixSigmaSecondPeak
flag to fix the position of the 2nd peak
TH1F * fHistoRawYieldDistBinC0All
histo with bkg in mass bin edges from all trials
TH1F * fHistoSignifTrialAll
histo with chi2 from all trials
Double_t fMinYieldGlob
tree
Bool_t fUseSecondPeak
switch for FixSigFixMean
Bool_t fFixMassSecondPeak
width of the 2nd peak
void SetFixGaussianMean(Double_t mean)
TH1F ** fHistoRawYieldTrial
histo with yield from subsamples of trials
void SetTemplatesForReflections(const TH1F *hTemplRefl, const TH1F *hTemplSig)
Int_t fNumOfLowLimFitSteps
number of steps in the first bin for rebin
TNtuple * fNtupleBinCount
tree
TH1F * fHistoRawYieldDistBinC1All
histo with bin counts from all trials
Bool_t DoFitWithPol3Bkg(TH1F *histoToFit, Double_t hmin, Double_t hmax, Int_t theCase)
TH1F * fHistoRawYieldTrialAll
histo with yield from all trials
Double_t * fUpLimFitSteps
number of steps on the max. mass for fit
Double_t GetReducedChiSquare() const
Double_t fMassSecondPeak
switch off/on second peak (for D+->KKpi in Ds)
Bool_t DoMultiTrials(TH1D *hInvMassHisto, TPad *thePad=0x0)
Int_t fNumOfnSigmaBinCSteps
TH1F ** fHistoRawYieldDistBinC1
histo with bin counts from subsamples of trials
Double_t GetRawYieldBinCounting(Double_t &errRyBC, Double_t nSigma=3., Int_t option=0, Int_t pdgCode=0) const
void ConfigureRebinSteps(Int_t nSteps, Int_t *values)
Int_t fNumOfUpLimFitSteps
TH1F * fHistoSigmaTrialAll
histo with yield from all trials
void SaveToRoot(TString fileName, TString option="recreate") const
TH1F * fhTemplRefl
histo with bin counts from subsamples of trials
TH1F * SetTemplateReflections(const TH1 *h, TString opt, Double_t minRange, Double_t maxRange)
TH1F * fHistoRawYieldDistAll
flag for drawing fits
TH2F ** fHistoRawYieldTrialBinC0
histo with bin counts from subsamples of trials
TH1F ** fHistoSigmaTrial
histo with yield from subsamples of trials
Bool_t fUsePowLawBkg
switch for pol5 background
Bool_t fUseFreeS
switch for FixSigDownFreeMean
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Int_t fFitOption
name to characterize analysis case
Bool_t fUsePol5Bkg
switch for pol4 background
Bool_t fSaveBkgVal
flag to fix the width of the 2nd peak
Bool_t fUseFixedMeanFreeS
switch for FreeSigma
Double_t GetSigmaUncertainty() const
void Significance(Double_t nOfSigma, Double_t &significance, Double_t &errsignificance) const
TH1F * fhTemplSign
template of reflection contribution
Bool_t fUseLinBkg
switch for exponential background
Double_t GetRawYieldError() const
Bool_t fUseFixSigDownFreeMean
switch for FixSigUpFreeMean
void Background(Double_t nOfSigma, Double_t &background, Double_t &errbackground) const
void SetInitialGaussianSigma(Double_t sigma)
void SetInitialGaussianMean(Double_t mean)
Bool_t fUseExpoBkg
LL or chi2 fit.
Int_t fNumOfRebinSteps
saves the invariant mass fit canvases in the file formats listed in this vector (if empty...
Bool_t fUsePol2Bkg
switch for linear background
Double_t * fLowLimFitSteps
number of steps on the min. mass for fit
void DrawHistos(TCanvas *cry) const
TH1F ** fHistoMeanTrial
histo with gauss sigma from subsamples of trials
AliHFInvMassMultiTrialFit()
TNtuple * fNtupleMultiTrials
std::set< std::string > fInvMassFitSaveAsFormats
void ConfigurenSigmaBinCSteps(Int_t nSteps, Double_t *values)
TH1F ** fHistoBkgTrial
histo with chi2 from subsamples of trials
TH2F * fHistoRawYieldTrialBinC0All
histo with bin counts from all trials
Double_t GetRawYield() const
TH2F * fHistoRawYieldTrialBinC1All
histo with bin counts from all trials