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

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 yilmaz 1.5 cout<<"Obsolete centrality usage."<<endl;
193     return;
194 yilmaz 1.2 if(cbin==0) centHF = "bin>=20 && bin<26";
195     if(cbin==1) centHF = "bin>=26 && bin<27";
196     if(cbin==2) centHF = "bin>=27 && bin<28";
197     if(cbin==3) centHF = "bin>=28 && bin<29";
198     if(cbin==4) centHF = "bin>=29 && bin<31";
199     if(cbin==5) centHF = "bin>=31";
200    
201     if(cbin==0) centNtrk = "ntrk >= 180";
202     if(cbin==1) centNtrk = "150 <= ntrk && ntrk < 180";
203     if(cbin==2) centNtrk = "110 <= ntrk && ntrk < 150";
204     if(cbin==3) centNtrk = "90 <= ntrk && ntrk < 150";
205     if(cbin==4) centNtrk = "60 <= ntrk && ntrk < 90";
206     if(cbin==5) centNtrk = "ntrk < 60";
207     }
208    
209     if(centMode == 1){
210 yilmaz 1.5 centHF = hfPlusBins[cbin];
211 yilmaz 1.2 centNtrk = centHF;
212     }
213    
214 yilmaz 1.1 cout<<"plotting ntrk bin : "<<cbin<<endl;
215    
216     // open the data file
217 yilmaz 1.2
218     if(iPlot > 100) entryMode = 1;
219    
220     string treeName = "ntdijet";
221     string wName = "ntw";
222     if(entryMode == 1){
223     treeName = "ntjet";
224     wName = "ntjetw";
225     }
226    
227     if(entryMode == 2){
228     treeName = "nttrk";
229     wName = "nttrkw";
230     }
231    
232 yilmaz 1.1 TFile *inf = new TFile(infname.Data());
233 yilmaz 1.2 TTree *nt =(TTree*)inf->FindObjectAny(treeName.data());
234 yilmaz 1.1 TTree *ntevt =(TTree*)inf->FindObjectAny("ntevt");
235 yilmaz 1.2 if(entryMode < 1) nt->AddFriend(ntevt);
236 yilmaz 1.1
237     // open the pythia (MC) file
238 yilmaz 1.3 TFile *infReference = new TFile(pythia.Data());
239     TTree *ntReference;
240     TTree *ntevtReference;
241    
242     ntReference = (TTree*) infReference->FindObjectAny(treeName.data());
243     ntevtReference = (TTree*) infReference->FindObjectAny("ntevt");
244     if(entryMode < 1) ntReference->AddFriend(ntevtReference);
245    
246 yilmaz 1.1 // open the datamix file
247     TFile *infMix = new TFile(mix.Data());
248 yilmaz 1.2 TTree *ntMix =(TTree*)infMix->FindObjectAny(treeName.data());
249 yilmaz 1.1 TTree *ntevtMix =(TTree*)infMix->FindObjectAny("ntevt");
250     // TFile *infW = new TFile("weights_hydjet.root");
251     // TTree *ntw =(TTree*)infW->FindObjectAny("ntw");
252    
253 yilmaz 1.2 TTree *ntw =(TTree*)infMix->FindObjectAny(wName.data());
254 yilmaz 1.1 ntMix->AddFriend(ntw);
255 yilmaz 1.2 if(entryMode < 1) ntMix->AddFriend(ntevtMix);
256 yilmaz 1.1
257     int Nbin = 10;
258     double max = 1.;
259 yilmaz 1.2 double min = 0;
260    
261     if(iPlot == 1 || iPlot == 21 || iPlot == 22){
262     Nbin = 20;
263     max = 2;
264     min = -2;
265     };
266 yilmaz 1.1
267     if(iPlot == 3){
268     Nbin = 30;
269     max = pi;
270     };
271    
272 yilmaz 1.2 if(iPlot == 8){
273     Nbin = 50;
274     max = 25;
275     min = -25;
276     };
277    
278     if(iPlot == 9){
279     Nbin = 50;
280     max = 250;
281     };
282    
283     if(iPlot == 11 || iPlot == 12){
284     Nbin = 50;
285     max = 25;
286     };
287    
288     if(iPlot == 101){
289     Nbin = 20;
290     max = 2;
291     min = -2;
292     }
293 yilmaz 1.1
294     // projection histogram
295 yilmaz 1.2 TH1D *h = new TH1D(Form("h",cbin),"",Nbin,min,max);
296 yilmaz 1.3 TH1D *hReference = new TH1D(Form("hReference",cbin),"",Nbin,min,max);
297 yilmaz 1.2 TH1D *hDataMix = new TH1D(Form("hDataMix",cbin),"",Nbin,min,max);
298    
299     TH1D *hB = new TH1D(Form("hB",cbin),"",Nbin,min,max);
300 yilmaz 1.3 TH1D *hReferenceB = new TH1D(Form("hReferenceB",cbin),"",Nbin,min,max);
301 yilmaz 1.2 TH1D *hDataMixB = new TH1D(Form("hDataMixB",cbin),"",Nbin,min,max);
302    
303     TH1D *hFull = new TH1D("hFull","",Nbin,min,max);
304 yilmaz 1.3 TH1D *hReferenceFull = new TH1D("hReferenceFull","",Nbin,min,max);
305 yilmaz 1.2 TH1D *hDataMixFull = new TH1D("hDataMixFull","",Nbin,min,max);
306 yilmaz 1.1
307     TH1D* hNorm = new TH1D("hNorm","",1000,0,1000);
308 yilmaz 1.3 TH1D* hNormReference = new TH1D("hNormReference","",1000,0,1000);
309 yilmaz 1.1 TH1D* hNormDataMix = new TH1D("hNormDataMix","",1000,0,1000);
310    
311     hB->SetLineStyle(2);
312 yilmaz 1.3 hReferenceB->SetLineStyle(2);
313 yilmaz 1.1 hDataMixB->SetLineStyle(2);
314    
315 yilmaz 1.3 // ntReference->SetAlias("pt1","et1");
316     // ntReference->SetAlias("pt2","et2");
317 yilmaz 1.1
318     nt->SetAlias("pt1","jtpt1");
319     nt->SetAlias("pt2","jtpt2");
320     nt->SetAlias("eta1","jteta1");
321     nt->SetAlias("eta2","jteta2");
322     nt->SetAlias("phi1","jtphi1");
323     nt->SetAlias("phi2","jtphi2");
324     ntMix->SetAlias("pt1","jtpt1");
325     ntMix->SetAlias("pt2","jtpt2");
326     ntMix->SetAlias("eta1","jteta1");
327     ntMix->SetAlias("eta2","jteta2");
328     ntMix->SetAlias("phi1","jtphi1");
329     ntMix->SetAlias("phi2","jtphi2");
330 yilmaz 1.3 ntReference->SetAlias("pt1","jtpt1");
331     ntReference->SetAlias("pt2","jtpt2");
332     ntReference->SetAlias("eta1","jteta1");
333     ntReference->SetAlias("eta2","jteta2");
334     ntReference->SetAlias("phi1","jtphi1");
335     ntReference->SetAlias("phi2","jtphi2");
336    
337     nt->SetAlias("cent","hfp");
338     ntMix->SetAlias("cent","hfp");
339     ntReference->SetAlias("cent","hfp");
340 yilmaz 1.2
341 yilmaz 1.1 nt->SetAlias("dphi","acos(cos(phi1-phi2))");
342     ntMix->SetAlias("dphi","acos(cos(phi1-phi2))");
343 yilmaz 1.3 ntReference->SetAlias("dphi","acos(cos(phi1-phi2))");
344 yilmaz 1.1
345     if(iPlot == 0){
346     nt->SetAlias("var","pt2/pt1");
347 yilmaz 1.3 ntReference->SetAlias("var","pt2/pt1");
348 yilmaz 1.1 ntMix->SetAlias("var","pt2/pt1");
349     }
350    
351 yilmaz 1.2 if(iPlot == 1){
352     nt->SetAlias("var","(eta1+eta2)/2");
353 yilmaz 1.3 ntReference->SetAlias("var","(eta1+eta2)/2");
354 yilmaz 1.2 ntMix->SetAlias("var","(eta1+eta2)/2");
355     }
356    
357 yilmaz 1.1 if(iPlot == 3){
358     nt->SetAlias("var","acos(cos(phi1-phi2))");
359 yilmaz 1.3 ntReference->SetAlias("var","acos(cos(phi1-phi2))");
360 yilmaz 1.1 ntMix->SetAlias("var","acos(cos(phi1-phi2))");
361     }
362    
363     if(iPlot == 8){
364 yilmaz 1.2 nt->SetAlias("var","pu1-pu2");
365 yilmaz 1.3 ntReference->SetAlias("var","pu1-pu2");
366 yilmaz 1.2 ntMix->SetAlias("var","pu1-pu2");
367 yilmaz 1.1 }
368    
369 yilmaz 1.2 if(iPlot == 11){
370     nt->SetAlias("var","pu1");
371 yilmaz 1.3 ntReference->SetAlias("var","pu1");
372 yilmaz 1.2 ntMix->SetAlias("var","pu1");
373     }
374    
375     if(iPlot == 12){
376     nt->SetAlias("var","pu2");
377 yilmaz 1.3 ntReference->SetAlias("var","pu2");
378 yilmaz 1.2 ntMix->SetAlias("var","pu2");
379     }
380    
381     if(iPlot == 9){
382     nt->SetAlias("var","ntrk");
383 yilmaz 1.3 ntReference->SetAlias("var","ntrk");
384 yilmaz 1.2 ntMix->SetAlias("var","ntrk");
385     }
386    
387     if(iPlot == 21){
388     nt->SetAlias("var","eta1");
389 yilmaz 1.3 ntReference->SetAlias("var","eta1");
390 yilmaz 1.2 ntMix->SetAlias("var","eta1");
391     }
392    
393     if(iPlot == 22){
394     nt->SetAlias("var","eta2");
395 yilmaz 1.3 ntReference->SetAlias("var","eta2");
396 yilmaz 1.2 ntMix->SetAlias("var","eta2");
397     }
398    
399    
400    
401     if(iPlot == 101){
402     nt->SetAlias("var","eta");
403 yilmaz 1.3 ntReference->SetAlias("var","eta");
404 yilmaz 1.2 ntMix->SetAlias("var","eta");
405     }
406    
407     if(iPlot == 51){
408     nt->SetAlias("var","matchPt1/pt1");
409 yilmaz 1.3 ntReference->SetAlias("var","matchPt1/pt1");
410 yilmaz 1.2 ntMix->SetAlias("var","matchPt1/pt1");
411     }
412    
413     if(iPlot == 52){
414     nt->SetAlias("var","matchPt2/pt2");
415 yilmaz 1.3 ntReference->SetAlias("var","matchPt2/pt2");
416 yilmaz 1.2 ntMix->SetAlias("var","matchPt2/pt2");
417     }
418    
419    
420 yilmaz 1.3 nt->Draw("var>>hFull",dijet&&noise&&jetID&&centHF&&vtx);
421     nt->Draw("var>>hB",side&&noise&&jetID&&centHF&&vtx);
422     nt->Draw("pt1>>hNorm",lead&&noise&&jetID&&centHF&&vtx);
423 yilmaz 1.1
424 yilmaz 1.3 ntMix->Draw("var>>hDataMixFull",weight*(dijet&&jetID&&centHF&&vtx));
425     ntMix->Draw("var>>hDataMixB",weight*(side&&jetID&&centHF&&vtx));
426     ntMix->Draw("pt1>>hNormDataMix",weight*(lead&&jetID&&centHF&&vtx));
427 yilmaz 1.1
428 yilmaz 1.3 ntReference->Draw("var>>hReferenceFull",dijet&&noise&&jetID&&centHF&&vtx);
429     ntReference->Draw("var>>hReferenceB",side&&noise&&jetID&&centHF&&vtx);
430     ntReference->Draw("pt1>>hNormReference",lead&&noise&&jetID&&centHF&&vtx);
431 yilmaz 1.1
432     hDataMix->Add(hDataMixFull);
433     h->Add(hFull);
434 yilmaz 1.3 hReference->Add(hReferenceFull);
435 yilmaz 1.1
436     if(subtract){
437     hDataMix->Add(hDataMixB,-1);
438     h->Add(hB,-1);
439 yilmaz 1.3 hReference->Add(hReferenceB,-1);
440 yilmaz 1.1 }
441    
442     hB->SetFillStyle(3005);
443     hB->SetFillColor(15);
444    
445     // calculate the statistical error and normalize
446     h->SetLineColor(dataColor);
447     h->SetMarkerColor(dataColor);
448     h->Sumw2();
449     if(normLead){
450     h->Scale(1./hNorm->Integral());
451     hB->Scale(1./hNorm->Integral());
452     }else{
453     hB->Scale(1./h->Integral());
454     h->Scale(1./h->Integral());
455     }
456     h->SetMarkerStyle(20);
457    
458 yilmaz 1.3 if(hReference->Integral() > 0){
459     hReference->Scale(1./hNormReference->Integral());
460 yilmaz 1.1 }
461    
462 yilmaz 1.3 hReference->SetLineColor(kBlue);
463     hReference->SetFillColor(kAzure-8);
464     hReference->SetFillStyle(3005);
465 yilmaz 1.1
466     if(normLead){
467     hDataMixB->Scale(1./hNormDataMix->Integral());
468     hDataMix->Scale(1./hNormDataMix->Integral());
469     }else{
470     hDataMixB->Scale(1./hDataMix->Integral());
471     hDataMix->Scale(1./hDataMix->Integral());
472     }
473     hDataMix->SetLineColor(mixColor);
474     hDataMix->SetFillColor(mixColor);
475     hDataMix->SetFillStyle(3004);
476    
477     hDataMix->SetMarkerSize(0);
478     hDataMix->SetStats(0);
479    
480     hDataMix->GetXaxis()->SetLabelSize(22);
481     hDataMix->GetXaxis()->SetLabelFont(43);
482     hDataMix->GetXaxis()->SetTitleSize(28);
483     hDataMix->GetXaxis()->SetTitleFont(43);
484     hDataMix->GetXaxis()->SetTitleOffset(2.2);
485     hDataMix->GetXaxis()->CenterTitle();
486    
487    
488     hDataMix->GetYaxis()->SetLabelSize(22);
489     hDataMix->GetYaxis()->SetLabelFont(43);
490     hDataMix->GetYaxis()->SetTitleSize(28);
491     hDataMix->GetYaxis()->SetTitleFont(43);
492     hDataMix->GetYaxis()->SetTitleOffset(2.2);
493     hDataMix->GetYaxis()->CenterTitle();
494    
495     if(drawXLabel) hDataMix->SetXTitle("A_{J} = (p_{T,1}-p_{T,2})/(p_{T,1}+p_{T,2})");
496     hDataMix->SetYTitle("Event Fraction");
497    
498 yilmaz 1.2 if(iPlot==1) hDataMix->SetXTitle("#eta_{dijet} = (#eta_{1}+#eta_{2})/2");
499     if(iPlot==21) hDataMix->SetXTitle("#eta_{1}");
500     if(iPlot==22) hDataMix->SetXTitle("#eta_{2}");
501    
502     if(iPlot==8) hDataMix->SetXTitle("p_{T,1}^{background}-p_{T,2}^{background}");
503     if(iPlot==9) hDataMix->SetXTitle("N_{trk}^{offline}");
504    
505     if(iPlot==11) hDataMix->SetXTitle("p_{T,1}^{background}");
506     if(iPlot==12) hDataMix->SetXTitle("p_{T,2}^{background}");
507 yilmaz 1.1
508     if(drawXLabel){
509     if(iPlot==0) hDataMix->SetXTitle("p_{T,2}/p_{T,1}");
510     if(iPlot==3) hDataMix->SetXTitle("#Delta #phi_{1,2}");
511     }
512    
513     if(iPlot==0) hDataMix->SetMaximum(0.32);
514 yilmaz 1.2
515     if(iPlot == 1 || iPlot==21 || iPlot==22){
516     hDataMix->SetMaximum(0.3);
517     hDataMix->SetMinimum(0);
518     }
519    
520    
521 yilmaz 1.1 if(iPlot==3){
522     hDataMix->SetMaximum(2.52);
523     hDataMix->SetMinimum(0.00004);
524     }
525    
526 yilmaz 1.2 if(iPlot==8){
527     hDataMix->SetMaximum(10);
528     hDataMix->SetMinimum(0.00004);
529     }
530    
531     if(iPlot==9){
532     hDataMix->SetMaximum(0.15);
533     hDataMix->SetMinimum(0.);
534     }
535    
536     if(iPlot==11 || iPlot == 12){
537     hDataMix->SetMaximum(10);
538     hDataMix->SetMinimum(0.00004);
539     }
540    
541    
542    
543 yilmaz 1.1 //hDataMix->GetXaxis()->SetNdivisions(905,true);
544     hDataMix->GetYaxis()->SetNdivisions(505,true);
545    
546 yilmaz 1.3 hReference->SetMarkerColor(ppColor);
547     hReference->SetLineColor(ppColor);
548     hReference->SetMarkerStyle(25);
549 yilmaz 1.1
550     hDataMix->Draw();//"hist");
551     hDataMix->Draw("hist same");
552 yilmaz 1.3 // hReference->Draw("same");
553 yilmaz 1.1
554     cout<<"PbPb ENTRIES : "<<endl;
555 yilmaz 1.3 cout<<hReference->GetEntries()<<endl;
556 yilmaz 1.1
557     cout<<"PbPb integral : "<<endl;
558 yilmaz 1.3 cout<<hReference->Integral()<<endl;
559 yilmaz 1.1
560     cout<<"pPb integral : "<<endl;
561     cout<<h->Integral()<<endl;
562    
563     cout<<"Mix integral : "<<endl;
564     cout<<hDataMix->Integral()<<endl;
565    
566     h->SetLineWidth(1);
567     h->Draw("same");
568     h->SetLineWidth(2);
569     h->Draw("same");
570    
571     // hDataMixB->Draw("same hist");
572     // hB->Draw("same hist");
573    
574     cout<<" mean value of data "<<h->GetMean()<<endl;
575    
576     if(drawLeg){
577     TLegend *t3=new TLegend(0.06,0.6,0.53,0.95);
578    
579     // t3->AddEntry(h,Form("%s #mub^{-1}",LUM),"");
580     t3->AddEntry(h,"pPb #sqrt{s}=5.02 TeV","p");
581 yilmaz 1.3 t3->AddEntry(hReference,"PbPb #sqrt{s}=2.76 TeV","p");
582 yilmaz 1.1 t3->AddEntry(hDataMix,"PYTHIA+HYDJET 1.8","lf");
583    
584     t3->SetFillColor(0);
585     t3->SetBorderSize(0);
586     t3->SetFillStyle(0);
587     t3->SetTextFont(63);
588     t3->SetTextSize(15);
589     t3->Draw();
590     }
591    
592     }
593    
594     void drawPatch(float x1, float y1, float x2, float y2){
595     TLegend *t1=new TLegend(x1,y1,x2,y2);
596     t1->SetFillColor(kWhite);
597     t1->SetBorderSize(0);
598     t1->SetFillStyle(1001);
599     t1->Draw("");
600     }
601    
602     void drawText(const char *text, float xp, float yp){
603     TLatex *tex = new TLatex(xp,yp,text);
604     tex->SetTextFont(63);
605     tex->SetTextSize(22);
606     //tex->SetTextSize(0.05);
607     tex->SetTextColor(kBlack);
608     tex->SetLineWidth(1);
609     tex->SetNDC();
610     tex->Draw();
611     }
612    
613    
614     void makeMultiPanelCanvas(TCanvas*& canv,
615     const Int_t columns,
616     const Int_t rows,
617     const Float_t leftOffset,
618     const Float_t bottomOffset,
619     const Float_t leftMargin,
620     const Float_t bottomMargin,
621     const Float_t edge) {
622     if (canv==0) {
623     Error("makeMultiPanelCanvas","Got null canvas.");
624     return;
625     }
626     canv->Clear();
627    
628     TPad* pad[columns][rows];
629    
630     Float_t Xlow[columns];
631     Float_t Xup[columns];
632     Float_t Ylow[rows];
633     Float_t Yup[rows];
634     Float_t PadWidth =
635     (1.0-leftOffset)/((1.0/(1.0-leftMargin)) +
636     (1.0/(1.0-edge))+(Float_t)columns-2.0);
637     Float_t PadHeight =
638     (1.0-bottomOffset)/((1.0/(1.0-bottomMargin)) +
639     (1.0/(1.0-edge))+(Float_t)rows-2.0);
640     Xlow[0] = leftOffset;
641     Xup[0] = leftOffset + PadWidth/(1.0-leftMargin);
642     Xup[columns-1] = 1;
643     Xlow[columns-1] = 1.0-PadWidth/(1.0-edge);
644    
645     Yup[0] = 1;
646     Ylow[0] = 1.0-PadHeight/(1.0-edge);
647     Ylow[rows-1] = bottomOffset;
648     Yup[rows-1] = bottomOffset + PadHeight/(1.0-bottomMargin);
649    
650     for(Int_t i=1;i<columns-1;i++) {
651     Xlow[i] = Xup[0] + (i-1)*PadWidth;
652     Xup[i] = Xup[0] + (i)*PadWidth;
653     }
654     Int_t ct = 0;
655     for(Int_t i=rows-2;i>0;i--) {
656     Ylow[i] = Yup[rows-1] + ct*PadHeight;
657     Yup[i] = Yup[rows-1] + (ct+1)*PadHeight;
658     ct++;
659     }
660    
661     TString padName;
662     for(Int_t i=0;i<columns;i++) {
663     for(Int_t j=0;j<rows;j++) {
664     canv->cd();
665     padName = Form("p_%d_%d",i,j);
666     pad[i][j] = new TPad(padName.Data(),padName.Data(),
667     Xlow[i],Ylow[j],Xup[i],Yup[j]);
668     if(i==0) pad[i][j]->SetLeftMargin(leftMargin);
669     else pad[i][j]->SetLeftMargin(0);
670    
671     if(i==(columns-1)) pad[i][j]->SetRightMargin(edge);
672     else pad[i][j]->SetRightMargin(0);
673    
674     if(j==0) pad[i][j]->SetTopMargin(edge);
675     else pad[i][j]->SetTopMargin(0);
676    
677     if(j==(rows-1)) pad[i][j]->SetBottomMargin(bottomMargin);
678     else pad[i][j]->SetBottomMargin(0);
679    
680     pad[i][j]->Draw();
681     pad[i][j]->cd();
682     pad[i][j]->SetNumber(columns*j+i+1);
683     }
684     }
685     }
686    
687