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: 2011/11/24 09:17:30 $
6  * $Revision: 1.6 $
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  stringstream superLayer; superLayer << sl.superlayer();
160 
161  string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
162  string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/TimeBoxes/TimeBox_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str();
163  TH1F *histo = (TH1F *) theFile->Get(histo_name.c_str());
164  if(histo){
165  int pad = (ch.station() - 1)*3 + sl.superlayer();
166  c1.cd(pad);
167  histo->Draw();
168  }
169  }
170  }
171  c1.Update();
172  psFile.NewPage();
173 
174  // Occupancy in Time Histos
175  c1.Clear();
176  c1.Divide(4,3);
177  // Loop over all the chambers
178  vector<DTChamber*>::const_iterator ch_digi2_it = muonGeom->chambers().begin();
179  vector<DTChamber*>::const_iterator ch_digi2_end = muonGeom->chambers().end();
180  for (; ch_digi2_it != ch_digi2_end; ++ch_digi2_it) {
181  DTChamberId ch = (*ch_digi2_it)->id();
182  stringstream wheel; wheel << ch.wheel();
183  stringstream station; station << ch.station();
184  stringstream sector; sector << ch.sector();
185  bool found = false;
186  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi2_it)->superLayers().begin();
187  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi2_it)->superLayers().end();
188  // Loop over the SLs
189  for(; sl_it != sl_end; ++sl_it) {
190  DTSuperLayerId sl = (*sl_it)->id();
191  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
192  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
193  stringstream superLayer; superLayer << sl.superlayer();
194  // Loop over the Ls
195  for(; l_it != l_end; ++l_it) {
196  DTLayerId layerId = (*l_it)->id();
197  stringstream layer; layer << layerId.layer();
198 
199  string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
200  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();
201  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
202  if(histo){
203  found = true;
204  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
205  c1.cd(pad);
206  histo->Draw();
207  }
208  }
209  }
210  if(found){
211  c1.Update();
212  psFile.NewPage();
213  }
214  }
215 
216  // Occupancy Noise
217  // Loop over all the chambers
218  vector<DTChamber*>::const_iterator ch_digi3_it = muonGeom->chambers().begin();
219  vector<DTChamber*>::const_iterator ch_digi3_end = muonGeom->chambers().end();
220  for (; ch_digi3_it != ch_digi3_end; ++ch_digi3_it) {
221  DTChamberId ch = (*ch_digi3_it)->id();
222  stringstream wheel; wheel << ch.wheel();
223  stringstream station; station << ch.station();
224  stringstream sector; sector << ch.sector();
225  bool found = false;
226  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi3_it)->superLayers().begin();
227  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi3_it)->superLayers().end();
228  // Loop over the SLs
229  for(; sl_it != sl_end; ++sl_it) {
230  DTSuperLayerId sl = (*sl_it)->id();
231  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
232  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
233  stringstream superLayer; superLayer << sl.superlayer();
234  // Loop over the Ls
235  for(; l_it != l_end; ++l_it) {
236  DTLayerId layerId = (*l_it)->id();
237  stringstream layer; layer << layerId.layer();
238 
239  string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
240  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();
241  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
242  if(histo){
243  found = true;
244  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
245  c1.cd(pad);
246  histo->Draw();
247  }
248  }
249  }
250  if(found) {
251  c1.Update();
252  psFile.NewPage();
253  }
254  }
255 
256  // Digi Per Event
257  // Loop over all the chambers
258  vector<DTChamber*>::const_iterator ch_digi4_it = muonGeom->chambers().begin();
259  vector<DTChamber*>::const_iterator ch_digi4_end = muonGeom->chambers().end();
260  for (; ch_digi4_it != ch_digi4_end; ++ch_digi4_it) {
261  DTChamberId ch = (*ch_digi4_it)->id();
262  stringstream wheel; wheel << ch.wheel();
263  stringstream station; station << ch.station();
264  stringstream sector; sector << ch.sector();
265  bool found = false;
266  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi4_it)->superLayers().begin();
267  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi4_it)->superLayers().end();
268  // Loop over the SLs
269  for(; sl_it != sl_end; ++sl_it) {
270  DTSuperLayerId sl = (*sl_it)->id();
271  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
272  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
273  stringstream superLayer; superLayer << sl.superlayer();
274  // Loop over the Ls
275  for(; l_it != l_end; ++l_it) {
276  DTLayerId layerId = (*l_it)->id();
277  stringstream layer; layer << layerId.layer();
278 
279  string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
280  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();
281  TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
282  if(histo){
283  found = true;
284  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
285  c1.cd(pad);
286  histo->Draw();
287  }
288  }
289  }
290  if(found){
291  c1.Update();
292  psFile.NewPage();
293  }
294  }
295  }
296 
297  // Reconstruction summary histos *********************************************************
298  if(RecoHistos){
299  // reco segment Histos - page1
300  c1.Clear();
301  c1.Divide(2,4);
302  // Loop over all the chambers
303  vector<DTChamber*>::const_iterator ch_reco_it = muonGeom->chambers().begin();
304  vector<DTChamber*>::const_iterator ch_reco_end = muonGeom->chambers().end();
305  for (; ch_reco_it != ch_reco_end; ++ch_reco_it) {
306  DTChamberId ch = (*ch_reco_it)->id();
307  stringstream wheel; wheel << ch.wheel();
308  stringstream station; station << ch.station();
309  stringstream sector; sector << ch.sector();
310 
311  string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str();
312  string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hN4DSeg_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
313  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
314  if(histo){
315  int pad = (ch.station() - 1)*2 + 1;
316  c1.cd(pad);
317  histo->Draw();
318  }
319  histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmXvsYInCham_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
320  TProfile *histo2 = (TProfile*) theFile -> Get(histo_name.c_str());
321  if(histo2){
322  int pad = (ch.station() - 1)*2 + 2;
323  c1.cd(pad);
324  histo2->Draw();
325  }
326  }
327  c1.Update();
328  psFile.NewPage();
329 
330  // reco segment Histos - page2
331  // Loop over all the chambers
332  vector<DTChamber*>::const_iterator ch_reco2_it = muonGeom->chambers().begin();
333  vector<DTChamber*>::const_iterator ch_reco2_end = muonGeom->chambers().end();
334  for (; ch_reco2_it != ch_reco2_end; ++ch_reco2_it) {
335  DTChamberId ch = (*ch_reco2_it)->id();
336  stringstream wheel; wheel << ch.wheel();
337  stringstream station; station << ch.station();
338  stringstream sector; sector << ch.sector();
339 
340  string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str();
341  string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmPhiDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
342  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
343  if(histo) {
344  int pad = (ch.station() - 1)*2 + 1;
345  c1.cd(pad);
346  histo->Draw();
347  }
348  histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmThetaDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
349  TH1F *histo2 = (TH1F*) theFile -> Get(histo_name.c_str());
350  if(histo2) {
351  int pad = (ch.station() - 1)*2 + 2;
352  c1.cd(pad);
353  histo2->Draw();
354  }
355  }
356  c1.Update();
357  psFile.NewPage();
358  }
359 
360  // Resolution summary histos *******************************************************************
361  if(ResoHistos){
362  // Residuals histos
363  c1.Clear();
364  c1.Divide(3,4);
365  // Loop over all the chambers
366  vector<DTChamber*>::const_iterator ch_reso_it = muonGeom->chambers().begin();
367  vector<DTChamber*>::const_iterator ch_reso_end = muonGeom->chambers().end();
368  for (; ch_reso_it != ch_reso_end; ++ch_reso_it) {
369  DTChamberId ch = (*ch_reso_it)->id();
370  stringstream wheel; wheel << ch.wheel();
371  stringstream station; station << ch.station();
372  stringstream sector; sector << ch.sector();
373  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_reso_it)->superLayers().begin();
374  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_reso_it)->superLayers().end();
375  // Loop over the SLs
376  for(; sl_it != sl_end; ++sl_it) {
377  DTSuperLayerId sl = (*sl_it)->id();
378  stringstream superLayer; superLayer << sl.superlayer();
379 
380  string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str();
381  string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();
382  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
383  if(histo){
384  int pad = (ch.station() - 1)*3 + sl.superlayer();
385  c1.cd(pad);
386  histo->Draw();
387  }
388  }
389  }
390  c1.Update();
391  psFile.NewPage();
392 
393  // Residuals as a function of the position Histos
394  // Loop over all the chambers
395  vector<DTChamber*>::const_iterator ch_reso2_it = muonGeom->chambers().begin();
396  vector<DTChamber*>::const_iterator ch_reso2_end = muonGeom->chambers().end();
397  for (; ch_reso2_it != ch_reso2_end; ++ch_reso2_it) {
398  DTChamberId ch = (*ch_reso2_it)->id();
399  stringstream wheel; wheel << ch.wheel();
400  stringstream station; station << ch.station();
401  stringstream sector; sector << ch.sector();
402  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_reso2_it)->superLayers().begin();
403  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_reso2_it)->superLayers().end();
404  // Loop over the SLs
405  for(; sl_it != sl_end; ++sl_it) {
406  DTSuperLayerId sl = (*sl_it)->id();
407  stringstream superLayer; superLayer << sl.superlayer();
408 
409  string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str();
410  string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDistVsDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();
411  TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
412  if(histo){
413  int pad = (ch.station() - 1)*3 + sl.superlayer();
414  c1.cd(pad);
415  histo->Draw();
416  }
417  }
418  }
419  c1.Update();
420  psFile.NewPage();
421  }
422 
423  // Efficiency summary histos ******************************************************************
424  if(EfficiencyHistos){
425  // Cell efficiency
426  c1.Clear();
427  c1.Divide(4,3);
428  // Loop over all the chambers
429  vector<DTChamber*>::const_iterator ch_eff_it = muonGeom->chambers().begin();
430  vector<DTChamber*>::const_iterator ch_eff_end = muonGeom->chambers().end();
431  for (; ch_eff_it != ch_eff_end; ++ch_eff_it) {
432  DTChamberId ch = (*ch_eff_it)->id();
433  stringstream wheel; wheel << ch.wheel();
434  stringstream station; station << ch.station();
435  stringstream sector; sector << ch.sector();
436  bool found = false;
437  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_eff_it)->superLayers().begin();
438  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_eff_it)->superLayers().end();
439  // Loop over the SLs
440  for(; sl_it != sl_end; ++sl_it) {
441  DTSuperLayerId sl = (*sl_it)->id();
442  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
443  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
444  stringstream superLayer; superLayer << sl.superlayer();
445  // Loop over the Ls
446  for(; l_it != l_end; ++l_it) {
447  DTLayerId layerId = (*l_it)->id();
448  stringstream layer; layer << layerId.layer();
449 
450  string efficiencyFolder = MainFolder + "Tests/DTEfficiency/Wheel" + wheel.str();
451  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();
452  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
453  if(histo){
454  found = true;
455  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
456  c1.cd(pad);
457  histo->Draw();
458  }
459  }
460  }
461  if(found){
462  c1.Update();
463  psFile.NewPage();
464  }
465  }
466 
467  // Chamber X efficiency
468  c1.Clear();
469  c1.Divide(2,2);
470  // Loop over all the chambers
471  vector<DTChamber*>::const_iterator ch_eff2_it = muonGeom->chambers().begin();
472  vector<DTChamber*>::const_iterator ch_eff2_end = muonGeom->chambers().end();
473  for (; ch_eff2_it != ch_eff2_end; ++ch_eff2_it) {
474  DTChamberId ch = (*ch_eff2_it)->id();
475  stringstream wheel; wheel << ch.wheel();
476  stringstream station; station << ch.station();
477  stringstream sector; sector << ch.sector();
478 
479  string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str();
480  string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/xEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
481  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
482  if(histo){
483  c1.cd(ch.station());
484  histo->Draw();
485  }
486  }
487  c1.Update();
488  psFile.NewPage();
489 
490  // Chamber Y efficiency
491  // Loop over all the chambers
492  vector<DTChamber*>::const_iterator ch_eff3_it = muonGeom->chambers().begin();
493  vector<DTChamber*>::const_iterator ch_eff3_end = muonGeom->chambers().end();
494  for (; ch_eff3_it != ch_eff3_end; ++ch_eff3_it) {
495  DTChamberId ch = (*ch_eff3_it)->id();
496  stringstream wheel; wheel << ch.wheel();
497  stringstream station; station << ch.station();
498  stringstream sector; sector << ch.sector();
499 
500  string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str();
501  string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/yEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
502  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
503  if(histo){
504  c1.cd(ch.station());
505  histo->Draw();
506  }
507  }
508  c1.Update();
509  psFile.NewPage();
510  }
511 
512  // Test Pulses Summary Histos **************************************************************
513  if(TestPulsesHistos){
514  c1.Clear();
515  c1.Divide(4,3);
516  // Loop over all the chambers
517  vector<DTChamber*>::const_iterator ch_TP_it = muonGeom->chambers().begin();
518  vector<DTChamber*>::const_iterator ch_TP_end = muonGeom->chambers().end();
519  for (; ch_TP_it != ch_TP_end; ++ch_TP_it) {
520  DTChamberId ch = (*ch_TP_it)->id();
521  stringstream wheel; wheel << ch.wheel();
522  stringstream station; station << ch.station();
523  stringstream sector; sector << ch.sector();
524  bool found = false;
525  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_TP_it)->superLayers().begin();
526  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_TP_it)->superLayers().end();
527  // Loop over the SLs
528  for(; sl_it != sl_end; ++sl_it) {
529  DTSuperLayerId sl = (*sl_it)->id();
530  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
531  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
532  stringstream superLayer; superLayer << sl.superlayer();
533  // Loop over the Ls
534  for(; l_it != l_end; ++l_it) {
535  DTLayerId layerId = (*l_it)->id();
536  stringstream layer; layer << layerId.layer();
537 
538  string testPulsesFolder = MainFolder + "DTTestPulsesTask/Wheel" + wheel.str();
539  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();
540  TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
541  if(histo){
542  found = true;
543  int pad = (sl.superlayer() - 1)*4 + layerId.layer();
544  c1.cd(pad);
545  histo->Draw();
546  }
547  }
548  }
549  if(found){
550  c1.Update();
551  psFile.NewPage();
552  }
553  }
554  }
555 
556  // Trigger Summary Histos ************************************************************************
557  if(TriggerHistos){
558  c1.Clear();
559  c1.Divide(2,2);
560  // Loop over all the chambers
561  vector<DTChamber*>::const_iterator ch_trigger_it = muonGeom->chambers().begin();
562  vector<DTChamber*>::const_iterator ch_trigger_end = muonGeom->chambers().end();
563  for (; ch_trigger_it != ch_trigger_end; ++ch_trigger_it) {
564  DTChamberId ch = (*ch_trigger_it)->id();
565  stringstream wheel; wheel << ch.wheel();
566  stringstream station; station << ch.station();
567  stringstream sector; sector << ch.sector();
568 
569  string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str();
570  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerPhi/DDU_BXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
571  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
572  if(histo){
573  c1.cd(ch.station());
574  histo->Draw();
575  }
576  }
577  c1.Update();
578  psFile.NewPage();
579 
580  // Loop over all the chambers
581  vector<DTChamber*>::const_iterator ch_trigger2_it = muonGeom->chambers().begin();
582  vector<DTChamber*>::const_iterator ch_trigger2_end = muonGeom->chambers().end();
583  for (; ch_trigger2_it != ch_trigger2_end; ++ch_trigger2_it) {
584  DTChamberId ch = (*ch_trigger2_it)->id();
585  stringstream wheel; wheel << ch.wheel();
586  stringstream station; station << ch.station();
587  stringstream sector; sector << ch.sector();
588 
589  string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str();
590  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerTheta/DDU_ThetaBXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
591  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
592  if(histo){
593  c1.cd(ch.station());
594  histo->Draw();
595  }
596  }
597  c1.Update();
598  psFile.NewPage();
599 
600  c1.Clear();
601  c1.Divide(1,2);
602  int counter1=0,counter2=0;
603  // Loop over all the chambers
604  vector<DTChamber*>::const_iterator ch_trigger3_it = muonGeom->chambers().begin();
605  vector<DTChamber*>::const_iterator ch_trigger3_end = muonGeom->chambers().end();
606  for (; ch_trigger3_it != ch_trigger3_end; ++ch_trigger3_it) {
607  DTChamberId ch = (*ch_trigger3_it)->id();
608  stringstream wheel; wheel << ch.wheel();
609  stringstream sector; sector << ch.sector();
610 
611  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
612  string histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerPhi/CorrFraction_Phi_W" + wheel.str() + "_Sec" + sector.str();
613  TH1F *Histo1 = (TH1F*) theFile -> Get(histo_Name.c_str());
614  if(Histo1 && counter1==0){
615  counter1++;
616  c1.cd(1);
617  Histo1->Draw();
618  }
619  histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerTheta/HFraction_Theta_W" + wheel.str() + "_Sec" + sector.str();
620  TH1F *Histo2 = (TH1F*) theFile -> Get(histo_Name.c_str());
621  if(Histo2 && counter2==0){
622  counter2++;
623  c1.cd(2);
624  Histo2->Draw();
625  }
626  }
627  c1.Update();
628  psFile.NewPage();
629 
630  c1.Clear();
631  c1.Divide(2,2);
632  // Loop over all the chambers
633  vector<DTChamber*>::const_iterator ch_trigger4_it = muonGeom->chambers().begin();
634  vector<DTChamber*>::const_iterator ch_trigger4_end = muonGeom->chambers().end();
635  for (; ch_trigger4_it != ch_trigger4_end; ++ch_trigger4_it) {
636  DTChamberId ch = (*ch_trigger4_it)->id();
637  stringstream wheel; wheel << ch.wheel();
638  stringstream station; station << ch.station();
639  stringstream sector; sector << ch.sector();
640 
641  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
642  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
643  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
644  string histo_nameHHHL = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPosHHHL_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
645  TH1F *histoHHHL = (TH1F*) theFile -> Get(histo_nameHHHL.c_str());
646  if(histo){
647  c1.cd(ch.station());
648  histo->GetYaxis()->SetRangeUser(0,1.1);
649  histo->Draw();
650  if(histoHHHL){
651  histoHHHL->Draw("same");
652  }
653  }
654  }
655  c1.Update();
656  psFile.NewPage();
657 
658  c1.Clear();
659  c1.Divide(2,2);
660  // Loop over all the chambers
661  vector<DTChamber*>::const_iterator ch_trigger5_it = muonGeom->chambers().begin();
662  vector<DTChamber*>::const_iterator ch_trigger5_end = muonGeom->chambers().end();
663  for (; ch_trigger5_it != ch_trigger5_end; ++ch_trigger5_it) {
664  DTChamberId ch = (*ch_trigger5_it)->id();
665  stringstream wheel; wheel << ch.wheel();
666  stringstream station; station << ch.station();
667  stringstream sector; sector << ch.sector();
668 
669  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
670  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
671  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
672  if(histo){
673  c1.cd(ch.station());
674  histo->GetYaxis()->SetRangeUser(0,1.1);
675  histo->Draw();
676  }
677  }
678  c1.Update();
679  psFile.NewPage();
680 
681  c1.Clear();
682  c1.Divide(2,2);
683  // Loop over all the chambers
684  vector<DTChamber*>::const_iterator ch_trigger6_it = muonGeom->chambers().begin();
685  vector<DTChamber*>::const_iterator ch_trigger6_end = muonGeom->chambers().end();
686  for (; ch_trigger6_it != ch_trigger6_end; ++ch_trigger6_it) {
687  DTChamberId ch = (*ch_trigger6_it)->id();
688  stringstream wheel; wheel << ch.wheel();
689  stringstream station; station << ch.station();
690  stringstream sector; sector << ch.sector();
691 
692  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
693  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
694  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
695  if(histo){
696  c1.cd(ch.station());
697  histo->GetYaxis()->SetRangeUser(0,1.1);
698  histo->Draw();
699  }
700  }
701  c1.Update();
702  psFile.NewPage();
703 
704  c1.Clear();
705  c1.Divide(2,2);
706  // Loop over all the chambers
707  vector<DTChamber*>::const_iterator ch_trigger7_it = muonGeom->chambers().begin();
708  vector<DTChamber*>::const_iterator ch_trigger7_end = muonGeom->chambers().end();
709  for (; ch_trigger7_it != ch_trigger7_end; ++ch_trigger7_it) {
710  DTChamberId ch = (*ch_trigger7_it)->id();
711  stringstream wheel; wheel << ch.wheel();
712  stringstream station; station << ch.station();
713  stringstream sector; sector << ch.sector();
714 
715  string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
716  string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
717  TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
718  if(histo){
719  histo->GetYaxis()->SetRangeUser(0,1.1);
720  c1.cd(ch.station());
721  histo->Draw();
722  }
723  }
724  c1.Update();
725  }
726  psFile.Close();
727 }
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
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:36