test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SeedMultiplicityPlots.cc
Go to the documentation of this file.
2 #include <vector>
3 #include <algorithm>
4 #include <string>
5 #include <map>
6 #include <iostream>
7 #include "TPad.h"
8 #include "TFile.h"
9 #include "TH2F.h"
10 #include "TH1F.h"
11 #include "TProfile.h"
12 #include "TLegend.h"
14 #include "TCanvas.h"
15 #include "TSystem.h"
16 #include "TStyle.h"
17 #include "TCanvas.h"
18 
20 
21  // gStyle->SetOptStat(111111);
22  TFile f1("/afs/cern.ch/cms/tracking/output/rootfiles/seedmultiplicity_Run2011A_express_ge1711_v3_v2.root");
23  TFile f2("/afs/cern.ch/cms/tracking/output/rootfiles/seedmultiplicity_highmult_default_Run2011A_express_ge1711_v3_v2.root");
24  TFile f3("/afs/cern.ch/cms/tracking/output/rootfiles/seedmultiplicity_highmult_Run2011A_express_ge1711_v3_v2.root");
25 
26  CommonAnalyzer castat1(&f1,"","seedmultiplicitymonitor");
27  CommonAnalyzer castat2(&f2,"","seedmultiplicitymonitor");
28  CommonAnalyzer castat3(&f3,"","seedmultiplicitymonitor");
29 
30  TH2F* iter3Pixel1 = (TH2F*)castat1.getObject("thTripletsPixel");
31  TH2F* iter3Pixel2 = (TH2F*)castat2.getObject("thTripletsPixel");
32  TH2F* iter3Pixel3 = (TH2F*)castat3.getObject("thTripletsPixel");
33 
34  if(iter3Pixel1 && iter3Pixel2 && iter3Pixel3) {
35  TProfile* iter3Pixel1_prof = iter3Pixel1->ProfileX("prof1");
36  TProfile* iter3Pixel2_prof = iter3Pixel2->ProfileX("prof2");
37  TProfile* iter3Pixel3_prof = iter3Pixel3->ProfileX("prof3");
38 
39  iter3Pixel1_prof->SetMarkerColor(kBlack); iter3Pixel1_prof->SetLineColor(kBlack);
40  iter3Pixel2_prof->SetMarkerColor(kBlue); iter3Pixel2_prof->SetLineColor(kBlue);
41  iter3Pixel3_prof->SetMarkerColor(kRed); iter3Pixel3_prof->SetLineColor(kRed);
42 
43  new TCanvas("profile","profile");
44 
45  iter3Pixel1_prof->GetXaxis()->SetRangeUser(0,10000);
46  iter3Pixel1_prof->GetXaxis()->SetTitle("clusters"); iter3Pixel1_prof->GetYaxis()->SetTitle("seeds");
47 
48 
49 
50  TLegend* leg = new TLegend(.2,.6,.5,.85,"Seeds vs clusters");
51  leg->AddEntry(iter3Pixel1_prof->DrawCopy(),"standard RECO","l");
52  leg->AddEntry(iter3Pixel2_prof->DrawCopy("same"),"standard RECO (high stat)","l");
53  leg->AddEntry(iter3Pixel3_prof->DrawCopy("same"),"iter2 thr = 2M","l");
54  leg->Draw();
55 
56  /*
57  std::cout << iter3Pixel1->GetTitle() << std::endl;
58  std::cout << iter3Pixel1->GetEntries() << std::endl;
59  iter3Pixel1->DrawCopy();
60  iter3Pixel1->GetXaxis()->SetRangeUser(0,10000);
61  iter3Pixel2->DrawCopy("same");
62  iter3Pixel3->DrawCopy("same");
63  */
64 
65  }
66 
67 
68  TH1F* iter3_2 = (TH1F*)castat2.getObject("thTriplets");
69  TH1F* iter3_3 = (TH1F*)castat3.getObject("thTriplets");
70 
71  if(iter3_2 && iter3_3) {
72 
73  iter3_2->SetLineColor(kBlue);
74  iter3_3->SetLineColor(kRed);
75 
76  new TCanvas("iter3","iter3");
77 
78  gPad->SetLogy(1);
79  TLegend* legiter3 = new TLegend(.5,.6,.85,.85,"iter3 seeds");
80  legiter3->AddEntry(iter3_2->DrawCopy(),"standard RECO","l");
81  legiter3->AddEntry(iter3_3->DrawCopy("same"),"iter2 thr = 2M","l");
82  legiter3->Draw();
83 
84  }
85 
86  TH1F* iter2_2 = (TH1F*)castat2.getObject("secTriplets");
87  TH1F* iter2_3 = (TH1F*)castat3.getObject("secTriplets");
88 
89  if(iter2_2 && iter2_3) {
90 
91  iter2_2->SetLineColor(kBlue);
92  iter2_3->SetLineColor(kRed);
93 
94  new TCanvas("iter2","iter2");
95 
96  gPad->SetLogy(1);
97  TLegend* legiter2 = new TLegend(.5,.6,.85,.85,"iter2 seeds");
98  legiter2->AddEntry(iter2_2->DrawCopy(),"standard RECO","l");
99  legiter2->AddEntry(iter2_3->DrawCopy("same"),"iter2 thr = 2M","l");
100  legiter2->Draw();
101 
102  }
103  // gStyle->SetOptStat(1111);
104 }
105 
106 void SeedMultiplicityPlots(const char* fullname,const char* module, const char* postfix, const char* shortname, const char* outtrunk) {
107 
108  std::cout << shortname << module << postfix << std::endl;
109 
110  char modfull[300];
111  sprintf(modfull,"%s%s",module,postfix);
112 
113  char dirname[400];
114  // sprintf(dirname,"%s%s",family,filename);
115  sprintf(dirname,"%s%s","seedmultiplicity_",shortname);
116 
117  // char fullname[300];
118  // if(strlen(family)==0) { sprintf(fullname,"rootfiles/seedmultiplicity_%s.root",filename);}
119  // else { sprintf(fullname,"rootfiles/%s.root",dirname); }
120 
121 
122 
123  // std::string workdir = outtrunk ;
124  // workdir += dirname;
125  // gSystem->cd(workdir.c_str());
126  // gSystem->MakeDirectory(labfull);
127  // gSystem->cd("/afs/cern.ch/cms/tracking/output");
128 
129 
130  TFile ff(fullname);
131 
132  // Colliding events
133 
134  gStyle->SetOptStat(111111);
135 
136  CommonAnalyzer castat(&ff,"",modfull);
137 
138  std::cout << "ready" << std::endl;
139 
140  TH1F* iter0 = (TH1F*)castat.getObject("newSeedFromTriplets");
141  if(iter0) {
142  iter0->Draw();
143  gPad->SetLogy(1);
144  std::string plotfilename;
145  plotfilename += outtrunk;
146  plotfilename += dirname;
147  plotfilename += "/iter0_";
148  plotfilename += dirname;
149  plotfilename += ".gif";
150  gPad->Print(plotfilename.c_str());
151  delete iter0;
152  gPad->SetLogy(0);
153  }
154 
155  TH1F* iter1 = (TH1F*)castat.getObject("newSeedFromPairs");
156  if(iter1) {
157  iter1->Draw();
158  gPad->SetLogy(1);
159  std::string plotfilename;
160  plotfilename += outtrunk;
161  plotfilename += dirname;
162  plotfilename += "/iter1_";
163  plotfilename += dirname;
164  plotfilename += ".gif";
165  gPad->Print(plotfilename.c_str());
166  delete iter1;
167  gPad->SetLogy(0);
168  }
169 
170  TH1F* iter2 = (TH1F*)castat.getObject("secTriplets");
171  if(iter2) {
172  iter2->Draw();
173  gPad->SetLogy(1);
174  std::string plotfilename;
175  plotfilename += outtrunk;
176  plotfilename += dirname;
177  plotfilename += "/iter2_";
178  plotfilename += dirname;
179  plotfilename += ".gif";
180  gPad->Print(plotfilename.c_str());
181  delete iter2;
182  gPad->SetLogy(0);
183  }
184 
185  TH1F* iter3 = (TH1F*)castat.getObject("thTriplets");
186  if(iter3) {
187  iter3->Draw();
188  gPad->SetLogy(1);
189  std::string plotfilename;
190  plotfilename += outtrunk;
191  plotfilename += dirname;
192  plotfilename += "/iter3_";
193  plotfilename += dirname;
194  plotfilename += ".gif";
195  gPad->Print(plotfilename.c_str());
196  delete iter3;
197  gPad->SetLogy(0);
198  }
199 
200  TH1F* iter3A = (TH1F*)castat.getObject("thTripletsA");
201  if(iter3A) {
202  iter3A->Draw();
203  gPad->SetLogy(1);
204  std::string plotfilename;
205  plotfilename += outtrunk;
206  plotfilename += dirname;
207  plotfilename += "/iter3A_";
208  plotfilename += dirname;
209  plotfilename += ".gif";
210  gPad->Print(plotfilename.c_str());
211  delete iter3A;
212  gPad->SetLogy(0);
213  }
214 
215  TH1F* iter3B = (TH1F*)castat.getObject("thTripletsB");
216  if(iter3B) {
217  iter3B->Draw();
218  gPad->SetLogy(1);
219  std::string plotfilename;
220  plotfilename += outtrunk;
221  plotfilename += dirname;
222  plotfilename += "/iter3B_";
223  plotfilename += dirname;
224  plotfilename += ".gif";
225  gPad->Print(plotfilename.c_str());
226  delete iter3B;
227  gPad->SetLogy(0);
228  }
229 
230  TH1F* iter4 = (TH1F*)castat.getObject("fourthPLSeeds");
231  if(iter4) {
232  iter4->Draw();
233  gPad->SetLogy(1);
234  std::string plotfilename;
235  plotfilename += outtrunk;
236  plotfilename += dirname;
237  plotfilename += "/iter4_";
238  plotfilename += dirname;
239  plotfilename += ".gif";
240  gPad->Print(plotfilename.c_str());
241  delete iter4;
242  gPad->SetLogy(0);
243  }
244 
245  TH1F* iter5 = (TH1F*)castat.getObject("fifthSeeds");
246  if(iter5) {
247  iter5->Draw();
248  gPad->SetLogy(1);
249  std::string plotfilename;
250  plotfilename += outtrunk;
251  plotfilename += dirname;
252  plotfilename += "/iter5_";
253  plotfilename += dirname;
254  plotfilename += ".gif";
255  gPad->Print(plotfilename.c_str());
256  delete iter5;
257  gPad->SetLogy(0);
258  }
259 
260  TH2F* iter0TK = (TH2F*)castat.getObject("newSeedFromTripletsTK");
261  if(iter0TK) {
262  iter0TK->Draw("colz");
263  iter0TK->GetYaxis()->SetRangeUser(0,1000); iter0TK->GetYaxis()->SetTitle("seeds");
264  iter0TK->GetXaxis()->SetRangeUser(0,50000); iter0TK->GetXaxis()->SetTitle("clusters");
265  gPad->SetLogz(1);
266  std::string plotfilename;
267  plotfilename += outtrunk;
268  plotfilename += dirname;
269  plotfilename += "/iter0TK_";
270  plotfilename += dirname;
271  plotfilename += ".gif";
272  gPad->Print(plotfilename.c_str());
273  delete iter0TK;
274  gPad->SetLogz(0);
275  }
276 
277  TH2F* iter1TK = (TH2F*)castat.getObject("newSeedFromPairsTK");
278  if(iter1TK) {
279  iter1TK->Draw("colz");
280  iter1TK->GetYaxis()->SetTitle("seeds");
281  iter1TK->GetXaxis()->SetRangeUser(0,50000); iter1TK->GetXaxis()->SetTitle("clusters");
282  gPad->SetLogz(1);
283  std::string plotfilename;
284  plotfilename += outtrunk;
285  plotfilename += dirname;
286  plotfilename += "/iter1TK_";
287  plotfilename += dirname;
288  plotfilename += ".gif";
289  gPad->Print(plotfilename.c_str());
290  delete iter1TK;
291  gPad->SetLogz(0);
292  }
293 
294  TH2F* iter2TK = (TH2F*)castat.getObject("secTripletsTK");
295  if(iter2TK) {
296  iter2TK->Draw("colz");
297  iter2TK->GetYaxis()->SetRangeUser(0,50000); iter2TK->GetYaxis()->SetTitle("seeds");
298  iter2TK->GetXaxis()->SetRangeUser(0,50000); iter2TK->GetXaxis()->SetTitle("clusters");
299  gPad->SetLogz(1);
300  std::string plotfilename;
301  plotfilename += outtrunk;
302  plotfilename += dirname;
303  plotfilename += "/iter2TK_";
304  plotfilename += dirname;
305  plotfilename += ".gif";
306  gPad->Print(plotfilename.c_str());
307  delete iter2TK;
308  gPad->SetLogz(0);
309  }
310 
311  TH2F* iter3TK = (TH2F*)castat.getObject("thTripletsTK");
312  if(iter3TK) {
313  iter3TK->Draw("colz");
314  // iter3TK->GetYaxis()->SetRangeUser(0,30000);
315  iter3TK->GetYaxis()->SetTitle("seeds");
316  iter3TK->GetXaxis()->SetRangeUser(0,50000); iter3TK->GetXaxis()->SetTitle("clusters");
317  gPad->SetLogz(1);
318  std::string plotfilename;
319  plotfilename += outtrunk;
320  plotfilename += dirname;
321  plotfilename += "/iter3TK_";
322  plotfilename += dirname;
323  plotfilename += ".gif";
324  gPad->Print(plotfilename.c_str());
325  delete iter3TK;
326  gPad->SetLogz(0);
327  }
328 
329  TH2F* iter3ATK = (TH2F*)castat.getObject("thTripletsATK");
330  if(iter3ATK) {
331  iter3ATK->Draw("colz");
332  // iter3ATK->GetYaxis()->SetRangeUser(0,30000);
333  iter3ATK->GetYaxis()->SetTitle("seeds");
334  iter3ATK->GetXaxis()->SetRangeUser(0,50000); iter3ATK->GetXaxis()->SetTitle("clusters");
335  gPad->SetLogz(1);
336  std::string plotfilename;
337  plotfilename += outtrunk;
338  plotfilename += dirname;
339  plotfilename += "/iter3ATK_";
340  plotfilename += dirname;
341  plotfilename += ".gif";
342  gPad->Print(plotfilename.c_str());
343  delete iter3ATK;
344  gPad->SetLogz(0);
345  }
346 
347  TH2F* iter3BTK = (TH2F*)castat.getObject("thTripletsBTK");
348  if(iter3BTK) {
349  iter3BTK->Draw("colz");
350  // iter3BTK->GetYaxis()->SetRangeUser(0,30000);
351  iter3BTK->GetYaxis()->SetTitle("seeds");
352  iter3BTK->GetXaxis()->SetRangeUser(0,50000); iter3BTK->GetXaxis()->SetTitle("clusters");
353  gPad->SetLogz(1);
354  std::string plotfilename;
355  plotfilename += outtrunk;
356  plotfilename += dirname;
357  plotfilename += "/iter3BTK_";
358  plotfilename += dirname;
359  plotfilename += ".gif";
360  gPad->Print(plotfilename.c_str());
361  delete iter3BTK;
362  gPad->SetLogz(0);
363  }
364 
365  TH2F* iter4TK = (TH2F*)castat.getObject("fourthPLSeedsTK");
366  if(iter4TK) {
367  iter4TK->Draw("colz");
368  iter4TK->GetYaxis()->SetTitle("seeds");
369  iter4TK->GetXaxis()->SetRangeUser(0,50000); iter4TK->GetXaxis()->SetTitle("clusters");
370  gPad->SetLogz(1);
371  std::string plotfilename;
372  plotfilename += outtrunk;
373  plotfilename += dirname;
374  plotfilename += "/iter4TK_";
375  plotfilename += dirname;
376  plotfilename += ".gif";
377  gPad->Print(plotfilename.c_str());
378  delete iter4TK;
379  gPad->SetLogz(0);
380  }
381 
382  TH2F* iter5TK = (TH2F*)castat.getObject("fifthSeedsTK");
383  if(iter5TK) {
384  iter5TK->Draw("colz");
385  iter5TK->GetYaxis()->SetRangeUser(0,30000); iter5TK->GetYaxis()->SetTitle("seeds");
386  iter5TK->GetXaxis()->SetRangeUser(0,50000); iter5TK->GetXaxis()->SetTitle("clusters");
387  gPad->SetLogz(1);
388  std::string plotfilename;
389  plotfilename += outtrunk;
390  plotfilename += dirname;
391  plotfilename += "/iter5TK_";
392  plotfilename += dirname;
393  plotfilename += ".gif";
394  gPad->Print(plotfilename.c_str());
395  delete iter5TK;
396  gPad->SetLogz(0);
397  }
398 
399  TH2F* iter0Pixel = (TH2F*)castat.getObject("newSeedFromTripletsPixel");
400  if(iter0Pixel) {
401  iter0Pixel->Draw("colz");
402  iter0Pixel->GetYaxis()->SetRangeUser(0,1000); iter0Pixel->GetYaxis()->SetTitle("seeds");
403  iter0Pixel->GetXaxis()->SetRangeUser(0,10000); iter0Pixel->GetXaxis()->SetTitle("clusters");
404  gPad->SetLogz(1);
405  std::string plotfilename;
406  plotfilename += outtrunk;
407  plotfilename += dirname;
408  plotfilename += "/iter0Pixel_";
409  plotfilename += dirname;
410  plotfilename += ".gif";
411  gPad->Print(plotfilename.c_str());
412  delete iter0Pixel;
413  gPad->SetLogz(0);
414  }
415 
416  TH2F* iter1Pixel = (TH2F*)castat.getObject("newSeedFromPairsPixel");
417  if(iter1Pixel) {
418  iter1Pixel->Draw("colz");
419  iter1Pixel->GetYaxis()->SetTitle("seeds");
420  iter1Pixel->GetXaxis()->SetRangeUser(0,10000); iter1Pixel->GetXaxis()->SetTitle("clusters");
421  gPad->SetLogz(1);
422  std::string plotfilename;
423  plotfilename += outtrunk;
424  plotfilename += dirname;
425  plotfilename += "/iter1Pixel_";
426  plotfilename += dirname;
427  plotfilename += ".gif";
428  gPad->Print(plotfilename.c_str());
429  delete iter1Pixel;
430  gPad->SetLogz(0);
431  }
432 
433  TH2F* iter2Pixel = (TH2F*)castat.getObject("secTripletsPixel");
434  if(iter2Pixel) {
435  iter2Pixel->Draw("colz");
436  iter2Pixel->GetYaxis()->SetRangeUser(0,50000); iter2Pixel->GetYaxis()->SetTitle("seeds");
437  iter2Pixel->GetXaxis()->SetRangeUser(0,10000); iter2Pixel->GetXaxis()->SetTitle("clusters");
438  gPad->SetLogz(1);
439  std::string plotfilename;
440  plotfilename += outtrunk;
441  plotfilename += dirname;
442  plotfilename += "/iter2Pixel_";
443  plotfilename += dirname;
444  plotfilename += ".gif";
445  gPad->Print(plotfilename.c_str());
446  delete iter2Pixel;
447  gPad->SetLogz(0);
448  }
449 
450  TH2F* iter3Pixel = (TH2F*)castat.getObject("thTripletsPixel");
451  if(iter3Pixel) {
452  iter3Pixel->Draw("colz");
453  // iter3Pixel->GetYaxis()->SetRangeUser(0,30000);
454  iter3Pixel->GetYaxis()->SetTitle("seeds");
455  iter3Pixel->GetXaxis()->SetRangeUser(0,10000); iter3Pixel->GetXaxis()->SetTitle("clusters");
456  gPad->SetLogz(1);
457  std::string plotfilename;
458  plotfilename += outtrunk;
459  plotfilename += dirname;
460  plotfilename += "/iter3Pixel_";
461  plotfilename += dirname;
462  plotfilename += ".gif";
463  gPad->Print(plotfilename.c_str());
464  delete iter3Pixel;
465  gPad->SetLogz(0);
466  }
467 
468  TH2F* iter3APixel = (TH2F*)castat.getObject("thTripletsAPixel");
469  if(iter3APixel) {
470  iter3APixel->Draw("colz");
471  // iter3APixel->GetYaxis()->SetRangeUser(0,30000);
472  iter3APixel->GetYaxis()->SetTitle("seeds");
473  iter3APixel->GetXaxis()->SetRangeUser(0,10000); iter3APixel->GetXaxis()->SetTitle("clusters");
474  gPad->SetLogz(1);
475  std::string plotfilename;
476  plotfilename += outtrunk;
477  plotfilename += dirname;
478  plotfilename += "/iter3APixel_";
479  plotfilename += dirname;
480  plotfilename += ".gif";
481  gPad->Print(plotfilename.c_str());
482  delete iter3APixel;
483  gPad->SetLogz(0);
484  }
485 
486  TH2F* iter3BPixel = (TH2F*)castat.getObject("thTripletsBPixel");
487  if(iter3BPixel) {
488  iter3BPixel->Draw("colz");
489  // iter3BPixel->GetYaxis()->SetRangeUser(0,30000);
490  iter3BPixel->GetYaxis()->SetTitle("seeds");
491  iter3BPixel->GetXaxis()->SetRangeUser(0,10000); iter3BPixel->GetXaxis()->SetTitle("clusters");
492  gPad->SetLogz(1);
493  std::string plotfilename;
494  plotfilename += outtrunk;
495  plotfilename += dirname;
496  plotfilename += "/iter3BPixel_";
497  plotfilename += dirname;
498  plotfilename += ".gif";
499  gPad->Print(plotfilename.c_str());
500  delete iter3BPixel;
501  gPad->SetLogz(0);
502  }
503 
504  TH2F* iter4Pixel = (TH2F*)castat.getObject("fourthPLSeedsPixel");
505  if(iter4Pixel) {
506  iter4Pixel->Draw("colz");
507  iter4Pixel->GetYaxis()->SetTitle("seeds");
508  iter4Pixel->GetXaxis()->SetRangeUser(0,10000); iter4Pixel->GetXaxis()->SetTitle("clusters");
509  gPad->SetLogz(1);
510  std::string plotfilename;
511  plotfilename += outtrunk;
512  plotfilename += dirname;
513  plotfilename += "/iter4Pixel_";
514  plotfilename += dirname;
515  plotfilename += ".gif";
516  gPad->Print(plotfilename.c_str());
517  delete iter4Pixel;
518  gPad->SetLogz(0);
519  }
520 
521  TH2F* iter5Pixel = (TH2F*)castat.getObject("fifthSeedsPixel");
522  if(iter5Pixel) {
523  iter5Pixel->Draw("colz");
524  iter5Pixel->GetYaxis()->SetRangeUser(0,30000); iter5Pixel->GetYaxis()->SetTitle("seeds");
525  iter5Pixel->GetXaxis()->SetRangeUser(0,10000); iter5Pixel->GetXaxis()->SetTitle("clusters");
526  gPad->SetLogz(1);
527  std::string plotfilename;
528  plotfilename += outtrunk;
529  plotfilename += dirname;
530  plotfilename += "/iter5Pixel_";
531  plotfilename += dirname;
532  plotfilename += ".gif";
533  gPad->Print(plotfilename.c_str());
534  delete iter5Pixel;
535  gPad->SetLogz(0);
536  }
537  gStyle->SetOptStat(1111);
538 
539 }
540 
TObject * getObject(const char *name) const
void SeedMultiplicityComparisonPlot()
void SeedMultiplicityPlots(const char *fullname, const char *module, const char *postfix, const char *shortname, const char *outtrunk)
tuple cout
Definition: gather_cfg.py:121
Definition: vlib.h:208