CMS 3D CMS Logo

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