1 #if !defined(__CINT__) || defined(__MAKECINT__) 5 #include <TPaveStats.h> 15 #include <TLegendEntry.h> 35 TString fileWeightName=
"trackletsWeightsMultInt_LHC13d3_08092014.root";
37 histoWeightName[0]=
"hNtrUnCorrEvWithCand";
38 histoWeightName[1]=
"hNtrUnCorrEvWithD";
39 histoWeightName[2]=
"hNtrUnCorrEvSel";
40 Int_t wcol[3]={kRed+1,kGreen+1,4};
41 Int_t wmark[3]={22,23,26};
45 TF1* funcPtWeight=0x0;
47 funcPtWeight=
new TF1(
"funcPtWeight",
"([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,30.);
48 funcPtWeight->SetParameters(2.94999e+00,3.47032e+00,2.81278e+00,2.5,1.93370e-02,3.86865e+00,-1.54113e-01,8.86944e-02,2.56267e-02);
50 funcPtWeight=
new TF1(
"funcPtWeight",
"([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,40.);
51 funcPtWeight->SetParameters(2.41522e+01,4.92146e+00,6.72495e+00,2.5,6.15361e-03,4.78995e+00,-4.29135e-01,3.99421e-01,-1.57220e-02);
53 funcPtWeight=
new TF1(
"funcPtWeight",
"([0]*x)/TMath::Power([2],(1+TMath::Power([3],x/[1])))+[4]*TMath::Exp([5]+[6]*x)+[7]*TMath::Exp([8]*x)",0.15,40.);
54 funcPtWeight->SetParameters(3.59525,2.67871,2.70402,1.72578,4.78167e-03,4.90992,-1.26424e-01,8.21269e-02,-1.26425e-01);
56 funcPtWeight=
new TF1(
"funcPtWeight",
"[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.15,40.);
57 funcPtWeight->SetParameters(1.99498e-01,-9.90532e-02,3.03645e-02,7.42483e-04);
59 funcPtWeight=
new TF1(
"funcPtWeight",
"[0]");
60 funcPtWeight->SetParameter(0,1.);
63 Int_t ptcol[
nPtBins]={1,kRed+1,kGreen+2,4,kOrange+2,kMagenta,kAzure+5,kMagenta+2};
66 TString dirName=Form(
"PWG3_D2H_InvMassDzeroLowPt%s",suffix.Data());
67 TString lstName=Form(
"coutputDzero%s",suffix.Data());
68 TFile*
fil=
new TFile(fileNameMC.Data());
69 TDirectoryFile* df=(TDirectoryFile*)fil->Get(dirName.Data());
76 TH2F* hEventMultZv=(
TH2F*)l->FindObject(
"hEventMultZv");
78 TH2F* hEventMultZvEvSel=(
TH2F*)l->FindObject(
"hEventMultZvEvSel");
79 hEventMultZv->GetXaxis()->SetTitle(
"Z_{vertex} (cm)");
80 hEventMultZv->GetYaxis()->SetTitle(
"N_{tracklets}");
81 hEventMultZvEvSel->GetXaxis()->SetTitle(
"Z_{vertex} (cm)");
82 hEventMultZvEvSel->GetYaxis()->SetTitle(
"N_{tracklets}");
84 Int_t binzm10=hEventMultZvEvSel->GetXaxis()->FindBin(-9.999);
85 Int_t binzp10=hEventMultZvEvSel->GetXaxis()->FindBin(9.999);
86 printf(
"%d %f --- %d %f\n",binzm10,hEventMultZvEvSel->GetXaxis()->GetBinLowEdge(binzm10),
87 binzp10,hEventMultZvEvSel->GetXaxis()->GetBinUpEdge(binzp10));
88 TH1D* hMultAllEv=hEventMultZv->ProjectionY(
"hMultAllEv");
89 TH1D* hMultEvZ10=hEventMultZv->ProjectionY(
"hMultEvZ10",binzm10,binzp10);
90 TH1D* hMultEvSel=hEventMultZvEvSel->ProjectionY(
"hMultEvSel");
91 hMultAllEv->SetLineColor(1);
92 hMultEvZ10->SetLineColor(kGreen+2);
93 hMultEvSel->SetLineColor(6);
94 hMultAllEv->GetYaxis()->SetTitle(
"Entries");
96 TH1D* hZvAllEv=hEventMultZv->ProjectionX(
"hZvAllEv");
97 TH1D* hZvEvSel=hEventMultZvEvSel->ProjectionX(
"hZvEvSel");
98 hZvAllEv->SetLineColor(1);
99 hZvEvSel->SetLineColor(6);
100 hZvAllEv->GetYaxis()->SetTitle(
"Entries");
102 TH1D* hRatioMultEv=(
TH1D*)hMultEvSel->Clone(
"hRatioMultEv");
103 hRatioMultEv->Divide(hMultEvSel,hMultEvZ10,1.,1.,
"B");
104 hRatioMultEv->SetStats(0);
105 hRatioMultEv->GetYaxis()->SetTitle(
"Ratio");
106 hRatioMultEv->SetLineColor(4);
107 TH1D* hRatioMultEvAll=(
TH1D*)hMultEvSel->Clone(
"hRatioMultEvAll");
108 hRatioMultEvAll->Divide(hMultEvSel,hMultAllEv,1.,1.,
"B");
109 hRatioMultEvAll->SetStats(0);
110 hRatioMultEvAll->GetYaxis()->SetTitle(
"Ratio");
111 hRatioMultEvAll->SetLineColor(6);
112 TH1D* hRatioMultEvZ10=(
TH1D*)hMultEvZ10->Clone(
"hRatioMultEvZ10");
113 hRatioMultEvZ10->Divide(hMultEvZ10,hMultAllEv,1.,1.,
"B");
114 hRatioMultEvZ10->SetStats(0);
115 hRatioMultEvZ10->GetYaxis()->SetTitle(
"Ratio");
116 TH1D* hRatioZvEv=(
TH1D*)hZvEvSel->Clone(
"hRatioZvEv");
117 hRatioZvEv->Divide(hZvEvSel,hZvAllEv,1.,1.,
"B");
118 hRatioZvEv->SetStats(0);
119 hRatioZvEv->GetYaxis()->SetTitle(
"Ratio");
121 TCanvas* cev=
new TCanvas(
"cev",
"Event selection",1300,950);
127 hMultAllEv->GetXaxis()->SetRangeUser(0.,
maxMult);
130 TPaveStats *sta=(TPaveStats*)hMultAllEv->GetListOfFunctions()->FindObject(
"stats");
134 hMultEvZ10->Draw(
"sames");
136 TPaveStats *stz=(TPaveStats*)hMultEvZ10->GetListOfFunctions()->FindObject(
"stats");
139 stz->SetTextColor(hMultEvZ10->GetLineColor());
141 hMultEvSel->Draw(
"sames");
143 TPaveStats *stb=(TPaveStats*)hMultEvSel->GetListOfFunctions()->FindObject(
"stats");
146 stb->SetTextColor(hMultEvSel->GetLineColor());
151 hRatioMultEvAll->SetMinimum(0.);
152 hRatioMultEvAll->GetXaxis()->SetRangeUser(0.,
maxMult);
153 hRatioMultEvAll->Draw();
154 hRatioMultEvZ10->Draw(
"same");
155 hRatioMultEv->Draw(
"same");
156 TLegend* leg=
new TLegend(0.45,0.3,0.89,0.7);
157 leg->AddEntry(hRatioMultEvAll,
"EvSel / AllEv",
"L")->SetTextColor(hRatioMultEvAll->GetLineColor());
158 leg->AddEntry(hRatioMultEvZ10,
"Ev(|z|<10) / AllEv",
"L")->SetTextColor(hRatioMultEvZ10->GetLineColor());
159 leg->AddEntry(hRatioMultEv,
"EvSel / Ev(|z|<10)",
"L")->SetTextColor(hRatioMultEv->GetLineColor());
166 TPaveStats *stc=(TPaveStats*)hZvAllEv->GetListOfFunctions()->FindObject(
"stats");
170 hZvEvSel->Draw(
"sames");
172 TPaveStats *
std=(TPaveStats*)hZvEvSel->GetListOfFunctions()->FindObject(
"stats");
175 std->SetTextColor(hZvEvSel->GetLineColor());
180 hRatioZvEv->SetMinimum(0.85);
181 hRatioZvEv->SetMaximum(1.01);
183 cev->SaveAs(Form(
"figures/FracEvSel%s.eps",suffix.Data()));
189 TH3F* hPtVsYVsMultReco=(
TH3F*)l->FindObject(
"hPtVsYVsMultReco");
190 TH3F* hPtVsYVsMultGenAccEvSel=(
TH3F*)l->FindObject(
"hPtVsYVsMultGenAccEvSel");
191 TH3F* hPtVsYVsMultGenAcc=(
TH3F*)l->FindObject(
"hPtVsYVsMultGenAcc");
192 TH3F* hPtVsYVsMultGenLimAcc=(
TH3F*)l->FindObject(
"hPtVsYVsMultGenLimAcc");
194 TH2D* hypt=(
TH2D*)hPtVsYVsMultGenAcc->Project3D(
"yx");
195 hypt->SetTitle(
"Generated in acceptance, all multiplcities");
196 TH2D* hptmult=(
TH2D*)hPtVsYVsMultGenLimAcc->Project3D(
"xz");
197 hptmult->SetTitle(
"Generated in |y|<0.5");
198 hptmult->SetStats(0);
200 hypt->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
201 hypt->GetYaxis()->SetTitle(
"y");
202 hptmult->GetYaxis()->SetTitle(
"p_{T} (GeV/c)");
203 hptmult->GetXaxis()->SetTitle(
"N_{tracklets} in |#eta|<1");
204 hptmult->GetXaxis()->SetRangeUser(0.,
maxMult);
206 TProfile* hMeanPtMult=hptmult->ProfileX(
"hMeanPtMult");
207 TCanvas* c0=
new TCanvas(
"c0",
"2D plots",1200,600);
211 gPad->SetRightMargin(0.12);
215 gPad->SetRightMargin(0.13);
216 hptmult->Draw(
"colz");
217 hMeanPtMult->Draw(
"same");
220 TH1D* hPtReco=hPtVsYVsMultReco->ProjectionX(
"hPtReco");
221 TH1D* hPtGenAcc=hPtVsYVsMultGenAcc->ProjectionX(
"hPtGenAcc");
222 TH1D* hPtGenAccEvSel=0x0;
223 if(hPtVsYVsMultGenAccEvSel) hPtGenAccEvSel=hPtVsYVsMultGenAccEvSel->ProjectionX(
"hPtGenAccEvSel");
224 TH1D* hPtGenLimAcc=hPtVsYVsMultGenLimAcc->ProjectionX(
"hPtGenLimAcc");
228 TH1D* hEffVsPt=(
TH1D*)hPtReco->Clone(
"hEff");
229 hEffVsPt->Divide(hPtReco,hPtGenAcc,1,1,
"B");
230 TH1D* hEffVsPtR=(
TH1D*)hPtRecoR->Clone(
"hEff");
231 hEffVsPtR->Divide(hPtRecoR,hPtGenAccR,1,1,
"B");
232 hEffVsPt->SetStats(0);
233 hEffVsPtR->SetStats(0);
234 TH1D* hAccVsPt=(
TH1D*)hPtGenAcc->Clone(
"hAcc");
235 hAccVsPt->Divide(hPtGenAcc,hPtGenLimAcc,1,1,
"B");
236 TH1D* hAccVsPtR=(
TH1D*)hPtGenAccR->Clone(
"hAcc");
237 hAccVsPtR->Divide(hPtGenAccR,hPtGenLimAccR,1,1,
"B");
238 hAccVsPt->SetStats(0);
239 hAccVsPtR->SetStats(0);
240 TH1D* hEvSelEffVsPt=0x0;
242 hEvSelEffVsPt=(
TH1D*)hPtGenAccEvSel->Clone(
"hEvSelEff");
243 hEvSelEffVsPt->Divide(hPtGenAccEvSel,hPtGenAcc,1,1,
"B");
244 hEvSelEffVsPt->SetStats(0);
247 TFile* fileAccToy=
new TFile(fileNameToy.Data());
248 TH1F* hPtGenAccToy=(TH1F*)fileAccToy->Get(
"hPtGenAcc");
249 TH1F* hPtGenLimAccToy=(TH1F*)fileAccToy->Get(
"hPtGenLimAcc");
250 TH1F* hAccToyFine=(TH1F*)fileAccToy->Get(
"hAccVsPt");
251 TH1F* hPtGenAccToyR=(TH1F*)hPtGenAccToy->Rebin(
nPtBins,
"hPtGenAccToyReb",
binLims);
252 TH1F* hPtGenLimAccToyR=(TH1F*)hPtGenLimAccToy->Rebin(
nPtBins,
"hPtGenLimAccToyReb",
binLims);
253 TH1F* hAccToy=(TH1F*)hPtGenAccToyR->Clone(
"hAccToy");
254 hPtGenAccToyR->Sumw2();
255 hPtGenLimAccToyR->Sumw2();
256 hAccToy->Divide(hPtGenAccToyR,hPtGenLimAccToyR,1,1,
"B");
257 hAccToy->SetLineColor(kGreen+2);
258 hAccToy->SetLineWidth(3);
259 hAccToy->SetMarkerStyle(25);
260 hAccToy->SetMarkerColor(kGreen+2);
261 hAccToy->SetStats(0);
262 hAccToyFine->SetLineColor(kGreen+2);
264 TCanvas* c1a=
new TCanvas(
"c1a",
"AccVsPt",1200,600);
268 hPtGenLimAcc->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
269 hPtGenLimAcc->GetYaxis()->SetTitle(
"Entries");
270 hPtGenLimAcc->SetLineColor(1);
271 hPtGenLimAcc->Draw();
273 TPaveStats *st1=(TPaveStats*)hPtGenLimAcc->GetListOfFunctions()->FindObject(
"stats");
276 hPtGenAcc->SetLineColor(2);
277 hPtGenAcc->Draw(
"sames");
279 TPaveStats *st2=(TPaveStats*)hPtGenAcc->GetListOfFunctions()->FindObject(
"stats");
282 st2->SetTextColor(2);
284 hPtGenAccEvSel->SetLineColor(6);
285 hPtGenAccEvSel->Draw(
"sames");
287 TPaveStats *st2s=(TPaveStats*)hPtGenAccEvSel->GetListOfFunctions()->FindObject(
"stats");
289 st2s->SetY2NDC(0.49);
290 st2s->SetTextColor(6);
292 hPtReco->SetLineColor(4);
293 hPtReco->Draw(
"sames");
295 TPaveStats *st13=(TPaveStats*)hPtReco->GetListOfFunctions()->FindObject(
"stats");
297 st13->SetY2NDC(0.29);
298 st13->SetTextColor(4);
301 hEffVsPt->SetLineColor(4);
302 hEffVsPt->SetMinimum(0);
303 hEffVsPt->SetMaximum(1.95);
304 hEffVsPt->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
305 hEffVsPt->GetYaxis()->SetTitle(
"Ratio");
307 hAccVsPt->SetLineColor(2);
308 hAccVsPt->Draw(
"same");
309 hAccToyFine->Draw(
"same");
310 hAccToy->Draw(
"same");
311 TLatex* tacc=
new TLatex(0.16,0.83,
"Acceptance (CombinHF, 13d3)");
313 tacc->SetTextColor(hAccVsPt->GetLineColor());
315 TLatex* tacct=
new TLatex(0.16,0.76,
"Acceptance (ToyMC)");
317 tacct->SetTextColor(hAccToyFine->GetLineColor());
319 TLatex* te=
new TLatex(0.16,0.69,
"Efficiency");
321 te->SetTextColor(hEffVsPt->GetLineColor());
325 TCanvas* c1e=
new TCanvas(
"c1e",
"EffVsPt",1200,600);
329 hPtGenLimAcc->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
330 hPtGenLimAcc->GetYaxis()->SetTitle(
"Entries");
331 hPtGenLimAcc->SetLineColor(1);
332 hPtGenLimAcc->Draw();
334 TPaveStats *st11=(TPaveStats*)hPtGenLimAcc->GetListOfFunctions()->FindObject(
"stats");
336 st11->SetY2NDC(0.89);
337 hPtGenAcc->SetLineColor(2);
338 hPtGenAcc->Draw(
"sames");
340 TPaveStats *st12=(TPaveStats*)hPtGenAcc->GetListOfFunctions()->FindObject(
"stats");
342 st12->SetY2NDC(0.69);
343 st12->SetTextColor(2);
345 hPtGenAccEvSel->SetLineColor(6);
346 hPtGenAccEvSel->Draw(
"sames");
348 TPaveStats *st12s=(TPaveStats*)hPtGenAccEvSel->GetListOfFunctions()->FindObject(
"stats");
349 st12s->SetY1NDC(0.3);
350 st12s->SetY2NDC(0.49);
351 st12s->SetTextColor(6);
353 hPtReco->SetLineColor(4);
354 hPtReco->Draw(
"sames");
356 TPaveStats *st3=(TPaveStats*)hPtReco->GetListOfFunctions()->FindObject(
"stats");
359 st3->SetTextColor(4);
362 TLatex* t1=
new TLatex(6.,0.25,
"GenAccInEvSel / GenAcc");
365 hEvSelEffVsPt->SetLineColor(6);
366 hEvSelEffVsPt->SetMinimum(0);
367 hEvSelEffVsPt->SetMaximum(1.05);
368 hEvSelEffVsPt->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
369 hEvSelEffVsPt->GetYaxis()->SetTitle(
"Ratio");
370 hEvSelEffVsPt->Draw();
373 hEffVsPt->Draw(
"same");
374 TLatex* t3=
new TLatex(6.,0.15,
"Reco / GenAcc");
377 c1e->SaveAs(Form(
"figures/EfficVsPt_%s.eps",suffix.Data()));
380 TH1D* hMultRecoAllPt=hPtVsYVsMultReco->ProjectionZ(
"hMultReco");
381 TH1D* hMultGenAccAllPt=hPtVsYVsMultGenAcc->ProjectionZ(
"hMultGenAcc");
382 TH1D* hMultGenAccEvSelAllPt=0x0;
383 if(hPtVsYVsMultGenAccEvSel) hMultGenAccEvSelAllPt=hPtVsYVsMultGenAccEvSel->ProjectionZ(
"hMultGenAccEvSel");
384 TH1D* hMultGenLimAccAllPt=hPtVsYVsMultGenLimAcc->ProjectionZ(
"hMultGenLimAcc");
385 TH1D* hEffVsMultAllPt=(
TH1D*)hMultRecoAllPt->Clone(
"hEff");
386 hEffVsMultAllPt->Divide(hMultRecoAllPt,hMultGenAccAllPt,1,1,
"B");
387 TH1D* hAccEffVsMultAllPt=(
TH1D*)hMultRecoAllPt->Clone(
"hAccEff");
388 hAccEffVsMultAllPt->Divide(hMultRecoAllPt,hMultGenLimAccAllPt,1,1,
"B");
389 TH1D* hAccVsMultAllPt=(
TH1D*)hMultGenAccAllPt->Clone(
"hAcc");
390 hAccVsMultAllPt->Divide(hMultGenAccAllPt,hMultGenLimAccAllPt,1,1,
"B");
391 hEffVsMultAllPt->SetStats(0);
392 hAccVsMultAllPt->SetStats(0);
393 hAccEffVsMultAllPt->SetStats(0);
394 TH1D* hEvSelEffVsMultAllPt=0x0;
395 if(hMultGenAccEvSelAllPt){
396 hEvSelEffVsMultAllPt=(
TH1D*)hMultGenAccEvSelAllPt->Clone(
"hEvSelEffMult");
397 hEvSelEffVsMultAllPt->Divide(hMultGenAccEvSelAllPt,hMultGenAccAllPt,1,1,
"B");
398 hEvSelEffVsMultAllPt->SetStats(0);
401 TCanvas* c2a=
new TCanvas(
"c2a",
"AccVsMult",1200,600);
405 hMultGenLimAccAllPt->SetLineColor(1);
406 hMultGenLimAccAllPt->GetXaxis()->SetTitle(
"N_{tracklets} in |#eta|<1");
407 hMultGenLimAccAllPt->GetYaxis()->SetTitle(
"Entries");
408 hMultGenLimAccAllPt->GetXaxis()->SetRangeUser(0.,
maxMult);
409 hMultGenLimAccAllPt->Draw();
411 TPaveStats *st21=(TPaveStats*)hMultGenLimAccAllPt->GetListOfFunctions()->FindObject(
"stats");
413 st21->SetY2NDC(0.89);
414 hMultGenAccAllPt->SetLineColor(2);
415 hMultGenAccAllPt->Draw(
"sames");
417 TPaveStats *st22=(TPaveStats*)hMultGenAccAllPt->GetListOfFunctions()->FindObject(
"stats");
419 st22->SetY2NDC(0.69);
420 st22->SetTextColor(2);
421 if(hMultGenAccEvSelAllPt){
422 hMultGenAccEvSelAllPt->SetLineColor(6);
423 hMultGenAccEvSelAllPt->Draw(
"sames");
425 TPaveStats *st22s=(TPaveStats*)hMultGenAccEvSelAllPt->GetListOfFunctions()->FindObject(
"stats");
426 st22s->SetY1NDC(0.3);
427 st22s->SetY2NDC(0.49);
428 st22s->SetTextColor(6);
430 hMultRecoAllPt->SetLineColor(4);
431 hMultRecoAllPt->Draw(
"sames");
433 TPaveStats *st23=(TPaveStats*)hMultRecoAllPt->GetListOfFunctions()->FindObject(
"stats");
435 st23->SetY2NDC(0.29);
436 st23->SetTextColor(4);
439 hEffVsMultAllPt->SetLineColor(4);
440 hEffVsMultAllPt->SetMinimum(0);
441 hEffVsMultAllPt->SetMaximum(1.6);
442 hEffVsMultAllPt->GetXaxis()->SetTitle(
"N_{tracklets} in |#eta|<1");
443 hEffVsMultAllPt->GetYaxis()->SetTitle(
"Ratio");
444 hEffVsMultAllPt->GetXaxis()->SetRangeUser(0.,
maxMult);
445 hEffVsMultAllPt->Draw();
446 hAccVsMultAllPt->SetLineColor(2);
447 hAccVsMultAllPt->Draw(
"same");
450 TLatex* tacc2=
new TLatex(0.16,0.8,
"Acceptance (CombinHF, 13d3)");
452 tacc2->SetTextColor(hAccVsMultAllPt->GetLineColor());
454 TLatex* te2=
new TLatex(0.16,0.72,
"Efficiency");
456 te2->SetTextColor(hEffVsMultAllPt->GetLineColor());
459 TCanvas* c2e=
new TCanvas(
"c2e",
"EffVsMult",1200,600);
463 hMultGenLimAccAllPt->GetXaxis()->SetTitle(
"N_{tracklets} in |#eta|<1");
464 hMultGenLimAccAllPt->GetYaxis()->SetTitle(
"Entries");
465 hMultGenLimAccAllPt->GetXaxis()->SetRangeUser(0.,
maxMult);
466 hMultGenLimAccAllPt->SetLineColor(1);
467 hMultGenLimAccAllPt->Draw();
469 TPaveStats *st1e=(TPaveStats*)hMultGenLimAccAllPt->GetListOfFunctions()->FindObject(
"stats");
471 st1e->SetY2NDC(0.89);
472 hMultGenAccAllPt->SetLineColor(2);
473 hMultGenAccAllPt->Draw(
"sames");
475 TPaveStats *st2e=(TPaveStats*)hMultGenAccAllPt->GetListOfFunctions()->FindObject(
"stats");
477 st2e->SetY2NDC(0.69);
478 st2e->SetTextColor(2);
479 if(hMultGenAccEvSelAllPt){
480 hMultGenAccEvSelAllPt->SetLineColor(6);
481 hMultGenAccEvSelAllPt->Draw(
"sames");
483 TPaveStats *st2se=(TPaveStats*)hMultGenAccEvSelAllPt->GetListOfFunctions()->FindObject(
"stats");
484 st2se->SetY1NDC(0.3);
485 st2se->SetY2NDC(0.49);
486 st2se->SetTextColor(6);
488 hMultRecoAllPt->SetLineColor(4);
489 hMultRecoAllPt->Draw(
"sames");
491 TPaveStats *st3s=(TPaveStats*)hMultRecoAllPt->GetListOfFunctions()->FindObject(
"stats");
493 st3s->SetY2NDC(0.29);
494 st3s->SetTextColor(4);
499 if(hMultGenAccEvSelAllPt){
500 hEvSelEffVsMultAllPt->SetLineColor(6);
501 hEvSelEffVsMultAllPt->SetMinimum(0);
502 hEvSelEffVsMultAllPt->SetMaximum(1.05);
503 hEvSelEffVsMultAllPt->GetXaxis()->SetTitle(
"N_{tracklets} in |#eta|<1");
504 hEvSelEffVsMultAllPt->GetYaxis()->SetTitle(
"Ratio");
505 hEvSelEffVsMultAllPt->GetXaxis()->SetRangeUser(0.,
maxMult);
506 hEvSelEffVsMultAllPt->Draw();
509 hEffVsMultAllPt->SetLineColor(4);
510 hEffVsMultAllPt->Draw(
"same");
512 c2e->SaveAs(Form(
"figures/EfficVsMult_%s.eps",suffix.Data()));
514 const Int_t nMultBins=6;
515 Double_t mulLims[nMultBins+1]={0.,5.,12.,20.,40.,80.,200.};
516 Int_t mulcol[nMultBins]={1,kRed+1,kGreen+2,4,kOrange+2,kMagenta};
518 TH1D* hPtRecoM[nMultBins];
519 TH1D* hPtGenAccM[nMultBins];
521 TH1D* hEffVsPtM[nMultBins];
522 for(
Int_t j=0; j<nMultBins; j++){
523 Int_t lowBin=hPtVsYVsMultReco->GetZaxis()->FindBin(mulLims[j]);
524 Int_t hiBin=hPtVsYVsMultReco->GetZaxis()->FindBin(mulLims[j+1]-0.001);
527 hPtRecoM[j]=hPtVsYVsMultReco->ProjectionX(Form(
"hPtRecoM%d",j),0,-1,lowBin,hiBin);
528 hPtGenAccM[j]=hPtVsYVsMultGenAcc->ProjectionX(Form(
"hPtGenAccM%d",j),0,-1,lowBin,hiBin);
530 hEffVsPtM[j]=(
TH1D*)hPtRecoM[j]->Clone(Form(
"hEffM%d",j));
531 hEffVsPtM[j]->Divide(hPtRecoM[j],hPtGenAccM[j],1,1,
"B");
534 hEffVsPtM[0]->SetStats(0);
535 TCanvas* cwp=
new TCanvas(
"cwp",
"Eff and Weight vs pt",1200,600);
538 gPad->SetLeftMargin(0.12);
539 hEffVsPtM[0]->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
540 hEffVsPtM[0]->GetYaxis()->SetTitle(
"Efficiency");
541 hEffVsPtM[0]->GetYaxis()->SetTitleOffset(1.4);
542 hEffVsPtM[0]->SetLineColor(mulcol[0]);
543 hEffVsPtM[0]->SetMinimum(0);
544 hEffVsPtM[0]->SetMaximum(1.8);
545 hEffVsPtM[0]->Draw();
546 TLegend* legp=
new TLegend(0.16,0.5,0.55,0.89);
547 legp->SetFillStyle(0);
548 legp->SetBorderSize(0);
549 legp->AddEntry(hEffVsPtM[0],Form(
"%.0f<N_{tracklets}<%.0f",mulLims[0],mulLims[1]),
"L")->SetTextColor(mulcol[0]);
550 for(
Int_t j=1; j<nMultBins; j++){
551 hEffVsPtM[j]->SetLineColor(mulcol[j]);
552 hEffVsPtM[j]->Draw(
"same");
553 legp->AddEntry(hEffVsPtM[j],Form(
"%.0f<N_{tracklets}<%.0f",mulLims[j],mulLims[j+1]),
"L")->SetTextColor(mulcol[j]);
557 gPad->SetLeftMargin(0.12);
558 funcPtWeight->SetTitle(
"");
559 funcPtWeight->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
560 funcPtWeight->GetYaxis()->SetTitle(
"Weight");
561 funcPtWeight->Draw();
562 cwp->SaveAs(Form(
"figures/EfficVsPtMultBins_%s.eps",suffix.Data()));
570 Int_t lowBin=hPtVsYVsMultReco->GetXaxis()->FindBin(
binLims[j]);
571 Int_t hiBin=hPtVsYVsMultReco->GetXaxis()->FindBin(
binLims[j+1]-0.001);
574 hMultReco[j]=hPtVsYVsMultReco->ProjectionZ(Form(
"hMultReco%d",j),lowBin,hiBin);
575 hMultGenAcc[j]=hPtVsYVsMultGenAcc->ProjectionZ(Form(
"hMultGenAcc%d",j),lowBin,hiBin);
577 hEffVsMult[j]=(
TH1D*)hMultReco[j]->Clone(
"hEff");
578 hEffVsMult[j]->Divide(hMultReco[j],hMultGenAcc[j],1,1,
"B");
601 TH1F** hWeight=
new TH1F*[3];
602 for(
Int_t iw=0;iw<3; iw++) hWeight[iw]=0x0;
604 if(
gSystem->AccessPathName(fileWeightName.Data())==0){
605 printf(
"Open file with multiplicity weights\n");
606 TFile* filw =
new TFile(fileWeightName.Data());
607 for(
Int_t iw=0;iw<3; iw++){
608 hWeight[iw]=(TH1F*)filw->Get(histoWeightName[iw].Data());
609 hWeight[iw]->SetLineColor(wcol[iw]);
610 hWeight[iw]->SetStats(0);
611 hWeight[iw]->GetXaxis()->SetTitle(
"N_{tracklets} in |#eta|<1");
612 hWeight[iw]->GetYaxis()->SetTitle(
"Weight");
613 hWeight[iw]->GetYaxis()->SetTitleOffset(1.4);
614 hWeight[iw]->SetMaximum(3.);
615 hWeight[iw]->SetMinimum(0.);
619 hEffVsMult[0]->SetStats(0);
620 TCanvas* cw=
new TCanvas(
"cw",
"Eff and Weight vs mult",1200,600);
623 gPad->SetLeftMargin(0.12);
624 hEffVsMult[0]->GetXaxis()->SetRangeUser(0.,
maxMult);
625 hEffVsMult[0]->GetXaxis()->SetTitle(
"N_{tracklets} in |#eta|<1");
626 hEffVsMult[0]->GetYaxis()->SetTitle(
"Efficiency");
627 hEffVsMult[0]->GetYaxis()->SetTitleOffset(1.4);
628 hEffVsMult[0]->SetLineColor(ptcol[0]);
629 hEffVsMult[0]->SetMinimum(0);
630 hEffVsMult[0]->SetMaximum(1.6);
631 hEffVsMult[0]->Draw();
632 TLegend* legm=
new TLegend(0.16,0.5,0.4,0.89);
633 legm->SetFillStyle(0);
634 legm->SetBorderSize(0);
635 legm->AddEntry(hEffVsMult[0],Form(
"%.0f<p_{T}<%.0f GeV/c",
binLims[0],
binLims[1]),
"L")->SetTextColor(ptcol[0]);
637 hEffVsMult[j]->SetLineColor(ptcol[j]);
638 hEffVsMult[j]->Draw(
"same");
639 legm->AddEntry(hEffVsMult[j],Form(
"%.0f<p_{T}<%.0f GeV/c",
binLims[j],
binLims[j+1]),
"L")->SetTextColor(ptcol[j]);
644 gPad->SetLeftMargin(0.12);
645 hWeight[0]->GetXaxis()->SetRangeUser(0.,
maxMult);
647 TLegend* legw=
new TLegend(0.2,0.65,0.55,0.89);
648 legw->SetFillStyle(0);
649 legw->AddEntry(hWeight[0],
"Candidate Weight",
"L");
651 hWeight[1]->Draw(
"same");
652 legw->AddEntry(hWeight[1],
"D Weight",
"L");
655 hWeight[2]->Draw(
"same");
656 legw->AddEntry(hWeight[2],
"EvSel Weight",
"L");
660 cw->SaveAs(Form(
"figures/EfficVsMultPtBins_%s.eps",suffix.Data()));
664 TH1D **hpteffMultWeight =
new TH1D*[3];
665 hpteffMultWeight[0]=
new TH1D(
"hEffVsPtCandWeight",
"",nPtBins,
binLims);
666 hpteffMultWeight[1]=
new TH1D(
"hEffVsPtDWeight",
"",nPtBins,
binLims);
667 hpteffMultWeight[2]=
new TH1D(
"hEffVsPtEvSelWeight",
"",nPtBins,
binLims);
668 TH1D **hpteffMultPtWeight =
new TH1D*[3];
669 hpteffMultPtWeight[0]=
new TH1D(
"hEffVsPtCandFONLLWeight",
"",nPtBins,
binLims);
670 hpteffMultPtWeight[1]=
new TH1D(
"hEffVsPtDFONLLWeight",
"",nPtBins,
binLims);
671 hpteffMultPtWeight[2]=
new TH1D(
"hEffVsPtEvSelFONLLWeight",
"",nPtBins,
binLims);
673 TH1D* hMultRecoAllPtW=hPtVsYVsMultReco->ProjectionZ(
"hMultRecoW");
674 TH1D* hMultGenAccAllPtW=hPtVsYVsMultGenAcc->ProjectionZ(
"hMultGenAccW");
675 TH1D* hMultGenLimAccAllPtW=hPtVsYVsMultGenLimAcc->ProjectionZ(
"hMultGenLimAccW");
676 hMultRecoAllPtW->Reset(
"ines");
677 hMultGenAccAllPtW->Reset(
"ines");
678 hMultGenLimAccAllPtW->Reset(
"ines");
688 countNumer[iPtBin]=0.0;
689 countDenom[iPtBin]=0.0;
690 for(
Int_t iw=0; iw<3; iw++){
691 countNumerMultWei[iPtBin][iw]=0.0;
692 countDenomMultWei[iPtBin][iw]=0.0;
693 countNumerMultPtWei[iPtBin][iw]=0.0;
694 countDenomMultPtWei[iPtBin][iw]=0.0;
698 for(
Int_t ibx=0; ibx<=hPtVsYVsMultGenAcc->GetNbinsX()+1; ibx++){
699 for(
Int_t iby=0; iby<=hPtVsYVsMultGenAcc->GetNbinsY()+1; iby++){
700 for(
Int_t ibz=0; ibz<=hPtVsYVsMultGenAcc->GetNbinsZ()+1; ibz++){
701 Double_t pt=hPtVsYVsMultGenAcc->GetXaxis()->GetBinCenter(ibx);
703 Double_t mult=hPtVsYVsMultGenAcc->GetZaxis()->GetBinCenter(ibz);
706 if(jPtBin>=0 && jPtBin<nPtBins){
707 Double_t wpt=funcPtWeight->Eval(pt);
708 countNumer[jPtBin]+=hPtVsYVsMultReco->GetBinContent(ibx,iby,ibz);
709 countDenom[jPtBin]+=hPtVsYVsMultGenAcc->GetBinContent(ibx,iby,ibz);
710 for(
Int_t iw=0; iw<3; iw++){
713 Int_t binw=hWeight[iw]->FindBin(mult);
714 if(binw>=1 && binw<hWeight[iw]->GetNbinsX()+1){
715 w=hWeight[iw]->GetBinContent(binw);
718 if(hPtVsYVsMultGenAcc->GetBinContent(ibx,iby,ibz)>0){
719 printf(
"mult %.0f bin %d wei %f\n",mult,binw,w);
727 countNumerMultWei[jPtBin][iw]+=hPtVsYVsMultReco->GetBinContent(ibx,iby,ibz)*w;
728 countDenomMultWei[jPtBin][iw]+=hPtVsYVsMultGenAcc->GetBinContent(ibx,iby,ibz)*w;
729 countNumerMultPtWei[jPtBin][iw]+=hPtVsYVsMultReco->GetBinContent(ibx,iby,ibz)*w*wpt;
730 countDenomMultPtWei[jPtBin][iw]+=hPtVsYVsMultGenAcc->GetBinContent(ibx,iby,ibz)*w*wpt;
731 hMultRecoAllPtW->Fill(mult,hPtVsYVsMultReco->GetBinContent(ibx,iby,ibz)*w);
732 hMultGenAccAllPtW->Fill(mult,hPtVsYVsMultGenAcc->GetBinContent(ibx,iby,ibz)*w);
733 hMultGenLimAccAllPtW->Fill(mult,hPtVsYVsMultGenLimAcc->GetBinContent(ibx,iby,ibz)*w);
741 Double_t eff1=countNumer[iPtBin]/countDenom[iPtBin];
742 Double_t erreff1=TMath::Sqrt(eff1*(1-eff1)/countDenom[iPtBin]);
743 printf(
"---- Pt range %.0f - %.0f ----\n",
binLims[iPtBin],
binLims[iPtBin+1]);
744 printf(
"Eff from Projection = %f/%f = %f+-%f\n",hPtRecoR->GetBinContent(iPtBin+1),hPtGenAccR->GetBinContent(iPtBin+1),hEffVsPtR->GetBinContent(iPtBin+1),hEffVsPtR->GetBinError(iPtBin+1));
745 printf(
"Eff No weights = %f/%f = %f+-%f\n",countNumer[iPtBin],countDenom[iPtBin],eff1,erreff1);
746 hpteffNoWeight->SetBinContent(iPtBin+1,eff1);
747 hpteffNoWeight->SetBinError(iPtBin+1,erreff1);
748 for(
Int_t iw=0;iw<3; iw++){
749 Double_t eff2=countNumerMultWei[iPtBin][iw]/countDenomMultWei[iPtBin][iw];
750 Double_t erreff2=TMath::Sqrt(eff2*(1-eff2)/countDenom[iPtBin]);
751 printf(
"Eff With mult weights %d = %f/%f = %f+-%f\n",iw,countNumerMultWei[iPtBin][iw],countDenomMultWei[iPtBin][iw],eff2,erreff2);
752 hpteffMultWeight[iw]->SetBinContent(iPtBin+1,eff2);
753 hpteffMultWeight[iw]->SetBinError(iPtBin+1,erreff2);
754 Double_t eff3=countNumerMultPtWei[iPtBin][iw]/countDenomMultPtWei[iPtBin][iw];
755 Double_t erreff3=TMath::Sqrt(eff3*(1-eff3)/countDenom[iPtBin]);
756 printf(
"Eff With mult+pt weights %d = %f/%f = %f+-%f\n",iw,countNumerMultPtWei[iPtBin][iw],countDenomMultPtWei[iPtBin][iw],eff3,erreff3);
757 hpteffMultPtWeight[iw]->SetBinContent(iPtBin+1,eff3);
758 hpteffMultPtWeight[iw]->SetBinError(iPtBin+1,erreff3);
762 TH1D* hEffVsMultAllPtW=(
TH1D*)hMultRecoAllPtW->Clone(
"hEff");
763 hEffVsMultAllPtW->Divide(hMultRecoAllPtW,hMultGenAccAllPtW,1,1,
"B");
764 TH1D* hAccVsMultAllPtW=(
TH1D*)hMultGenAccAllPtW->Clone(
"hAcc");
765 hAccVsMultAllPtW->Divide(hMultGenAccAllPtW,hMultGenLimAccAllPtW,1,1,
"B");
766 hEffVsMultAllPtW->SetStats(0);
767 hAccVsMultAllPtW->SetStats(0);
769 TCanvas* c2w=
new TCanvas(
"c2w",
"EffVsMultW",1200,600);
773 hMultGenLimAccAllPtW->SetLineColor(1);
774 hMultGenLimAccAllPtW->GetXaxis()->SetRangeUser(0.,
maxMult);
775 hMultGenLimAccAllPtW->GetXaxis()->SetTitle(
"N_{tracklets} in |#eta|<1");
776 hMultGenLimAccAllPtW->GetYaxis()->SetTitle(
"Entries");
777 hMultGenLimAccAllPtW->Draw();
778 hMultGenAccAllPtW->SetLineColor(2);
779 hMultGenAccAllPtW->Draw(
"same");
780 hMultRecoAllPtW->SetLineColor(4);
781 hMultRecoAllPtW->Draw(
"same");
783 hEffVsMultAllPtW->SetLineColor(4);
784 hEffVsMultAllPtW->SetMinimum(0);
785 hEffVsMultAllPtW->SetMaximum(1.6);
786 hEffVsMultAllPtW->GetXaxis()->SetRangeUser(0.,
maxMult);
787 hEffVsMultAllPtW->GetXaxis()->SetTitle(
"N_{tracklets} in |#eta|<1");
788 hEffVsMultAllPtW->GetYaxis()->SetTitle(
"Ratio");
789 hEffVsMultAllPtW->Draw();
790 hAccVsMultAllPtW->SetLineColor(2);
791 hAccVsMultAllPtW->Draw(
"same");
798 hEffVsPtR->SetMarkerStyle(0);
799 hEffVsPtR->SetMarkerColor(0);
800 hEffVsPtR->SetMarkerSize(1.2);
801 hEffVsPtR->SetLineColor(kGray);
802 hEffVsPtR->SetLineWidth(4);
803 hEffVsPtR->SetStats(0);
804 hpteffNoWeight->SetMarkerStyle(20);
806 TH1F** hRatio=
new TH1F*[3];
807 for(
Int_t iw=0;iw<3; iw++){
808 hRatio[iw]=(TH1F*)hpteffMultWeight[iw]->Clone(
"hRatio");
809 hRatio[iw]->Divide(hpteffMultWeight[iw],hpteffNoWeight);
810 hRatio[iw]->GetYaxis()->SetTitle(
"With Mult weight / Without weight");
811 hRatio[iw]->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
812 hRatio[iw]->GetYaxis()->SetTitleOffset(1.4);
813 hRatio[iw]->SetLineColor(wcol[iw]);
814 hRatio[iw]->SetMarkerColor(wcol[iw]);
815 hRatio[iw]->SetMarkerStyle(wmark[iw]);
816 hRatio[iw]->SetStats(0);
817 hpteffMultWeight[iw]->SetLineColor(wcol[iw]);
818 hpteffMultWeight[iw]->SetMarkerColor(wcol[iw]);
819 hpteffMultWeight[iw]->SetMarkerStyle(wmark[iw]);
821 TH1F** hRatioPtW=
new TH1F*[3];
822 for(
Int_t iw=0;iw<3; iw++){
823 hRatioPtW[iw]=(TH1F*)hpteffMultPtWeight[iw]->Clone(
"hRatio");
824 hRatioPtW[iw]->Divide(hpteffMultPtWeight[iw],hpteffMultWeight[iw]);
825 hRatioPtW[iw]->GetYaxis()->SetTitle(
"With Mult+p_{T} weight / With only Mult weight");
826 hRatioPtW[iw]->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
827 hRatioPtW[iw]->GetYaxis()->SetTitleOffset(1.4);
828 hRatioPtW[iw]->SetLineColor(wcol[iw]);
829 hRatioPtW[iw]->SetMarkerColor(wcol[iw]);
830 hRatioPtW[iw]->SetMarkerStyle(wmark[iw]);
831 hRatioPtW[iw]->SetStats(0);
832 hpteffMultPtWeight[iw]->SetLineColor(wcol[iw]);
833 hpteffMultPtWeight[iw]->SetMarkerColor(wcol[iw]);
834 hpteffMultPtWeight[iw]->SetMarkerStyle(wmark[iw]);
837 TCanvas* ceff=
new TCanvas(
"ceff",
"Eff Mult Wei",1200,600);
840 gPad->SetLeftMargin(0.12);
843 hEffVsPtR->SetMinimum(0);
844 hEffVsPtR->SetMaximum(1);
846 hEffVsPtR->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
847 hEffVsPtR->GetYaxis()->SetTitle(
"Efficiency");
848 hEffVsPtR->GetYaxis()->SetTitleOffset(1.4);
849 hpteffNoWeight->Draw(
"same");
850 for(
Int_t iw=0;iw<3; iw++) hpteffMultWeight[iw]->
Draw(
"same");
851 TLegend* leg=
new TLegend(0.55,0.15,0.89,0.45);
852 leg->SetFillStyle(0);
853 leg->AddEntry(hEffVsPtR,
"TH3F::Project",
"L");
854 leg->AddEntry(hpteffNoWeight,
"Multiplcity slices - No Weight",
"PL");
855 leg->AddEntry(hpteffMultWeight[0],
"Multiplcity slices - Cand Weight",
"PL");
856 leg->AddEntry(hpteffMultWeight[1],
"Multiplcity slices - D Weight",
"PL");
857 leg->AddEntry(hpteffMultWeight[2],
"Multiplcity slices - EvSel Weight",
"PL");
860 gPad->SetLeftMargin(0.12);
864 hRatio[0]->SetMinimum(0.95);
865 hRatio[0]->SetMaximum(1.05);
866 for(
Int_t iw=1;iw<3; iw++) hRatio[iw]->
Draw(
"same");
867 ceff->SaveAs(Form(
"figures/EfficWithMultWeights_%s.eps",suffix.Data()));
870 TCanvas* ceff2=
new TCanvas(
"ceff2",
"Eff Mult+Pt Wei",1200,600);
873 gPad->SetLeftMargin(0.12);
876 hEffVsPtR->SetMinimum(0);
877 hEffVsPtR->SetMaximum(1);
879 hEffVsPtR->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
880 hEffVsPtR->GetYaxis()->SetTitle(
"Efficiency");
881 hEffVsPtR->GetYaxis()->SetTitleOffset(1.4);
882 hpteffNoWeight->Draw(
"same");
883 for(
Int_t iw=0;iw<3; iw++) hpteffMultPtWeight[iw]->
Draw(
"same");
884 TLegend* leg2=
new TLegend(0.55,0.15,0.89,0.45);
885 leg2->SetFillStyle(0);
886 leg2->AddEntry(hEffVsPtR,
"TH3F::Project",
"L");
887 leg2->AddEntry(hpteffNoWeight,
"Multiplcity slices - No Weight",
"PL");
888 leg2->AddEntry(hpteffMultPtWeight[0],
"Multiplcity slices - FONLL+Cand Weight",
"PL");
889 leg2->AddEntry(hpteffMultPtWeight[1],
"Multiplcity slices - FONLL+D Weight",
"PL");
890 leg2->AddEntry(hpteffMultPtWeight[2],
"Multiplcity slices - FONLL+EvSel Weight",
"PL");
893 gPad->SetLeftMargin(0.12);
896 hRatioPtW[0]->Draw();
897 hRatioPtW[0]->SetMinimum(0.95);
898 hRatioPtW[0]->SetMaximum(1.05);
899 for(
Int_t iw=1;iw<3; iw++) hRatioPtW[iw]->
Draw(
"same");
900 ceff2->SaveAs(Form(
"figures/EfficWithMultAndPtWeights_%s.eps",suffix.Data()));
902 TFile* out=
new TFile(Form(
"outputEff_%s.root",suffix.Data()),
"recreate");
905 hpteffMultPtWeight[0]->Write();
906 hpteffMultPtWeight[1]->Write();
907 hpteffMultPtWeight[2]->Write();
908 hEvSelEffVsPt->Write();
void Draw(const char *filename, const char *title="", const char *others="ALL", const char *options="DEFAULT", const char *outFlg="ALL", UShort_t rebin=5, Float_t eff=0, const char *base="")
Double_t binLims[nPtBins+1]
void ComputeEfficiencyFromCombinHF()