]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/macros/DrawMCQAplots.C
add extra namings
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / DrawMCQAplots.C
CommitLineData
8c1c76e9 1void DrawMCQAplots(Int_t imode){
2
3 // if you want to draw differential yield for charm, set imode==4
4 // if you want to draw differential yield for charm, set imode==5
5 // if you want to draw differential yield for charm and beauty, set imode==0
6 // if you want to compare differential yield of electron yield from charm and beauty w/wo acc cut(eta<0.9), set imode==11
7 // if you want to compare differetail cross section together with NLO prediction, set imode==12
8
9 // load libs
10 gSystem->Load("libANALYSIS.so");
11 gSystem->Load("libANALYSISalice.so");
12 gSystem->Load("libCORRFW.so");
13 gSystem->Load("libPWG0base.so");
40a0a69c 14 gSystem->Load("libPWGHFhfe.so");
8c1c76e9 15
16 // put input file name
17 //char filename[]="./HFEtask.root";
18 char filename[]="/lustre/alice/train/V006.MC_pp/2011-01-07_1954.4718/mergedPeriods/MC_pp/7TeV/LHC10f7a_c/HFEtask.root"; // pwg3 samples for pp
19 //char NLOcalcc[]="../rootfiles/cpp10CTQ6diff.root"; // p+p 10TeV for cquark (pt, rapidity for q and fragments )
20 //char NLOcalcb[]="../rootfiles/bpp10CTQ6diff.root"; // p+p 10TeV for bquark (pt, rapidity for q and fragments )
21 //char NLOcalccb[]="../rootfiles/pp10CTQ6_pt_yall_cb.root"; // p+p 7TeV for c and b (pT only)
22 char NLOcalcc[]="../rootfiles/cpp7CTQ6diff.root"; // p+p 7TeV for cquark (pt, rapidity for q and fragments )
23 char NLOcalcb[]="../rootfiles/bpp7CTQ6diff.root"; // p+p 7TeV for bquark (pt, rapidity for q and fragments )
24 char NLOcalccb[]="../rootfiles/pp7CTQ6_pt_yall_cb.root"; // p+p 7TeV for c and b (pT only)
25
26
27 if(imode == 4) DrawDifferentialYield(4,filename, NLOcalcc); // charm differentail yield
28 if(imode == 5) DrawDifferentialYield(5,filename, NLOcalcb); // beauty differential yield
29 if(imode == 0) DrawDifferentialYieldBoth(filename, NLOcalccb); // both charm and beauty
30 if(imode == 11) DrawDifferentialYieldAcc(filename); // electron yield w/wo acc cut
31 //if(imode == 12) DrawDifferentialXsectionBoth(filename, NLOcalccb); //be careful, have to look again the overall normalization
32
33}
34
35//--------------------------
36void DrawDifferentialYield(Int_t qtype, char *filename, char *NLOcalc){
37
38 TFile *_file[2];
39 _file[0] = TFile::Open(filename);
40 _file[1] = TFile::Open(NLOcalc);
41
42 setGeneralStyle();
43 char configname[]="mcQA";
44 enum qType {kQuark=0, kantiQuark=1, kHadron=2, kElec=3, kElec2nd=4, keHadron=5, kDeHadron=6};
45 enum hqType {kCharmQuark=4, kBeautyQuark=5};
46 Int_t fgkQuark = qtype;
47 const Int_t fgkqType=7;
48
49 struct hists {
50 TH1F *Pt;
51 TH1F *Eta;
52 TH1F *Y;
53 };
54
55 struct histsComm {
56 TH1F *PdgCode;
57 TH1F *Nq;
58 };
59
60 hists fHist[7];
61 histsComm fHistComm;
62
63 TString kqTypeLabel[fgkqType];
64 if (fgkQuark == kCharmQuark){
65 kqTypeLabel[kQuark]="c";
66 kqTypeLabel[kantiQuark]="cbar";
67 kqTypeLabel[kHadron]="cHadron";
68 kqTypeLabel[kElec]="ce";
69 kqTypeLabel[kElec2nd]="nulle";
70 kqTypeLabel[keHadron]="ceHadron";
71 kqTypeLabel[kDeHadron]="nullHadron";
72 } else if (fgkQuark == kBeautyQuark){
73 kqTypeLabel[kQuark]="b";
74 kqTypeLabel[kantiQuark]="bbar";
75 kqTypeLabel[kHadron]="bHadron";
76 kqTypeLabel[kElec]="be";
77 kqTypeLabel[kElec2nd]="bce";
78 kqTypeLabel[keHadron]="beHadron";
79 kqTypeLabel[kDeHadron]="bDeHadron";
80 }
81 Int_t kColorCode[fgkqType];
82 kColorCode[kQuark]=2;
83 kColorCode[kantiQuark]=2;
84 kColorCode[kHadron]=6;
85 kColorCode[kElec]=4;
86 kColorCode[kElec2nd]=4;
87 kColorCode[keHadron]=3;
88 kColorCode[kDeHadron]=3;
89
90 Int_t kLineStyle[fgkqType];
91 kLineStyle[kQuark]=1;
92 kLineStyle[kantiQuark]=1;
93 kLineStyle[kHadron]=3;
94 kLineStyle[kElec]=2;
95 kLineStyle[kElec2nd]=1;
96 kLineStyle[keHadron]=2;
97 kLineStyle[kDeHadron]=1;
98
99
100 cPt = new TCanvas("cPt","pT",0,0,600,500);
101 cY = new TCanvas("cY","rapidity",0,0,600,500);
102 cPdg = new TCanvas("cPdg","pdg code",0,0,600,500);
103 cNq = new TCanvas("cNq","number of quark",0,0,600,500);
104
105
106 TList *tl = (TList *)_file[0]->Get("HFE_QA")->FindObject("MCqa");
107 //count # of events
108 TList *tl_result = (TList *)_file[0]->Get("HFE_Results");
109 AliHFEcontainer *containerhfe = (AliHFEcontainer *) tl_result->FindObject("trackContainer");
110 if(!containerhfe) {
111 printf("No hfe container \n");
112 return;
113 }
114 Int_t nEvt = (Int_t) containerhfe->GetNumberOfEvents();
115 cout << "# of events " << nEvt << endl;
116
117 Double_t scalefactor = 1./float(nEvt); //normalize with total number of event
118
119 TString hname;
120 for (Int_t iqType = 0; iqType < fgkqType; iqType++ ){
121
122 //pT distribution
123 hname="mcqa_Pt_";
124 hname=hname+kqTypeLabel[iqType];
125 fHist[iqType].Pt = (TH1F*)tl->FindObject(hname);
126 fHist[iqType].Pt->SetXTitle("p_{t} [GeV/c]");
127 fHist[iqType].Pt->SetYTitle("1/N_{Evt}dN/dp_{t} [1/GeVc^{-1}]");
128 setDataStyle(*fHist[iqType].Pt, kColorCode[iqType], 3, kLineStyle[iqType]);
129
130 CorrectFromTheWidth(fHist[iqType].Pt); //consider pT bin size
131 fHist[iqType].Pt->Scale(scalefactor); //normalize with # of events
132 if (iqType==1) {
133 fHist[iqType].Pt->Add(fHist[0].Pt); // add Q and Qbar
134 fHist[iqType].Pt->Scale(0.5); // get number of ccbar pair
135 }
136
137 //eta and rapidity distribution
138 hname="mcqa_Eta_";
139 hname=hname+kqTypeLabel[iqType];
140 fHist[iqType].Eta = (TH1F*)tl->FindObject(hname);
141 hname="mcqa_Y_";
142 hname=hname+kqTypeLabel[iqType];
143 fHist[iqType].Y = (TH1F*)tl->FindObject(hname);
144 fHist[iqType].Y->SetXTitle("Y");
145 fHist[iqType].Y->SetYTitle("1/N_{Evt}dN/dY");
146 setDataStyle(*fHist[iqType].Y, kColorCode[iqType], 3, kLineStyle[iqType]);
147
148 CorrectFromTheWidth(fHist[iqType].Y); //consider pT bin size
149 fHist[iqType].Y->Scale(scalefactor); //normalize with # of events
150 if (iqType==1) {
151 fHist[iqType].Y->Add(fHist[0].Y); // add Q and Qbar
152 fHist[iqType].Y->Scale(0.5); // get number of ccbar pair
153 }
154
155 cPt->cd();
156 setPadStyle(2,gPad);
157 if (iqType==1) fHist[iqType].Pt->Draw();
158 if(iqType==2 || iqType==3 || iqType==4 || iqType==5 || iqType==6) fHist[iqType].Pt->Draw("same");
159
160 cY->cd();
161 setPadStyle(2,gPad);
162 if (iqType==1) fHist[iqType].Y->Draw();
163 if(iqType==2 || iqType==3 || iqType==4 || iqType==5 || iqType==6) fHist[iqType].Y->Draw("same");
164
165 }
166
167 cPdg->cd();
168 hname="mcqa_PdgCode_";
169 hname=hname+kqTypeLabel[kQuark]+"Hadron";
170 fHistComm.PdgCode = (TH1F*)tl->FindObject(hname);
171 fHistComm.PdgCode->SetXTitle("hadron pdg code");
172 fHistComm.PdgCode->SetYTitle("Yield");
173 setDataStyle(*fHistComm.PdgCode, 2, 2, 1);
174 setPadStyle(2,gPad);
175 fHistComm.PdgCode->Draw();
176
177 cNq->cd();
178 hname="mcqa_Nq_";
179 hname=hname+kqTypeLabel[kQuark];
180 fHistComm.Nq = (TH1F*)tl->FindObject(hname);
181 fHistComm.Nq->SetXTitle("number of "+kqTypeLabel[kQuark]+","+kqTypeLabel[kQuark]+"-bar per event");
182 fHistComm.Nq->SetYTitle("Yield per Event");
183 setDataStyle(*fHistComm.Nq, 2, 4, 1);
184 setPadStyle(1,gPad);
185 fHistComm.Nq->Scale(scalefactor);
186 fHistComm.Nq->Draw();
187
188
189
190 TLegend *legend1 = new TLegend(0.50,0.73,0.98,0.99,"");
191 setLegendStyle(*legend1,1);
192 legend1->AddEntry(fHist[0].Pt,kqTypeLabel[kQuark]+"#bar{"+kqTypeLabel[kQuark]+"}"+" pair", "l");
193 legend1->AddEntry(fHist[2].Pt,kqTypeLabel[kQuark]+" hadrons from "+kqTypeLabel[kQuark]+", #bar{"+kqTypeLabel[kQuark]+"}", "l");
194 legend1->AddEntry(fHist[3].Pt,"elec. from "+kqTypeLabel[kQuark]+"->e", "l");
195 if(qtype==5) legend1->AddEntry(fHist[4].Pt,"elec. from "+kqTypeLabel[kQuark]+"->c->e", "l");
196 legend1->AddEntry(fHist[5].Pt,kqTypeLabel[kQuark]+" hadron decaying "+kqTypeLabel[kQuark]+"->e", "l");
197 if(qtype==5) legend1->AddEntry(fHist[6].Pt,kqTypeLabel[kQuark]+" hadron decaying "+kqTypeLabel[kQuark]+"->c->e", "l");
198
199 TLegend *legend1_ = new TLegend(0.65,0.42,0.90,0.72,"");
200 setLegendStyle(*legend1_,1);
201 legend1_->AddEntry(fHist[0].Pt,"Yield per event", "");
202 legend1_->AddEntry(fHist[0].Pt,"(0.1<p_{t}<20)", "");
203 legend1_->AddEntry(fHist[0].Pt,Form("%1.4f",fHist[1].Pt->Integral("width")), "l");
204 legend1_->AddEntry(fHist[2].Pt,Form("%1.4f",fHist[2].Pt->Integral("width")), "l");
205 legend1_->AddEntry(fHist[3].Pt,Form("%1.4f",fHist[3].Pt->Integral("width")), "l");
206 if(qtype==5) legend1_->AddEntry(fHist[4].Pt,Form("%1.4f",fHist[4].Pt->Integral("width")), "l");
207 legend1_->AddEntry(fHist[5].Pt,Form("%1.4f",fHist[5].Pt->Integral("width")), "l");
208 if(qtype==5) legend1_->AddEntry(fHist[6].Pt,Form("%1.4f",fHist[6].Pt->Integral("width")), "l");
209
210 cPt->cd();
211 legend1_->Draw();
212
213 TLegend *legend2 = new TLegend(0.26,0.15,0.74,0.37,"");
214 setLegendStyle(*legend2,1);
215 legend2->AddEntry(fHist[0].Y,kqTypeLabel[kQuark]+"#bar{"+kqTypeLabel[kQuark]+"}"+" pair", "l");
216 legend2->AddEntry(fHist[2].Y,kqTypeLabel[kQuark]+" hadrons from "+kqTypeLabel[kQuark], "l");
217 legend2->AddEntry(fHist[3].Y,"elec. from "+kqTypeLabel[kQuark]+"->e", "l");
218 if(qtype==5) legend2->AddEntry(fHist[4].Y,"elec. from "+kqTypeLabel[kQuark]+"->c->e", "l");
219 legend2->AddEntry(fHist[5].Y,kqTypeLabel[kQuark]+" hadron decaying "+kqTypeLabel[kQuark]+"->e", "l");
220 if(qtype==5) legend2->AddEntry(fHist[6].Y,kqTypeLabel[kQuark]+" hadron decaying "+kqTypeLabel[kQuark]+"->c->e", "l");
221
222 TLegend *legend2_ = new TLegend(0.70,0.77,0.98,0.99,"");
223 setLegendStyle(*legend2_,1);
224 legend2_->AddEntry(fHist[0].Y,"Yield per event", "");
225 legend2_->AddEntry(fHist[0].Y,"(all p_{t},-7.5<Y<7.5)", "");
226 legend2_->AddEntry(fHist[0].Y,Form("%1.4f",fHist[1].Y->Integral("width")), "l");
227 legend2_->AddEntry(fHist[2].Y,Form("%1.4f",fHist[2].Y->Integral("width")), "l");
228 legend2_->AddEntry(fHist[3].Y,Form("%1.4f",fHist[3].Y->Integral("width")), "l");
229 if(qtype==5) legend2_->AddEntry(fHist[4].Y,Form("%1.4f",fHist[4].Y->Integral("width")), "l");
230 legend2_->AddEntry(fHist[5].Y,Form("%1.4f",fHist[5].Y->Integral("width")), "l");
231 if(qtype==5) legend2_->AddEntry(fHist[6].Y,Form("%1.4f",fHist[6].Y->Integral("width")), "l");
232
233 cY->cd();
234 legend2_->Draw();
235
236 TLegend *legend3 = new TLegend(0.35,0.80,0.88,0.88,"");
237 setLegendStyle(*legend3,0);
238 legend3->AddEntry(fHistComm.Nq,"semi-leptonic decay", "");
239
240 cNq->cd();
241 legend3->Draw();
242
243 Double_t totcrossNLO=0;
244 Double_t scalefactorNLO=0;
245 Double_t totcrossNLOY=0;
246 Double_t scalefactorNLOY=0;
247 if(qtype==4) {
248 //TH1F *hNLO = (TH1F*)_file[1]->Get("hpt_c");
249 TH1F *hNLO = (TH1F*)_file[1]->Get("hptQwkick");
250 TH1F *hNLOY = (TH1F*)_file[1]->Get("hyQwkick");
251 }
252 if(qtype==5) {
253 //if(qtype==5) TH1F *hNLO = (TH1F*)_file[1]->Get("hpt_b");
254 TH1F *hNLO = (TH1F*)_file[1]->Get("hptQwkick");
255 TH1F *hNLOY = (TH1F*)_file[1]->Get("hyQwkick");
256 }
257 // pt
258 totcrossNLO = hNLO->Integral("width");
259 hNLO->SetMarkerStyle(3);
260 hNLO->SetMarkerColor(1);
261 hNLO->SetLineColor(1);
262 hNLO->SetLineWidth(2);
263 scalefactorNLO = (fHist[1].Pt->Integral("width"))/totcrossNLO; // normalize to the b-bbar total cross section
264 hNLO->Scale(scalefactorNLO);
265 // rapidity
266 totcrossNLOY = hNLOY->Integral("width");
267 hNLOY->SetMarkerStyle(3);
268 hNLOY->SetMarkerColor(1);
269 hNLOY->SetLineColor(1);
270 hNLOY->SetLineWidth(2);
271 scalefactorNLOY = (fHist[1].Y->Integral("width"))/totcrossNLOY; // normalize to the b-bbar total cross section
272 hNLOY->Scale(scalefactorNLOY);
273
274 cPt->cd();
275 hNLO->Draw("samep");
276 if(qtype==4) legend1->AddEntry(hNLO,"charm from NLO", "lp");
277 if(qtype==5) legend1->AddEntry(hNLO,"bottom from NLO", "lp");
278 legend1->Draw();
279
280 cY->cd();
281 hNLOY->Draw("samep");
282 if(qtype==4) legend2->AddEntry(hNLOY,"charm from NLO", "lp");
283 if(qtype==5) legend2->AddEntry(hNLOY,"bottom from NLO", "lp");
284 legend2->Draw();
285}
286
287//--------------------------
288void DrawDifferentialYieldBoth(char *filename, char *NLOcalc){
289
290 TFile *_file[1];
291 _file[0] = TFile::Open(filename);
292 _file[1] = TFile::Open(NLOcalc);
293
294 setGeneralStyle();
295 char configname[]="mcQA";
296 enum qType {kQuark, kantiQuark, kHadron, kElec, kElec2nd, keHadron, kDeHadron};
297 const Int_t fgkqType=7;
298
299 struct hists {
300 TH1F *Pt;
301 TH1F *Eta;
302 TH1F *Y;
303 };
304
305 hists fHist[2][7];
306
307 TString kqTypeLabel[2][fgkqType];
308 kqTypeLabel[0][kQuark]="c";
309 kqTypeLabel[0][kantiQuark]="cbar";
310 kqTypeLabel[0][kHadron]="cHadron";
311 kqTypeLabel[0][kElec]="ce";
312 kqTypeLabel[0][kElec2nd]="nulle";
313 kqTypeLabel[0][keHadron]="ceHadron";
314 kqTypeLabel[0][kDeHadron]="nullHadron";
315 kqTypeLabel[1][kQuark]="b";
316 kqTypeLabel[1][kantiQuark]="bbar";
317 kqTypeLabel[1][kHadron]="bHadron";
318 kqTypeLabel[1][kElec]="be";
319 kqTypeLabel[1][kElec2nd]="bce";
320 kqTypeLabel[1][keHadron]="beHadron";
321 kqTypeLabel[1][kDeHadron]="bDeHadron";
322
323 Int_t kColorCode[2][fgkqType];
324 for(Int_t iq=0; iq<7; iq++){
325 kColorCode[0][iq]=4;
326 kColorCode[1][iq]=2;
327 }
328
329 Int_t kLineStyle[fgkqType];
330 kLineStyle[kQuark]=1;
331 kLineStyle[kantiQuark]=1;
332 kLineStyle[kHadron]=2;
333 kLineStyle[kElec]=2;
334 kLineStyle[kElec2nd]=1;
335 kLineStyle[keHadron]=2;
336 kLineStyle[kDeHadron]=1;
337
338
339 cPt = new TCanvas("cPt","pT of Quark & Hadron",0,0,600,500);
340 cY = new TCanvas("cY","rapidity of Quark & Hadron",0,0,600,500);
341
342 cPtElec = new TCanvas("cPtElec","pT of Electron",0,0,600,500);
343 cYQElec = new TCanvas("cYElec","rapidity of Electron",0,0,600,500);
344
345 TList *tl = (TList *)_file[0]->Get("HFE_QA")->FindObject("MCqa");
346 //count # of events
347 TList *tl_result = (TList *)_file[0]->Get("HFE_Results");
348 AliHFEcontainer *containerhfe = (AliHFEcontainer *) tl_result->FindObject("trackContainer");
349 if(!containerhfe) {
350 printf("No hfe container \n");
351 return;
352 }
353 Int_t nEvt = (Int_t) containerhfe->GetNumberOfEvents();
354 cout << "# of events " << nEvt << endl;
355
356 Double_t scalefactor = 1./float(nEvt); //normalize with total number of event
357
358 TString hname;
359 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
360 for (Int_t iqType = 0; iqType < fgkqType; iqType++ ){
361
362 //pT distribution
363 hname="mcqa_Pt_";
364 hname=hname+kqTypeLabel[iHQ][iqType];
365 fHist[iHQ][iqType].Pt = (TH1F*)tl->FindObject(hname);
366 fHist[iHQ][iqType].Pt->SetXTitle("p_{t} [GeV/c]");
367 fHist[iHQ][iqType].Pt->SetYTitle("1/N_{Evt}dN/dp_{t} [1/GeVc^{-1}]");
368 setDataStyle(*fHist[iHQ][iqType].Pt, kColorCode[iHQ][iqType], 3, kLineStyle[iqType]);
369
370 CorrectFromTheWidth(fHist[iHQ][iqType].Pt); //consider pT bin size
371 fHist[iHQ][iqType].Pt->Scale(scalefactor); //normalize with # of events
372 if (iqType==1) {
373 fHist[iHQ][iqType].Pt->Add(fHist[iHQ][0].Pt); // Q+Qbar
374 fHist[iHQ][iqType].Pt->Scale(0.5); // pair
375 }
376
377 //eta and rapidity distribution
378 hname="mcqa_Eta_";
379 hname=hname+kqTypeLabel[iHQ][iqType];
380 fHist[iHQ][iqType].Eta = (TH1F*)tl->FindObject(hname);
381 hname="mcqa_Y_";
382 hname=hname+kqTypeLabel[iHQ][iqType];
383 fHist[iHQ][iqType].Y = (TH1F*)tl->FindObject(hname);
384 fHist[iHQ][iqType].Y->SetXTitle("Y");
385 fHist[iHQ][iqType].Y->SetYTitle("1/N_{Evt}dN/dY");
386 setDataStyle(*fHist[iHQ][iqType].Y, kColorCode[iHQ][iqType], 3, kLineStyle[iqType]);
387
388 CorrectFromTheWidth(fHist[iHQ][iqType].Y); //consider Y bin size
389 fHist[iHQ][iqType].Y->Scale(scalefactor); //normalize with # of events
390 if (iqType==1) {
391 fHist[iHQ][iqType].Y->Add(fHist[iHQ][0].Y); // Q+Qbar
392 fHist[iHQ][iqType].Y->Scale(0.5); // pair
393 }
394 }
395 }
396
397 Int_t iorder[2] = {0,1};
398 if (fHist[0][1].Pt->GetEntries() < fHist[1][1].Pt->GetEntries()) {iorder[0]=1; iorder[1]=0;};
399
400 cPt->cd();
401 setPadStyle(2,gPad);
402 fHist[iorder[0]][1].Pt->Draw();
403 fHist[iorder[1]][1].Pt->Draw("same");
404 fHist[iorder[0]][2].Pt->Draw("same");
405 fHist[iorder[1]][2].Pt->Draw("same");
406
407 cY->cd();
408 setPadStyle(2,gPad);
409 fHist[iorder[0]][1].Y->Draw();
410 fHist[iorder[1]][1].Y->Draw("same");
411 fHist[iorder[0]][2].Y->Draw("same");
412 fHist[iorder[1]][2].Y->Draw("same");
413
414 cPtElec->cd();
415 setPadStyle(2,gPad);
416 fHist[iorder[0]][3].Pt->Draw();
417 fHist[iorder[1]][3].Pt->Draw("same");
418 fHist[1][4].Pt->Draw("same");
419
420 cYElec->cd();
421 setPadStyle(2,gPad);
422 fHist[iorder[0]][3].Y->Draw();
423 fHist[iorder[1]][3].Y->Draw("same");
424 fHist[1][4].Y->Draw("same");
425
426
427 TLegend *legend1 = new TLegend(0.50,0.77,0.98,0.99,"");
428 setLegendStyle(*legend1,1);
429 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
430 legend1->AddEntry(fHist[iHQ][0].Pt,kqTypeLabel[iHQ][kQuark]+"#bar{"+kqTypeLabel[iHQ][kQuark]+"}"+" pair", "l");
431 legend1->AddEntry(fHist[iHQ][2].Pt,kqTypeLabel[iHQ][kQuark]+" hadrons from "+kqTypeLabel[iHQ][kQuark], "l");
432 }
433 TLegend *legend1_ = new TLegend(0.65,0.42,0.90,0.72,"");
434 setLegendStyle(*legend1_,1);
435 legend1_->AddEntry(fHist[0][0].Pt,"Yield per event", "");
436 legend1_->AddEntry(fHist[0][0].Pt,"(0.1<p_{t}<20)", "");
437 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
438 legend1_->AddEntry(fHist[iHQ][0].Pt,Form("%1.4f",fHist[iHQ][1].Pt->Integral("width")), "l");
439 legend1_->AddEntry(fHist[iHQ][2].Pt,Form("%1.4f",fHist[iHQ][2].Pt->Integral("width")), "l");
440 }
441
442 TLegend *legend2 = new TLegend(0.50,0.77,0.98,0.99,"");
443 setLegendStyle(*legend2,1);
444 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
445 legend2->AddEntry(fHist[iHQ][3].Pt,"elec. from "+kqTypeLabel[iHQ][kQuark]+"->e", "l");
446 if(iHQ==1) legend2->AddEntry(fHist[iHQ][4].Pt,"elec. from "+kqTypeLabel[iHQ][kQuark]+"->c->e", "l");
447 }
448 TLegend *legend2_ = new TLegend(0.65,0.42,0.90,0.72,"");
449 setLegendStyle(*legend2_,1);
450 legend2_->AddEntry(fHist[0][0].Pt,"Yield per event", "");
451 legend2_->AddEntry(fHist[0][0].Pt,"(0.1<p_{t}<20)", "");
452 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
453 legend2_->AddEntry(fHist[iHQ][3].Pt,Form("%1.4f",fHist[iHQ][3].Pt->Integral("width")), "l");
454 if(iHQ==1) legend2_->AddEntry(fHist[iHQ][4].Pt,Form("%1.4f",fHist[iHQ][4].Pt->Integral("width")), "l");
455 }
456
457
458 TLegend *legend3 = new TLegend(0.26,0.15,0.74,0.37,"");
459 setLegendStyle(*legend3,1);
460 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
461 legend3->AddEntry(fHist[iHQ][0].Y,kqTypeLabel[iHQ][kQuark]+"#bar{"+kqTypeLabel[iHQ][kQuark]+"}"+" pair", "l");
462 legend3->AddEntry(fHist[iHQ][2].Y,kqTypeLabel[iHQ][kQuark]+" hadrons from "+kqTypeLabel[iHQ][kQuark], "l");
463 }
464 TLegend *legend3_ = new TLegend(0.70,0.77,0.98,0.99,"");
465 setLegendStyle(*legend3_,1);
466 legend3_->AddEntry(fHist[0][0].Y,"Yield per event", "");
467 legend3_->AddEntry(fHist[0][0].Y,"(all p_{t},-7.5<Y<7.5)", "");
468 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
469 legend3_->AddEntry(fHist[iHQ][0].Y,Form("%1.4f",fHist[iHQ][1].Y->Integral("width")), "l");
470 legend3_->AddEntry(fHist[iHQ][2].Y,Form("%1.4f",fHist[iHQ][2].Y->Integral("width")), "l");
471 }
472
473 TLegend *legend4 = new TLegend(0.30,0.15,0.70,0.27,"");
474 setLegendStyle(*legend4,1);
475 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
476 legend4->AddEntry(fHist[iHQ][3].Y,"elec. from "+kqTypeLabel[iHQ][kQuark]+"->e", "l");
477 if(iHQ==1) legend4->AddEntry(fHist[iHQ][4].Y,"elec. from "+kqTypeLabel[iHQ][kQuark]+"->c->e", "l");
478 }
479 TLegend *legend4_ = new TLegend(0.70,0.82,0.98,0.99,"");
480 setLegendStyle(*legend4_,1);
481 legend4_->AddEntry(fHist[0][0].Y,"Yield per event", "");
482 legend4_->AddEntry(fHist[0][0].Y,"(all p_{t},-7.5<Y<7.5)", "");
483 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
484 legend4_->AddEntry(fHist[iHQ][3].Y,Form("%1.4f",fHist[iHQ][3].Y->Integral("width")), "l");
485 if(iHQ==1) legend4_->AddEntry(fHist[iHQ][4].Y,Form("%1.4f",fHist[iHQ][4].Y->Integral("width")), "l");
486 }
487
488
489 cPt->cd();
490 legend1->Draw();
491 legend1_->Draw();
492
493 cPtElec->cd();
494 legend2->Draw();
495 legend2_->Draw();
496
497 cY->cd();
498 legend3->Draw();
499 legend3_->Draw();
500
501 cYElec->cd();
502 legend4->Draw();
503 legend4_->Draw();
504
505 TH1F *hNLOc = (TH1F*)_file[1]->Get("hpt_c");
506 TH1F *hNLOb = (TH1F*)_file[1]->Get("hpt_b");
507 Double_t ctotcrossNLO = hNLOc->Integral("width");
508 Double_t btotcrossNLO = hNLOb->Integral("width");
509 Double_t cscalefactorNLO = (fHist[0][1].Pt->Integral("width"))/ctotcrossNLO; // normalize to the b-bbar total cross section
510 Double_t bscalefactorNLO = (fHist[1][1].Pt->Integral("width"))/btotcrossNLO; // normalize to the b-bbar total cross section
511 hNLOc->Scale(cscalefactorNLO);
512 hNLOb->Scale(bscalefactorNLO);
513 cPt->cd();
514 hNLOc->SetMarkerStyle(28);
515 hNLOb->SetMarkerStyle(3);
516 hNLOc->SetMarkerColor(1);
517 hNLOb->SetMarkerColor(1);
518 hNLOc->Draw("samep");
519 hNLOb->Draw("samep");
520 legend1->AddEntry(hNLOc,"charm from NLO", "p");
521 legend1->AddEntry(hNLOb,"bottom from NLO", "p");
522 legend1->Draw();
523
524}
525
526
527//--------------------------
528void DrawDifferentialYieldAcc(char *filename){
529
530 TFile *_file[1];
531 _file[0] = TFile::Open(filename);
532
533 setGeneralStyle();
534 char configname[]="mcQA";
535 enum qType {kQuark, kantiQuark, kHadron, kElec, kElec2nd, keHadron, kDeHadron};
536 const Int_t fgkqType=7;
537
538 struct hists {
539 TH1F *Pt;
540 TH1F *Eta;
541 TH1F *Y;
542 TH1F *barrel_Pt;
543 TH1F *barrel_Eta;
544 TH1F *barrel_Y;
545 };
546
547 hists fHist[2][7];
548
549 TString kqTypeLabel[2][fgkqType];
550 kqTypeLabel[0][kQuark]="c";
551 kqTypeLabel[0][kElec]="ce";
552 kqTypeLabel[0][kElec2nd]="nulle";
553 kqTypeLabel[1][kQuark]="b";
554 kqTypeLabel[1][kElec]="be";
555 kqTypeLabel[1][kElec2nd]="bce";
556
557 Int_t kColorCode[2][fgkqType][2];
558 for(Int_t iq=0; iq<7; iq++){
559 kColorCode[0][iq][0]=kRed;
560 kColorCode[1][iq][0]=kBlue;
561 }
562 kColorCode[1][kElec2nd][0]=kBlack;
563
564 Int_t kMarkerStyle[2][2][fgkqType];
565 kMarkerStyle[0][0][kElec]=24;
566 kMarkerStyle[0][1][kElec]=25;
567 kMarkerStyle[1][0][kElec]=20;
568 kMarkerStyle[1][1][kElec]=21;
569 kMarkerStyle[0][1][kElec2nd]=25;
570 kMarkerStyle[1][1][kElec2nd]=21;
571
572 Int_t kLineStyle[fgkqType];
573 kLineStyle[kElec]=1;
574 kLineStyle[kElec2nd]=1;
575
576 cPtElec = new TCanvas("cPtElec","pT of Electron",0,0,600,500);
577 cYQElec = new TCanvas("cYElec","rapidity of Electron",0,0,600,500);
578
579 TList *tl = (TList *)_file[0]->Get("HFE_QA")->FindObject("MCqa");
580 //count # of events
581 TList *tl_result = (TList *)_file[0]->Get("HFE_Results");
582 AliHFEcontainer *containerhfe = (AliHFEcontainer *) tl_result->FindObject("trackContainer");
583 if(!containerhfe) {
584 printf("No hfe container \n");
585 return;
586 }
587 Int_t nEvt = (Int_t) containerhfe->GetNumberOfEvents();
588 cout << "# of events " << nEvt << endl;
589
590 Double_t scalefactor = 1./float(nEvt); //normalize with total number of event
591
592 TString hname;
593 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
594 for (Int_t iqType = 3; iqType < 5; iqType++ ){
595
596 //pT distribution
597 hname="mcqa_Pt_";
598 hname=hname+kqTypeLabel[iHQ][iqType];
599 fHist[iHQ][iqType].Pt = (TH1F*)tl->FindObject(hname);
600 fHist[iHQ][iqType].Pt->SetXTitle("p_{t} [GeV/c]");
601 fHist[iHQ][iqType].Pt->SetYTitle("1/N_{Evt}dN/dp_{t} [1/GeVc^{-1}]");
602 setDataStyle(*fHist[iHQ][iqType].Pt, kColorCode[iHQ][iqType][0], 1, kLineStyle[iqType]);
603 fHist[iHQ][iqType].Pt->SetMarkerStyle(kMarkerStyle[0][iHQ][iqType]);
604
605 fHist[iHQ][iqType].Pt->Sumw2();
606 CorrectFromTheWidth(fHist[iHQ][iqType].Pt); //consider pT bin size
607 fHist[iHQ][iqType].Pt->Scale(scalefactor); //normalize with # of events
608 fHist[iHQ][iqType].Pt->Scale(0.5); //to get (e+e-)/2
609
610 hname="mcqa_barrel_Pt_";
611 hname=hname+kqTypeLabel[iHQ][iqType];
612 fHist[iHQ][iqType].barrel_Pt = (TH1F*)tl->FindObject(hname);
613 fHist[iHQ][iqType].barrel_Pt->SetXTitle("p_{t} [GeV/c]");
614 fHist[iHQ][iqType].barrel_Pt->SetYTitle("1/N_{Evt}dN/dp_{t} [1/GeVc^{-1}]");
615 setDataStyle(*fHist[iHQ][iqType].barrel_Pt, kColorCode[iHQ][iqType][0], 1, kLineStyle[iqType]);
616 fHist[iHQ][iqType].barrel_Pt->SetMarkerStyle(kMarkerStyle[1][iHQ][iqType]);
617
618 fHist[iHQ][iqType].barrel_Pt->Sumw2();
619 CorrectFromTheWidth(fHist[iHQ][iqType].barrel_Pt); //consider pT bin size
620 fHist[iHQ][iqType].barrel_Pt->Scale(scalefactor); //normalize with # of events
621 fHist[iHQ][iqType].barrel_Pt->Scale(0.5); //to get (e+e-)/2
622
623
624 //eta and rapidity distribution
625 hname="mcqa_Eta_";
626 hname=hname+kqTypeLabel[iHQ][iqType];
627 fHist[iHQ][iqType].Eta = (TH1F*)tl->FindObject(hname);
628 hname="mcqa_Y_";
629 hname=hname+kqTypeLabel[iHQ][iqType];
630 fHist[iHQ][iqType].Y = (TH1F*)tl->FindObject(hname);
631 fHist[iHQ][iqType].Y->SetXTitle("Y");
632 fHist[iHQ][iqType].Y->SetYTitle("1/N_{Evt}dN/dY");
633 setDataStyle(*fHist[iHQ][iqType].Y, kColorCode[iHQ][iqType][0], 1, kLineStyle[iqType]);
634 fHist[iHQ][iqType].Y->SetMarkerStyle(kMarkerStyle[0][1][iqType]);
635
636 fHist[iHQ][iqType].Y->Rebin(2);
637 fHist[iHQ][iqType].Y->Sumw2();
638 CorrectFromTheWidth(fHist[iHQ][iqType].Y); //consider Y bin size
639 fHist[iHQ][iqType].Y->Scale(scalefactor); //normalize with # of events
640 fHist[iHQ][iqType].Y->Scale(0.5); //to get (e+e-)/2
641
642 hname="mcqa_barrel_Eta_";
643 hname=hname+kqTypeLabel[iHQ][iqType];
644 fHist[iHQ][iqType].barrel_Eta = (TH1F*)tl->FindObject(hname);
645 hname="mcqa_barrel_Y_";
646 hname=hname+kqTypeLabel[iHQ][iqType];
647 fHist[iHQ][iqType].barrel_Y = (TH1F*)tl->FindObject(hname);
648 fHist[iHQ][iqType].barrel_Y->SetXTitle("Y");
649 fHist[iHQ][iqType].barrel_Y->SetYTitle("1/N_{Evt}dN/dY");
650 setDataStyle(*fHist[iHQ][iqType].barrel_Y, kColorCode[iHQ][iqType][0], 1, kLineStyle[iqType]);
651 fHist[iHQ][iqType].barrel_Y->SetMarkerStyle(kMarkerStyle[1][iHQ][iqType]);
652
653 fHist[iHQ][iqType].barrel_Y->Rebin(2);
654 fHist[iHQ][iqType].barrel_Y->Sumw2();
655 CorrectFromTheWidth(fHist[iHQ][iqType].barrel_Y); //consider Y bin size
656 fHist[iHQ][iqType].barrel_Y->Scale(scalefactor); //normalize with # of events
657 fHist[iHQ][iqType].barrel_Y->Scale(0.5); //to get (e+e-)/2
658 }
659 }
660
661 Int_t iorder[2] = {0,1};
662 if (fHist[0][3].Pt->GetEntries() < fHist[1][3].Pt->GetEntries()) {iorder[0]=1; iorder[1]=0;};
663
664 cPtElec->cd();
665 setPadStyle(2,gPad);
666 fHist[iorder[0]][3].Pt->SetAxisRange(0,10,"X");
667 fHist[iorder[0]][3].Pt->Draw("p");
668 fHist[iorder[1]][3].Pt->Draw("samep");
669 fHist[1][4].Pt->Draw("samep");
670 fHist[iorder[0]][3].barrel_Pt->Draw("samep");
671 fHist[iorder[1]][3].barrel_Pt->Draw("samep");
672 fHist[1][4].barrel_Pt->Draw("samep");
673
674 cYElec->cd();
675 setPadStyle(2,gPad);
676 fHist[iorder[0]][3].Y->Draw();
677 fHist[iorder[1]][3].Y->Draw("same");
678 fHist[1][4].Y->Draw("same");
679 fHist[iorder[0]][3].barrel_Y->Draw("samelp");
680 fHist[iorder[1]][3].barrel_Y->Draw("samelp");
681 fHist[1][4].barrel_Y->Draw("samelp");
682
683
684 TLegend *legend2 = new TLegend(0.62,0.74,0.98,0.99,"");
685 setLegendStyle(*legend2,1);
686 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
687 legend2->AddEntry(fHist[iHQ][3].Pt,"(e+e^{-})/2, "+kqTypeLabel[iHQ][kQuark]+"->e", "p");
688 legend2->AddEntry(fHist[iHQ][3].barrel_Pt,"(e+e^{-})/2, "+kqTypeLabel[iHQ][kQuark]+"->e |#eta<0.9|", "p");
689 if(iHQ==1) legend2->AddEntry(fHist[iHQ][4].Pt,"(e+e^{-})/2, "+kqTypeLabel[iHQ][kQuark]+"->c->e", "p");
690 if(iHQ==1) legend2->AddEntry(fHist[iHQ][4].barrel_Pt,"(e+e^{-})/2, "+kqTypeLabel[iHQ][kQuark]+"->c->e |#eta<0.9|", "p");
691 }
692 TLegend *legend2_ = new TLegend(0.62,0.42,0.98,0.72,"");
693 setLegendStyle(*legend2_,1);
694 legend2_->AddEntry(fHist[0][0].Pt,"(e+e^{-})/2, yield per event", "");
695 legend2_->AddEntry(fHist[0][0].Pt,"(0.1<p_{t}<20)", "");
696 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
697 legend2_->AddEntry(fHist[iHQ][3].Pt,Form("%1.4f",fHist[iHQ][3].Pt->Integral("width")), "p");
698 legend2_->AddEntry(fHist[iHQ][3].barrel_Pt,Form("%1.4f",fHist[iHQ][3].barrel_Pt->Integral("width")), "p");
699 if(iHQ==1) legend2_->AddEntry(fHist[iHQ][4].Pt,Form("%1.4f",fHist[iHQ][4].Pt->Integral("width")), "p");
700 if(iHQ==1) legend2_->AddEntry(fHist[iHQ][4].barrel_Pt,Form("%1.4f",fHist[iHQ][4].barrel_Pt->Integral("width")), "p");
701 }
702
703
704 TLegend *legend4 = new TLegend(0.30,0.12,0.70,0.36,"");
705 setLegendStyle(*legend4,1);
706 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
707 legend4->AddEntry(fHist[iHQ][3].Y,"(e+e^{-})/2, "+kqTypeLabel[iHQ][kQuark]+"->e", "p");
708 legend4->AddEntry(fHist[iHQ][3].barrel_Y,"(e+e^{-})/2, "+kqTypeLabel[iHQ][kQuark]+"->e |#eta<0.9|", "p");
709 if(iHQ==1) legend4->AddEntry(fHist[iHQ][4].Y,"(e+e^{-})/2, "+kqTypeLabel[iHQ][kQuark]+"->c->e", "p");
710 if(iHQ==1) legend4->AddEntry(fHist[iHQ][4].barrel_Y,"(e+e^{-})/2, "+kqTypeLabel[iHQ][kQuark]+"->c->e |#eta<0.9|", "p");
711 }
712 TLegend *legend4_ = new TLegend(0.65,0.72,0.98,0.99,"");
713 setLegendStyle(*legend4_,1);
714 legend4_->AddEntry(fHist[0][0].Y,"(e+e^{-})/2, yield per event", "");
715 legend4_->AddEntry(fHist[0][0].Y,"(all p_{t})", "");
716 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
717 legend4_->AddEntry(fHist[iHQ][3].Y,Form("%1.4f",fHist[iHQ][3].Y->Integral("width")), "p");
718 legend4_->AddEntry(fHist[iHQ][3].barrel_Y,Form("%1.4f",fHist[iHQ][3].barrel_Y->Integral("width")), "p");
719 if(iHQ==1) legend4_->AddEntry(fHist[iHQ][4].Y,Form("%1.4f",fHist[iHQ][4].Y->Integral("width")), "p");
720 if(iHQ==1) legend4_->AddEntry(fHist[iHQ][4].barrel_Y,Form("%1.4f",fHist[iHQ][4].barrel_Y->Integral("width")), "p");
721 }
722
723
724 cPtElec->cd();
725 legend2->Draw();
726 legend2_->Draw();
727
728 cYElec->cd();
729 legend4->Draw();
730 legend4_->Draw();
731
732}
733
734//--------------------------
735void DrawDifferentialXsectionBoth(char *filename, char *NLOcalc){
736
737 TFile *_file[1];
738 _file[0] = TFile::Open(filename);
739 _file[1] = TFile::Open(NLOcalc);
740
741 setGeneralStyle();
742 char configname[]="mcQA";
743 enum qType {kQuark, kantiQuark, kHadron, kElec, kElec2nd, keHadron, kDeHadron};
744 const Int_t fgkqType=7;
745
746 struct hists {
747 TH1F *Pt;
748 };
749
750 hists fHist[2][7];
751
752 TString kqTypeLabel[2][fgkqType];
753 kqTypeLabel[0][kQuark]="c";
754 kqTypeLabel[0][kantiQuark]="cbar";
755 kqTypeLabel[0][kHadron]="cHadron";
756 kqTypeLabel[0][kElec]="ce";
757 kqTypeLabel[0][kElec2nd]="nulle";
758 kqTypeLabel[0][keHadron]="ceHadron";
759 kqTypeLabel[0][kDeHadron]="nullHadron";
760 kqTypeLabel[1][kQuark]="b";
761 kqTypeLabel[1][kantiQuark]="bbar";
762 kqTypeLabel[1][kHadron]="bHadron";
763 kqTypeLabel[1][kElec]="be";
764 kqTypeLabel[1][kElec2nd]="bce";
765 kqTypeLabel[1][keHadron]="beHadron";
766 kqTypeLabel[1][kDeHadron]="bDeHadron";
767
768 Int_t kColorCode[2][fgkqType];
769 for(Int_t iq=0; iq<7; iq++){
770 kColorCode[0][iq]=4;
771 kColorCode[1][iq]=2;
772 }
773
774 Int_t kLineStyle[fgkqType];
775 kLineStyle[kQuark]=1;
776 kLineStyle[kantiQuark]=1;
777 kLineStyle[kHadron]=2;
778 kLineStyle[kElec]=2;
779 kLineStyle[kElec2nd]=1;
780 kLineStyle[keHadron]=2;
781 kLineStyle[kDeHadron]=1;
782
783
784 cPt = new TCanvas("cPt","pT of Quark & Hadron",0,0,600,500);
785
786 Double_t totcrossNLO[2];
787 TH1F *hNLOc = (TH1F*)_file[1]->Get("hpt_c");
788 TH1F *hNLOb = (TH1F*)_file[1]->Get("hpt_b");
789 totcrossNLO[0] = hNLOc->Integral("width");
790 totcrossNLO[1] = hNLOb->Integral("width");
791 cPt->cd();
792 setPadStyle(2,gPad);
793 hNLOc->SetMarkerStyle(28);
794 hNLOb->SetMarkerStyle(3);
795 hNLOc->SetMarkerColor(1);
796 hNLOb->SetMarkerColor(1);
797 hNLOc->Draw("p");
798 hNLOb->Draw("samep");
799
800
801 TList *tl = (TList *)_file[0]->Get("HFE_QA")->FindObject("MCqa");
802 //count # of events
803 TList *tl_result = (TList *)_file[0]->Get("HFE_Results");
804 AliHFEcontainer *containerhfe = (AliHFEcontainer *) tl_result->FindObject("trackContainer");
805 if(!containerhfe) {
806 printf("No hfe container \n");
807 return;
808 }
809 Int_t nEvt = (Int_t) containerhfe->GetNumberOfEvents();
810 cout << "# of events " << nEvt << endl;
811
812 Double_t scalefactor = 1./float(nEvt); //normalize with total number of event
813
814 TString hname;
815 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
816 for (Int_t iqType = 0; iqType < 3; iqType++ ){
817
818 //pT distribution
819 hname="mcqa_Pt_";
820 hname=hname+kqTypeLabel[iHQ][iqType];
821 fHist[iHQ][iqType].Pt = (TH1F*)tl->FindObject(hname);
822 fHist[iHQ][iqType].Pt->SetXTitle("p_{t} [GeV/c]");
823 fHist[iHQ][iqType].Pt->SetYTitle("1/N_{Evt}dN/dp_{t} [1/GeVc^{-1}]");
824 setDataStyle(*fHist[iHQ][iqType].Pt, kColorCode[iHQ][iqType], 3, kLineStyle[iqType]);
825
826 CorrectFromTheWidth(fHist[iHQ][iqType].Pt); //consider pT bin size
827 fHist[iHQ][iqType].Pt->Scale(scalefactor); //normalize with # of events
828 if (iqType==1) {
829 fHist[iHQ][iqType].Pt->Add(fHist[iHQ][0].Pt); //Q+Qbar
830 fHist[iHQ][iqType].Pt->Scale(0.5); // pari
831 Double_t xfactor = fHist[iHQ][iqType].Pt->Integral("width");
832 fHist[iHQ][iqType].Pt->Scale(totcrossNLO[iHQ]/xfactor); //consider pT bin size
833 }
834 }
835 }
836
837 Int_t iorder[2] = {0,1};
838 if (fHist[0][1].Pt->GetEntries() < fHist[1][1].Pt->GetEntries()) {iorder[0]=1; iorder[1]=0;};
839
840 cPt->cd();
841 setPadStyle(2,gPad);
842 fHist[iorder[0]][1].Pt->Draw("same");
843 fHist[iorder[1]][1].Pt->Draw("same");
844
845 TLegend *legend1 = new TLegend(0.50,0.77,0.98,0.99,"");
846 setLegendStyle(*legend1,1);
847 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
848 legend1->AddEntry(fHist[iHQ][0].Pt,kqTypeLabel[iHQ][kQuark]+"#bar{"+kqTypeLabel[iHQ][kQuark]+"}"+" pair", "l");
849 }
850 legend1->AddEntry(hNLOc,"charm from NLO", "p");
851 legend1->AddEntry(hNLOb,"bottom from NLO", "p");
852
853 cPt->cd();
854 legend1->Draw();
855
856}
857//--------------------------
858void setDataStyle(TH1F &h, Int_t lc, Int_t lw, Int_t ls){
859
860 h.SetLineColor(lc);
861 h.SetLineWidth(lw);
862 h.SetLineStyle(ls);
863 h.SetMarkerColor(lc);
864
865}
866
867//--------------------------
868void setLegendStyle(TLegend &legend, Int_t bs){
869
870 legend.SetBorderSize(bs);
871 legend.SetFillColor(0);
872 legend.SetTextFont(132);
873 legend.SetTextSize(0.04);
874 legend.SetMargin(0.15);
875
876}
877
878//--------------------------
879void setPadStyle(Int_t lvl, TPad *pad){
880
881 pad->SetLogy();
882 if(lvl>0) gPad->SetGridy();
883 if(lvl>1) gPad->SetGridx();
884
885}
886
887//--------------------------
888void setGeneralStyle(){
889
890 gStyle->SetPalette(1);
891
892 gStyle->SetFrameBorderMode(0);
893 gStyle->SetFrameFillColor(0);
894 gStyle->SetPadBorderSize(0);
895 gStyle->SetPadBorderMode(0);
896 gStyle->SetCanvasColor(0);
897 gStyle->SetCanvasBorderSize(10);
898
899 gStyle->SetOptStat(0);
900 gStyle->SetOptTitle(0);
901 gStyle->SetTitleFillColor(10);
902 gStyle->SetTitleBorderSize(0);
903 gStyle->SetTitleSize(0.04,"X");
904 gStyle->SetTitleSize(0.04,"Y");
905 gStyle->SetTitleFont(132,"X");
906 gStyle->SetTitleFont(132,"Y");
907 gStyle->SetTitleXOffset(0.9);
908 gStyle->SetTitleYOffset(0.9);
909 gStyle->SetLabelFont(132,"X");
910 gStyle->SetLabelFont(132,"Y");
911 gStyle->SetLabelSize(0.04,"X");
912 gStyle->SetLabelSize(0.04,"Y");
913
914 gStyle->SetTitleSize(0.05,"X");
915 gStyle->SetTitleSize(0.05,"Y");
916 gStyle->SetLineWidth(2);
917
918}
919
920void CorrectFromTheWidth(TH1F *h1) const {
921 //
922 // Correct from the width of the bins --> dN/dp_{T} (GeV/c)^{-1}
923 //
924
925 TAxis *axis = h1->GetXaxis();
926 Int_t nbinX = h1->GetNbinsX();
927
928 for(Int_t i = 1; i <= nbinX; i++) {
929
930 Double_t width = axis->GetBinWidth(i);
931 Double_t content = h1->GetBinContent(i);
932 Double_t error = h1->GetBinError(i);
933 h1->SetBinContent(i,content/width);
934 h1->SetBinError(i,error/width);
935 }
936
937}
938