CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTCreateSummaryHistos.cc
Go to the documentation of this file.
1 
2 /*
3  * See header file for a description of this class.
4  *
5  * $Date: 2008/01/22 18:45:23 $
6  * $Revision: 1.4 $
7  * \author G. Mila - INFN Torino
8  */
9 
10 
12 
13 // Framework
15 
16 
17 // Geometry
21 
23 
24 #include <stdio.h>
25 #include <sstream>
26 #include <math.h>
27 
28 #include "TCanvas.h"
29 #include "TFile.h"
30 #include "TProfile.h"
31 
32 using namespace edm;
33 using namespace std;
34 
36 
37  edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos]: Constructor";
38 
39  parameters = ps;
40 
41  // The root file which contain the histos
42  string rootFileName = ps.getUntrackedParameter<string>("rootFileName", "DTEfficiencyTest.root");
43  theFile = new TFile(rootFileName.c_str(), "READ");
44 
45  // The *.ps file which contains the summary histos
46  PsFileName = ps.getUntrackedParameter<string>("PsFileName", "DTSummaryHistos");
47 
48  // Files to write in the *.ps file
49  DataIntegrityHistos = ps.getUntrackedParameter<bool>("DataIntegrityHistos", false);
50  DigiHistos = ps.getUntrackedParameter<bool>("DigiHistos", false);
51  RecoHistos = ps.getUntrackedParameter<bool>("RecoHistos", false);
52  ResoHistos = ps.getUntrackedParameter<bool>("ResoHistos", false);
53  EfficiencyHistos = ps.getUntrackedParameter<bool>("EfficiencyHistos", false);
54  TestPulsesHistos = ps.getUntrackedParameter<bool>("TestPulsesHistos", false);
55  TriggerHistos = ps.getUntrackedParameter<bool>("TriggerHistos", false);
56 
57  // The DDU Id
58  DDUId = ps.getUntrackedParameter<int>("DDUId");
59 
60  MainFolder = "DQMData/DT/";
61 }
62 
64 
65  edm::LogVerbatim ("histos") << "DTCreateSummaryHistos: analyzed " << nevents << " events";
66  theFile->Close();
67 
68 }
69 
70 
72 
73  edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos]: BeginJob";
74 
75  nevents = 0;
76 
77 }
78 
80 
81  // Get the geometry
82  context.get<MuonGeometryRecord>().get(muonGeom);
83 
84 }
85 
87 
88  nevents++;
89  runNumber = e.id().run();
90 
91 }
92 
93 
95 
96  edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos] endjob called!";
97 
98  stringstream RunNum; RunNum << runNumber;
99  string PsFileNameWithRun = PsFileName + "_" + RunNum.str() + ".ps";
100  TPostScript psFile(PsFileNameWithRun.c_str(),111);
101  psFile.Range(20,26);
102  //psFile.NewPage();
103  TCanvas c1("c1","",600,780);
104 
105 
106 
107  // DataIntegrity summary histos **************************************************************
108  if(DataIntegrityHistos){
109  c1.Clear();
110  c1.Divide(2,2);
111  stringstream dduID; dduID << DDUId;
112 
113  string histo_name1 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_TTSValues";
114  TH1F *histo1 = (TH1F*) theFile -> Get(histo_name1.c_str());
115  c1.cd(1);
116  if(histo1)
117  histo1->Draw();
118 
119  string histo_name2 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSStatus";
120  TH1F *histo2 = (TH1F*) theFile -> Get(histo_name2.c_str());
121  c1.cd(2);
122  if(histo2)
123  histo2->Draw();
124 
125  string histo_name3 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSSummary";
126  TH1F *histo3 = (TH1F*) theFile -> Get(histo_name3.c_str());
127  c1.cd(3);
128  if(histo3)
129  histo3->Draw();
130 
131  string histo_name4 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/ROS1/FED" + dduID.str() + "_ROS1_ROSError";
132  TH1F *histo4 = (TH1F*) theFile -> Get(histo_name4.c_str());
133  c1.cd(4);
134  if(histo4)
135  histo4->Draw();
136 
137  c1.Update();
138  psFile.NewPage();
139  }
140 
141  // Digi summary histos ********************************************************************
142  if(DigiHistos){
143  // Time Box Histos
144  c1.Clear();
145  c1.Divide(3,4);
146  // Loop over all the chambers
147  vector<DTChamber*>::const_iterator ch_digi_it = muonGeom->chambers().begin();
148  vector<DTChamber*>::const_iterator ch_digi_end = muonGeom->chambers().end();
149  for (; ch_digi_it != ch_digi_end; ++ch_digi_it) {
150  DTChamberId ch = (*ch_digi_it)->id();
151  stringstream wheel; wheel << ch.wheel();
152  stringstream station; station << ch.station();
153  stringstream sector; sector << ch.sector();
154  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi_it)->superLayers().begin();
155  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi_it)->superLayers().end();
156  // Loop over the SLs
157  for(; sl_it != sl_end; ++sl_it) {
158  DTSuperLayerId sl = (*sl_it)->id();
159  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
160  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
161  stringstream superLayer; superLayer << sl.superlayer();
162 
163  string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
164  string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/TimeBoxes/TimeBox_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str();
165  TH1F *histo = (TH1F *) theFile->Get(histo_name.c_str());
166  if(histo){
167  int pad = (ch.station() - 1)*3 + sl.superlayer();
168  c1.cd(pad);
169  histo->Draw();
170  }
171  }
172  }
173  c1.Update();
174  psFile.NewPage();
175 
176  // Occupancy in Time Histos
177  c1.Clear();
178  c1.Divide(4,3);
179  // Loop over all the chambers
180  vector<DTChamber*>::const_iterator ch_digi2_it = muonGeom->chambers().begin();
181  vector<DTChamber*>::const_iterator ch_digi2_end = muonGeom->chambers().end();
182  for (; ch_digi2_it != ch_digi2_end; ++ch_digi2_it) {
183  DTChamberId ch = (*ch_digi2_it)->id();
184  stringstream wheel; wheel << ch.wheel();
185  stringstream station; station << ch.station();
186  stringstream sector; sector << ch.sector();
187  bool found = false;
188  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi2_it)->superLayers().begin();
189  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi2_it)->superLayers().end();
190  // Loop over the SLs
191  for(; sl_it != sl_end; ++sl_it) {
192  DTSuperLayerId sl = (*sl_it)->id();
193  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
194  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
195  stringstream superLayer; superLayer << sl.superlayer();
196  // Loop over the Ls
197  for(; l_it != l_end; ++l_it) {
198  DTLayerId layerId = (*l_it)->id();
199  stringstream layer; layer << layerId.layer();
200 
201  string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
202  string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyInTimeHits_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str();
203  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
204  if(histo){
205  found = true;
206  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
207  c1.cd(pad);
208  histo->Draw();
209  }
210  }
211  }
212  if(found){
213  c1.Update();
214  psFile.NewPage();
215  }
216  }
217 
218  // Occupancy Noise
219  // Loop over all the chambers
220  vector<DTChamber*>::const_iterator ch_digi3_it = muonGeom->chambers().begin();
221  vector<DTChamber*>::const_iterator ch_digi3_end = muonGeom->chambers().end();
222  for (; ch_digi3_it != ch_digi3_end; ++ch_digi3_it) {
223  DTChamberId ch = (*ch_digi3_it)->id();
224  stringstream wheel; wheel << ch.wheel();
225  stringstream station; station << ch.station();
226  stringstream sector; sector << ch.sector();
227  bool found = false;
228  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi3_it)->superLayers().begin();
229  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi3_it)->superLayers().end();
230  // Loop over the SLs
231  for(; sl_it != sl_end; ++sl_it) {
232  DTSuperLayerId sl = (*sl_it)->id();
233  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
234  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
235  stringstream superLayer; superLayer << sl.superlayer();
236  // Loop over the Ls
237  for(; l_it != l_end; ++l_it) {
238  DTLayerId layerId = (*l_it)->id();
239  stringstream layer; layer << layerId.layer();
240 
241  string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
242  string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyNoise_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str();
243  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
244  if(histo){
245  found = true;
246  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
247  c1.cd(pad);
248  histo->Draw();
249  }
250  }
251  }
252  if(found) {
253  c1.Update();
254  psFile.NewPage();
255  }
256  }
257 
258  // Digi Per Event
259  // Loop over all the chambers
260  vector<DTChamber*>::const_iterator ch_digi4_it = muonGeom->chambers().begin();
261  vector<DTChamber*>::const_iterator ch_digi4_end = muonGeom->chambers().end();
262  for (; ch_digi4_it != ch_digi4_end; ++ch_digi4_it) {
263  DTChamberId ch = (*ch_digi4_it)->id();
264  stringstream wheel; wheel << ch.wheel();
265  stringstream station; station << ch.station();
266  stringstream sector; sector << ch.sector();
267  bool found = false;
268  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi4_it)->superLayers().begin();
269  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi4_it)->superLayers().end();
270  // Loop over the SLs
271  for(; sl_it != sl_end; ++sl_it) {
272  DTSuperLayerId sl = (*sl_it)->id();
273  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
274  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
275  stringstream superLayer; superLayer << sl.superlayer();
276  // Loop over the Ls
277  for(; l_it != l_end; ++l_it) {
278  DTLayerId layerId = (*l_it)->id();
279  stringstream layer; layer << layerId.layer();
280 
281  string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
282  string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/DigiPerEvent/DigiPerEvent_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
283  TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
284  if(histo){
285  found = true;
286  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
287  c1.cd(pad);
288  histo->Draw();
289  }
290  }
291  }
292  if(found){
293  c1.Update();
294  psFile.NewPage();
295  }
296  }
297  }
298 
299  // Reconstruction summary histos *********************************************************
300  if(RecoHistos){
301  // reco segment Histos - page1
302  c1.Clear();
303  c1.Divide(2,4);
304  // Loop over all the chambers
305  vector<DTChamber*>::const_iterator ch_reco_it = muonGeom->chambers().begin();
306  vector<DTChamber*>::const_iterator ch_reco_end = muonGeom->chambers().end();
307  for (; ch_reco_it != ch_reco_end; ++ch_reco_it) {
308  DTChamberId ch = (*ch_reco_it)->id();
309  stringstream wheel; wheel << ch.wheel();
310  stringstream station; station << ch.station();
311  stringstream sector; sector << ch.sector();
312 
313  string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str();
314  string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hN4DSeg_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
315  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
316  if(histo){
317  int pad = (ch.station() - 1)*2 + 1;
318  c1.cd(pad);
319  histo->Draw();
320  }
321  histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmXvsYInCham_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
322  TProfile *histo2 = (TProfile*) theFile -> Get(histo_name.c_str());
323  if(histo2){
324  int pad = (ch.station() - 1)*2 + 2;
325  c1.cd(pad);
326  histo2->Draw();
327  }
328  }
329  c1.Update();
330  psFile.NewPage();
331 
332  // reco segment Histos - page2
333  // Loop over all the chambers
334  vector<DTChamber*>::const_iterator ch_reco2_it = muonGeom->chambers().begin();
335  vector<DTChamber*>::const_iterator ch_reco2_end = muonGeom->chambers().end();
336  for (; ch_reco2_it != ch_reco2_end; ++ch_reco2_it) {
337  DTChamberId ch = (*ch_reco2_it)->id();
338  stringstream wheel; wheel << ch.wheel();
339  stringstream station; station << ch.station();
340  stringstream sector; sector << ch.sector();
341 
342  string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str();
343  string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmPhiDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
344  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
345  if(histo) {
346  int pad = (ch.station() - 1)*2 + 1;
347  c1.cd(pad);
348  histo->Draw();
349  }
350  histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmThetaDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
351  TH1F *histo2 = (TH1F*) theFile -> Get(histo_name.c_str());
352  if(histo2) {
353  int pad = (ch.station() - 1)*2 + 2;
354  c1.cd(pad);
355  histo2->Draw();
356  }
357  }
358  c1.Update();
359  psFile.NewPage();
360  }
361 
362  // Resolution summary histos *******************************************************************
363  if(ResoHistos){
364  // Residuals histos
365  c1.Clear();
366  c1.Divide(3,4);
367  // Loop over all the chambers
368  vector<DTChamber*>::const_iterator ch_reso_it = muonGeom->chambers().begin();
369  vector<DTChamber*>::const_iterator ch_reso_end = muonGeom->chambers().end();
370  for (; ch_reso_it != ch_reso_end; ++ch_reso_it) {
371  DTChamberId ch = (*ch_reso_it)->id();
372  stringstream wheel; wheel << ch.wheel();
373  stringstream station; station << ch.station();
374  stringstream sector; sector << ch.sector();
375  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_reso_it)->superLayers().begin();
376  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_reso_it)->superLayers().end();
377  // Loop over the SLs
378  for(; sl_it != sl_end; ++sl_it) {
379  DTSuperLayerId sl = (*sl_it)->id();
380  stringstream superLayer; superLayer << sl.superlayer();
381 
382  string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str();
383  string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();
384  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
385  if(histo){
386  int pad = (ch.station() - 1)*3 + sl.superlayer();
387  c1.cd(pad);
388  histo->Draw();
389  }
390  }
391  }
392  c1.Update();
393  psFile.NewPage();
394 
395  // Residuals as a function of the position Histos
396  // Loop over all the chambers
397  vector<DTChamber*>::const_iterator ch_reso2_it = muonGeom->chambers().begin();
398  vector<DTChamber*>::const_iterator ch_reso2_end = muonGeom->chambers().end();
399  for (; ch_reso2_it != ch_reso2_end; ++ch_reso2_it) {
400  DTChamberId ch = (*ch_reso2_it)->id();
401  stringstream wheel; wheel << ch.wheel();
402  stringstream station; station << ch.station();
403  stringstream sector; sector << ch.sector();
404  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_reso2_it)->superLayers().begin();
405  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_reso2_it)->superLayers().end();
406  // Loop over the SLs
407  for(; sl_it != sl_end; ++sl_it) {
408  DTSuperLayerId sl = (*sl_it)->id();
409  stringstream superLayer; superLayer << sl.superlayer();
410 
411  string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str();
412  string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDistVsDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();
413  TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
414  if(histo){
415  int pad = (ch.station() - 1)*3 + sl.superlayer();
416  c1.cd(pad);
417  histo->Draw();
418  }
419  }
420  }
421  c1.Update();
422  psFile.NewPage();
423  }
424 
425  // Efficiency summary histos ******************************************************************
426  if(EfficiencyHistos){
427  // Cell efficiency
428  c1.Clear();
429  c1.Divide(4,3);
430  // Loop over all the chambers
431  vector<DTChamber*>::const_iterator ch_eff_it = muonGeom->chambers().begin();
432  vector<DTChamber*>::const_iterator ch_eff_end = muonGeom->chambers().end();
433  for (; ch_eff_it != ch_eff_end; ++ch_eff_it) {
434  DTChamberId ch = (*ch_eff_it)->id();
435  stringstream wheel; wheel << ch.wheel();
436  stringstream station; station << ch.station();
437  stringstream sector; sector << ch.sector();
438  bool found = false;
439  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_eff_it)->superLayers().begin();
440  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_eff_it)->superLayers().end();
441  // Loop over the SLs
442  for(; sl_it != sl_end; ++sl_it) {
443  DTSuperLayerId sl = (*sl_it)->id();
444  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
445  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
446  stringstream superLayer; superLayer << sl.superlayer();
447  // Loop over the Ls
448  for(; l_it != l_end; ++l_it) {
449  DTLayerId layerId = (*l_it)->id();
450  stringstream layer; layer << layerId.layer();
451 
452  string efficiencyFolder = MainFolder + "Tests/DTEfficiency/Wheel" + wheel.str();
453  string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/UnassEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
454  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
455  if(histo){
456  found = true;
457  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
458  c1.cd(pad);
459  histo->Draw();
460  }
461  }
462  }
463  if(found){
464  c1.Update();
465  psFile.NewPage();
466  }
467  }
468 
469  // Chamber X efficiency
470  c1.Clear();
471  c1.Divide(2,2);
472  // Loop over all the chambers
473  vector<DTChamber*>::const_iterator ch_eff2_it = muonGeom->chambers().begin();
474  vector<DTChamber*>::const_iterator ch_eff2_end = muonGeom->chambers().end();
475  for (; ch_eff2_it != ch_eff2_end; ++ch_eff2_it) {
476  DTChamberId ch = (*ch_eff2_it)->id();
477  stringstream wheel; wheel << ch.wheel();
478  stringstream station; station << ch.station();
479  stringstream sector; sector << ch.sector();
480 
481  string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str();
482  string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/xEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
483  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
484  if(histo){
485  c1.cd(ch.station());
486  histo->Draw();
487  }
488  }
489  c1.Update();
490  psFile.NewPage();
491 
492  // Chamber Y efficiency
493  // Loop over all the chambers
494  vector<DTChamber*>::const_iterator ch_eff3_it = muonGeom->chambers().begin();
495  vector<DTChamber*>::const_iterator ch_eff3_end = muonGeom->chambers().end();
496  for (; ch_eff3_it != ch_eff3_end; ++ch_eff3_it) {
497  DTChamberId ch = (*ch_eff3_it)->id();
498  stringstream wheel; wheel << ch.wheel();
499  stringstream station; station << ch.station();
500  stringstream sector; sector << ch.sector();
501 
502  string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str();
503  string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/yEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
504  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
505  if(histo){
506  c1.cd(ch.station());
507  histo->Draw();
508  }
509  }
510  c1.Update();
511  psFile.NewPage();
512  }
513 
514  // Test Pulses Summary Histos **************************************************************
515  if(TestPulsesHistos){
516  c1.Clear();
517  c1.Divide(4,3);
518  // Loop over all the chambers
519  vector<DTChamber*>::const_iterator ch_TP_it = muonGeom->chambers().begin();
520  vector<DTChamber*>::const_iterator ch_TP_end = muonGeom->chambers().end();
521  for (; ch_TP_it != ch_TP_end; ++ch_TP_it) {
522  DTChamberId ch = (*ch_TP_it)->id();
523  stringstream wheel; wheel << ch.wheel();
524  stringstream station; station << ch.station();
525  stringstream sector; sector << ch.sector();
526  bool found = false;
527  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_TP_it)->superLayers().begin();
528  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_TP_it)->superLayers().end();
529  // Loop over the SLs
530  for(; sl_it != sl_end; ++sl_it) {
531  DTSuperLayerId sl = (*sl_it)->id();
532  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
533  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
534  stringstream superLayer; superLayer << sl.superlayer();
535  // Loop over the Ls
536  for(; l_it != l_end; ++l_it) {
537  DTLayerId layerId = (*l_it)->id();
538  stringstream layer; layer << layerId.layer();
539 
540  string testPulsesFolder = MainFolder + "DTTestPulsesTask/Wheel" + wheel.str();
541  string histo_name = testPulsesFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/SuperLayer" + superLayer.str() + "/TPProfile/TestPulses2D_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
542  TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
543  if(histo){
544  found = true;
545  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
546  c1.cd(pad);
547  histo->Draw();
548  }
549  }
550  }
551  if(found){
552  c1.Update();
553  psFile.NewPage();
554  }
555  }
556  }
557 
558  // Trigger Summary Histos ************************************************************************
559  if(TriggerHistos){
560  c1.Clear();
561  c1.Divide(2,2);
562  // Loop over all the chambers
563  vector<DTChamber*>::const_iterator ch_trigger_it = muonGeom->chambers().begin();
564  vector<DTChamber*>::const_iterator ch_trigger_end = muonGeom->chambers().end();
565  for (; ch_trigger_it != ch_trigger_end; ++ch_trigger_it) {
566  DTChamberId ch = (*ch_trigger_it)->id();
567  stringstream wheel; wheel << ch.wheel();
568  stringstream station; station << ch.station();
569  stringstream sector; sector << ch.sector();
570 
571  string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str();
572  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerPhi/DDU_BXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
573  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
574  if(histo){
575  c1.cd(ch.station());
576  histo->Draw();
577  }
578  }
579  c1.Update();
580  psFile.NewPage();
581 
582  // Loop over all the chambers
583  vector<DTChamber*>::const_iterator ch_trigger2_it = muonGeom->chambers().begin();
584  vector<DTChamber*>::const_iterator ch_trigger2_end = muonGeom->chambers().end();
585  for (; ch_trigger2_it != ch_trigger2_end; ++ch_trigger2_it) {
586  DTChamberId ch = (*ch_trigger2_it)->id();
587  stringstream wheel; wheel << ch.wheel();
588  stringstream station; station << ch.station();
589  stringstream sector; sector << ch.sector();
590 
591  string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str();
592  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerTheta/DDU_ThetaBXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
593  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
594  if(histo){
595  c1.cd(ch.station());
596  histo->Draw();
597  }
598  }
599  c1.Update();
600  psFile.NewPage();
601 
602  c1.Clear();
603  c1.Divide(1,2);
604  int counter1=0,counter2=0;
605  // Loop over all the chambers
606  vector<DTChamber*>::const_iterator ch_trigger3_it = muonGeom->chambers().begin();
607  vector<DTChamber*>::const_iterator ch_trigger3_end = muonGeom->chambers().end();
608  for (; ch_trigger3_it != ch_trigger3_end; ++ch_trigger3_it) {
609  DTChamberId ch = (*ch_trigger3_it)->id();
610  stringstream wheel; wheel << ch.wheel();
611  stringstream sector; sector << ch.sector();
612 
613  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
614  string histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerPhi/CorrFraction_Phi_W" + wheel.str() + "_Sec" + sector.str();
615  TH1F *Histo1 = (TH1F*) theFile -> Get(histo_Name.c_str());
616  if(Histo1 && counter1==0){
617  counter1++;
618  c1.cd(1);
619  Histo1->Draw();
620  }
621  histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerTheta/HFraction_Theta_W" + wheel.str() + "_Sec" + sector.str();
622  TH1F *Histo2 = (TH1F*) theFile -> Get(histo_Name.c_str());
623  if(Histo2 && counter2==0){
624  counter2++;
625  c1.cd(2);
626  Histo2->Draw();
627  }
628  }
629  c1.Update();
630  psFile.NewPage();
631 
632  c1.Clear();
633  c1.Divide(2,2);
634  // Loop over all the chambers
635  vector<DTChamber*>::const_iterator ch_trigger4_it = muonGeom->chambers().begin();
636  vector<DTChamber*>::const_iterator ch_trigger4_end = muonGeom->chambers().end();
637  for (; ch_trigger4_it != ch_trigger4_end; ++ch_trigger4_it) {
638  DTChamberId ch = (*ch_trigger4_it)->id();
639  stringstream wheel; wheel << ch.wheel();
640  stringstream station; station << ch.station();
641  stringstream sector; sector << ch.sector();
642 
643  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
644  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
645  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
646  string histo_nameHHHL = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPosHHHL_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
647  TH1F *histoHHHL = (TH1F*) theFile -> Get(histo_nameHHHL.c_str());
648  if(histo){
649  c1.cd(ch.station());
650  histo->GetYaxis()->SetRangeUser(0,1.1);
651  histo->Draw();
652  if(histoHHHL){
653  histoHHHL->Draw("same");
654  }
655  }
656  }
657  c1.Update();
658  psFile.NewPage();
659 
660  c1.Clear();
661  c1.Divide(2,2);
662  // Loop over all the chambers
663  vector<DTChamber*>::const_iterator ch_trigger5_it = muonGeom->chambers().begin();
664  vector<DTChamber*>::const_iterator ch_trigger5_end = muonGeom->chambers().end();
665  for (; ch_trigger5_it != ch_trigger5_end; ++ch_trigger5_it) {
666  DTChamberId ch = (*ch_trigger5_it)->id();
667  stringstream wheel; wheel << ch.wheel();
668  stringstream station; station << ch.station();
669  stringstream sector; sector << ch.sector();
670 
671  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
672  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
673  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
674  if(histo){
675  c1.cd(ch.station());
676  histo->GetYaxis()->SetRangeUser(0,1.1);
677  histo->Draw();
678  }
679  }
680  c1.Update();
681  psFile.NewPage();
682 
683  c1.Clear();
684  c1.Divide(2,2);
685  // Loop over all the chambers
686  vector<DTChamber*>::const_iterator ch_trigger6_it = muonGeom->chambers().begin();
687  vector<DTChamber*>::const_iterator ch_trigger6_end = muonGeom->chambers().end();
688  for (; ch_trigger6_it != ch_trigger6_end; ++ch_trigger6_it) {
689  DTChamberId ch = (*ch_trigger6_it)->id();
690  stringstream wheel; wheel << ch.wheel();
691  stringstream station; station << ch.station();
692  stringstream sector; sector << ch.sector();
693 
694  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
695  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
696  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
697  if(histo){
698  c1.cd(ch.station());
699  histo->GetYaxis()->SetRangeUser(0,1.1);
700  histo->Draw();
701  }
702  }
703  c1.Update();
704  psFile.NewPage();
705 
706  c1.Clear();
707  c1.Divide(2,2);
708  // Loop over all the chambers
709  vector<DTChamber*>::const_iterator ch_trigger7_it = muonGeom->chambers().begin();
710  vector<DTChamber*>::const_iterator ch_trigger7_end = muonGeom->chambers().end();
711  for (; ch_trigger7_it != ch_trigger7_end; ++ch_trigger7_it) {
712  DTChamberId ch = (*ch_trigger7_it)->id();
713  stringstream wheel; wheel << ch.wheel();
714  stringstream station; station << ch.station();
715  stringstream sector; sector << ch.sector();
716 
717  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
718  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
719  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
720  if(histo){
721  histo->GetYaxis()->SetRangeUser(0,1.1);
722  c1.cd(ch.station());
723  histo->Draw();
724  }
725  }
726  c1.Update();
727  }
728  psFile.Close();
729 }
RunNumber_t run() const
Definition: EventID.h:42
T getUntrackedParameter(std::string const &, T const &) const
dictionary parameters
Definition: Parameters.py:2
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
int layer() const
Return the layer number.
Definition: DTLayerId.h:55
tuple histo
Definition: trackerHits.py:12
void beginRun(const edm::Run &run, const edm::EventSetup &setup)
BeginRun.
int nevents
virtual ~DTCreateSummaryHistos()
Destructor.
int superlayer() const
Return the superlayer number (deprecated method name)
const T & get() const
Definition: EventSetup.h:55
DTCreateSummaryHistos(const edm::ParameterSet &ps)
Constructor.
edm::EventID id() const
Definition: EventBase.h:56
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
Definition: Run.h:32