ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/macros/plotSignalMultiplicity.C
Revision: 1.2
Committed: Sat Feb 2 14:00:35 2013 UTC (12 years, 3 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
CVS Tags: HiForest_V02_72
Changes since 1.1: +259 -43 lines
Log Message:
update

File Contents

# User Rev Content
1 yilmaz 1.1 #include "weightMix.C"
2 yilmaz 1.2 #include "TProfile.h"
3 yilmaz 1.1
4 yilmaz 1.2 static int centMode = 3;
5     static string centName[] = {"N_{trk}^{offline}","HF+","N_{side}","N_{trk}^{low p_{T}}"};
6 yilmaz 1.1
7 yilmaz 1.2 TProfile* getMult(int isample = 2, string var = "xreco"){
8 yilmaz 1.1
9     TH1::SetDefaultSumw2();
10    
11 yilmaz 1.2 TChain* ntdijet = new TChain("ntdijet");
12     TChain* ntmatch = new TChain("ntmatch");
13 yilmaz 1.1 TChain* ntevt = new TChain("ntevt");
14     TChain* ntw;
15    
16 yilmaz 1.2 const char* pPbFile = "data_pPb.root";
17     const char* PbPbFile = "data_PbPb.root";
18     const char* HydjetFile = "hydjet.root";
19     const char* HijingFile = "hijing.root";
20    
21 yilmaz 1.1 if(isample == 0){
22 yilmaz 1.2 ntdijet->Add(pPbFile);
23     ntevt->Add(pPbFile);
24 yilmaz 1.1 }
25    
26     if(isample == 1){
27 yilmaz 1.2 ntdijet->Add(PbPbFile);
28     ntevt->Add(PbPbFile);
29 yilmaz 1.1 }
30    
31     if(isample == 2){
32     ntw = new TChain("ntw");
33 yilmaz 1.2 ntmatch->Add(HijingFile);
34     ntdijet->Add(HijingFile);
35     ntevt->Add(HijingFile);
36     ntw->Add(HijingFile);
37 yilmaz 1.1 }
38    
39     if(isample == 3){
40     ntw = new TChain("ntw");
41 yilmaz 1.2 ntmatch->Add(HydjetFile);
42     ntdijet->Add(HydjetFile);
43     ntevt->Add(HydjetFile);
44     ntw->Add(HydjetFile);
45 yilmaz 1.1 }
46    
47     string varName = "NNNNN";
48     if(var == "ngen30") varName = "N_{GenJet}(p_{T}>30)";
49     if(var == "njet30") varName = "N_{RecoJet}(p_{T}>30)";
50 yilmaz 1.2 if(var == "xreco") varName = "#LTp_{T,2}/p_{T,1}#GT";
51     if(var == "dphi") varName = "#LT#Delta#phi_{1,2}#GT";
52    
53     if(var == "xgen"){
54     varName = "True (GenJet) #LTp_{T,2}/p_{T,1}#GT";
55 yilmaz 1.1 }
56    
57     ntdijet->AddFriend(ntevt);
58 yilmaz 1.2 if(isample > 1){
59     ntdijet->AddFriend(ntw);
60     ntdijet->AddFriend(ntmatch);
61    
62     }
63 yilmaz 1.1
64     TH2D* h[20];
65     TProfile* p[20];
66    
67 yilmaz 1.2 int nmax = 300;
68     if(centMode == 1) nmax = 100;
69     if(centMode == 2) nmax = 100;
70    
71     double ymax = 10;
72    
73     if(var == "dphi"){
74     ymax = pi;
75     }
76     if(var == "xreco" || var == "xgen"){
77     ymax = 1;
78     }
79    
80     // if(isample == 2) nmax = 500;
81 yilmaz 1.1
82     for(int i = 0; i < 5; ++i){
83 yilmaz 1.2 h[i] = new TH2D(Form("h%d",i),"",nmax/10,0,nmax,100,0,ymax);
84 yilmaz 1.1 }
85    
86     TH2D* hn = new TH2D(Form("hn%d",isample),"",nmax/10,0,nmax,100,0,2.);
87    
88 yilmaz 1.2 TCut dijet("jtpt1 > 120 && jtpt2 > 30");
89    
90     if(var != "dphi") dijet = dijet&&"acos(cos(jtphi1-jtphi2))> 2.0944";
91 yilmaz 1.1 TCut weight("weight");
92     if(isample < 2) weight = "jtpt1 > -999";
93    
94 yilmaz 1.2 if(centMode == 0){
95     ntdijet->SetAlias("cent","ntrk");
96     ntdijet->SetAlias("gens","nps");
97     ntdijet->SetAlias("genb","npb");
98     }
99    
100     if(centMode == 1){
101     ntdijet->SetAlias("cent","hf");
102     ntdijet->SetAlias("gens","hfs");
103     ntdijet->SetAlias("genb","hfb");
104     }
105    
106     if(centMode == 2){
107     ntdijet->SetAlias("cent","nside");
108     ntdijet->SetAlias("gens","nls");
109     ntdijet->SetAlias("genb","nlb");
110     }
111    
112     if(centMode == 3){
113     ntdijet->SetAlias("cent","nls+nlb");
114     ntdijet->SetAlias("gens","nls");
115     ntdijet->SetAlias("genb","nlb");
116     }
117    
118     ntdijet->SetAlias("gen","gens+genb");
119    
120    
121     ntdijet->SetAlias("xgen","pt2/pt1");
122     ntdijet->SetAlias("xreco","jtpt2/jtpt1");
123     ntdijet->SetAlias("dphi","acos(cos(jtphi1-jtphi2))");
124     ntdijet->SetAlias("","");
125     ntdijet->SetAlias("","");
126 yilmaz 1.1
127     ntdijet->SetAlias("var",var.data());
128    
129    
130 yilmaz 1.2 if(var == "jtpt2/jtpt1") var = "xreco";
131     if(var == "pt2/pt1") var = "xgen";
132     if(var == "acos(cos(jtphi1-jtphi2))") var = "dphi";
133    
134    
135 yilmaz 1.1 TCanvas* c2 = new TCanvas("c2","",600,600);
136 yilmaz 1.2 ntdijet->Draw(Form("var:cent>>h%d",0),weight*dijet,"colz");
137     c2->Print(Form("figure_c2_%s_%d.pdf",var.data(),isample));
138    
139 yilmaz 1.1
140     if(isample > 1){
141    
142     TCanvas* c1 = new TCanvas("c1","",600,600);
143 yilmaz 1.2 ntdijet->Draw(Form("gens/genb:cent>>hn%d",isample),weight*dijet,"colz");
144     hn->SetTitle(Form(";%s;N_{signal particle}/N_{bkg particle}",centName[centMode].data()));
145     hn->GetXaxis()->CenterTitle();
146     hn->GetYaxis()->CenterTitle();
147    
148     hn->Draw("colz");
149    
150    
151 yilmaz 1.1 hn->ProfileX(Form("phn_%d",isample))->Draw("same");
152 yilmaz 1.2 c1->Print(Form("figure_c1_%s_%d.pdf",var.data(),isample));
153 yilmaz 1.1
154     TCanvas* c3 = new TCanvas("c3","",600,600);
155 yilmaz 1.2 ntdijet->Draw(Form("var:genb+gens>>h%d",1),weight*dijet,"colz");
156     c3->Print(Form("figure_c3_%s_%d.pdf",var.data(),isample));
157    
158 yilmaz 1.1
159     TCanvas* c4 = new TCanvas("c4","",600,600);
160 yilmaz 1.2 ntdijet->Draw(Form("var:gens>>h%d",2),weight*dijet,"colz");
161     c4->Print(Form("figure_c4_%s_%d.pdf",var.data(),isample));
162    
163 yilmaz 1.1 TCanvas* c5 = new TCanvas("c5","",600,600);
164 yilmaz 1.2 ntdijet->Draw(Form("var:genb>>h%d",3),weight*dijet,"colz");
165     c5->Print(Form("figure_c5_%s_%d.pdf",var.data(),isample));
166 yilmaz 1.1
167     }
168    
169     TCanvas* cc1 = new TCanvas("cc1","",600,600);
170     for(int i = 0; i < 4; ++i){
171     p[i] = h[i]->ProfileX(Form("p%d_%d",i,isample));
172     }
173    
174     p[2]->SetMarkerColor(2);
175     p[2]->SetLineColor(2);
176    
177     p[3]->SetMarkerColor(4);
178     p[3]->SetLineColor(4);
179    
180     p[1]->SetMaximum(5);
181     p[1]->SetMinimum(0);
182    
183 yilmaz 1.2 if(var == "xreco" || var == "xgen"){
184     p[1]->SetMaximum(1);
185     }
186     if(var == "dphi"){
187     p[1]->SetMaximum(pi);
188     p[1]->SetMinimum(pi-pi/3);
189    
190     }
191     if(var == "nps" || var == "npb"){
192     p[1]->SetMaximum(50);
193     }
194    
195     p[1]->GetXaxis()->SetTitle("N_{?}");
196     p[0]->GetXaxis()->SetTitle(centName[centMode].data());
197    
198     for(int i = 0; i < 4; ++i){
199     p[i]->GetYaxis()->SetTitle(varName.data());
200     p[i]->GetXaxis()->CenterTitle();
201     p[i]->GetYaxis()->CenterTitle();
202     }
203    
204    
205 yilmaz 1.1 p[1]->Draw("hist");
206     p[0]->Draw("same");
207    
208     p[2]->Draw("same");
209     p[3]->Draw("same");
210    
211 yilmaz 1.2 TLegend *t3=new TLegend(0.26,0.2,0.53,0.45);
212     t3->SetFillColor(0);
213     t3->SetBorderSize(0);
214     t3->SetFillStyle(0);
215     t3->SetTextFont(63);
216     t3->SetTextSize(20);
217     if(centMode == 0){
218     t3->AddEntry(p[1],Form("N = %s","N_{gen}"),"l");
219     t3->AddEntry(p[0],Form("N = %s","N_{trk}"),"p");
220     t3->AddEntry(p[2],Form("N = %s","N_{signal}"),"p");
221     t3->AddEntry(p[3],Form("N = %s","N_{bkg}"),"p");
222     }
223     if(centMode == 1){
224     t3->AddEntry(p[1],Form("N = %s","E_{T}^{HF}_{gen}"),"l");
225     t3->AddEntry(p[0],Form("N = %s","E_{T}^{HF}_{reco}"),"p");
226     t3->AddEntry(p[2],Form("N = %s","E_{T}^{HF}_{signal}"),"p");
227     t3->AddEntry(p[3],Form("N = %s","E_{T}^{HF}_{bkg}"),"p");
228     }
229    
230     t3->Draw();
231    
232     cc1->Print(Form("figure_cc1_%s_%d.pdf",var.data(),isample));
233    
234 yilmaz 1.1
235     return p[0];
236    
237     }
238    
239    
240 yilmaz 1.2 void plotVariable(string var = "jtpt2/jtpt1"){
241    
242     // var = "nps";
243     // var = "npb";
244 yilmaz 1.1
245 yilmaz 1.2 TCanvas* cc2 = new TCanvas("cc2","",600,600);
246 yilmaz 1.1
247     TProfile* p[4];
248    
249     for(int i = 0; i < 4; ++i){
250     p[i] = getMult(i,var);
251     p[i]->SetName(Form("pp%d",i));
252     p[i]->SetDirectory(0);
253     }
254    
255 yilmaz 1.2 p[1]->GetXaxis()->SetTitle(centName[centMode].data());
256 yilmaz 1.1
257     p[1]->SetMarkerStyle(25);
258     p[1]->SetMarkerColor(4);
259     p[1]->SetLineColor(4);
260    
261     p[3]->SetLineColor(4);
262    
263 yilmaz 1.2 p[1]->SetMaximum(5);
264     p[1]->SetMinimum(0);
265     if(var == "xreco" || var == "xgen"){
266     p[1]->SetMaximum(1);
267     }
268     if(var == "dphi"){
269     p[1]->SetMaximum(pi);
270     p[1]->SetMinimum(pi-pi/3);
271    
272     }
273     if(var == "nps" || var == "npb"){
274     p[1]->SetMaximum(250);
275     }
276    
277     cc2->cd();
278 yilmaz 1.1 p[1]->Draw("");
279     p[0]->Draw("same");
280     p[2]->Draw("hist same");
281     p[3]->Draw("hist same");
282    
283 yilmaz 1.2 TLegend *t3=new TLegend(0.26,0.2,0.53,0.45);
284 yilmaz 1.1 t3->SetFillColor(0);
285     t3->SetBorderSize(0);
286     t3->SetFillStyle(0);
287     t3->SetTextFont(63);
288     t3->SetTextSize(20);
289     t3->AddEntry(p[0],"pPb data","p");
290     t3->AddEntry(p[1],"PbPb data","p");
291     t3->AddEntry(p[2],"pPb Hijing + Pythia","l");
292     t3->AddEntry(p[3],"PbPb Hydjet + Pythia","l");
293    
294     t3->Draw();
295    
296 yilmaz 1.2 if(var == "jtpt2/jtpt1") var = "xreco";
297     if(var == "pt2/pt1") var = "xgen";
298     if(var == "acos(cos(jtphi1-jtphi2))") var = "dphi";
299    
300     cc2->Print(Form("figure_cc0_%s.pdf",var.data()));
301    
302    
303     TCanvas* cc3 = new TCanvas("cc3","",600,600);
304    
305     p[0]->GetXaxis()->SetTitle(centName[centMode].data());
306    
307     p[0]->Draw("");
308     p[2]->Draw("hist same");
309    
310     t3=new TLegend(0.26,0.2,0.53,0.45);
311     t3->SetFillColor(0);
312     t3->SetBorderSize(0);
313     t3->SetFillStyle(0);
314     t3->SetTextFont(63);
315     t3->SetTextSize(20);
316     t3->AddEntry(p[0],"pPb data","p");
317     t3->AddEntry(p[2],"pPb Hijing + Pythia","l");
318    
319     t3->Draw();
320    
321     cc3->Print(Form("figure_cc3_pPb_%s.pdf",var.data()));
322    
323     TCanvas* cc4 = new TCanvas("cc4","",600,600);
324     if(centMode == 0){
325     p[1]->GetXaxis()->SetTitle("N_{trk}^{heavy ion tracking}");
326     }
327     if(centMode == 1){
328     p[1]->GetXaxis()->SetTitle("E_{T}^{HF+}_{heavy ion reco}");
329     }
330    
331     p[1]->Draw("");
332     p[3]->Draw("hist same");
333    
334     t3=new TLegend(0.26,0.2,0.53,0.45);
335     t3->SetFillColor(0);
336     t3->SetBorderSize(0);
337     t3->SetFillStyle(0);
338     t3->SetTextFont(63);
339     t3->SetTextSize(20);
340     t3->AddEntry(p[1],"PbPb data","p");
341     t3->AddEntry(p[3],"PbPb Hydjet + Pythia","l");
342    
343     t3->Draw();
344    
345     cc4->Print(Form("figure_cc4_PbPb_%s.pdf",var.data()));
346    
347    
348    
349    
350    
351    
352 yilmaz 1.1
353     }
354    
355    
356    
357 yilmaz 1.2 void plotSignalMultiplicity(){
358    
359     string var = "xreco";
360     plotVariable(var);
361    
362     return;
363    
364     var = "xgen";
365     plotVariable(var);
366    
367    
368     var = "dphi";
369     plotVariable(var);
370    
371     var = "ngen30";
372     plotVariable(var);
373    
374     var = "njet30";
375     plotVariable(var);
376    
377     var = "nps";
378     plotVariable(var);
379     var = "npb";
380     plotVariable(var);
381    
382    
383     }
384    
385 yilmaz 1.1
386