ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/macros/plotFigure.C
Revision: 1.6
Committed: Wed Feb 13 12:47:54 2013 UTC (12 years, 2 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
CVS Tags: HiForest_V02_85, HiForest_V02_84, HiForest_V02_83, HiForest_V02_82, HiForest_V02_81, HiForest_V02_80, HiForest_V02_79, HiForest_V02_78, HiForest_V02_77, HiForest_V02_76, HiForest_V02_73, HEAD
Changes since 1.5: +59 -59 lines
Log Message:
latest plotting macros

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 yilmaz 1.6 void drawText(const char *text, float xp, float yp, int size = 22);
49     //void drawText(const char *text, float xp1, float yp1, float xp2, float yp2, int size);
50 yilmaz 1.1
51     //--------------------------------------------------------------
52     // drawPatch() is a crazy way of removing 0 in the second and third
53     // pad which is partially shown due to no margin between the pads
54     // if anybody has a better way of doing it let me know! - Andre
55     //--------------------------------------------------------------
56     void drawPatch(float x1, float y1, float x2, float y2);
57     //---------------------------------------------------------------------
58    
59 yilmaz 1.6 void plotFigure(int iplot = 0){
60 yilmaz 1.3 TString infname = "/d101/yetkin/analysis/d0204/ntuple_data_pPb_akPu3PF_forest71_20130204_01.root";
61 yilmaz 1.6 TString refname = "/d101/yetkin/analysis/d0205/ntuple_data_PbPb_akPu3PF_forest71_20130205_01.root";
62 yilmaz 1.3 TString mixname = "/d101/yetkin/analysis/d0204/hijing.root";
63 yilmaz 1.2
64 yilmaz 1.6 infname = "ntuple_data_pPb_akPu3PF_forest71_20130204_01.root";
65     refname = "ntuple_data_PbPb_akPu3PF_forest71_20130205_01.root";
66     mixname = "hijing.root";
67    
68 yilmaz 1.2 string hfNames[] = {
69     "30<E_{T}^{HF[#eta > 4]}<70",
70     "20<E_{T}^{HF[#eta > 4]}<30",
71     "15<E_{T}^{HF[#eta > 4]}<20",
72     "10<E_{T}^{HF[#eta > 4]}<15",
73     "5<E_{T}^{HF[#eta > 4]}<10",
74     "0<E_{T}^{HF[#eta > 4]}<5"
75     };
76    
77    
78     string ntrkNames[] = {
79     "180 #leq N_{trk}^{offline}",
80     "150 #leq N_{trk}^{offline} < 180",
81     "110 #leq N_{trk}^{offline} < 150",
82     "90 #leq N_{trk}^{offline} < 110",
83     "60 #leq N_{trk}^{offline} < 90",
84     "N_{trk}^{offline} < 60"
85     };
86    
87     string *binNames = hfNames;
88     if(centMode == 0) binNames = ntrkNames;
89 yilmaz 1.1
90     iPlot = iplot;
91    
92     TH1::SetDefaultSumw2();
93    
94     TCanvas *c1 = new TCanvas("c1","",1050,700);
95     makeMultiPanelCanvas(c1,3,2,0.0,0.0,0.2,0.2,0.02);
96     TLatex *jetf_PbPb;
97    
98 yilmaz 1.6 if(iPlot == 3 || iPlot == 8 || iPlot == 11 || iPlot == 12 || iPlot == 13 || iPlot == 14){
99 yilmaz 1.1 for(int i = 0; i < 6; ++i){
100     c1->cd(i+1)->SetLogy();
101     }
102     }
103    
104    
105     c1->cd(1);
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.6 double y1 = 0.85;
111     double x1 = 0.5;
112    
113     if(i == 2 || i == 5) x1 = 0.6;
114     drawText(binNames[i].data(),x1,y1);
115 yilmaz 1.2 }
116 yilmaz 1.1
117    
118    
119     c1->cd(1);
120    
121 yilmaz 1.6 drawText("CMS Preliminary",0.22,0.9,18);
122     drawText(Form("pPb %s",LUM_pPb),0.22,0.8,18);
123     if(iPlot == 0 || iPlot == 3) drawText(Form("PbPb %s",LUM_PbPb),0.22,0.7,18);
124 yilmaz 1.1
125    
126     c1->cd(2);
127 yilmaz 1.6 drawText("anti-k_{T} (R=0.3)",0.02,0.9,18);
128     drawText("PU subt. PF jets",0.02,0.8,18);
129     drawText("|#eta|<2",0.02,0.7,18);
130    
131     c1->cd(3);
132     drawText(Form("p_{T,1} > %d GeV/c",leadCut),0.02,0.9,18);
133     drawText(Form("p_{T,2} > %d GeV/c",subleadCut),0.02,0.8,18);
134     drawText("#Delta#phi_{12} > #frac{2}{3}#pi",0.02,0.7,18);
135 yilmaz 1.1
136    
137     const char* date = "20130127";
138 yilmaz 1.2
139     string figures[150] = {"imbalance","etaDijet","", "dphi","",
140     "","", "", "pudifference", "ntrk",
141 yilmaz 1.6 "","pu1","pu2","trkMax1","trkMax2",
142 yilmaz 1.2 "","","","","",
143     "","eta1","eta2"
144     };
145    
146 yilmaz 1.1 string formats[] = {"gif","pdf","eps","C"};
147    
148     for(int it = 0; it < 4; ++it){
149     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()));
150     }
151    
152     }
153    
154     void plotBalance(int cbin,
155     TString infname,
156     TString pythia,
157     TString mix,
158     bool drawXLabel,
159     bool drawLeg)
160     {
161    
162 yilmaz 1.6 bool showPbPb = 0;
163     if(iPlot == 0 || iPlot == 3) showPbPb = 1;
164    
165 yilmaz 1.1 if(iPlot != 3) dijet = dijet&&deltaPhi;
166    
167     TCut centHF("");
168     TCut centNtrk("");
169    
170 yilmaz 1.2 if(centMode == 0){
171 yilmaz 1.5 cout<<"Obsolete centrality usage."<<endl;
172     return;
173 yilmaz 1.2 if(cbin==0) centHF = "bin>=20 && bin<26";
174     if(cbin==1) centHF = "bin>=26 && bin<27";
175     if(cbin==2) centHF = "bin>=27 && bin<28";
176     if(cbin==3) centHF = "bin>=28 && bin<29";
177     if(cbin==4) centHF = "bin>=29 && bin<31";
178     if(cbin==5) centHF = "bin>=31";
179    
180     if(cbin==0) centNtrk = "ntrk >= 180";
181     if(cbin==1) centNtrk = "150 <= ntrk && ntrk < 180";
182     if(cbin==2) centNtrk = "110 <= ntrk && ntrk < 150";
183     if(cbin==3) centNtrk = "90 <= ntrk && ntrk < 150";
184     if(cbin==4) centNtrk = "60 <= ntrk && ntrk < 90";
185     if(cbin==5) centNtrk = "ntrk < 60";
186     }
187    
188     if(centMode == 1){
189 yilmaz 1.5 centHF = hfPlusBins[cbin];
190 yilmaz 1.2 centNtrk = centHF;
191     }
192    
193 yilmaz 1.1 cout<<"plotting ntrk bin : "<<cbin<<endl;
194    
195     // open the data file
196 yilmaz 1.2
197     if(iPlot > 100) entryMode = 1;
198    
199     string treeName = "ntdijet";
200     string wName = "ntw";
201     if(entryMode == 1){
202     treeName = "ntjet";
203     wName = "ntjetw";
204     }
205    
206     if(entryMode == 2){
207     treeName = "nttrk";
208     wName = "nttrkw";
209     }
210    
211 yilmaz 1.1 TFile *inf = new TFile(infname.Data());
212 yilmaz 1.2 TTree *nt =(TTree*)inf->FindObjectAny(treeName.data());
213 yilmaz 1.1 TTree *ntevt =(TTree*)inf->FindObjectAny("ntevt");
214 yilmaz 1.2 if(entryMode < 1) nt->AddFriend(ntevt);
215 yilmaz 1.1
216     // open the pythia (MC) file
217 yilmaz 1.3 TFile *infReference = new TFile(pythia.Data());
218     TTree *ntReference;
219     TTree *ntevtReference;
220    
221     ntReference = (TTree*) infReference->FindObjectAny(treeName.data());
222     ntevtReference = (TTree*) infReference->FindObjectAny("ntevt");
223     if(entryMode < 1) ntReference->AddFriend(ntevtReference);
224    
225 yilmaz 1.1 // open the datamix file
226     TFile *infMix = new TFile(mix.Data());
227 yilmaz 1.2 TTree *ntMix =(TTree*)infMix->FindObjectAny(treeName.data());
228 yilmaz 1.1 TTree *ntevtMix =(TTree*)infMix->FindObjectAny("ntevt");
229     // TFile *infW = new TFile("weights_hydjet.root");
230     // TTree *ntw =(TTree*)infW->FindObjectAny("ntw");
231    
232 yilmaz 1.2 TTree *ntw =(TTree*)infMix->FindObjectAny(wName.data());
233 yilmaz 1.1 ntMix->AddFriend(ntw);
234 yilmaz 1.2 if(entryMode < 1) ntMix->AddFriend(ntevtMix);
235 yilmaz 1.1
236     int Nbin = 10;
237     double max = 1.;
238 yilmaz 1.2 double min = 0;
239    
240     if(iPlot == 1 || iPlot == 21 || iPlot == 22){
241     Nbin = 20;
242     max = 2;
243     min = -2;
244     };
245 yilmaz 1.1
246     if(iPlot == 3){
247     Nbin = 30;
248     max = pi;
249     };
250    
251 yilmaz 1.2 if(iPlot == 8){
252     Nbin = 50;
253     max = 25;
254     min = -25;
255     };
256    
257     if(iPlot == 9){
258     Nbin = 50;
259     max = 250;
260     };
261    
262     if(iPlot == 11 || iPlot == 12){
263     Nbin = 50;
264     max = 25;
265     };
266    
267 yilmaz 1.6 if(iPlot == 13 || iPlot == 14){
268     Nbin = 75;
269     max = 150;
270     }
271    
272 yilmaz 1.2 if(iPlot == 101){
273     Nbin = 20;
274     max = 2;
275     min = -2;
276     }
277 yilmaz 1.1
278     // projection histogram
279 yilmaz 1.2 TH1D *h = new TH1D(Form("h",cbin),"",Nbin,min,max);
280 yilmaz 1.3 TH1D *hReference = new TH1D(Form("hReference",cbin),"",Nbin,min,max);
281 yilmaz 1.2 TH1D *hDataMix = new TH1D(Form("hDataMix",cbin),"",Nbin,min,max);
282    
283     TH1D *hB = new TH1D(Form("hB",cbin),"",Nbin,min,max);
284 yilmaz 1.3 TH1D *hReferenceB = new TH1D(Form("hReferenceB",cbin),"",Nbin,min,max);
285 yilmaz 1.2 TH1D *hDataMixB = new TH1D(Form("hDataMixB",cbin),"",Nbin,min,max);
286    
287     TH1D *hFull = new TH1D("hFull","",Nbin,min,max);
288 yilmaz 1.3 TH1D *hReferenceFull = new TH1D("hReferenceFull","",Nbin,min,max);
289 yilmaz 1.2 TH1D *hDataMixFull = new TH1D("hDataMixFull","",Nbin,min,max);
290 yilmaz 1.1
291     TH1D* hNorm = new TH1D("hNorm","",1000,0,1000);
292 yilmaz 1.3 TH1D* hNormReference = new TH1D("hNormReference","",1000,0,1000);
293 yilmaz 1.1 TH1D* hNormDataMix = new TH1D("hNormDataMix","",1000,0,1000);
294    
295     hB->SetLineStyle(2);
296 yilmaz 1.3 hReferenceB->SetLineStyle(2);
297 yilmaz 1.1 hDataMixB->SetLineStyle(2);
298    
299 yilmaz 1.3 // ntReference->SetAlias("pt1","et1");
300     // ntReference->SetAlias("pt2","et2");
301 yilmaz 1.1
302     nt->SetAlias("pt1","jtpt1");
303     nt->SetAlias("pt2","jtpt2");
304     nt->SetAlias("eta1","jteta1");
305     nt->SetAlias("eta2","jteta2");
306     nt->SetAlias("phi1","jtphi1");
307     nt->SetAlias("phi2","jtphi2");
308     ntMix->SetAlias("pt1","jtpt1");
309     ntMix->SetAlias("pt2","jtpt2");
310     ntMix->SetAlias("eta1","jteta1");
311     ntMix->SetAlias("eta2","jteta2");
312     ntMix->SetAlias("phi1","jtphi1");
313     ntMix->SetAlias("phi2","jtphi2");
314 yilmaz 1.3 ntReference->SetAlias("pt1","jtpt1");
315     ntReference->SetAlias("pt2","jtpt2");
316     ntReference->SetAlias("eta1","jteta1");
317     ntReference->SetAlias("eta2","jteta2");
318     ntReference->SetAlias("phi1","jtphi1");
319     ntReference->SetAlias("phi2","jtphi2");
320    
321     nt->SetAlias("cent","hfp");
322     ntMix->SetAlias("cent","hfp");
323     ntReference->SetAlias("cent","hfp");
324 yilmaz 1.2
325 yilmaz 1.1 nt->SetAlias("dphi","acos(cos(phi1-phi2))");
326     ntMix->SetAlias("dphi","acos(cos(phi1-phi2))");
327 yilmaz 1.3 ntReference->SetAlias("dphi","acos(cos(phi1-phi2))");
328 yilmaz 1.1
329     if(iPlot == 0){
330     nt->SetAlias("var","pt2/pt1");
331 yilmaz 1.3 ntReference->SetAlias("var","pt2/pt1");
332 yilmaz 1.1 ntMix->SetAlias("var","pt2/pt1");
333     }
334    
335 yilmaz 1.2 if(iPlot == 1){
336     nt->SetAlias("var","(eta1+eta2)/2");
337 yilmaz 1.3 ntReference->SetAlias("var","(eta1+eta2)/2");
338 yilmaz 1.2 ntMix->SetAlias("var","(eta1+eta2)/2");
339     }
340    
341 yilmaz 1.1 if(iPlot == 3){
342     nt->SetAlias("var","acos(cos(phi1-phi2))");
343 yilmaz 1.3 ntReference->SetAlias("var","acos(cos(phi1-phi2))");
344 yilmaz 1.1 ntMix->SetAlias("var","acos(cos(phi1-phi2))");
345     }
346    
347     if(iPlot == 8){
348 yilmaz 1.2 nt->SetAlias("var","pu1-pu2");
349 yilmaz 1.3 ntReference->SetAlias("var","pu1-pu2");
350 yilmaz 1.2 ntMix->SetAlias("var","pu1-pu2");
351 yilmaz 1.1 }
352    
353 yilmaz 1.2 if(iPlot == 11){
354     nt->SetAlias("var","pu1");
355 yilmaz 1.3 ntReference->SetAlias("var","pu1");
356 yilmaz 1.2 ntMix->SetAlias("var","pu1");
357     }
358    
359     if(iPlot == 12){
360     nt->SetAlias("var","pu2");
361 yilmaz 1.3 ntReference->SetAlias("var","pu2");
362 yilmaz 1.2 ntMix->SetAlias("var","pu2");
363     }
364    
365 yilmaz 1.6 if(iPlot == 13){
366     nt->SetAlias("var","trkMax1");
367     ntReference->SetAlias("var","trkMax1");
368     ntMix->SetAlias("var","trkMax1");
369     }
370    
371     if(iPlot == 14){
372     nt->SetAlias("var","trkMax2");
373     ntReference->SetAlias("var","trkMax2");
374     ntMix->SetAlias("var","trkMax2");
375     }
376    
377 yilmaz 1.2 if(iPlot == 9){
378     nt->SetAlias("var","ntrk");
379 yilmaz 1.3 ntReference->SetAlias("var","ntrk");
380 yilmaz 1.2 ntMix->SetAlias("var","ntrk");
381     }
382    
383     if(iPlot == 21){
384     nt->SetAlias("var","eta1");
385 yilmaz 1.3 ntReference->SetAlias("var","eta1");
386 yilmaz 1.2 ntMix->SetAlias("var","eta1");
387     }
388    
389     if(iPlot == 22){
390     nt->SetAlias("var","eta2");
391 yilmaz 1.3 ntReference->SetAlias("var","eta2");
392 yilmaz 1.2 ntMix->SetAlias("var","eta2");
393     }
394    
395    
396    
397     if(iPlot == 101){
398     nt->SetAlias("var","eta");
399 yilmaz 1.3 ntReference->SetAlias("var","eta");
400 yilmaz 1.2 ntMix->SetAlias("var","eta");
401     }
402    
403     if(iPlot == 51){
404     nt->SetAlias("var","matchPt1/pt1");
405 yilmaz 1.3 ntReference->SetAlias("var","matchPt1/pt1");
406 yilmaz 1.2 ntMix->SetAlias("var","matchPt1/pt1");
407     }
408    
409     if(iPlot == 52){
410     nt->SetAlias("var","matchPt2/pt2");
411 yilmaz 1.3 ntReference->SetAlias("var","matchPt2/pt2");
412 yilmaz 1.2 ntMix->SetAlias("var","matchPt2/pt2");
413     }
414    
415    
416 yilmaz 1.3 nt->Draw("var>>hFull",dijet&&noise&&jetID&&centHF&&vtx);
417     nt->Draw("var>>hB",side&&noise&&jetID&&centHF&&vtx);
418     nt->Draw("pt1>>hNorm",lead&&noise&&jetID&&centHF&&vtx);
419 yilmaz 1.1
420 yilmaz 1.3 ntMix->Draw("var>>hDataMixFull",weight*(dijet&&jetID&&centHF&&vtx));
421     ntMix->Draw("var>>hDataMixB",weight*(side&&jetID&&centHF&&vtx));
422     ntMix->Draw("pt1>>hNormDataMix",weight*(lead&&jetID&&centHF&&vtx));
423 yilmaz 1.1
424 yilmaz 1.3 ntReference->Draw("var>>hReferenceFull",dijet&&noise&&jetID&&centHF&&vtx);
425     ntReference->Draw("var>>hReferenceB",side&&noise&&jetID&&centHF&&vtx);
426     ntReference->Draw("pt1>>hNormReference",lead&&noise&&jetID&&centHF&&vtx);
427 yilmaz 1.1
428     hDataMix->Add(hDataMixFull);
429     h->Add(hFull);
430 yilmaz 1.3 hReference->Add(hReferenceFull);
431 yilmaz 1.1
432     if(subtract){
433     hDataMix->Add(hDataMixB,-1);
434     h->Add(hB,-1);
435 yilmaz 1.3 hReference->Add(hReferenceB,-1);
436 yilmaz 1.1 }
437    
438     hB->SetFillStyle(3005);
439     hB->SetFillColor(15);
440    
441     // calculate the statistical error and normalize
442     h->SetLineColor(dataColor);
443     h->SetMarkerColor(dataColor);
444     h->Sumw2();
445     if(normLead){
446     h->Scale(1./hNorm->Integral());
447     hB->Scale(1./hNorm->Integral());
448     }else{
449     hB->Scale(1./h->Integral());
450     h->Scale(1./h->Integral());
451     }
452     h->SetMarkerStyle(20);
453    
454 yilmaz 1.3 if(hReference->Integral() > 0){
455     hReference->Scale(1./hNormReference->Integral());
456 yilmaz 1.1 }
457    
458 yilmaz 1.3 hReference->SetLineColor(kBlue);
459     hReference->SetFillColor(kAzure-8);
460     hReference->SetFillStyle(3005);
461 yilmaz 1.1
462     if(normLead){
463     hDataMixB->Scale(1./hNormDataMix->Integral());
464     hDataMix->Scale(1./hNormDataMix->Integral());
465     }else{
466     hDataMixB->Scale(1./hDataMix->Integral());
467     hDataMix->Scale(1./hDataMix->Integral());
468     }
469     hDataMix->SetLineColor(mixColor);
470     hDataMix->SetFillColor(mixColor);
471     hDataMix->SetFillStyle(3004);
472    
473     hDataMix->SetMarkerSize(0);
474     hDataMix->SetStats(0);
475    
476     hDataMix->GetXaxis()->SetLabelSize(22);
477     hDataMix->GetXaxis()->SetLabelFont(43);
478     hDataMix->GetXaxis()->SetTitleSize(28);
479     hDataMix->GetXaxis()->SetTitleFont(43);
480     hDataMix->GetXaxis()->SetTitleOffset(2.2);
481     hDataMix->GetXaxis()->CenterTitle();
482    
483    
484     hDataMix->GetYaxis()->SetLabelSize(22);
485     hDataMix->GetYaxis()->SetLabelFont(43);
486     hDataMix->GetYaxis()->SetTitleSize(28);
487     hDataMix->GetYaxis()->SetTitleFont(43);
488     hDataMix->GetYaxis()->SetTitleOffset(2.2);
489     hDataMix->GetYaxis()->CenterTitle();
490    
491     if(drawXLabel) hDataMix->SetXTitle("A_{J} = (p_{T,1}-p_{T,2})/(p_{T,1}+p_{T,2})");
492     hDataMix->SetYTitle("Event Fraction");
493    
494 yilmaz 1.2 if(iPlot==1) hDataMix->SetXTitle("#eta_{dijet} = (#eta_{1}+#eta_{2})/2");
495     if(iPlot==21) hDataMix->SetXTitle("#eta_{1}");
496     if(iPlot==22) hDataMix->SetXTitle("#eta_{2}");
497    
498     if(iPlot==8) hDataMix->SetXTitle("p_{T,1}^{background}-p_{T,2}^{background}");
499     if(iPlot==9) hDataMix->SetXTitle("N_{trk}^{offline}");
500    
501     if(iPlot==11) hDataMix->SetXTitle("p_{T,1}^{background}");
502     if(iPlot==12) hDataMix->SetXTitle("p_{T,2}^{background}");
503 yilmaz 1.1
504 yilmaz 1.6 if(iPlot==13) hDataMix->SetXTitle("p_{T} leading track in leading jet");
505     if(iPlot==14) hDataMix->SetXTitle("p_{T} leading track in subleading jet");
506    
507    
508 yilmaz 1.1 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.6 if(showPbPb) 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 yilmaz 1.6 TLegend *t3=new TLegend(0.01,0.7,0.3,0.95);
578 yilmaz 1.1 t3->AddEntry(h,"pPb #sqrt{s}=5.02 TeV","p");
579 yilmaz 1.6 if(showPbPb) t3->AddEntry(hReference,"PbPb #sqrt{s}=2.76 TeV","p");
580     t3->AddEntry(hDataMix,"PYTHIA+HIJING","lf");
581 yilmaz 1.1
582     t3->SetFillColor(0);
583     t3->SetBorderSize(0);
584     t3->SetFillStyle(0);
585     t3->SetTextFont(63);
586     t3->SetTextSize(15);
587     t3->Draw();
588     }
589    
590     }
591    
592     void drawPatch(float x1, float y1, float x2, float y2){
593     TLegend *t1=new TLegend(x1,y1,x2,y2);
594     t1->SetFillColor(kWhite);
595     t1->SetBorderSize(0);
596     t1->SetFillStyle(1001);
597     t1->Draw("");
598     }
599    
600 yilmaz 1.6 void drawText(const char *text, float xp, float yp, int size){
601 yilmaz 1.1 TLatex *tex = new TLatex(xp,yp,text);
602     tex->SetTextFont(63);
603 yilmaz 1.6 tex->SetTextSize(size);
604 yilmaz 1.1 tex->SetTextColor(kBlack);
605     tex->SetLineWidth(1);
606     tex->SetNDC();
607     tex->Draw();
608     }
609    
610    
611 yilmaz 1.6
612    
613    
614 yilmaz 1.1 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