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