1 void DrawMCQAplots(Int_t imode){
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
10 gSystem->Load("libANALYSIS.so");
11 gSystem->Load("libANALYSISalice.so");
12 gSystem->Load("libCORRFW.so");
13 gSystem->Load("libPWG0base.so");
14 gSystem->Load("libPWGHFhfe.so");
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)
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
35 //--------------------------
36 void DrawDifferentialYield(Int_t qtype, char *filename, char *NLOcalc){
39 _file[0] = TFile::Open(filename);
40 _file[1] = TFile::Open(NLOcalc);
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;
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";
81 Int_t kColorCode[fgkqType];
83 kColorCode[kantiQuark]=2;
84 kColorCode[kHadron]=6;
86 kColorCode[kElec2nd]=4;
87 kColorCode[keHadron]=3;
88 kColorCode[kDeHadron]=3;
90 Int_t kLineStyle[fgkqType];
92 kLineStyle[kantiQuark]=1;
93 kLineStyle[kHadron]=3;
95 kLineStyle[kElec2nd]=1;
96 kLineStyle[keHadron]=2;
97 kLineStyle[kDeHadron]=1;
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);
106 TList *tl = (TList *)_file[0]->Get("HFE_QA")->FindObject("MCqa");
108 TList *tl_result = (TList *)_file[0]->Get("HFE_Results");
109 AliHFEcontainer *containerhfe = (AliHFEcontainer *) tl_result->FindObject("trackContainer");
111 printf("No hfe container \n");
114 Int_t nEvt = (Int_t) containerhfe->GetNumberOfEvents();
115 cout << "# of events " << nEvt << endl;
117 Double_t scalefactor = 1./float(nEvt); //normalize with total number of event
120 for (Int_t iqType = 0; iqType < fgkqType; iqType++ ){
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]);
130 CorrectFromTheWidth(fHist[iqType].Pt); //consider pT bin size
131 fHist[iqType].Pt->Scale(scalefactor); //normalize with # of events
133 fHist[iqType].Pt->Add(fHist[0].Pt); // add Q and Qbar
134 fHist[iqType].Pt->Scale(0.5); // get number of ccbar pair
137 //eta and rapidity distribution
139 hname=hname+kqTypeLabel[iqType];
140 fHist[iqType].Eta = (TH1F*)tl->FindObject(hname);
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]);
148 CorrectFromTheWidth(fHist[iqType].Y); //consider pT bin size
149 fHist[iqType].Y->Scale(scalefactor); //normalize with # of events
151 fHist[iqType].Y->Add(fHist[0].Y); // add Q and Qbar
152 fHist[iqType].Y->Scale(0.5); // get number of ccbar pair
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");
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");
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);
175 fHistComm.PdgCode->Draw();
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);
185 fHistComm.Nq->Scale(scalefactor);
186 fHistComm.Nq->Draw();
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");
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");
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");
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");
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", "");
243 Double_t totcrossNLO=0;
244 Double_t scalefactorNLO=0;
245 Double_t totcrossNLOY=0;
246 Double_t scalefactorNLOY=0;
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");
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");
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);
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);
276 if(qtype==4) legend1->AddEntry(hNLO,"charm from NLO", "lp");
277 if(qtype==5) legend1->AddEntry(hNLO,"bottom from NLO", "lp");
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");
287 //--------------------------
288 void DrawDifferentialYieldBoth(char *filename, char *NLOcalc){
291 _file[0] = TFile::Open(filename);
292 _file[1] = TFile::Open(NLOcalc);
295 char configname[]="mcQA";
296 enum qType {kQuark, kantiQuark, kHadron, kElec, kElec2nd, keHadron, kDeHadron};
297 const Int_t fgkqType=7;
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";
323 Int_t kColorCode[2][fgkqType];
324 for(Int_t iq=0; iq<7; iq++){
329 Int_t kLineStyle[fgkqType];
330 kLineStyle[kQuark]=1;
331 kLineStyle[kantiQuark]=1;
332 kLineStyle[kHadron]=2;
334 kLineStyle[kElec2nd]=1;
335 kLineStyle[keHadron]=2;
336 kLineStyle[kDeHadron]=1;
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);
342 cPtElec = new TCanvas("cPtElec","pT of Electron",0,0,600,500);
343 cYQElec = new TCanvas("cYElec","rapidity of Electron",0,0,600,500);
345 TList *tl = (TList *)_file[0]->Get("HFE_QA")->FindObject("MCqa");
347 TList *tl_result = (TList *)_file[0]->Get("HFE_Results");
348 AliHFEcontainer *containerhfe = (AliHFEcontainer *) tl_result->FindObject("trackContainer");
350 printf("No hfe container \n");
353 Int_t nEvt = (Int_t) containerhfe->GetNumberOfEvents();
354 cout << "# of events " << nEvt << endl;
356 Double_t scalefactor = 1./float(nEvt); //normalize with total number of event
359 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
360 for (Int_t iqType = 0; iqType < fgkqType; iqType++ ){
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]);
370 CorrectFromTheWidth(fHist[iHQ][iqType].Pt); //consider pT bin size
371 fHist[iHQ][iqType].Pt->Scale(scalefactor); //normalize with # of events
373 fHist[iHQ][iqType].Pt->Add(fHist[iHQ][0].Pt); // Q+Qbar
374 fHist[iHQ][iqType].Pt->Scale(0.5); // pair
377 //eta and rapidity distribution
379 hname=hname+kqTypeLabel[iHQ][iqType];
380 fHist[iHQ][iqType].Eta = (TH1F*)tl->FindObject(hname);
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]);
388 CorrectFromTheWidth(fHist[iHQ][iqType].Y); //consider Y bin size
389 fHist[iHQ][iqType].Y->Scale(scalefactor); //normalize with # of events
391 fHist[iHQ][iqType].Y->Add(fHist[iHQ][0].Y); // Q+Qbar
392 fHist[iHQ][iqType].Y->Scale(0.5); // pair
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;};
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");
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");
416 fHist[iorder[0]][3].Pt->Draw();
417 fHist[iorder[1]][3].Pt->Draw("same");
418 fHist[1][4].Pt->Draw("same");
422 fHist[iorder[0]][3].Y->Draw();
423 fHist[iorder[1]][3].Y->Draw("same");
424 fHist[1][4].Y->Draw("same");
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");
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");
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");
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");
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");
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");
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");
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");
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);
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");
527 //--------------------------
528 void DrawDifferentialYieldAcc(char *filename){
531 _file[0] = TFile::Open(filename);
534 char configname[]="mcQA";
535 enum qType {kQuark, kantiQuark, kHadron, kElec, kElec2nd, keHadron, kDeHadron};
536 const Int_t fgkqType=7;
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";
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;
562 kColorCode[1][kElec2nd][0]=kBlack;
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;
572 Int_t kLineStyle[fgkqType];
574 kLineStyle[kElec2nd]=1;
576 cPtElec = new TCanvas("cPtElec","pT of Electron",0,0,600,500);
577 cYQElec = new TCanvas("cYElec","rapidity of Electron",0,0,600,500);
579 TList *tl = (TList *)_file[0]->Get("HFE_QA")->FindObject("MCqa");
581 TList *tl_result = (TList *)_file[0]->Get("HFE_Results");
582 AliHFEcontainer *containerhfe = (AliHFEcontainer *) tl_result->FindObject("trackContainer");
584 printf("No hfe container \n");
587 Int_t nEvt = (Int_t) containerhfe->GetNumberOfEvents();
588 cout << "# of events " << nEvt << endl;
590 Double_t scalefactor = 1./float(nEvt); //normalize with total number of event
593 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
594 for (Int_t iqType = 3; iqType < 5; iqType++ ){
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]);
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
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]);
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
624 //eta and rapidity distribution
626 hname=hname+kqTypeLabel[iHQ][iqType];
627 fHist[iHQ][iqType].Eta = (TH1F*)tl->FindObject(hname);
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]);
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
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]);
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
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;};
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");
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");
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");
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");
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");
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");
734 //--------------------------
735 void DrawDifferentialXsectionBoth(char *filename, char *NLOcalc){
738 _file[0] = TFile::Open(filename);
739 _file[1] = TFile::Open(NLOcalc);
742 char configname[]="mcQA";
743 enum qType {kQuark, kantiQuark, kHadron, kElec, kElec2nd, keHadron, kDeHadron};
744 const Int_t fgkqType=7;
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";
768 Int_t kColorCode[2][fgkqType];
769 for(Int_t iq=0; iq<7; iq++){
774 Int_t kLineStyle[fgkqType];
775 kLineStyle[kQuark]=1;
776 kLineStyle[kantiQuark]=1;
777 kLineStyle[kHadron]=2;
779 kLineStyle[kElec2nd]=1;
780 kLineStyle[keHadron]=2;
781 kLineStyle[kDeHadron]=1;
784 cPt = new TCanvas("cPt","pT of Quark & Hadron",0,0,600,500);
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");
793 hNLOc->SetMarkerStyle(28);
794 hNLOb->SetMarkerStyle(3);
795 hNLOc->SetMarkerColor(1);
796 hNLOb->SetMarkerColor(1);
798 hNLOb->Draw("samep");
801 TList *tl = (TList *)_file[0]->Get("HFE_QA")->FindObject("MCqa");
803 TList *tl_result = (TList *)_file[0]->Get("HFE_Results");
804 AliHFEcontainer *containerhfe = (AliHFEcontainer *) tl_result->FindObject("trackContainer");
806 printf("No hfe container \n");
809 Int_t nEvt = (Int_t) containerhfe->GetNumberOfEvents();
810 cout << "# of events " << nEvt << endl;
812 Double_t scalefactor = 1./float(nEvt); //normalize with total number of event
815 for (Int_t iHQ= 0; iHQ < 2; iHQ++ ){
816 for (Int_t iqType = 0; iqType < 3; iqType++ ){
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]);
826 CorrectFromTheWidth(fHist[iHQ][iqType].Pt); //consider pT bin size
827 fHist[iHQ][iqType].Pt->Scale(scalefactor); //normalize with # of events
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
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;};
842 fHist[iorder[0]][1].Pt->Draw("same");
843 fHist[iorder[1]][1].Pt->Draw("same");
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");
850 legend1->AddEntry(hNLOc,"charm from NLO", "p");
851 legend1->AddEntry(hNLOb,"bottom from NLO", "p");
857 //--------------------------
858 void setDataStyle(TH1F &h, Int_t lc, Int_t lw, Int_t ls){
863 h.SetMarkerColor(lc);
867 //--------------------------
868 void setLegendStyle(TLegend &legend, Int_t bs){
870 legend.SetBorderSize(bs);
871 legend.SetFillColor(0);
872 legend.SetTextFont(132);
873 legend.SetTextSize(0.04);
874 legend.SetMargin(0.15);
878 //--------------------------
879 void setPadStyle(Int_t lvl, TPad *pad){
882 if(lvl>0) gPad->SetGridy();
883 if(lvl>1) gPad->SetGridx();
887 //--------------------------
888 void setGeneralStyle(){
890 gStyle->SetPalette(1);
892 gStyle->SetFrameBorderMode(0);
893 gStyle->SetFrameFillColor(0);
894 gStyle->SetPadBorderSize(0);
895 gStyle->SetPadBorderMode(0);
896 gStyle->SetCanvasColor(0);
897 gStyle->SetCanvasBorderSize(10);
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");
914 gStyle->SetTitleSize(0.05,"X");
915 gStyle->SetTitleSize(0.05,"Y");
916 gStyle->SetLineWidth(2);
920 void CorrectFromTheWidth(TH1F *h1) const {
922 // Correct from the width of the bins --> dN/dp_{T} (GeV/c)^{-1}
925 TAxis *axis = h1->GetXaxis();
926 Int_t nbinX = h1->GetNbinsX();
928 for(Int_t i = 1; i <= nbinX; i++) {
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);