ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/macros/plotSignalMultiplicity.C
(Generate patch)

Comparing UserCode/CmsHi/JetAnalysis/macros/plotSignalMultiplicity.C (file contents):
Revision 1.1 by yilmaz, Tue Jan 29 00:37:02 2013 UTC vs.
Revision 1.2 by yilmaz, Sat Feb 2 14:00:35 2013 UTC

# Line 1 | Line 1
1   #include "weightMix.C"
2 + #include "TProfile.h"
3  
4 + static int centMode = 3;
5 + static string centName[] = {"N_{trk}^{offline}","HF+","N_{side}","N_{trk}^{low p_{T}}"};
6  
7 < TProfile* getMult(int isample = 2, string var = "pt2/pt1"){
7 > TProfile* getMult(int isample = 2, string var = "xreco"){
8  
9    TH1::SetDefaultSumw2();
10  
11 <  TChain* ntdijet;
12 <
10 <  if(var == "pt2/pt1"){
11 <    ntdijet = new TChain("ntmatch");
12 <  }else{
13 <    ntdijet = new TChain("ntdijet");
14 <  }
15 <
11 >  TChain* ntdijet = new TChain("ntdijet");
12 >  TChain* ntmatch = new TChain("ntmatch");
13    TChain* ntevt = new TChain("ntevt");
14    TChain* ntw;
15  
16 +  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    if(isample == 0){
22 <    ntdijet->Add("/d101/yetkin/analysis/d0128/data_pPb.root");
23 <    ntevt->Add("/d101/yetkin/analysis/d0128/data_pPb.root");
22 >    ntdijet->Add(pPbFile);
23 >    ntevt->Add(pPbFile);
24    }
25  
26    if(isample == 1){
27 <    ntdijet->Add("/d101/yetkin/analysis/d0128/data_PbPb.root");
28 <    ntevt->Add("/d101/yetkin/analysis/d0128/data_PbPb.root");
27 >    ntdijet->Add(PbPbFile);
28 >    ntevt->Add(PbPbFile);
29    }
30  
31    if(isample == 2){
32      ntw = new TChain("ntw");
33 <
34 <    ntdijet->Add("/d101/yetkin/analysis/d0128/mix_hijing.root");
35 <    ntevt->Add("/d101/yetkin/analysis/d0128/mix_hijing.root");
36 <    ntw->Add("/d101/yetkin/analysis/d0128/mix_hijing.root");
33 >    ntmatch->Add(HijingFile);
34 >    ntdijet->Add(HijingFile);
35 >    ntevt->Add(HijingFile);
36 >    ntw->Add(HijingFile);
37    }
38  
39    if(isample == 3){
40      ntw = new TChain("ntw");
41 <
42 <    ntdijet->Add("/d101/yetkin/analysis/d0128/mix_hydjet.root");
43 <    ntevt->Add("/d101/yetkin/analysis/d0128/mix_hydjet.root");
44 <    ntw->Add("/d101/yetkin/analysis/d0128/mix_hydjet.root");
41 >    ntmatch->Add(HydjetFile);
42 >    ntdijet->Add(HydjetFile);
43 >    ntevt->Add(HydjetFile);
44 >    ntw->Add(HydjetFile);
45    }
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 <  if(var == "jtpt2/jtpt1") varName = "p_{T,2}/p_{T,1}";
51 <  if(var == "pt2/pt1"){
52 <    varName = "True (GenJet) p_{T,2}/p_{T,1}";    
50 >  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    }
56  
57    ntdijet->AddFriend(ntevt);
58 <  if(isample > 1) ntdijet->AddFriend(ntw);
58 >  if(isample > 1){
59 >    ntdijet->AddFriend(ntw);
60 >    ntdijet->AddFriend(ntmatch);
61 >
62 >  }
63  
64    TH2D* h[20];
65    TProfile* p[20];
66  
67 <  int nmax = 200;
68 <  if(isample == 2) nmax = 500;
67 >  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  
82    for(int i = 0; i < 5; ++i){
83 <    h[i] = new TH2D(Form("h%d",i),"",nmax/10,0,nmax,10,0,10);
83 >    h[i] = new TH2D(Form("h%d",i),"",nmax/10,0,nmax,100,0,ymax);
84    }
85    
86    TH2D* hn = new TH2D(Form("hn%d",isample),"",nmax/10,0,nmax,100,0,2.);
87  
88 <  TCut dijet("jtpt1 > 120 && jtpt2 > 30 && acos(cos(jtphi1-jtphi2))> 2.0944");
88 >  TCut dijet("jtpt1 > 120 && jtpt2 > 30");
89 >
90 >  if(var != "dphi") dijet = dijet&&"acos(cos(jtphi1-jtphi2))> 2.0944";
91    TCut weight("weight");
92    if(isample < 2) weight = "jtpt1 > -999";
93  
94 +  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  
127    ntdijet->SetAlias("var",var.data());
128  
129  
130 +  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    TCanvas* c2 = new TCanvas("c2","",600,600);
136 <  ntdijet->Draw(Form("var:ntrk>>h%d",0),weight*dijet,"colz");
136 >  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  
140    if(isample > 1){
141  
142      TCanvas* c1 = new TCanvas("c1","",600,600);
143 <    ntdijet->Draw(Form("nps/npb:ntrk>>hn%d",isample),weight*dijet,"colz");
143 >    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      hn->ProfileX(Form("phn_%d",isample))->Draw("same");
152 +    c1->Print(Form("figure_c1_%s_%d.pdf",var.data(),isample));
153      
154      TCanvas* c3 = new TCanvas("c3","",600,600);
155 <    ntdijet->Draw(Form("var:npb+nps>>h%d",1),weight*dijet,"colz");
155 >    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      
159      TCanvas* c4 = new TCanvas("c4","",600,600);
160 <    ntdijet->Draw(Form("var:nps>>h%d",2),weight*dijet,"colz");
161 <    
160 >    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      TCanvas* c5 = new TCanvas("c5","",600,600);
164 <    ntdijet->Draw(Form("var:npb>>h%d",3),weight*dijet,"colz");
164 >    ntdijet->Draw(Form("var:genb>>h%d",3),weight*dijet,"colz");
165 >    c5->Print(Form("figure_c5_%s_%d.pdf",var.data(),isample));
166    
167    }
168  
# Line 107 | Line 180 | TProfile* getMult(int isample = 2, strin
180    p[1]->SetMaximum(5);
181    p[1]->SetMinimum(0);
182  
183 +  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    p[1]->Draw("hist");
206    p[0]->Draw("same");
207  
208    p[2]->Draw("same");
209    p[3]->Draw("same");
210  
211 <  p[0]->GetXaxis()->SetTitle("N_{trk}^{offline}");
212 <  p[0]->GetYaxis()->SetTitle(varName.data());
213 <  p[0]->GetXaxis()->CenterTitle();
214 <  p[0]->GetYaxis()->CenterTitle();
211 >  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  
235    return p[0];
236  
237   }
238  
239  
240 < void plotSignalMultiplicity(string var = "njet30"){
240 > void plotVariable(string var = "jtpt2/jtpt1"){
241 >
242 >   //   var = "nps";
243 >   //   var = "npb";
244  
245 <  //  getSignalBias(2,var);
129 <  //  return;
245 >  TCanvas* cc2 = new TCanvas("cc2","",600,600);
246  
247    TProfile* p[4];
248  
# Line 136 | Line 252 | void plotSignalMultiplicity(string var =
252      p[i]->SetDirectory(0);
253    }
254  
255 +  p[1]->GetXaxis()->SetTitle(centName[centMode].data());
256  
257    p[1]->SetMarkerStyle(25);
258    p[1]->SetMarkerColor(4);
# Line 143 | Line 260 | void plotSignalMultiplicity(string var =
260  
261    p[3]->SetLineColor(4);
262  
263 +  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    p[1]->Draw("");
279    p[0]->Draw("same");
280    p[2]->Draw("hist same");
281    p[3]->Draw("hist same");
282  
283 <  TLegend *t3=new TLegend(0.26,0.6,0.53,0.85);
283 >  TLegend *t3=new TLegend(0.26,0.2,0.53,0.45);
284    t3->SetFillColor(0);
285    t3->SetBorderSize(0);
286    t3->SetFillStyle(0);
# Line 161 | Line 293 | void plotSignalMultiplicity(string var =
293  
294    t3->Draw();
295  
296 +  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  
353   }
354  
355  
356  
357 + 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  
386  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines