1 #if !defined(__CINT__) || defined(__MAKECINT__)
12 #include <TPaveText.h>
14 #include <TLegendEntry.h>
15 #include <TDatabasePDG.h>
24 TString
fileName=
"AnalysisResults_train543544.root";
31 0.0109,0.0118,0.0129,0.0145};
73 TH1F* histof=(TH1F*)histo->Clone(Form(
"%s_Fl",histo->GetName()));
86 TString hname=histo->GetName();
89 if(hname.Contains(
"Rot") || hname.Contains(
"ME") || hname.Contains(
"LS")){
94 TH1F* histof=(TH1F*)histo->Clone(Form(
"%s_Fl",histo->GetName()));
105 TCanvas *cTest=
new TCanvas(
"cTest",
"cTest",800,800);
109 hReflModif->SetLineColor(kRed);
110 hSigModif->SetLineColor(kBlue);
112 hReflModif->Draw(
"same");
113 if(saveReflModifPlot){
114 cTest->SaveAs(Form(
"cTest%d.root",iPtBin));
118 Double_t fixSoverRefAt=
rOverSmodif*(hReflModif->Integral(hReflModif->FindBin(
fitrangelow[iPtBin]*1.0001),hReflModif->FindBin(
fitrangeup[iPtBin]*0.999))/hSigModif->Integral(hSigModif->FindBin(
fitrangelow[iPtBin]*1.0001),hSigModif->FindBin(
fitrangeup[iPtBin]*0.999)));
120 Printf(
"SOMETHING WENT WRONG WHILE SETTINGS REFLECTIONS TEMPLATE");
140 Double_t
GetSignalBinCounting(TH1 *h,TF1 *fbackground,Double_t &err,Double_t nsigmaBC=4.,Double_t sigmafit=0.010,Double_t minx=-999,Double_t maxx=-999){
144 binL=h->FindBin(minx);
146 Printf(
"Left range for bin counting smaller than allowed by histogram axis, setting it to the minimum ");
151 Double_t lr=
massD-sigmafit*nsigmaBC;
152 if(minx<0&&minx>-999.){
154 Printf(
"Left range for counting set to min of value defined");
161 Printf(
"Left range for bin counting smaller than allowed by histogram axis, setting it to the minimum ");
167 binR=h->FindBin(maxx);
168 if(binR>h->GetNbinsX()){
169 Printf(
"Right range for bin counting larger than allowed by histogram axis, setting it to the maximum allowed ");
174 Double_t rr=
massD+sigmafit*nsigmaBC;
175 if(maxx<0. && maxx>-999){
177 Printf(
"Right range for counting set to max of value defined");
182 if(binR>h->GetNbinsX()){
183 Printf(
"Right range for bin counting larger than allowed by histogram axis, setting it to the maximum allowed ");
190 for(Int_t j=binL;j<=binR;j++){
191 sign+=h->GetBinContent(j)-fbackground->Integral(h->GetBinLowEdge(j),h->GetBinLowEdge(j)+h->GetBinWidth(j))/h->GetBinWidth(j);
192 err+=h->GetBinError(j)*h->GetBinError(j);
194 err=TMath::Sqrt(err);
199 TF1* fgfit=(TF1*)hPulls->GetListOfFunctions()->FindObject(
"gaus");
200 TLatex* tg1=
new TLatex(0.2,0.8,Form(
"Gauss mean = %.2f#pm%.2f",fgfit->GetParameter(1),fgfit->GetParError(1)));
203 TLatex* tg2=
new TLatex(0.2,0.7,Form(
"Gauss #sigma = %.2f#pm%.2f",fgfit->GetParameter(2),fgfit->GetParError(2)));
211 Double_t min=hRef->GetBinLowEdge(1);
212 Double_t max=hRef->GetBinLowEdge(hRef->GetNbinsX())+hRef->GetBinWidth(hRef->GetNbinsX());
214 Int_t binmin=h1->FindBin(min*1.00001);
215 Int_t binmax=h1->FindBin(max*0.99999);
217 if(binmin<1||binmax>h1->GetNbinsX()){
218 Printf(
"Cannot adapt range: different bins: Ref histo min, max = %f, %f, hist 1 min %f -> bin min %d , max %f -> bin max %d, nbins= %d",min,max,h1->GetBinLowEdge(1),binmin,h1->GetBinLowEdge(h1->GetNbinsX())+h1->GetBinWidth(1),binmax,h1->GetNbinsX());
221 if(TMath::Abs(h1->GetBinLowEdge(binmin)-min)>0.0001*min||TMath::Abs(h1->GetBinLowEdge(binmax)+h1->GetBinWidth(binmax)-max)>0.0001*max){
222 Printf(
"Cannot adapt range and rebin histo");
225 Double_t *binsNew=
new Double_t[binmax-binmin+2];
226 for(Int_t j=binmin;j<=binmax;j++){
227 binsNew[j-binmin]=h1->GetBinLowEdge(j);
229 binsNew[binmax-binmin+1]=binsNew[binmax-binmin]+h1->GetBinWidth(binmax-binmin);
231 TString stype=h1->ClassName();
232 if(!stype.Contains(
"TH1F")){
233 hOut=(TH1F*)h1->Rebin(binmax-binmin+1,Form(
"%s_reb",h1->GetName()),binsNew);
235 else if(!stype.Contains(
"TH1D")){
236 hOut=(TH1D*)h1->Rebin(binmax-binmin+1,Form(
"%s_reb",h1->GetName()),binsNew);
240 Double_t width=h1->GetBinWidth(binmin);
241 Double_t widthRef=hRef->GetBinWidth(1);
243 if((TMath::Abs(width-widthRef)<0.00001*widthRef)){
249 Printf(
"Should rebin the reference histo by %d",(Int_t)(width/widthRef));
254 if(TMath::Abs(wr-(Int_t)wr)>0.00001){
255 Printf(
"Cannot adapt histo: rebin issue, width ref = %f, width h1=%f",widthRef,width);
258 else rebinh=(Int_t)wr;
268 TF1 *fp2=
new TF1(
"fp2",
"pol2",h->GetXaxis()->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()));
269 TH1D *htmp=(TH1D*)h->Clone(
"htmp");
270 for(Int_t i=3;i<=h->GetNbinsX()-3;i++){
271 htmp->Fit(fp2,
"RLEMN0",
"",h->GetXaxis()->GetBinLowEdge(i-2),h->GetXaxis()->GetBinUpEdge(i+2));
272 h->SetBinContent(i,(fp2->Integral(h->GetXaxis()->GetBinLowEdge(i),h->GetXaxis()->GetBinUpEdge(i)))/h->GetBinWidth(i));
275 htmp->Fit(fp2,
"RLEMN0",
"",h->GetXaxis()->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(5));
276 h->SetBinContent(2,(fp2->Integral(h->GetXaxis()->GetBinLowEdge(2),h->GetXaxis()->GetBinUpEdge(2)))/h->GetBinWidth(2));
278 htmp->Fit(fp2,
"RLEMN0",
"",h->GetXaxis()->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(4));
279 h->SetBinContent(1,(fp2->Integral(h->GetXaxis()->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(1)))/h->GetBinWidth(1));
282 htmp->Fit(fp2,
"RLEMN0",
"",h->GetXaxis()->GetBinLowEdge(h->GetNbinsX()-4),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()));
283 h->SetBinContent(h->GetNbinsX()-1,(fp2->Integral(h->GetXaxis()->GetBinLowEdge(h->GetNbinsX()-1),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()-1)))/h->GetBinWidth(h->GetNbinsX()-1));
285 htmp->Fit(fp2,
"RLEMN0",
"",h->GetXaxis()->GetBinLowEdge(h->GetNbinsX()-3),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()));
286 h->SetBinContent(h->GetNbinsX(),(fp2->Integral(h->GetXaxis()->GetBinLowEdge(h->GetNbinsX()),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX())))/h->GetBinWidth(h->GetNbinsX()));
294 if(isXpt==1)h->GetXaxis()->SetTitle(
"#it{p}_{T} (GeV/#it{c})");
297 h->SetMarkerStyle(21);
298 h->GetYaxis()->SetTitleOffset(1.8);
299 h->SetMarkerColor(kBlack);
300 h->SetMarkerSize(1.0);
301 h->SetLineColor(kBlack);
306 h->SetMarkerStyle(25);
307 h->GetYaxis()->SetTitleOffset(1.8);
308 h->SetMarkerColor(4);
309 h->SetMarkerSize(1.0);
315 h->SetMarkerStyle(22);
316 h->GetYaxis()->SetTitleOffset(1.8);
317 h->SetMarkerColor(kGreen+2);
318 h->SetMarkerSize(1.0);
319 h->SetLineColor(kGreen+2);
324 h->SetMarkerStyle(27);
325 h->GetYaxis()->SetTitleOffset(1.8);
326 h->SetMarkerColor(6);
327 h->SetMarkerSize(1.0);
340 else if(ndivisions<5){
343 else if(ndivisions<7){
347 else if(ndivisions<=8){
351 else if(ndivisions<10){
355 else if(ndivisions<13){
359 else if(ndivisions<17){
374 TF1 *f=
new TF1(
"GausPlusLine",
"[0]*1./(TMath::Sqrt(2.*TMath::Pi())*[2])*TMath::Exp(-(x-[1])*(x-[1])/(2.*[2]*[2]))+[3]+[4]*x",minRange,maxRange);
376 f->SetParameter(1,
massD);
377 f->SetParLimits(0,0.,1.e+7);
378 f->SetParLimits(1,1.8,1.92);
379 f->SetParameter(2,0.010);
380 f->SetParLimits(2,0,0.1);
381 f->SetParameter(3,0.);
390 Double_t norm=hRatio->GetMaximum();
394 for(Int_t iMassBin=1; iMassBin<hRatio->GetNbinsX(); iMassBin++){
395 Double_t bce=hRatio->GetBinCenter(iMassBin);
397 Double_t bco=hRatio->GetBinContent(iMassBin);
398 if(bco>norm) norm=bco;
403 TF1* func0=(TF1*)hRatio->GetListOfFunctions()->FindObject(
"pol0");
404 Double_t norml=func0->GetParameter(0);
406 func0=(TF1*)hRatio->GetListOfFunctions()->FindObject(
"pol0");
407 Double_t normh=func0->GetParameter(0);
408 norm=TMath::Max(norml,normh);
417 TString dirName=Form(
"PWG3_D2H_InvMass%sLowPt%s",
meson.Data(),
suffix.Data());
418 TString lstName=Form(
"coutput%s%s",
meson.Data(),
suffix.Data());
420 if(
meson==
"Dplus")
massD=TDatabasePDG::Instance()->GetParticle(411)->Mass();
421 else if(
meson==
"Dzero")
massD=TDatabasePDG::Instance()->GetParticle(421)->Mass();
423 TFile* fil=
new TFile(
fileName.Data());
424 TDirectoryFile* df=(TDirectoryFile*)fil->Get(dirName.Data());
427 TDirectoryFile* dfMC;
433 TH1F* hnEv=
new TH1F(
"hEvForNorm",
"events for normalization",1,0,1);
437 TList* l=(TList*)df->Get(lstName.Data());
440 TH3F* h3d=(TH3F*)l->FindObject(
"hMassVsPtVsY");
441 TH3F* h3dr=(TH3F*)l->FindObject(
"hMassVsPtVsYRot");
442 TH3F* h3dme=(TH3F*)l->FindObject(
"hMassVsPtVsYME");
443 TH3F* h3dmepp=(TH3F*)l->FindObject(
"hMassVsPtVsYMELSpp");
444 TH3F* h3dmemm=(TH3F*)l->FindObject(
"hMassVsPtVsYMELSmm");
445 TH2F* hpoolMix=(TH2F*)l->FindObject(
"hMixingsPerPool");
446 TH2F* hpoolEv=(TH2F*)l->FindObject(
"hEventsPerPool");
447 TH3F* h3dlsp=(TH3F*)l->FindObject(
"hMassVsPtVsYLSpp");
448 TH3F* h3dlsm=(TH3F*)l->FindObject(
"hMassVsPtVsYLSmm");
452 dfMC=(TDirectoryFile*)filMC->Get(dirName.Data());
454 lMC=(TList*)dfMC->Get(lstName.Data());
455 h3drefl=(TH3F*)lMC->FindObject(
"hMassVsPtVsYRefl");
456 h3dmcsig=(TH3F*)lMC->FindObject(
"hMassVsPtVsYSig");
460 TCanvas* cem=
new TCanvas(
"cem",
"Pools",1200,600);
463 gPad->SetRightMargin(0.12);
464 gPad->SetLeftMargin(0.12);
465 hpoolMix->GetXaxis()->SetTitle(
"zVertex");
466 hpoolMix->GetYaxis()->SetTitle(
"Multiplicity");
467 hpoolMix->GetYaxis()->SetTitleOffset(1.4);
468 hpoolMix->Draw(
"colztext");
470 gPad->SetRightMargin(0.12);
471 gPad->SetLeftMargin(0.12);
472 hpoolEv->Draw(
"colztext");
473 hpoolEv->GetXaxis()->SetTitle(
"zVertex");
474 hpoolEv->GetYaxis()->SetTitle(
"Multiplicity");
475 hpoolEv->GetYaxis()->SetTitleOffset(1.4);
478 TCanvas* c1=
new TCanvas(
"c1",
"Mass",1200,800);
481 TCanvas* c2=
new TCanvas(
"c2",
"Mass-Bkg Rot",1200,800);
483 TCanvas* c2pulls=
new TCanvas(
"c2pulls",
"Mass-Bkg Rot pulls",1200,800);
485 TCanvas* c2residuals=
new TCanvas(
"c2residuals",
"Mass-Bkg Rot residuals",1200,800);
487 TCanvas* c2residualTrend=
new TCanvas(
"c2residualTrend",
"Mass-Bkg Rot residual trend vs. mass",1200,800);
489 TCanvas* c2pullTrend=
new TCanvas(
"c2pullTrend",
"Mass-Bkg Rot pull trend vs. mass",1200,800);
492 TCanvas* c3=
new TCanvas(
"c3",
"Mass-Bkg LS",1200,800);
494 TCanvas* c3pulls=
new TCanvas(
"c3pulls",
"Mass-Bkg LS pulls",1200,800);
496 TCanvas* c3residuals=
new TCanvas(
"c3residuals",
"Mass-Bkg LS residuals",1200,800);
498 TCanvas* c3residualTrend=
new TCanvas(
"c3residualTrend",
"Mass-Bkg LS residual trend vs. mass",1200,800);
500 TCanvas* c3pullTrend=
new TCanvas(
"c3pullTrend",
"Mass-Bkg LS pull trend vs. mass",1200,800);
503 TCanvas* c4=
new TCanvas(
"c4",
"Mass-Bkg EM",1200,800);
505 TCanvas* c4pulls=
new TCanvas(
"c4pulls",
"Mass-Bkg EM pulls",1200,800);
507 TCanvas* c4residuals=
new TCanvas(
"c4residuals",
"Mass-Bkg EM residuals",1200,800);
509 TCanvas* c4residualTrend=
new TCanvas(
"c4residualTrend",
"Mass-Bkg EM residual trend vs. mass",1200,800);
511 TCanvas* c4pullTrend=
new TCanvas(
"c4pullTrend",
"Mass-Bkg EM pull trend vs. mass",1200,800);
516 TCanvas *c5pulls=0x0;
517 TCanvas *c5residuals=0x0;
518 TCanvas *c5residualTrend=0x0;
519 TCanvas *c5pullTrend=0x0;
522 c5=
new TCanvas(
"c5",
"Mass SB Fit",1200,800);
524 c5sub=
new TCanvas(
"c5sub",
"Mass-Bkg SB",1200,800);
526 c5pulls=
new TCanvas(
"c5pulls",
"Mass-Bkg SB pulls",1200,800);
528 c5residuals=
new TCanvas(
"c5residuals",
"Mass-Bkg SB residuals",1200,800);
530 c5residualTrend=
new TCanvas(
"c5residualTrend",
"Mass-Bkg SB residual trend vs. mass",1200,800);
532 c5pullTrend=
new TCanvas(
"c5pullTrend",
"Mass-Bkg SB pull trend vs. mass",1200,800);
536 TCanvas *cCompareResidualTrends=
new TCanvas(
"cCompareResidualTrends",
"cCompareResidualTrends",1200,800);
548 TH1F* hRawYieldSBfit=
new TH1F(
"hRawYieldSBfit",
"",
nPtBins,
binLims);
560 TH1F* hRawYieldRotBC=
new TH1F(
"hRawYieldRotBC",
"BC yield (rotational background)",
nPtBins,
binLims);
561 TH1F* hRawYieldLSBC=
new TH1F(
"hRawYieldLSBC",
"BC yield (like-sign background)",
nPtBins,
binLims);
562 TH1F* hRawYieldMEBC=
new TH1F(
"hRawYieldMEBC",
"BC yield (mixed-event background)",
nPtBins,
binLims);
563 TH1F* hRawYieldSBfitBC=
new TH1F(
"hRawYieldSBfitBC",
"BC yield (direct fit background)",
nPtBins,
binLims);
565 TLatex* tME=
new TLatex(0.65,0.82,
"MixEv +- pairs");
567 TLatex* tMEpp=
new TLatex(0.65,0.75,
"MixEv ++ pairs");
569 TLatex* tMEmm=
new TLatex(0.65,0.68,
"MixEv -- pairs");
572 TF1 *fpeak=
new TF1(
"fpeak",
"[0]*1./(TMath::Sqrt(2.*TMath::Pi())*[2])*TMath::Exp(-(x-[1])*(x-[1])/(2.*[2]*[2]))",
minMass,
maxMass);
574 TDirectory *current = gDirectory;
575 TFile* fout=
new TFile(Form(
"outputMassFits_%s.root",
suffix.Data()),
"recreate");
579 for(Int_t iPtBin=0; iPtBin<
nPtBins; iPtBin++){
581 Int_t bin1=h3d->GetYaxis()->FindBin(
binLims[iPtBin]);
582 Int_t bin2=h3d->GetYaxis()->FindBin(
binLims[iPtBin+1]-0.0001);
583 printf(
"Bin %d Pt range=%f %f\n",iPtBin,h3d->GetYaxis()->GetBinLowEdge(bin1),h3d->GetYaxis()->GetBinUpEdge(bin2));
584 TH1D* hMassPtBin=h3d->ProjectionX(Form(
"hMassPtBin%d",iPtBin),bin1,bin2);
585 TH1D* hMassPtBinr=h3dr->ProjectionX(Form(
"hMassPtBinr%d",iPtBin),bin1,bin2);
586 TH1D* hMassPtBinme=h3dme->ProjectionX(Form(
"hMassPtBinme%d",iPtBin),bin1,bin2);
587 TH1D* hMassPtBinmeLSpp=h3dmepp->ProjectionX(Form(
"hMassPtBinmeLSpp%d",iPtBin),bin1,bin2);
588 TH1D* hMassPtBinmeLSmm=h3dmemm->ProjectionX(Form(
"hMassPtBinmeLSmm%d",iPtBin),bin1,bin2);
591 Int_t bin1MC=h3drefl->GetYaxis()->FindBin(
binLims[iPtBin]);
592 Int_t bin2MC=h3drefl->GetYaxis()->FindBin(
binLims[iPtBin+1]-0.0001);
593 hMCReflPtBin=h3drefl->ProjectionX(Form(
"hMCReflPtBin%d",iPtBin),bin1MC,bin2MC);
594 hMCSigPtBin=h3dmcsig->ProjectionX(Form(
"hMCMassPtBin%d",iPtBin),bin1MC,bin2MC);
597 TH1D* hMassPtBinlsp=0x0;
598 TH1D* hMassPtBinlsm=0x0;
599 TH1D* hMassPtBinls=0x0;
601 hMassPtBinlsp=h3dlsp->ProjectionX(Form(
"hMassPtBinlsp%d",iPtBin),bin1,bin2);
602 hMassPtBinlsm=h3dlsm->ProjectionX(Form(
"hMassPtBinlsm%d",iPtBin),bin1,bin2);
603 hMassPtBinls=(TH1D*)hMassPtBinlsp->Clone(Form(
"hMassPtBinls%d",iPtBin));
604 hMassPtBinls->Reset();
605 for(Int_t iBin=1; iBin<=hMassPtBinlsp->GetNbinsX(); iBin++){
606 Double_t np=hMassPtBinlsp->GetBinContent(iBin);
607 Double_t nm=hMassPtBinlsm->GetBinContent(iBin);
608 Double_t tt=2*TMath::Sqrt(np*nm);
609 Double_t enp=hMassPtBinlsp->GetBinError(iBin);
610 Double_t enm=hMassPtBinlsm->GetBinError(iBin);
612 if(tt>0) ett=2./tt*TMath::Sqrt(np*np*enm*enm+nm*nm*enp*enp);
613 hMassPtBinls->SetBinContent(iBin,tt);
614 hMassPtBinls->SetBinError(iBin,ett);
618 hMassPtBinls->SetLineColor(kGreen+1);
626 hMassPtBin->SetLineColor(1);
627 hMassPtBinr->SetLineColor(4);
628 hMassPtBinme->SetLineColor(kOrange+1);
629 hMassPtBinmeLSpp->SetLineColor(kGreen+2);
630 hMassPtBinmeLSmm->SetLineColor(kCyan);
631 hMassPtBin->SetTitle(Form(
"%.1f<p_{T}<%.1f GeV/c",
binLims[iPtBin],
binLims[iPtBin+1]));
632 hMassPtBinr->SetTitle(Form(
"%.1f<p_{T}<%.1f GeV/c",
binLims[iPtBin],
binLims[iPtBin+1]));
633 hMassPtBinme->SetTitle(Form(
"%.1f<p_{T}<%.1f GeV/c",
binLims[iPtBin],
binLims[iPtBin+1]));
634 TH1D* hRatioMEpp=(TH1D*)hMassPtBinmeLSpp->Clone(Form(
"hRatioPtBinmeLSpp%d",iPtBin));
635 hRatioMEpp->Divide(hMassPtBinme);
636 TH1D* hRatioMEmm=(TH1D*)hMassPtBinmeLSmm->Clone(Form(
"hRatioPtBinmeLSmm%d",iPtBin));
637 hRatioMEmm->Divide(hMassPtBinme);
638 TH1D* hMassPtBinmeAll=(TH1D*)hMassPtBinme->Clone(Form(
"hRatioPtBinmeAll%d",iPtBin));
639 hMassPtBinmeAll->Add(hMassPtBinmeLSpp);
640 hMassPtBinmeAll->Add(hMassPtBinmeLSmm);
641 hMassPtBinmeAll->SetLineColor(kRed);
642 TH1D* hRatioME=(TH1D*)hMassPtBinme->Clone(Form(
"hRatioME%d",iPtBin));
643 hRatioME->Divide(hMassPtBin);
644 TH1D* hRatioMEAll=(TH1D*)hMassPtBinmeAll->Clone(Form(
"hRatioMEAll%d",iPtBin));
645 hRatioMEAll->Divide(hMassPtBin);
648 TCanvas* c0=
new TCanvas(Form(
"CBin%d",iPtBin),Form(
"Bin%d norm",iPtBin),1000,700);
651 TH1D* hRatio=(TH1D*)hMassPtBinr->Clone(
"hRatio");
652 hRatio->Divide(hMassPtBin);
654 hRatio->GetYaxis()->SetTitle(
"Rotational/All");
655 hRatio->GetXaxis()->SetTitle(
"Invariant mass (GeV/c^{2})");
657 hMassPtBinr->Scale(1./normRot);
659 hMassPtBinme->GetYaxis()->SetTitle(
"Entries (EvMix)");
660 hMassPtBinme->GetXaxis()->SetTitle(
"Invariant mass (GeV/c^{2})");
661 hMassPtBinme->DrawCopy();
662 hMassPtBinmeLSpp->Draw(
"same");
663 hMassPtBinmeLSmm->Draw(
"same");
664 tME->SetTextColor(hMassPtBinme->GetLineColor());
665 tMEpp->SetTextColor(hMassPtBinmeLSpp->GetLineColor());
666 tMEmm->SetTextColor(hMassPtBinmeLSmm->GetLineColor());
672 hRatioMEpp->SetMinimum(0.4);
673 hRatioMEpp->SetMaximum(0.6);
674 hRatioMEpp->GetYaxis()->SetTitle(
"ME with LS / ME with OS");
675 hRatioMEpp->GetXaxis()->SetTitle(
"Invariant mass (GeV/c^{2})");
676 hRatioMEmm->Draw(
"same");
679 hRatioME->SetMaximum(hRatioMEAll->GetMaximum()*1.05);
680 hRatioMEAll->Draw(
"same");
681 hRatioME->GetYaxis()->SetTitle(
"EvMix/All");
682 hRatioME->GetXaxis()->SetTitle(
"Invariant mass (GeV/c^{2})");
686 hMassPtBinme->Scale(1./normME);
687 hMassPtBinmeAll->Scale(1./normMEAll);
691 hMassPtBin->GetYaxis()->SetTitle(
"Counts");
692 hMassPtBin->GetYaxis()->SetTitleOffset(2.);
693 hMassPtBin->GetXaxis()->SetTitle(
"Invariant mass (GeV/c^{2})");
694 hMassPtBinr->Draw(
"same");
696 else hMassPtBinmeAll->Draw(
"same");
697 if(hMassPtBinls) hMassPtBinls->Draw(
"same");
699 TLegend* leg=
new TLegend(0.5,0.6,0.89,0.89);
700 leg->SetFillStyle(0);
701 leg->AddEntry(hMassPtBin,
"All candidates",
"L")->SetTextColor(hMassPtBin->GetLineColor());
702 leg->AddEntry(hMassPtBinr,
"Background (rotations)",
"L")->SetTextColor(hMassPtBinr->GetLineColor());
703 if(!
useEMwithLS) leg->AddEntry(hMassPtBinme,
"Background (ME)",
"L")->SetTextColor(hMassPtBinme->GetLineColor());
704 else leg->AddEntry(hMassPtBinmeAll,
"Background (ME)",
"L")->SetTextColor(hMassPtBinmeAll->GetLineColor());
705 if(hMassPtBinls) leg->AddEntry(hMassPtBinls,
"Like-sign",
"L")->SetTextColor(hMassPtBinls->GetLineColor());
709 TH1D* hMassSubRot=(TH1D*)hMassPtBin->Clone(Form(
"hMassSubRot_bin%d",iPtBin));
710 hMassSubRot->Add(hMassPtBinr,-1);
711 hMassSubRot->SetTitle(Form(
"%.1f<p_{T}<%.1f GeV/c -- Rotational",
binLims[iPtBin],
binLims[iPtBin+1]));
712 TH1D* hMassSubME=(TH1D*)hMassPtBin->Clone(Form(
"hMassSubME_bin%d",iPtBin));
714 else hMassSubME->Add(hMassPtBinmeAll,-1);
715 hMassSubME->SetTitle(Form(
"%.1f<p_{T}<%.1f GeV/c -- Mixed Ev",
binLims[iPtBin],
binLims[iPtBin+1]));
716 TH1D* hMassSubLS=0x0;
718 hMassSubLS=(TH1D*)hMassPtBin->Clone(Form(
"hMassSubLS_bin%d",iPtBin));
719 hMassSubLS->Add(hMassPtBinls,-1);
720 hMassSubLS->SetTitle(Form(
"%.1f<p_{T}<%.1f GeV/c -- Like Sign",
binLims[iPtBin],
binLims[iPtBin+1]));
725 hMassSubRot->Write();
727 if(hMassPtBinls) hMassSubLS->Write();
730 hMassSubRot->Rebin(
rebin[iPtBin]);
731 hMassSubME->Rebin(
rebin[iPtBin]);
732 if(hMassPtBinls) hMassSubLS->Rebin(
rebin[iPtBin]);
747 if(hMassPtBinls) out2=fitterLS[iPtBin]->
MassFitter(0);
752 TH1D *hMassDirectFit=(TH1D*)hMassPtBin->Clone(Form(
"hMassDirectFit_bin%d",iPtBin));
753 hMassDirectFit->Rebin(
rebin[iPtBin]);
760 else fitterSB[iPtBin]->
DrawHere(gPad,3,1);
761 hRawYieldSBfit->SetBinContent(iPtBin+1,fitterSB[iPtBin]->GetRawYield());
762 hRawYieldSBfit->SetBinError(iPtBin+1,fitterSB[iPtBin]->GetRawYieldError());
763 hChiSqSBfit->SetBinContent(iPtBin+1,fitterSB[iPtBin]->GetReducedChiSquare());
764 hChiSqSBfit->SetBinError(iPtBin+1,0.00001);
765 hNdfSBfit->SetBinContent(iPtBin+1,fitterSB[iPtBin]->GetMassFunc()->GetNDF());
766 hNdfSBfit->SetBinError(iPtBin+1,0.00001);
772 TH1F* hsubTemp=(TH1F*)hMassDirectFit->Clone(Form(
"%sSubBack%d",hMassDirectFit->GetName(),iPtBin));
773 TH1F* hsubTempAllRange=(TH1F*)hMassDirectFit->Clone(Form(
"%sSubBackAllRange%d",hMassDirectFit->GetName(),iPtBin));
777 for(Int_t jst=1;jst<=hsubTemp->GetNbinsX();jst++){
778 Double_t backg=funcBkg->Integral(hsubTemp->GetBinLowEdge(jst),hsubTemp->GetBinLowEdge(jst)+hsubTemp->GetBinWidth(jst))/hsubTemp->GetBinWidth(jst);
779 Double_t tot=funcAll->Integral(hsubTempAllRange->GetBinLowEdge(jst),hsubTempAllRange->GetBinLowEdge(jst)+hsubTempAllRange->GetBinWidth(jst))/hsubTempAllRange->GetBinWidth(jst);
780 hsubTemp->SetBinContent(jst,hsubTemp->GetBinContent(jst)-backg);
781 hsubTempAllRange->SetBinContent(jst,hsubTempAllRange->GetBinContent(jst)-tot);
783 hsubTemp->SetLineColor(kBlue);
784 hsubTempAllRange->SetLineColor(kGray+2);
787 for(Int_t ibs=1; ibs<hsubTemp->GetNbinsX(); ibs++){
788 Double_t binc=hsubTemp->GetBinCenter(ibs);
790 Double_t yl=hsubTemp->GetBinContent(ibs)-hsubTemp->GetBinError(ibs);
791 Double_t yu=hsubTemp->GetBinContent(ibs)+hsubTemp->GetBinError(ibs);
796 if(ymax>0) ymax*=1.2;
798 if(ymin<0) ymin*=1.2;
801 hsubTemp->SetMinimum(ymin);
802 hsubTemp->SetMaximum(ymax);
803 hsubTemp->SetMarkerStyle(20);
804 hsubTemp->SetMarkerColor(hsubTemp->GetLineColor());
805 hsubTemp->DrawCopy();
806 hsubTempAllRange->DrawCopy(
"same");
807 hsubTemp->DrawCopy(
"same");
808 fpeak->SetParameter(0,funcAll->GetParameter(
nDegreeBackPol[iPtBin]+1));
809 fpeak->SetParameter(1,funcAll->GetParameter(
nDegreeBackPol[iPtBin]+2));
810 fpeak->SetParameter(2,funcAll->GetParameter(
nDegreeBackPol[iPtBin]+3));
811 fpeak->DrawCopy(
"same");
815 hRawYieldSBfitBC->SetBinContent(iPtBin+1,bc);
816 hRawYieldSBfitBC->SetBinError(iPtBin+1,errbc);
818 c5pulls->cd(iPtBin+1);
819 TH1F *hPulls=
new TH1F();
820 TH1F *hPullsTrend=
new TH1F();
821 TH1F *hResidualTrend=
new TH1F();
827 c5residuals->cd(iPtBin+1);
831 cCompareResidualTrends->cd(iPtBin+1);
832 hResidualTrend->Draw();
834 c5residualTrend->cd(iPtBin+1);
835 hResidualTrend->Draw();
837 c5pullTrend->cd(iPtBin+1);
841 delete hMassDirectFit;
849 hRawYieldRot->SetBinContent(iPtBin+1,fitterRot[iPtBin]->GetRawYield());
850 hRawYieldRot->SetBinError(iPtBin+1,fitterRot[iPtBin]->GetRawYieldError());
851 hChiSqRot->SetBinContent(iPtBin+1,fitterRot[iPtBin]->GetReducedChiSquare());
852 hChiSqRot->SetBinError(iPtBin+1,0.00001);
853 hNdfRot->SetBinContent(iPtBin+1,fitterRot[iPtBin]->GetMassFunc()->GetNDF());
854 hNdfRot->SetBinError(iPtBin+1,0.00001);
860 hRawYieldRotBC->SetBinContent(iPtBin+1,bc);
861 hRawYieldRotBC->SetBinError(iPtBin+1,errbc);
863 c2pulls->cd(iPtBin+1);
864 TH1F *hPullsTrend=
new TH1F();
865 TH1F *hPulls=
new TH1F();
866 TH1F *hResidualTrend=
new TH1F();
872 c2residuals->cd(iPtBin+1);
876 c2residualTrend->cd(iPtBin+1);
877 hResidualTrend->Draw();
878 cCompareResidualTrends->cd(iPtBin+1);
879 if(out4)hResidualTrend->Draw(
"same");
880 else hResidualTrend->Draw();
882 c2pullTrend->cd(iPtBin+1);
886 else hMassSubRot->Draw(
"");
893 hRawYieldLS->SetBinContent(iPtBin+1,fitterLS[iPtBin]->GetRawYield());
894 hRawYieldLS->SetBinError(iPtBin+1,fitterLS[iPtBin]->GetRawYieldError());
895 hChiSqLS->SetBinContent(iPtBin+1,fitterLS[iPtBin]->GetReducedChiSquare());
896 hChiSqLS->SetBinError(iPtBin+1,0.00001);
897 hNdfLS->SetBinContent(iPtBin+1,fitterLS[iPtBin]->GetMassFunc()->GetNDF());
898 hNdfLS->SetBinError(iPtBin+1,0.00001);
904 hRawYieldLSBC->SetBinContent(iPtBin+1,bc);
905 hRawYieldLSBC->SetBinError(iPtBin+1,errbc);
907 c3pulls->cd(iPtBin+1);
908 TH1F *hPullsTrend=
new TH1F();
909 TH1F *hPulls=
new TH1F();
910 TH1F *hResidualTrend=
new TH1F();
916 c3residuals->cd(iPtBin+1);
920 c3residualTrend->cd(iPtBin+1);
921 hResidualTrend->Draw();
923 cCompareResidualTrends->cd(iPtBin+1);
924 if(out4||out1)hResidualTrend->Draw(
"same");
925 else hResidualTrend->Draw();
927 c3pullTrend->cd(iPtBin+1);
930 else if(hMassPtBinls) hMassSubLS->Draw(
"");
936 hRawYieldME->SetBinContent(iPtBin+1,fitterME[iPtBin]->GetRawYield());
937 hRawYieldME->SetBinError(iPtBin+1,fitterME[iPtBin]->GetRawYieldError());
938 hChiSqME->SetBinContent(iPtBin+1,fitterME[iPtBin]->GetReducedChiSquare());
939 hChiSqME->SetBinError(iPtBin+1,0.00001);
940 hNdfME->SetBinContent(iPtBin+1,fitterME[iPtBin]->GetMassFunc()->GetNDF());
941 hNdfME->SetBinError(iPtBin+1,0.00001);
947 hRawYieldMEBC->SetBinContent(iPtBin+1,bc);
948 hRawYieldMEBC->SetBinError(iPtBin+1,errbc);
951 c4pulls->cd(iPtBin+1);
952 TH1F *hPullsTrend=
new TH1F();
953 TH1F *hPulls=
new TH1F();
954 TH1F *hResidualTrend=
new TH1F();
959 c4residuals->cd(iPtBin+1);
963 c4residualTrend->cd(iPtBin+1);
964 hResidualTrend->Draw();
966 cCompareResidualTrends->cd(iPtBin+1);
967 if(out4||out1||out2)hResidualTrend->Draw(
"same");
968 else hResidualTrend->Draw();
970 c4pullTrend->cd(iPtBin+1);
973 else hMassSubME->Draw(
"");
981 path.Append(
"/figures");
982 if(
gSystem->AccessPathName(path.Data())){
983 gROOT->ProcessLine(Form(
".!mkdir -p %s",path.Data()));
987 c2->SaveAs(Form(
"figures/InvMassSpectra_%s_Rot.eps",
suffix.Data()));
988 c3->SaveAs(Form(
"figures/InvMassSpectra_%s_LS.eps",
suffix.Data()));
989 c4->SaveAs(Form(
"figures/InvMassSpectra_%s_EM.eps",
suffix.Data()));
991 c5->SaveAs(Form(
"figures/InvMassSpectra_%s_SB.eps",
suffix.Data()));
992 c5sub->SaveAs(Form(
"figures/InvMassSpectra_%s_SBsub.eps",
suffix.Data()));
993 c5sub->SaveAs(Form(
"figures/InvMassSpectra_%s_SBsub.root",
suffix.Data()));
997 c2residuals->SaveAs(Form(
"figures/ResidualDistribution_%s_Rot.eps",
suffix.Data()));
998 c3residuals->SaveAs(Form(
"figures/ResidualDistribution_%s_LS.eps",
suffix.Data()));
999 c4residuals->SaveAs(Form(
"figures/ResidualDistribution_%s_EM.eps",
suffix.Data()));
1001 c2residualTrend->SaveAs(Form(
"figures/residualTrendvsMass_%s_Rot.eps",
suffix.Data()));
1002 c3residualTrend->SaveAs(Form(
"figures/residualTrendvsMass_%s_LS.eps",
suffix.Data()));
1003 c4residualTrend->SaveAs(Form(
"figures/residualTrendvsMass_%s_EM.eps",
suffix.Data()));
1005 c2pulls->SaveAs(Form(
"figures/PullDistribution_%s_Rot.eps",
suffix.Data()));
1006 c3pulls->SaveAs(Form(
"figures/PullDistribution_%s_LS.eps",
suffix.Data()));
1007 c4pulls->SaveAs(Form(
"figures/PullDistribution_%s_EM.eps",
suffix.Data()));
1009 c2pullTrend->SaveAs(Form(
"figures/pullTrendvsMass_%s_Rot.eps",
suffix.Data()));
1010 c3pullTrend->SaveAs(Form(
"figures/pullTrendvsMass_%s_LS.eps",
suffix.Data()));
1011 c4pullTrend->SaveAs(Form(
"figures/pullTrendvsMass_%s_EM.eps",
suffix.Data()));
1014 c5residuals->SaveAs(Form(
"figures/ResidualDistribution_%s_SB.eps",
suffix.Data()));
1015 c5residualTrend->SaveAs(Form(
"figures/residualTrendvsMass_%s_SB.eps",
suffix.Data()));
1016 c5pulls->SaveAs(Form(
"figures/PullDistribution_%s_SB.eps",
suffix.Data()));
1017 c5pullTrend->SaveAs(Form(
"figures/pullTrendvsMass_%s_SB.eps",
suffix.Data()));
1024 c2->SaveAs(Form(
"figures/InvMassSpectra_%s_Rot.root",
suffix.Data()));
1025 c3->SaveAs(Form(
"figures/InvMassSpectra_%s_LS.root",
suffix.Data()));
1026 c4->SaveAs(Form(
"figures/InvMassSpectra_%s_EM.root",
suffix.Data()));
1028 c2residuals->SaveAs(Form(
"figures/ResidualDistribution_%s_Rot.root",
suffix.Data()));
1029 c3residuals->SaveAs(Form(
"figures/ResidualDistribution_%s_LS.root",
suffix.Data()));
1030 c4residuals->SaveAs(Form(
"figures/ResidualDistribution_%s_EM.root",
suffix.Data()));
1032 c2residualTrend->SaveAs(Form(
"figures/residualTrendvsMass_%s_Rot.root",
suffix.Data()));
1033 c3residualTrend->SaveAs(Form(
"figures/residualTrendvsMass_%s_LS.root",
suffix.Data()));
1034 c4residualTrend->SaveAs(Form(
"figures/residualTrendvsMass_%s_EM.root",
suffix.Data()));
1036 c2pulls->SaveAs(Form(
"figures/PullDistribution_%s_Rot.root",
suffix.Data()));
1037 c3pulls->SaveAs(Form(
"figures/PullDistribution_%s_LS.root",
suffix.Data()));
1038 c4pulls->SaveAs(Form(
"figures/PullDistribution_%s_EM.root",
suffix.Data()));
1040 c2pullTrend->SaveAs(Form(
"figures/pullTrendvsMass_%s_Rot.root",
suffix.Data()));
1041 c3pullTrend->SaveAs(Form(
"figures/pullTrendvsMass_%s_LS.root",
suffix.Data()));
1042 c4pullTrend->SaveAs(Form(
"figures/pullTrendvsMass_%s_EM.root",
suffix.Data()));
1045 c5->SaveAs(Form(
"figures/InvMassSpectra_%s_SB.root",
suffix.Data()));
1046 c5residuals->SaveAs(Form(
"figures/ResidualDistribution_%s_SB.root",
suffix.Data()));
1047 c5residualTrend->SaveAs(Form(
"figures/residualTrendvsMass_%s_SB.root",
suffix.Data()));
1048 c5pulls->SaveAs(Form(
"figures/PullDistribution_%s_SB.root",
suffix.Data()));
1049 c5pullTrend->SaveAs(Form(
"figures/pullTrendvsMass_%s_SB.root",
suffix.Data()));
1053 TCanvas* cry=
new TCanvas(
"cry",
"RawYield",800,700);
1054 cry->SetLeftMargin(0.15);
1055 hRawYieldRot->SetMarkerStyle(21);
1056 hRawYieldRot->Draw(
"P");
1057 hRawYieldRot->SetMinimum(0);
1058 hRawYieldRot->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
1059 hRawYieldRot->GetYaxis()->SetTitle(
"Raw Yield");
1060 hRawYieldRot->GetYaxis()->SetTitleOffset(1.8);
1061 Double_t max=hRawYieldRot->GetMaximum();
1062 if(hRawYieldLS->GetMaximum()>max)max=hRawYieldLS->GetMaximum();
1063 if(hRawYieldME->GetMaximum()>max)max=hRawYieldME->GetMaximum();
1065 if(hRawYieldSBfit->GetMaximum()>max)max=hRawYieldSBfit->GetMaximum();
1067 hRawYieldRot->SetMaximum(max*1.2);
1069 hRawYieldLS->SetMarkerStyle(22);
1070 hRawYieldLS->SetMarkerColor(kGreen+2);
1071 hRawYieldLS->SetLineColor(kGreen+2);
1072 hRawYieldLS->Draw(
"PZSAME");
1073 hRawYieldME->SetMarkerStyle(25);
1074 hRawYieldME->SetMarkerColor(4);
1075 hRawYieldME->SetLineColor(4);
1076 hRawYieldME->Draw(
"PSAME");
1078 hRawYieldSBfit->SetMarkerStyle(27);
1079 hRawYieldSBfit->SetMarkerColor(6);
1080 hRawYieldSBfit->SetLineColor(6);
1081 hRawYieldSBfit->Draw(
"PSAME");
1083 TLegend* legry=
new TLegend(0.7,0.7,0.89,0.89);
1084 legry->SetFillStyle(0);
1085 legry->SetBorderSize(0);
1086 legry->AddEntry(hRawYieldRot,
"Rotational",
"PL")->SetTextColor(1);
1087 legry->AddEntry(hRawYieldLS,
"Like Sign",
"PL")->SetTextColor(kGreen+2);
1088 legry->AddEntry(hRawYieldME,
"Ev Mix",
"PL")->SetTextColor(4);
1090 legry->AddEntry(hRawYieldSBfit,
"Direct Fit",
"PL")->SetTextColor(6);
1096 TCanvas* cch2=
new TCanvas(
"cch2",
"Chi2",800,700);
1097 cch2->SetLeftMargin(0.15);
1098 hChiSqRot->SetMarkerStyle(21);
1099 hChiSqRot->Draw(
"P");
1100 hChiSqRot->SetMinimum(0);
1101 hChiSqRot->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
1102 hChiSqRot->GetYaxis()->SetTitle(
"#chi^{2}/ndf");
1103 hChiSqRot->GetYaxis()->SetTitleOffset(1.8);
1104 Double_t maxc=hChiSqRot->GetMaximum();
1105 if(hChiSqLS->GetMaximum()>maxc)maxc=hChiSqLS->GetMaximum();
1106 if(hChiSqME->GetMaximum()>maxc)maxc=hChiSqME->GetMaximum();
1108 if(hChiSqSBfit->GetMaximum()>maxc)maxc=hChiSqSBfit->GetMaximum();
1110 hChiSqRot->SetMaximum(maxc*1.2);
1112 hChiSqLS->SetMarkerStyle(22);
1113 hChiSqLS->SetMarkerColor(kGreen+2);
1114 hChiSqLS->SetLineColor(kGreen+2);
1115 hChiSqLS->Draw(
"PZSAME");
1116 hChiSqME->SetMarkerStyle(25);
1117 hChiSqME->SetMarkerColor(4);
1118 hChiSqME->SetLineColor(4);
1119 hChiSqME->Draw(
"PSAME");
1121 hChiSqSBfit->SetMarkerStyle(27);
1122 hChiSqSBfit->SetMarkerColor(6);
1123 hChiSqSBfit->SetLineColor(6);
1124 hChiSqSBfit->Draw(
"PSAME");
1133 TH1F* hRatioLSToME=(TH1F*)hRawYieldLS->Clone(
"hRatioLStoME");
1134 TH1F* hRatioRotToME=(TH1F*)hRawYieldRot->Clone(
"hRatioRottoME");
1135 TH1F* hRatioMEToME=(TH1F*)hRawYieldME->Clone(
"hRatioMEtoME");
1136 TH1F* hRatioSBToME=(TH1F*)hRawYieldSBfit->Clone(
"hRatioSBtoME");
1137 for(Int_t ib=1; ib<=hRawYieldME->GetNbinsX(); ib++){
1138 Double_t yme=hRawYieldME->GetBinContent(ib);
1140 hRatioLSToME->SetBinContent(ib,hRawYieldLS->GetBinContent(ib)/yme);
1141 hRatioLSToME->SetBinError(ib,hRawYieldLS->GetBinError(ib)/yme);
1142 hRatioMEToME->SetBinContent(ib,hRawYieldME->GetBinContent(ib)/yme);
1143 hRatioMEToME->SetBinError(ib,hRawYieldME->GetBinError(ib)/yme);
1144 hRatioRotToME->SetBinContent(ib,hRawYieldRot->GetBinContent(ib)/yme);
1145 hRatioRotToME->SetBinError(ib,hRawYieldRot->GetBinError(ib)/yme);
1146 hRatioSBToME->SetBinContent(ib,hRawYieldSBfit->GetBinContent(ib)/yme);
1147 hRatioSBToME->SetBinError(ib,hRawYieldSBfit->GetBinError(ib)/yme);
1151 TCanvas* cry2=
new TCanvas(
"cry2",
"RawYield+Ratios",1400,700);
1154 gPad->SetLeftMargin(0.15);
1155 gPad->SetRightMargin(0.05);
1156 hRawYieldRot->Draw(
"P");
1157 hRawYieldLS->Draw(
"PZSAME");
1158 hRawYieldME->Draw(
"PSAME");
1160 hRawYieldSBfit->Draw(
"PSAME");
1164 hRatioLSToME->SetStats(0);
1165 hRatioLSToME->SetMinimum(0.3);
1166 hRatioLSToME->SetMaximum(1.7);
1167 hRatioLSToME->GetYaxis()->SetTitle(
"Ratio To EvMix");
1168 hRatioLSToME->Draw(
"same");
1169 hRatioRotToME->Draw(
"same");
1170 hRatioMEToME->Draw(
"same");
1171 hRatioSBToME->Draw(
"same");
1176 cCompareResidualTrends->cd(1);
1177 TLegend *legRT=
new TLegend(*legry);
1178 legRT->SetX1NDC(0.12);
1179 legRT->SetY1NDC(0.7);
1180 legRT->SetX2NDC(0.3);
1181 legRT->SetY2NDC(0.9);
1185 TCanvas* cryBC=
new TCanvas(
"cryBC",
"RawYield with BC",800,700);
1186 cryBC->SetLeftMargin(0.15);
1187 hRawYieldRot->Draw(
"P");
1188 hRawYieldME->Draw(
"PSAME");
1189 hRawYieldLS->Draw(
"PZSAME");
1191 hRawYieldSBfit->Draw(
"PSAME");
1194 if(hRawYieldRotBC->GetMaximum()>max)max=hRawYieldRotBC->GetMaximum();
1195 if(hRawYieldLSBC->GetMaximum()>max)max=hRawYieldLSBC->GetMaximum();
1196 if(hRawYieldMEBC->GetMaximum()>max)max=hRawYieldMEBC->GetMaximum();
1198 if(hRawYieldSBfitBC->GetMaximum()>max)max=hRawYieldSBfitBC->GetMaximum();
1200 hRawYieldRot->SetMaximum(max*1.2);
1202 hRawYieldRotBC->SetMarkerStyle(21);
1203 hRawYieldRotBC->SetLineStyle(2);
1204 hRawYieldRotBC->Draw(
"PSAME");
1207 hRawYieldLSBC->SetMarkerStyle(22);
1208 hRawYieldLSBC->SetMarkerColor(kGreen+2);
1209 hRawYieldLSBC->SetLineColor(kGreen+2);
1210 hRawYieldLSBC->SetLineStyle(2);
1211 hRawYieldLSBC->Draw(
"PZSAME");
1213 hRawYieldMEBC->SetMarkerStyle(25);
1214 hRawYieldMEBC->SetMarkerColor(4);
1215 hRawYieldMEBC->SetLineColor(4);
1216 hRawYieldMEBC->SetLineStyle(2);
1217 hRawYieldMEBC->Draw(
"PSAME");
1219 hRawYieldSBfitBC->SetMarkerStyle(27);
1220 hRawYieldSBfitBC->SetMarkerColor(6);
1221 hRawYieldSBfitBC->SetLineColor(6);
1222 hRawYieldSBfitBC->SetLineStyle(2);
1223 hRawYieldSBfitBC->Draw(
"PSAME");
1226 TLegend* legryBC=
new TLegend(0.7,0.7,0.89,0.89);
1227 legryBC->SetFillStyle(0);
1228 legryBC->SetBorderSize(0);
1229 legryBC->AddEntry(hRawYieldRot,
"Rotational",
"PL")->SetTextColor(1);
1230 legryBC->AddEntry(hRawYieldRotBC,
"Rotational BC",
"PL")->SetTextColor(1);
1231 legryBC->AddEntry(hRawYieldLS,
"Like Sign ",
"PL")->SetTextColor(kGreen+2);
1232 legryBC->AddEntry(hRawYieldLSBC,
"Like Sign BC",
"PL")->SetTextColor(kGreen+2);
1233 legryBC->AddEntry(hRawYieldME,
"Ev Mix",
"PL")->SetTextColor(4);
1234 legryBC->AddEntry(hRawYieldMEBC,
"Ev Mix BC",
"PL")->SetTextColor(4);
1236 legryBC->AddEntry(hRawYieldSBfit,
"Direct Fit",
"PL")->SetTextColor(6);
1237 legryBC->AddEntry(hRawYieldSBfitBC,
"Direct Fit BC",
"PL")->SetTextColor(6);
1247 hRawYieldRot->Write();
1248 hRawYieldLS->Write();
1249 hRawYieldME->Write();
1250 hRawYieldSBfit->Write();
1254 hChiSqSBfit->Write();
1268 fitter->
Signal(3,sig,esig);
1269 Double_t mean=fitter->
GetMean();
1273 Double_t minBin=histo->FindBin(mean-3.*sigma);
1274 Double_t maxBin=histo->FindBin(mean+3.*sigma);
1275 Double_t back=histo->Integral(minBin,maxBin);
1276 TPaveText* tpar=
new TPaveText(0.5,0.7,0.89,.87,
"NDC");
1277 tpar->SetBorderSize(0);
1278 tpar->SetFillStyle(0);
1279 tpar->AddText(Form(
"Mean = %.3f #pm %.3f",mean,emean));
1280 tpar->AddText(Form(
"Sigma = %.3f #pm %.3f",sigma,esigma));
1281 tpar->SetTextColor(4);
1284 TPaveText* tss=
new TPaveText(0.15,0.15,0.5,0.4,
"NDC");
1285 tss->SetBorderSize(0);
1286 tss->SetFillStyle(0);
1287 tss->AddText(Form(
"S(3#sigma) = %.0f #pm %.0f",sig,esig));
1288 tss->AddText(Form(
"B(3#sigma) = %.3g",back));
1289 tss->AddText(Form(
"S/B (3#sigma) = %.4f",sig/back));
1290 tss->AddText(Form(
"Significance(3#sigma) = %.2f",sig/TMath::Sqrt(back+sig)));
1291 tss->SetTextColor(1);
TH1F * GetHistoClone() const
TH1 * AdaptRangesAndBinning(const TH1 *hRef, TH1 *h1)
void DrawHere(TVirtualPad *pd, Double_t nsigma=3, Int_t writeFitInfo=1) const
write the canvas in a root file
void SetFixReflOverS(Double_t val, Bool_t fixpar=kTRUE)
Double_t GetSignalBinCounting(TH1 *h, TF1 *fbackground, Double_t &err, Double_t nsigmaBC=4., Double_t sigmafit=0.010, Double_t minx=-999, Double_t maxx=-999)
void DivideCanvas(TCanvas *c, Int_t ndivisions)
void SetInitialGaussianMean(Double_t mean)
void DrawHere(TVirtualPad *pd, Double_t nsigma=3, Int_t writeFitInfo=1)
void SetBackHighPolDegree(Int_t deg)
void WriteFitInfo(AliHFMassFitter *fitter, TH1D *histo)
virtual void SetFixGaussianMean(Double_t mean=1.865, Bool_t fixpar=kTRUE)
void PrintGausParams(TH1F *hPulls)
Bool_t MassFitter(Bool_t draw=kTRUE)
TF1 * GetBackgroundRecalcFunc()
AliHFMassFitterVAR * ConfigureFitterVAR(TH1D *histo, Int_t iPtBin, Int_t typeback=6, Bool_t saveReflModifPlot=kTRUE)
void ProjectCombinHFAndFit()
AliHFMassFitterVAR for the fit of invariant mass distribution of charmed mesons.
virtual void Signal(Double_t nOfSigma, Double_t &signal, Double_t &errsignal) const
return total integral of the histogram
Double_t binLims[nPtBins+1]
void SetStyleHisto(TH1 *h, Int_t method, Int_t isXpt=-1)
Double_t GetMeanUncertainty() const
AliHFMassFitter * ConfigureFitter(TH1D *histo, Int_t iPtBin)
Double_t fitrangelow[nPtBins]
void SetReflectionSigmaFactor(Int_t constant)
Bool_t QuadraticSmooth(TH1 *h, Int_t ntimes=1)
Double_t GetNEventsForNorm()
Double_t nsigmaBinCounting
Double_t fitrangeup[nPtBins]
Double_t GetBackgroundNormalizationFactor(TH1D *hRatio)
void SetInitialGaussianSigma(Double_t sigma)
change the default value of the mean
TH1F * GetResidualsAndPulls(TH1 *h, TF1 *f, Double_t minrange=0, Double_t maxrange=-1, TH1 *hPulls=0x0, TH1 *hResidualTrend=0x0, TH1 *hPullsTrend=0x0)
virtual void SetFixGaussianSigma(Double_t sigma=0.012, Bool_t fixpar=kTRUE)
TH1F * SetTemplateReflections(const TH1 *h, TString option="templ", Double_t minRange=1.72, Double_t maxRange=2.05)
virtual Bool_t MassFitter(Bool_t draw=kTRUE)
void SetFixGaussianSigma(Double_t sigma=0.012, Bool_t fixpar=kTRUE)
Int_t nDegreeBackPol[nPtBins]
void SetFitOption(TString opt)
Double_t GetSigma() const
TF1 * GausPlusLine(Double_t minRange=1.72, Double_t maxRange=2.05)
void SetFixGaussianMean(Double_t mean=1.865, Bool_t fixpar=kTRUE)
AliHFMassFitter for the fit of invariant mass distribution of charmed mesons.
Double_t GetSigmaUncertainty() const