1 #if !defined(__CINT__) || defined(__MAKECINT__)
7 #include "TGraphAsymmErrors.h"
14 #include <Riostream.h>
44 const char *nbfilename=
"HFPtSpectrum_D0Kpi_method2_221110_newnorm.root",
45 const char *outfilename=
"HFPtSpectrum_D0Kpi_combinedFD.root",
46 const char *thfilename=
"D0DplusDstarPredictions_y05.root",
52 TFile * fcfile =
new TFile(fcfilename,
"read");
53 TH1D * histoSigmaCorrFc = (
TH1D*)fcfile->Get(
"histoSigmaCorr");
54 histoSigmaCorrFc->SetNameTitle(
"histoSigmaCorrFc",
"histoSigmaCorrFc");
56 gSigmaCorrFc->SetNameTitle(
"gSigmaCorrFc",
"gSigmaCorrFc");
58 gSigmaCorrConservativeFc->SetNameTitle(
"gSigmaCorrConservativeFc",
"Cross section (fc prompt fraction)");
60 gFcConservativeFc->SetNameTitle(
"gFcConservativeFc",
"fc prompt fraction");
64 TFile * nbfile =
new TFile(nbfilename,
"read");
65 TH1D * histoSigmaCorrNb = (
TH1D*)nbfile->Get(
"histoSigmaCorr");
66 histoSigmaCorrNb->SetNameTitle(
"histoSigmaCorrNb",
"histoSigmaCorrNb");
68 gSigmaCorrNb->SetNameTitle(
"gSigmaCorrNb",
"gSigmaCorrNb");
70 gSigmaCorrConservativeNb->SetNameTitle(
"gSigmaCorrConservativeNb",
"Cross section (Nb prompt fraction)");
72 gFcConservativeNb->SetNameTitle(
"gFcConservativeNb",
"Nb prompt fraction");
76 TFile *thfile =
new TFile(thfilename,
"read");
82 thD0Kpiprediction->SetLineColor(4);
83 thD0Kpiprediction->SetFillColor(kAzure+9);
84 thDpluskpipiprediction->SetLineColor(4);
85 thDpluskpipiprediction->SetFillColor(kAzure+9);
86 thDstarD0piprediction->SetLineColor(4);
87 thDstarD0piprediction->SetFillColor(kAzure+9);
88 thDsKKpiprediction->SetLineColor(4);
89 thDsKKpiprediction->SetFillColor(kAzure+9);
97 binwidth = histoSigmaCorrFc->GetBinWidth(i);
98 xlow = histoSigmaCorrFc->GetBinLowEdge(i);
101 limits[
nbins] = xlow + binwidth;
110 TH1D * histoSigmaCorr =
new TH1D(
"histoSigmaCorr",
"corrected cross-section (combined fc and Nb MC feed-down subtraction)",nbins,limits);
112 gSigmaCorr->SetNameTitle(
"gSigmaCorr",
"gSigmaCorr (combined fc and Nb MC FD)");
114 gFcCorrConservative->SetNameTitle(
"gFcCorrConservative",
"Combined prompt fraction");
116 gSigmaCorrConservative->SetNameTitle(
"gSigmaCorrConservative",
"Cross section (combined prompt fraction)");
118 gSigmaCorrConservativePC->SetNameTitle(
"gSigmaCorrConservativePC",
"Conservative gSigmaCorr (combined fc and Nb MC FD) in percentages [for drawing with AliHFSystErr]");
137 cout <<
" Systematics not yet implemented " << endl;
147 Double_t pt=0., average = 0., averageStatUnc=0., avErrx=0., avErryl=0., avErryh=0., avErryfdl=0., avErryfdh=0.;
148 Double_t avErrylPC=0., avErryhPC=0., avErryfdlPC=0., avErryfdhPC=0.;
149 Double_t valFc = 0., valFcErrstat=0., valFcErrx=0., valFcErryl=0., valFcErryh=0., valFcErryfdl=0., valFcErryfdh=0.;
150 Double_t valNb = 0., valNbErrstat=0., valNbErrx=0., valNbErryl=0., valNbErryh=0., valNbErryfdl=0., valNbErryfdh=0.;
151 Double_t corrfd = 0., corrfdl=0., corrfdh=0.;
156 valFc = histoSigmaCorrFc->GetBinContent(ibin);
157 pt = histoSigmaCorrFc->GetBinCenter(ibin);
158 valFcErrstat = histoSigmaCorrFc->GetBinError(ibin);
160 gSigmaCorrConservativeFc->GetPoint(ibin,ptt,value);
161 if (value<=0.)
continue;
162 if ( TMath::Abs(valFc-value)>0.1 || TMath::Abs(pt-ptt)>0.1 )
163 cout <<
"Hey you ! There might be a problem with the fc input file, please, have a look !" << endl;
164 valFcErrx = gSigmaCorrFc->GetErrorXlow(ibin);
165 valFcErryl = gSigmaCorrFc->GetErrorYlow(ibin);
166 valFcErryh = gSigmaCorrFc->GetErrorYhigh(ibin);
167 valFcErryfdl = TMath::Abs( gSigmaCorrConservativeFc->GetErrorYlow(ibin) );
168 valFcErryfdh = TMath::Abs( gSigmaCorrConservativeFc->GetErrorYhigh(ibin) );
170 gFcConservativeFc->GetPoint(ibin,x,valfdFc);
171 Double_t valfdFch = gFcConservativeFc->GetErrorYhigh(ibin);
172 Double_t valfdFcl = gFcConservativeFc->GetErrorYlow(ibin);
175 valNb = histoSigmaCorrNb->GetBinContent(ibin);
176 pt = histoSigmaCorrNb->GetBinCenter(ibin);
177 valNbErrstat = histoSigmaCorrNb->GetBinError(ibin);
178 gSigmaCorrConservativeNb->GetPoint(ibin,ptt,value);
179 if ( TMath::Abs(valNb-value)>0.1 || TMath::Abs(pt-ptt)>0.1 )
180 cout <<
"Hey you ! There might be a problem with the Nb input file, please, have a look !" << endl;
181 valNbErrx = gSigmaCorrNb->GetErrorXlow(ibin);
182 valNbErryl = gSigmaCorrNb->GetErrorYlow(ibin);
183 valNbErryh = gSigmaCorrNb->GetErrorYhigh(ibin);
184 valNbErryfdl = gSigmaCorrConservativeNb->GetErrorYlow(ibin);
185 valNbErryfdh = gSigmaCorrConservativeNb->GetErrorYhigh(ibin);
187 gFcConservativeNb->GetPoint(ibin,x,valfdNb);
188 Double_t valfdNbh = gFcConservativeNb->GetErrorYhigh(ibin);
189 Double_t valfdNbl = gFcConservativeNb->GetErrorYlow(ibin);
197 if ( TMath::Abs( valFcErrx - valNbErrx ) > 0.1 )
198 cout <<
"Hey you ! There might be consistency problem with the fc & Nb input files, please, have a look !" << endl;
199 averageStatUnc = valNbErrstat ;
204 Double_t minimum[2] = { (valFc - valFcErryfdl), (valNb - valNbErryfdl) };
205 Double_t maximum[2] = { (valFc + valFcErryfdh), (valNb + valNbErryfdh) };
206 avErryfdl = average - TMath::MinElement(2,minimum);
207 avErryfdh = TMath::MaxElement(2,maximum) - average;
209 avErryfdl = average - (valNb - valNbErryfdl);
210 avErryfdh = (valNb + valNbErryfdh) - average;
212 avErryfdlPC = avErryfdl / average ;
213 avErryfdhPC = avErryfdh / average ;
217 Double_t minimumfc[2] = { (valfdNb - valfdNbl), (valfdFc - valfdFcl) };
218 Double_t maximumfc[2] = { (valfdNb + valfdNbh), (valfdFc + valfdFch) };
219 corrfdl = corrfd - TMath::MinElement(2,minimumfc);
220 corrfdh = TMath::MaxElement(2,maximumfc) - corrfd;
226 avErryl = avErrylPC * average ;
227 avErryh = avErryhPC * average ;
233 if ( average > 0.1 ) {
234 histoSigmaCorr->SetBinContent(ibin,average);
235 histoSigmaCorr->SetBinError(ibin,averageStatUnc);
236 gSigmaCorr->SetPoint(ibin,pt,average);
237 gSigmaCorr->SetPointError(ibin,valFcErrx,valFcErrx,avErryl,avErryh);
238 gSigmaCorrConservative->SetPoint(ibin,pt,average);
239 gSigmaCorrConservative->SetPointError(ibin,valFcErrx,valFcErrx,avErryfdl,avErryfdh);
240 gSigmaCorrConservativePC->SetPoint(ibin,pt,0.);
241 gSigmaCorrConservativePC->SetPointError(ibin,valFcErrx,valFcErrx,avErryfdlPC,avErryfdhPC);
242 gFcCorrConservative->SetPoint(ibin,pt,corrfd);
243 gFcCorrConservative->SetPointError(ibin,valFcErrx,valFcErrx,corrfdl,corrfdh);
249 gROOT->SetStyle(
"Plain");
250 gStyle->SetOptTitle(0);
254 TH2F *histo2Draw =
new TH2F(
"histo2Draw",
"histo2 (for drawing)",100,0,20.,100,1e3,5e7);
255 histo2Draw->SetStats(0);
256 histo2Draw->GetXaxis()->SetTitle(
"p_{T} [GeV]");
257 histo2Draw->GetXaxis()->SetTitleSize(0.05);
258 histo2Draw->GetXaxis()->SetTitleOffset(0.95);
259 histo2Draw->GetYaxis()->SetTitle(
"#frac{1}{BR} #times #frac{d#sigma}{dp_{T}} |_{|y|<0.5}");
260 histo2Draw->GetYaxis()->SetTitleSize(0.05);
262 TCanvas *combinefdunc =
new TCanvas(
"combinefdunc",
"show the FD results combination");
266 histoSigmaCorrFc->SetMarkerStyle(20);
267 histoSigmaCorrFc->SetMarkerColor(kGreen+2);
268 histoSigmaCorrFc->SetLineColor(kGreen+2);
269 histoSigmaCorrFc->Draw(
"esame");
270 gSigmaCorrConservativeFc->SetMarkerStyle(20);
271 gSigmaCorrConservativeFc->SetMarkerColor(kGreen+2);
272 gSigmaCorrConservativeFc->SetLineColor(kGreen+2);
273 gSigmaCorrConservativeFc->SetFillStyle(3004);
274 gSigmaCorrConservativeFc->SetFillColor(kGreen);
275 gSigmaCorrConservativeFc->Draw(
"2[]same");
277 histoSigmaCorrNb->SetMarkerStyle(25);
278 histoSigmaCorrNb->SetMarkerColor(kViolet+5);
279 histoSigmaCorrNb->SetLineColor(kViolet+5);
280 histoSigmaCorrNb->Draw(
"esame");
281 gSigmaCorrConservativeNb->SetMarkerStyle(25);
282 gSigmaCorrConservativeNb->SetMarkerColor(kOrange+7);
283 gSigmaCorrConservativeNb->SetLineColor(kOrange+7);
284 gSigmaCorrConservativeNb->SetFillStyle(3018);
285 gSigmaCorrConservativeNb->SetFillColor(kMagenta);
286 gSigmaCorrConservativeNb->Draw(
"2[]same");
288 gSigmaCorrConservative->SetLineColor(kRed);
289 gSigmaCorrConservative->SetLineWidth(2);
290 gSigmaCorrConservative->SetFillColor(kRed);
291 gSigmaCorrConservative->SetFillStyle(0);
292 gSigmaCorrConservative->Draw(
"2");
293 histoSigmaCorr->SetMarkerColor(kRed);
294 histoSigmaCorr->Draw(
"esame");
297 TLegend* leg=combinefdunc->BuildLegend();
298 leg->SetFillStyle(0);
299 combinefdunc->SetLogy();
300 combinefdunc->Update();
302 TCanvas *combinefcunc =
new TCanvas(
"combinefcunc",
"show the fc FD results combination");
304 TH2F *histo3Draw =
new TH2F(
"histo3Draw",
"histo3 (for drawing)",100,0,20.,10,0.,1.);
305 histo3Draw->SetStats(0);
306 histo3Draw->GetXaxis()->SetTitle(
"p_{T} [GeV]");
307 histo3Draw->GetXaxis()->SetTitleSize(0.05);
308 histo3Draw->GetXaxis()->SetTitleOffset(0.95);
309 histo3Draw->GetYaxis()->SetTitle(
"Prompt fraction of the raw yields");
310 histo3Draw->GetYaxis()->SetTitleSize(0.05);
313 gFcConservativeFc->SetMarkerStyle(20);
314 gFcConservativeFc->SetMarkerColor(kGreen+2);
315 gFcConservativeFc->SetLineColor(kGreen+2);
316 gFcConservativeFc->SetFillStyle(3004);
317 gFcConservativeFc->SetFillColor(kGreen);
318 gFcConservativeFc->Draw(
"2P");
320 gFcConservativeNb ->SetMarkerStyle(25);
321 gFcConservativeNb ->SetMarkerSize(1.3);
322 gFcConservativeNb->SetMarkerColor(kOrange+7);
323 gFcConservativeNb->SetLineColor(kOrange+7);
324 gFcConservativeNb->SetFillStyle(3018);
325 gFcConservativeNb->SetFillColor(kMagenta);
326 gFcConservativeNb->Draw(
"2P");
328 gFcCorrConservative->SetMarkerStyle(21);
329 gFcCorrConservative->SetLineColor(kRed);
330 gFcCorrConservative->SetLineWidth(2);
331 gFcCorrConservative->SetFillColor(kRed);
332 gFcCorrConservative->SetFillStyle(0);
333 gFcCorrConservative->Draw(
"2P");
335 leg=combinefcunc->BuildLegend();
336 leg->SetFillStyle(0);
338 combinefcunc->Update();
342 TCanvas *finalresults =
new TCanvas(
"finalresults",
"show all combined results");
345 thD0Kpiprediction->SetLineColor(kGreen+2);
346 thD0Kpiprediction->SetLineWidth(3);
347 thD0Kpiprediction->SetFillColor(kGreen-6);
348 thD0Kpiprediction->Draw(
"3CA");
349 thD0Kpiprediction->Draw(
"CX");
351 else if (
decay==2 ) {
352 thDpluskpipiprediction->SetLineColor(kGreen+2);
353 thDpluskpipiprediction->SetLineWidth(3);
354 thDpluskpipiprediction->SetFillColor(kGreen-6);
355 thDpluskpipiprediction->Draw(
"3CA");
356 thDpluskpipiprediction->Draw(
"CX");
358 else if (
decay==3 ) {
359 thDstarD0piprediction->SetLineColor(kGreen+2);
360 thDstarD0piprediction->SetLineWidth(3);
361 thDstarD0piprediction->SetFillColor(kGreen-6);
362 thDstarD0piprediction->Draw(
"3CA");
363 thDstarD0piprediction->Draw(
"CX");
365 else if (
decay==4 ) {
366 thDsKKpiprediction->SetLineColor(kGreen+2);
367 thDsKKpiprediction->SetLineWidth(3);
368 thDsKKpiprediction->SetFillColor(kGreen-6);
369 thDsKKpiprediction->Draw(
"3CA");
370 thDsKKpiprediction->Draw(
"CX");
373 gSigmaCorr->SetLineColor(kRed);
374 gSigmaCorr->SetLineWidth(1);
375 gSigmaCorr->SetFillColor(kRed);
376 gSigmaCorr->SetFillStyle(0);
377 gSigmaCorr->Draw(
"2");
378 histoSigmaCorr->SetMarkerStyle(21);
379 histoSigmaCorr->SetMarkerColor(kRed);
380 histoSigmaCorr->Draw(
"esame");
382 leg =
new TLegend(0.7,0.75,0.87,0.5);
383 leg->SetBorderSize(0);
384 leg->SetLineColor(0);
385 leg->SetFillColor(0);
386 leg->SetTextFont(42);
387 if (
decay==1 ) leg->AddEntry(thD0Kpiprediction,
"FONLL ",
"fl");
388 else if (
decay==2 ) leg->AddEntry(thDpluskpipiprediction,
"FONLL ",
"fl");
389 else if (
decay==3 ) leg->AddEntry(thDstarD0piprediction,
"FONLL ",
"fl");
390 else if (
decay==4 ) leg->AddEntry(thDsKKpiprediction,
"FONLL ",
"fl");
391 leg->AddEntry(histoSigmaCorr,
"data stat. unc.",
"pl");
392 leg->AddEntry(gSigmaCorr,
"data syst. unc.",
"f");
395 finalresults->SetLogy();
396 finalresults->Update();
401 systematics.
DrawErrors(gSigmaCorrConservativePC);
405 TFile * out =
new TFile(outfilename,
"recreate");
406 histoSigmaCorr->Write();
408 gSigmaCorrConservative->Write();
409 gSigmaCorrConservativePC->Write();
410 gFcCorrConservative->Write();
void SetIsLowEnergy(Bool_t flag)
void SetCentrality(TString centrality)
Double_t GetTotalSystErr(Double_t pt, Double_t feeddownErr=0) const
void Init(Int_t decay)
Function to initialize the variables/histograms.
void SetCollisionType(Int_t type)
void CombineFeedDownMCSubtractionMethodsUncertainties(const char *fcfilename="HFPtSpectrum_D0Kpi_method1_221110_newnorm.root", const char *nbfilename="HFPtSpectrum_D0Kpi_method2_221110_newnorm.root", const char *outfilename="HFPtSpectrum_D0Kpi_combinedFD.root", const char *thfilename="D0DplusDstarPredictions_y05.root", Int_t decay=1, Int_t centrality=kpp7, Bool_t useFC=kTRUE)
void DrawErrors(TGraphAsymmErrors *grErrFeeddown=0) const
void SetRunNumber(Int_t number)