ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/macros/plotFigure.C
Revision: 1.4
Committed: Mon Feb 4 22:46:10 2013 UTC (12 years, 3 months ago) by yjlee
Content type: text/plain
Branch: MAIN
Changes since 1.3: +2 -2 lines
Log Message:
lumi

File Contents

# User Rev Content
1 yilmaz 1.1 #if !defined(__CINT__) || defined(__MAKECINT__)
2    
3     #include <iostream>
4 yilmaz 1.2 #include <string>
5 yilmaz 1.1 #include "TCanvas.h"
6     #include "TError.h"
7     #include "TPad.h"
8     #include "TString.h"
9     #include "TRandom.h"
10     #include "TH1F.h"
11    
12     #include "TFile.h"
13     #include "TTree.h"
14     #include "TH1D.h"
15     #include "TH2D.h"
16     #include "TCanvas.h"
17     #include "TLegend.h"
18     #include "TLatex.h"
19     #include "TString.h"
20    
21 yilmaz 1.2 using namespace std;
22    
23 yilmaz 1.1 #endif
24    
25 yilmaz 1.3 #include "CommonParameters.h"
26 yilmaz 1.1
27     static int iPlot = -99;
28    
29 yilmaz 1.2 int centMode = 1;
30     int entryMode = 0;
31 yilmaz 1.1
32     //---------------------------------------------------------------------
33     void makeMultiPanelCanvas(TCanvas*& canv, const Int_t columns,
34     const Int_t rows, const Float_t leftOffset=0.,
35     const Float_t bottomOffset=0.,
36     const Float_t leftMargin=0.2,
37     const Float_t bottomMargin=0.2,
38     const Float_t edge=0.05);
39    
40     void plotBalance(int cbin = 0,
41     TString infname = "file1.root",
42     TString refname = "file2.root",
43     TString mixname = "file3.root",
44     bool drawXLabel = false,
45     bool drawLeg = false);
46    
47    
48     void drawText(const char *text, float xp, float yp);
49    
50     //--------------------------------------------------------------
51     // drawPatch() is a crazy way of removing 0 in the second and third
52     // pad which is partially shown due to no margin between the pads
53     // if anybody has a better way of doing it let me know! - Andre
54     //--------------------------------------------------------------
55     void drawPatch(float x1, float y1, float x2, float y2);
56     //---------------------------------------------------------------------
57    
58 yilmaz 1.2 void plotFigure(int iplot = 9){
59 yilmaz 1.3 TString infname = "/d101/yetkin/analysis/d0204/ntuple_data_pPb_akPu3PF_forest71_20130204_01.root";
60     TString refname = "/d101/yetkin/analysis/d0204/ntuple_data_PbPb_akPu3PF_forest71_20130204_01.root";
61     TString mixname = "/d101/yetkin/analysis/d0204/hijing.root";
62 yilmaz 1.2
63     string hfNames[] = {
64     "30<E_{T}^{HF[#eta > 4]}<70",
65     "20<E_{T}^{HF[#eta > 4]}<30",
66     "15<E_{T}^{HF[#eta > 4]}<20",
67     "10<E_{T}^{HF[#eta > 4]}<15",
68     "5<E_{T}^{HF[#eta > 4]}<10",
69     "0<E_{T}^{HF[#eta > 4]}<5"
70     };
71    
72    
73     string ntrkNames[] = {
74     "180 #leq N_{trk}^{offline}",
75     "150 #leq N_{trk}^{offline} < 180",
76     "110 #leq N_{trk}^{offline} < 150",
77     "90 #leq N_{trk}^{offline} < 110",
78     "60 #leq N_{trk}^{offline} < 90",
79     "N_{trk}^{offline} < 60"
80     };
81    
82     string *binNames = hfNames;
83     if(centMode == 0) binNames = ntrkNames;
84 yilmaz 1.1
85     iPlot = iplot;
86    
87     TH1::SetDefaultSumw2();
88    
89     TCanvas *c1 = new TCanvas("c1","",1050,700);
90     makeMultiPanelCanvas(c1,3,2,0.0,0.0,0.2,0.2,0.02);
91     TLatex *jetf_PbPb;
92    
93 yilmaz 1.2 if(iPlot == 3 || iPlot == 8 || iPlot == 11 || iPlot == 12){
94 yilmaz 1.1 for(int i = 0; i < 6; ++i){
95     c1->cd(i+1)->SetLogy();
96     }
97     }
98    
99    
100     c1->cd(1);
101    
102     jetf_PbPb = new TLatex(0.477,0.54,"Anti-k_{T} (PFlow), R=0.3");
103     jetf_PbPb->SetTextFont(63);
104     jetf_PbPb->SetTextSize(15);
105     jetf_PbPb->Draw();
106    
107 yilmaz 1.2 for(int i = 0; i < 6; ++i){
108     c1->cd(6-i);
109 yilmaz 1.3 plotBalance(i,infname,refname,mixname,i==1,i==0);
110 yilmaz 1.2 double y1 = 0.07;
111     if(i < 3) y1 = 0.23;
112     y1= 0.9;
113     drawText(binNames[i].data(),0.3,y1);
114     // drawText("(d)",0.25,0.92);
115     }
116 yilmaz 1.1
117     c1->cd(2);
118    
119     TLatex tsel;
120     tsel.SetNDC();
121     tsel.SetTextFont(63);
122     tsel.SetTextSize(15);
123     tsel.DrawLatex(0.15,0.75,Form("p_{T,1} > %d GeV/c",leadCut));
124     tsel.DrawLatex(0.15,0.65,Form("p_{T,2} > %d GeV/c",subleadCut));
125     tsel.DrawLatex(0.15,0.55,"#Delta#phi_{12} > #frac{2}{3}#pi");
126    
127     c1->cd(1);
128    
129     TLatex *cms = new TLatex(0.03,0.28,"CMS Preliminary");
130     if(iPlot == 3) cms = new TLatex(0.04,1.,"CMS Preliminary");
131     cms->SetTextFont(63);
132     cms->SetTextSize(17);
133     cms->Draw();
134    
135     c1->cd(1);
136 yjlee 1.4 TLatex *lumi = new TLatex(0.1,0.26,"pPb L=17.3 nb^{-1}");
137     if(iPlot == 3) lumi = new TLatex(0.1,0.46,"pPb L=17.3 nb^{-1}");
138 yilmaz 1.1
139     lumi->SetTextFont(63);
140     lumi->SetTextSize(15);
141     lumi->Draw();
142    
143     lumi = new TLatex(0.1,0.24,"PbPb L=150 #mub^{-1}");
144     if(iPlot == 3) lumi = new TLatex(0.1,0.14,"PbPb L=150 #mub^{-1}");
145    
146     lumi->SetTextFont(63);
147     lumi->SetTextSize(15);
148     lumi->Draw();
149    
150    
151    
152     c1->cd(2);
153     TLatex *jetf_pp;
154    
155     jetf_pp = new TLatex(0.12,0.24,"anti-k_{T}, (R=0.3) PF jets PU");
156    
157     jetf_pp->SetTextFont(63);
158     jetf_pp->SetTextSize(15);
159     jetf_pp->Draw();
160    
161     const char* date = "20130127";
162 yilmaz 1.2
163     string figures[150] = {"imbalance","etaDijet","", "dphi","",
164     "","", "", "pudifference", "ntrk",
165     "","pu1","pu2","","",
166     "","","","","",
167     "","eta1","eta2"
168     };
169    
170 yilmaz 1.1 string formats[] = {"gif","pdf","eps","C"};
171    
172     for(int it = 0; it < 4; ++it){
173     c1->Print(Form("./fig/dijet_%s_lead%d_sub%d_all_cent_%s%s.%s",figures[iPlot].data(),leadCut,subleadCut,date,subtract?"_subt":"",formats[it].data()));
174     }
175    
176     }
177    
178     void plotBalance(int cbin,
179     TString infname,
180     TString pythia,
181     TString mix,
182     bool drawXLabel,
183     bool drawLeg)
184     {
185    
186     if(iPlot != 3) dijet = dijet&&deltaPhi;
187    
188     TCut centHF("");
189     TCut centNtrk("");
190    
191 yilmaz 1.2 if(centMode == 0){
192     if(cbin==0) centHF = "bin>=20 && bin<26";
193     if(cbin==1) centHF = "bin>=26 && bin<27";
194     if(cbin==2) centHF = "bin>=27 && bin<28";
195     if(cbin==3) centHF = "bin>=28 && bin<29";
196     if(cbin==4) centHF = "bin>=29 && bin<31";
197     if(cbin==5) centHF = "bin>=31";
198    
199     if(cbin==0) centNtrk = "ntrk >= 180";
200     if(cbin==1) centNtrk = "150 <= ntrk && ntrk < 180";
201     if(cbin==2) centNtrk = "110 <= ntrk && ntrk < 150";
202     if(cbin==3) centNtrk = "90 <= ntrk && ntrk < 150";
203     if(cbin==4) centNtrk = "60 <= ntrk && ntrk < 90";
204     if(cbin==5) centNtrk = "ntrk < 60";
205     }
206    
207     if(centMode == 1){
208     if(cbin==0) centHF = "cent>=30 && cent<70";
209     if(cbin==1) centHF = "cent>=20 && cent<30";
210     if(cbin==2) centHF = "cent>=15 && cent<20";
211     if(cbin==3) centHF = "cent>=10 && cent<15";
212     if(cbin==4) centHF = "cent>=5 && cent<10";
213     if(cbin==5) centHF = "cent<5";
214    
215     centNtrk = centHF;
216     }
217    
218    
219    
220 yilmaz 1.1
221    
222     cout<<"plotting ntrk bin : "<<cbin<<endl;
223    
224     // open the data file
225 yilmaz 1.2
226     if(iPlot > 100) entryMode = 1;
227    
228     string treeName = "ntdijet";
229     string wName = "ntw";
230     if(entryMode == 1){
231     treeName = "ntjet";
232     wName = "ntjetw";
233     }
234    
235     if(entryMode == 2){
236     treeName = "nttrk";
237     wName = "nttrkw";
238     }
239    
240 yilmaz 1.1 TFile *inf = new TFile(infname.Data());
241 yilmaz 1.2 TTree *nt =(TTree*)inf->FindObjectAny(treeName.data());
242 yilmaz 1.1 TTree *ntevt =(TTree*)inf->FindObjectAny("ntevt");
243 yilmaz 1.2 if(entryMode < 1) nt->AddFriend(ntevt);
244 yilmaz 1.1
245     // open the pythia (MC) file
246 yilmaz 1.3 TFile *infReference = new TFile(pythia.Data());
247     TTree *ntReference;
248     TTree *ntevtReference;
249    
250     ntReference = (TTree*) infReference->FindObjectAny(treeName.data());
251     ntevtReference = (TTree*) infReference->FindObjectAny("ntevt");
252     if(entryMode < 1) ntReference->AddFriend(ntevtReference);
253    
254 yilmaz 1.1 // open the datamix file
255     TFile *infMix = new TFile(mix.Data());
256 yilmaz 1.2 TTree *ntMix =(TTree*)infMix->FindObjectAny(treeName.data());
257 yilmaz 1.1 TTree *ntevtMix =(TTree*)infMix->FindObjectAny("ntevt");
258     // TFile *infW = new TFile("weights_hydjet.root");
259     // TTree *ntw =(TTree*)infW->FindObjectAny("ntw");
260    
261 yilmaz 1.2 TTree *ntw =(TTree*)infMix->FindObjectAny(wName.data());
262 yilmaz 1.1 ntMix->AddFriend(ntw);
263 yilmaz 1.2 if(entryMode < 1) ntMix->AddFriend(ntevtMix);
264 yilmaz 1.1
265     int Nbin = 10;
266     double max = 1.;
267 yilmaz 1.2 double min = 0;
268    
269     if(iPlot == 1 || iPlot == 21 || iPlot == 22){
270     Nbin = 20;
271     max = 2;
272     min = -2;
273     };
274 yilmaz 1.1
275     if(iPlot == 3){
276     Nbin = 30;
277     max = pi;
278     };
279    
280 yilmaz 1.2 if(iPlot == 8){
281     Nbin = 50;
282     max = 25;
283     min = -25;
284     };
285    
286     if(iPlot == 9){
287     Nbin = 50;
288     max = 250;
289     };
290    
291     if(iPlot == 11 || iPlot == 12){
292     Nbin = 50;
293     max = 25;
294     };
295    
296     if(iPlot == 101){
297     Nbin = 20;
298     max = 2;
299     min = -2;
300     }
301 yilmaz 1.1
302     // projection histogram
303 yilmaz 1.2 TH1D *h = new TH1D(Form("h",cbin),"",Nbin,min,max);
304 yilmaz 1.3 TH1D *hReference = new TH1D(Form("hReference",cbin),"",Nbin,min,max);
305 yilmaz 1.2 TH1D *hDataMix = new TH1D(Form("hDataMix",cbin),"",Nbin,min,max);
306    
307     TH1D *hB = new TH1D(Form("hB",cbin),"",Nbin,min,max);
308 yilmaz 1.3 TH1D *hReferenceB = new TH1D(Form("hReferenceB",cbin),"",Nbin,min,max);
309 yilmaz 1.2 TH1D *hDataMixB = new TH1D(Form("hDataMixB",cbin),"",Nbin,min,max);
310    
311     TH1D *hFull = new TH1D("hFull","",Nbin,min,max);
312 yilmaz 1.3 TH1D *hReferenceFull = new TH1D("hReferenceFull","",Nbin,min,max);
313 yilmaz 1.2 TH1D *hDataMixFull = new TH1D("hDataMixFull","",Nbin,min,max);
314 yilmaz 1.1
315     TH1D* hNorm = new TH1D("hNorm","",1000,0,1000);
316 yilmaz 1.3 TH1D* hNormReference = new TH1D("hNormReference","",1000,0,1000);
317 yilmaz 1.1 TH1D* hNormDataMix = new TH1D("hNormDataMix","",1000,0,1000);
318    
319     hB->SetLineStyle(2);
320 yilmaz 1.3 hReferenceB->SetLineStyle(2);
321 yilmaz 1.1 hDataMixB->SetLineStyle(2);
322    
323 yilmaz 1.3 // ntReference->SetAlias("pt1","et1");
324     // ntReference->SetAlias("pt2","et2");
325 yilmaz 1.1
326     nt->SetAlias("pt1","jtpt1");
327     nt->SetAlias("pt2","jtpt2");
328     nt->SetAlias("eta1","jteta1");
329     nt->SetAlias("eta2","jteta2");
330     nt->SetAlias("phi1","jtphi1");
331     nt->SetAlias("phi2","jtphi2");
332     ntMix->SetAlias("pt1","jtpt1");
333     ntMix->SetAlias("pt2","jtpt2");
334     ntMix->SetAlias("eta1","jteta1");
335     ntMix->SetAlias("eta2","jteta2");
336     ntMix->SetAlias("phi1","jtphi1");
337     ntMix->SetAlias("phi2","jtphi2");
338 yilmaz 1.3 ntReference->SetAlias("pt1","jtpt1");
339     ntReference->SetAlias("pt2","jtpt2");
340     ntReference->SetAlias("eta1","jteta1");
341     ntReference->SetAlias("eta2","jteta2");
342     ntReference->SetAlias("phi1","jtphi1");
343     ntReference->SetAlias("phi2","jtphi2");
344    
345     nt->SetAlias("cent","hfp");
346     ntMix->SetAlias("cent","hfp");
347     ntReference->SetAlias("cent","hfp");
348 yilmaz 1.2
349 yilmaz 1.1 nt->SetAlias("dphi","acos(cos(phi1-phi2))");
350     ntMix->SetAlias("dphi","acos(cos(phi1-phi2))");
351 yilmaz 1.3 ntReference->SetAlias("dphi","acos(cos(phi1-phi2))");
352 yilmaz 1.1
353     if(iPlot == 0){
354     nt->SetAlias("var","pt2/pt1");
355 yilmaz 1.3 ntReference->SetAlias("var","pt2/pt1");
356 yilmaz 1.1 ntMix->SetAlias("var","pt2/pt1");
357     }
358    
359 yilmaz 1.2 if(iPlot == 1){
360     nt->SetAlias("var","(eta1+eta2)/2");
361 yilmaz 1.3 ntReference->SetAlias("var","(eta1+eta2)/2");
362 yilmaz 1.2 ntMix->SetAlias("var","(eta1+eta2)/2");
363     }
364    
365 yilmaz 1.1 if(iPlot == 3){
366     nt->SetAlias("var","acos(cos(phi1-phi2))");
367 yilmaz 1.3 ntReference->SetAlias("var","acos(cos(phi1-phi2))");
368 yilmaz 1.1 ntMix->SetAlias("var","acos(cos(phi1-phi2))");
369     }
370    
371     if(iPlot == 8){
372 yilmaz 1.2 nt->SetAlias("var","pu1-pu2");
373 yilmaz 1.3 ntReference->SetAlias("var","pu1-pu2");
374 yilmaz 1.2 ntMix->SetAlias("var","pu1-pu2");
375 yilmaz 1.1 }
376    
377 yilmaz 1.2 if(iPlot == 11){
378     nt->SetAlias("var","pu1");
379 yilmaz 1.3 ntReference->SetAlias("var","pu1");
380 yilmaz 1.2 ntMix->SetAlias("var","pu1");
381     }
382    
383     if(iPlot == 12){
384     nt->SetAlias("var","pu2");
385 yilmaz 1.3 ntReference->SetAlias("var","pu2");
386 yilmaz 1.2 ntMix->SetAlias("var","pu2");
387     }
388    
389     if(iPlot == 9){
390     nt->SetAlias("var","ntrk");
391 yilmaz 1.3 ntReference->SetAlias("var","ntrk");
392 yilmaz 1.2 ntMix->SetAlias("var","ntrk");
393     }
394    
395     if(iPlot == 21){
396     nt->SetAlias("var","eta1");
397 yilmaz 1.3 ntReference->SetAlias("var","eta1");
398 yilmaz 1.2 ntMix->SetAlias("var","eta1");
399     }
400    
401     if(iPlot == 22){
402     nt->SetAlias("var","eta2");
403 yilmaz 1.3 ntReference->SetAlias("var","eta2");
404 yilmaz 1.2 ntMix->SetAlias("var","eta2");
405     }
406    
407    
408    
409     if(iPlot == 101){
410     nt->SetAlias("var","eta");
411 yilmaz 1.3 ntReference->SetAlias("var","eta");
412 yilmaz 1.2 ntMix->SetAlias("var","eta");
413     }
414    
415     if(iPlot == 51){
416     nt->SetAlias("var","matchPt1/pt1");
417 yilmaz 1.3 ntReference->SetAlias("var","matchPt1/pt1");
418 yilmaz 1.2 ntMix->SetAlias("var","matchPt1/pt1");
419     }
420    
421     if(iPlot == 52){
422     nt->SetAlias("var","matchPt2/pt2");
423 yilmaz 1.3 ntReference->SetAlias("var","matchPt2/pt2");
424 yilmaz 1.2 ntMix->SetAlias("var","matchPt2/pt2");
425     }
426    
427    
428 yilmaz 1.3 nt->Draw("var>>hFull",dijet&&noise&&jetID&&centHF&&vtx);
429     nt->Draw("var>>hB",side&&noise&&jetID&&centHF&&vtx);
430     nt->Draw("pt1>>hNorm",lead&&noise&&jetID&&centHF&&vtx);
431 yilmaz 1.1
432 yilmaz 1.3 ntMix->Draw("var>>hDataMixFull",weight*(dijet&&jetID&&centHF&&vtx));
433     ntMix->Draw("var>>hDataMixB",weight*(side&&jetID&&centHF&&vtx));
434     ntMix->Draw("pt1>>hNormDataMix",weight*(lead&&jetID&&centHF&&vtx));
435 yilmaz 1.1
436 yilmaz 1.3 ntReference->Draw("var>>hReferenceFull",dijet&&noise&&jetID&&centHF&&vtx);
437     ntReference->Draw("var>>hReferenceB",side&&noise&&jetID&&centHF&&vtx);
438     ntReference->Draw("pt1>>hNormReference",lead&&noise&&jetID&&centHF&&vtx);
439 yilmaz 1.1
440     hDataMix->Add(hDataMixFull);
441     h->Add(hFull);
442 yilmaz 1.3 hReference->Add(hReferenceFull);
443 yilmaz 1.1
444     if(subtract){
445     hDataMix->Add(hDataMixB,-1);
446     h->Add(hB,-1);
447 yilmaz 1.3 hReference->Add(hReferenceB,-1);
448 yilmaz 1.1 }
449    
450     hB->SetFillStyle(3005);
451     hB->SetFillColor(15);
452    
453     // calculate the statistical error and normalize
454     h->SetLineColor(dataColor);
455     h->SetMarkerColor(dataColor);
456     h->Sumw2();
457     if(normLead){
458     h->Scale(1./hNorm->Integral());
459     hB->Scale(1./hNorm->Integral());
460     }else{
461     hB->Scale(1./h->Integral());
462     h->Scale(1./h->Integral());
463     }
464     h->SetMarkerStyle(20);
465    
466 yilmaz 1.3 if(hReference->Integral() > 0){
467     hReference->Scale(1./hNormReference->Integral());
468 yilmaz 1.1 }
469    
470 yilmaz 1.3 hReference->SetLineColor(kBlue);
471     hReference->SetFillColor(kAzure-8);
472     hReference->SetFillStyle(3005);
473 yilmaz 1.1
474     if(normLead){
475     hDataMixB->Scale(1./hNormDataMix->Integral());
476     hDataMix->Scale(1./hNormDataMix->Integral());
477     }else{
478     hDataMixB->Scale(1./hDataMix->Integral());
479     hDataMix->Scale(1./hDataMix->Integral());
480     }
481     hDataMix->SetLineColor(mixColor);
482     hDataMix->SetFillColor(mixColor);
483     hDataMix->SetFillStyle(3004);
484    
485     hDataMix->SetMarkerSize(0);
486     hDataMix->SetStats(0);
487    
488     hDataMix->GetXaxis()->SetLabelSize(22);
489     hDataMix->GetXaxis()->SetLabelFont(43);
490     hDataMix->GetXaxis()->SetTitleSize(28);
491     hDataMix->GetXaxis()->SetTitleFont(43);
492     hDataMix->GetXaxis()->SetTitleOffset(2.2);
493     hDataMix->GetXaxis()->CenterTitle();
494    
495    
496     hDataMix->GetYaxis()->SetLabelSize(22);
497     hDataMix->GetYaxis()->SetLabelFont(43);
498     hDataMix->GetYaxis()->SetTitleSize(28);
499     hDataMix->GetYaxis()->SetTitleFont(43);
500     hDataMix->GetYaxis()->SetTitleOffset(2.2);
501     hDataMix->GetYaxis()->CenterTitle();
502    
503     if(drawXLabel) hDataMix->SetXTitle("A_{J} = (p_{T,1}-p_{T,2})/(p_{T,1}+p_{T,2})");
504     hDataMix->SetYTitle("Event Fraction");
505    
506 yilmaz 1.2 if(iPlot==1) hDataMix->SetXTitle("#eta_{dijet} = (#eta_{1}+#eta_{2})/2");
507     if(iPlot==21) hDataMix->SetXTitle("#eta_{1}");
508     if(iPlot==22) hDataMix->SetXTitle("#eta_{2}");
509    
510     if(iPlot==8) hDataMix->SetXTitle("p_{T,1}^{background}-p_{T,2}^{background}");
511     if(iPlot==9) hDataMix->SetXTitle("N_{trk}^{offline}");
512    
513     if(iPlot==11) hDataMix->SetXTitle("p_{T,1}^{background}");
514     if(iPlot==12) hDataMix->SetXTitle("p_{T,2}^{background}");
515 yilmaz 1.1
516     if(drawXLabel){
517     if(iPlot==0) hDataMix->SetXTitle("p_{T,2}/p_{T,1}");
518     if(iPlot==3) hDataMix->SetXTitle("#Delta #phi_{1,2}");
519     }
520    
521     if(iPlot==0) hDataMix->SetMaximum(0.32);
522 yilmaz 1.2
523     if(iPlot == 1 || iPlot==21 || iPlot==22){
524     hDataMix->SetMaximum(0.3);
525     hDataMix->SetMinimum(0);
526     }
527    
528    
529 yilmaz 1.1 if(iPlot==3){
530     hDataMix->SetMaximum(2.52);
531     hDataMix->SetMinimum(0.00004);
532     }
533    
534 yilmaz 1.2 if(iPlot==8){
535     hDataMix->SetMaximum(10);
536     hDataMix->SetMinimum(0.00004);
537     }
538    
539     if(iPlot==9){
540     hDataMix->SetMaximum(0.15);
541     hDataMix->SetMinimum(0.);
542     }
543    
544     if(iPlot==11 || iPlot == 12){
545     hDataMix->SetMaximum(10);
546     hDataMix->SetMinimum(0.00004);
547     }
548    
549    
550    
551 yilmaz 1.1 //hDataMix->GetXaxis()->SetNdivisions(905,true);
552     hDataMix->GetYaxis()->SetNdivisions(505,true);
553    
554 yilmaz 1.3 hReference->SetMarkerColor(ppColor);
555     hReference->SetLineColor(ppColor);
556     hReference->SetMarkerStyle(25);
557 yilmaz 1.1
558     hDataMix->Draw();//"hist");
559     hDataMix->Draw("hist same");
560 yilmaz 1.3 // hReference->Draw("same");
561 yilmaz 1.1
562     cout<<"PbPb ENTRIES : "<<endl;
563 yilmaz 1.3 cout<<hReference->GetEntries()<<endl;
564 yilmaz 1.1
565     cout<<"PbPb integral : "<<endl;
566 yilmaz 1.3 cout<<hReference->Integral()<<endl;
567 yilmaz 1.1
568     cout<<"pPb integral : "<<endl;
569     cout<<h->Integral()<<endl;
570    
571     cout<<"Mix integral : "<<endl;
572     cout<<hDataMix->Integral()<<endl;
573    
574     h->SetLineWidth(1);
575     h->Draw("same");
576     h->SetLineWidth(2);
577     h->Draw("same");
578    
579     // hDataMixB->Draw("same hist");
580     // hB->Draw("same hist");
581    
582     cout<<" mean value of data "<<h->GetMean()<<endl;
583    
584     if(drawLeg){
585     TLegend *t3=new TLegend(0.06,0.6,0.53,0.95);
586    
587     // t3->AddEntry(h,Form("%s #mub^{-1}",LUM),"");
588     t3->AddEntry(h,"pPb #sqrt{s}=5.02 TeV","p");
589 yilmaz 1.3 t3->AddEntry(hReference,"PbPb #sqrt{s}=2.76 TeV","p");
590 yilmaz 1.1 t3->AddEntry(hDataMix,"PYTHIA+HYDJET 1.8","lf");
591    
592     t3->SetFillColor(0);
593     t3->SetBorderSize(0);
594     t3->SetFillStyle(0);
595     t3->SetTextFont(63);
596     t3->SetTextSize(15);
597     t3->Draw();
598     }
599    
600     }
601    
602     void drawPatch(float x1, float y1, float x2, float y2){
603     TLegend *t1=new TLegend(x1,y1,x2,y2);
604     t1->SetFillColor(kWhite);
605     t1->SetBorderSize(0);
606     t1->SetFillStyle(1001);
607     t1->Draw("");
608     }
609    
610     void drawText(const char *text, float xp, float yp){
611     TLatex *tex = new TLatex(xp,yp,text);
612     tex->SetTextFont(63);
613     tex->SetTextSize(22);
614     //tex->SetTextSize(0.05);
615     tex->SetTextColor(kBlack);
616     tex->SetLineWidth(1);
617     tex->SetNDC();
618     tex->Draw();
619     }
620    
621    
622     void makeMultiPanelCanvas(TCanvas*& canv,
623     const Int_t columns,
624     const Int_t rows,
625     const Float_t leftOffset,
626     const Float_t bottomOffset,
627     const Float_t leftMargin,
628     const Float_t bottomMargin,
629     const Float_t edge) {
630     if (canv==0) {
631     Error("makeMultiPanelCanvas","Got null canvas.");
632     return;
633     }
634     canv->Clear();
635    
636     TPad* pad[columns][rows];
637    
638     Float_t Xlow[columns];
639     Float_t Xup[columns];
640     Float_t Ylow[rows];
641     Float_t Yup[rows];
642     Float_t PadWidth =
643     (1.0-leftOffset)/((1.0/(1.0-leftMargin)) +
644     (1.0/(1.0-edge))+(Float_t)columns-2.0);
645     Float_t PadHeight =
646     (1.0-bottomOffset)/((1.0/(1.0-bottomMargin)) +
647     (1.0/(1.0-edge))+(Float_t)rows-2.0);
648     Xlow[0] = leftOffset;
649     Xup[0] = leftOffset + PadWidth/(1.0-leftMargin);
650     Xup[columns-1] = 1;
651     Xlow[columns-1] = 1.0-PadWidth/(1.0-edge);
652    
653     Yup[0] = 1;
654     Ylow[0] = 1.0-PadHeight/(1.0-edge);
655     Ylow[rows-1] = bottomOffset;
656     Yup[rows-1] = bottomOffset + PadHeight/(1.0-bottomMargin);
657    
658     for(Int_t i=1;i<columns-1;i++) {
659     Xlow[i] = Xup[0] + (i-1)*PadWidth;
660     Xup[i] = Xup[0] + (i)*PadWidth;
661     }
662     Int_t ct = 0;
663     for(Int_t i=rows-2;i>0;i--) {
664     Ylow[i] = Yup[rows-1] + ct*PadHeight;
665     Yup[i] = Yup[rows-1] + (ct+1)*PadHeight;
666     ct++;
667     }
668    
669     TString padName;
670     for(Int_t i=0;i<columns;i++) {
671     for(Int_t j=0;j<rows;j++) {
672     canv->cd();
673     padName = Form("p_%d_%d",i,j);
674     pad[i][j] = new TPad(padName.Data(),padName.Data(),
675     Xlow[i],Ylow[j],Xup[i],Yup[j]);
676     if(i==0) pad[i][j]->SetLeftMargin(leftMargin);
677     else pad[i][j]->SetLeftMargin(0);
678    
679     if(i==(columns-1)) pad[i][j]->SetRightMargin(edge);
680     else pad[i][j]->SetRightMargin(0);
681    
682     if(j==0) pad[i][j]->SetTopMargin(edge);
683     else pad[i][j]->SetTopMargin(0);
684    
685     if(j==(rows-1)) pad[i][j]->SetBottomMargin(bottomMargin);
686     else pad[i][j]->SetBottomMargin(0);
687    
688     pad[i][j]->Draw();
689     pad[i][j]->cd();
690     pad[i][j]->SetNumber(columns*j+i+1);
691     }
692     }
693     }
694    
695