CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTResolutionTest.cc
Go to the documentation of this file.
1 
2 
3 /*
4  * See header file for a description of this class.
5  *
6  * $Date: 2010/01/05 10:15:46 $
7  * $Revision: 1.36 $
8  * \author G. Mila - INFN Torino
9  */
10 
11 
13 
14 // Framework
20 
21 
22 // Geometry
26 
27 
28 
32 
33 #include <iostream>
34 #include <stdio.h>
35 #include <string>
36 #include <sstream>
37 #include <math.h>
38 #include "TF1.h"
39 
40 
41 using namespace edm;
42 using namespace std;
43 
44 
46 
47  edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Constructor";
48  parameters = ps;
49 
50  dbe = edm::Service<DQMStore>().operator->();
51  if(ps.getUntrackedParameter<bool>("readFile", false))
52  dbe->open(ps.getUntrackedParameter<string>("inputFile", "residuals.root"));
53 
54  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
55 
56  percentual = parameters.getUntrackedParameter<int>("BadSLpercentual", 10);
57 
58  //debug = parameters.getUntrackedParameter<bool>("debug", false);
59 
60 }
61 
62 
64 
65  edm::LogVerbatim ("resolution") << "DTResolutionTest: analyzed " << nevents << " events";
66 
67 }
68 
69 
71 
72  edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: BeginRun";
73 
74  nevents = 0;
75  // Get the geometry
76  context.get<MuonGeometryRecord>().get(muonGeom);
77 
78  // book the histos
79  for(int wheel=-2; wheel<3; wheel++){
80  bookHistos(wheel);
81  }
82  vector<DTChamber*> chambers = muonGeom->chambers();
83  for(vector<DTChamber*>::const_iterator chamber = chambers.begin();
84  chamber != chambers.end(); ++chamber) {
85  bookHistos((*chamber)->id());
86  }
87 
88 }
89 
90 
92 
93  edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: Begin of LS transition";
94 
95  // Get the run number
96  run = lumiSeg.run();
97 }
98 
99 
101 
102  nevents++;
103  edm::LogVerbatim ("resolution") << "[DTResolutionTest]: "<<nevents<<" events";
104 
105 }
106 
107 
108 
110 
111  // counts number of updats (online mode) or number of events (standalone mode)
112  //nevents++;
113  // if running in standalone perform diagnostic only after a reasonalbe amount of events
114  //if ( parameters.getUntrackedParameter<bool>("runningStandalone", false) &&
115  // nevents%parameters.getUntrackedParameter<int>("diagnosticPrescale", 1000) != 0 ) return;
116  //edm::LogVerbatim ("resolution") << "[DTResolutionTest]: "<<nevents<<" updates";
117 
118  edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: End of LS transition, performing the DQM client operation";
119 
120  // counts number of lumiSegs
121  nLumiSegs = lumiSeg.id().luminosityBlock();
122 
123  // prescale factor
124  if ( nLumiSegs%prescaleFactor != 0 ) return;
125 
126  for(map<int, MonitorElement*> ::const_iterator histo = wheelMeanHistos.begin();
127  histo != wheelMeanHistos.end();
128  histo++) {
129  (*histo).second->Reset();
130  }
131  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
132  for(map<int, MonitorElement*> ::const_iterator histo = wheelSigmaHistos.begin();
133  histo != wheelSigmaHistos.end();
134  histo++) {
135  (*histo).second->Reset();
136  }
137  }
138  if(parameters.getUntrackedParameter<bool>("slopeTest")){
139  for(map<int, MonitorElement*> ::const_iterator histo = wheelSlopeHistos.begin();
140  histo != wheelSlopeHistos.end();
141  histo++) {
142  (*histo).second->Reset();
143  }
144  }
145 
146  cmsMeanHistos.clear();
147  for(int i=-2; i<3; i++){
148  for(int j=1; j<15; j++){
149  MeanFilled[make_pair(i,j)]=false;
150  }
151  }
152  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
153  cmsSigmaHistos.clear();
154  for(int i=-2; i<3; i++){
155  for(int j=1; j<15; j++){
156  SigmaFilled[make_pair(i,j)]=false;
157  }
158  }
159  }
160  if(parameters.getUntrackedParameter<bool>("slopeTest")){
161  cmsSlopeHistos.clear();
162  for(int i=-2; i<3; i++){
163  for(int j=1; j<15; j++){
164  SlopeFilled[make_pair(i,j)]=false;
165  }
166  }
167  }
168 
169 
170  // summary histos initialization
171  for(int wh=-2; wh<=3; wh++){
172  if(wh!=3){
173  for(int xBin=0; xBin<14; xBin++){
174  for(int yBin=0; yBin<11; yBin++){
175  wheelMeanHistos[wh]->setBinContent(xBin,yBin,0);
176  if(parameters.getUntrackedParameter<bool>("sigmaTest"))
177  wheelSigmaHistos[wh]->setBinContent(xBin,yBin,0);
178  if(parameters.getUntrackedParameter<bool>("slopeTest"))
179  wheelSlopeHistos[wh]->setBinContent(xBin,yBin,0);
180  }
181  }
182  }
183  else{
184  for(int xBin=0; xBin<14; xBin++){
185  for(int yBin=-2; yBin<3; yBin++){
186  wheelMeanHistos[wh]->setBinContent(xBin,yBin,0);
187  if(parameters.getUntrackedParameter<bool>("sigmaTest"))
188  wheelSigmaHistos[wh]->setBinContent(xBin,yBin,0);
189  if(parameters.getUntrackedParameter<bool>("slopeTest"))
190  wheelSlopeHistos[wh]->setBinContent(xBin,yBin,0);
191  }
192  }
193  }
194  }
195 
196 
197  edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: "<<nLumiSegs<<" updates";
198 
199  vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
200  vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
201 
202  edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Residual Distribution tests results";
203 
204  for (; ch_it != ch_end; ++ch_it) {
205 
206  DTChamberId chID = (*ch_it)->id();
207 
208  // Fill the test histos
209  int entry=-1;
210  if(chID.station() == 1) entry=0;
211  if(chID.station() == 2) entry=3;
212  if(chID.station() == 3) entry=6;
213  if(chID.station() == 4) entry=9;
214 
215  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
216  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
217 
218  for(; sl_it != sl_end; ++sl_it) {
219 
220  DTSuperLayerId slID = (*sl_it)->id();
221 
222  edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Superlayer: " << slID;
223 
224  stringstream wheel; wheel << slID.wheel();
225  stringstream station; station << slID.station();
226  stringstream sector; sector << slID.sector();
227  stringstream superLayer; superLayer << slID.superlayer();
228 
229  string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
230  string supLayer = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();
231 
232  MonitorElement * res_histo = dbe->get(getMEName(slID));
233  if (res_histo) {
234  // gaussian test
235  string GaussianCriterionName =
236  parameters.getUntrackedParameter<string>("resDistributionTestName",
237  "ResidualsDistributionGaussianTest");
238  const QReport * GaussianReport = res_histo->getQReport(GaussianCriterionName);
239  if(GaussianReport){
240  // FIXE ME: if the quality test fails this cout return a null pointer
241  //edm::LogWarning ("resolution") << "-------- SuperLayer : "<<supLayer<<" "<<GaussianReport->getMessage()<<" ------- "<<GaussianReport->getStatus();
242  }
243  int BinNumber = entry+slID.superLayer();
244  if(BinNumber == 12) BinNumber=11;
245  float mean = (*res_histo).getMean(1);
246  float sigma = (*res_histo).getRMS(1);
247  MeanHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, mean);
248  if(parameters.getUntrackedParameter<bool>("sigmaTest"))
249  SigmaHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, sigma);
250  }
251 
252  if(parameters.getUntrackedParameter<bool>("slopeTest")){
253  MonitorElement * res_histo_2D = dbe->get(getMEName2D(slID));
254  if (res_histo_2D) {
255  TH2F * res_histo_2D_root = res_histo_2D->getTH2F();
256  int BinNumber = entry+slID.superLayer();
257  if(BinNumber == 12) BinNumber=11;
258  TProfile* prof = res_histo_2D_root->ProfileX();
259  prof->GetXaxis()->SetRangeUser(0,2);
260  //prof->Fit("pol1","Q0");
261  try {
262  prof->Fit("pol1","Q0");
263  } catch (...) {
264  edm::LogError ("resolution") << "[DTResolutionTest]: Exception when fitting..."
265  << "SuperLayer : " << slID << "\n"
266  << " STEP : " << parameters.getUntrackedParameter<string>("STEP", "STEP3") << "\n"
267  << "Filling slope histogram with standard value -99. for bin " << BinNumber;
268  SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, -99.);
269  continue;
270  }
271  TF1 *fitting = prof->GetFunction("pol1");
272  double slope = fitting->GetParameter(1);
273  SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, slope);
274  }
275  }
276 
277  }
278  }
279 
280  // Mean test
281  string MeanCriterionName = parameters.getUntrackedParameter<string>("meanTestName","ResidualsMeanInRange");
282  for(map<pair<int,int>, MonitorElement*>::const_iterator hMean = MeanHistos.begin();
283  hMean != MeanHistos.end();
284  hMean++) {
285  const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName);
286  stringstream wheel; wheel << (*hMean).first.first;
287  stringstream sector; sector << (*hMean).first.second;
288  // Report the channels failing the test on the mean
289  if(theMeanQReport) {
290  vector<dqm::me_util::Channel> badChannels = theMeanQReport->getBadChannels();
291  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
292  channel != badChannels.end(); channel++) {
293  edm::LogError("resolution") << "Bad mean channel: wh: " << wheel.str()
294  << " st: " << stationFromBin((*channel).getBin())
295  << " sect: " <<sector.str()
296  << " sl: " << slFromBin((*channel).getBin())
297  << " mean (cm): " << (*channel).getContents();
298  string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
299  if(parameters.getUntrackedParameter<bool>("meanWrongHisto")){
300  MeanHistosSetRange.find(HistoName)->second->Fill((*channel).getBin());
301  MeanHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents());
302  }
303  // fill the wheel summary histos if the SL has not passed the test
304  if(abs((*channel).getContents())<parameters.getUntrackedParameter<double>("meanMaxLimit"))
305  wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,1);
306  else
307  wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,2);
308  // fill the cms summary histo if the percentual of SL which have not passed the test
309  // is more than a predefined treshold
310  if(abs((*channel).getContents())>parameters.getUntrackedParameter<double>("meanMaxLimit")){
311  cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)]++;
312  if(((*hMean).first.second<13 &&
313  double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/11>double(percentual)/100 &&
314  MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false) ||
315  ((*hMean).first.first>=13 &&
316  double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/2>double(percentual)/100 &&
317  MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false)){
318  MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]=true;
319  wheelMeanHistos[3]->Fill(((*hMean).first.second)-1,(*hMean).first.first);
320  }
321  }
322  }
323  // FIXE ME: if the quality test fails this cout return a null pointer
324  //edm::LogWarning ("resolution") << "-------- wheel: "<<wheel.str()<<" sector: "<<sector.str()<<" "<<theMeanQReport->getMessage()<<" ------- "<<theMeanQReport->getStatus();
325  }
326  }
327 
328  // Sigma test
329  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
330  string SigmaCriterionName = parameters.getUntrackedParameter<string>("sigmaTestName","ResidualsSigmaInRange");
331  for(map<pair<int,int>, MonitorElement*>::const_iterator hSigma = SigmaHistos.begin();
332  hSigma != SigmaHistos.end();
333  hSigma++) {
334  const QReport * theSigmaQReport = (*hSigma).second->getQReport(SigmaCriterionName);
335  stringstream wheel; wheel << (*hSigma).first.first;
336  stringstream sector; sector << (*hSigma).first.second;
337  if(theSigmaQReport) {
338  vector<dqm::me_util::Channel> badChannels = theSigmaQReport->getBadChannels();
339  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
340  channel != badChannels.end(); channel++) {
341  edm::LogError("resolution") << "Bad sigma: wh: " << wheel.str()
342  << " st: " << stationFromBin((*channel).getBin())
343  << " sect: " <<sector.str()
344  << " sl: " << slFromBin((*channel).getBin())
345  << " sigma (cm): " << (*channel).getContents();
346  string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
347  SigmaHistosSetRange.find(HistoName)->second->Fill((*channel).getBin());
348  SigmaHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents());
349  // fill the wheel summary histos if the SL has not passed the test
350  wheelSigmaHistos[(*hSigma).first.first]->Fill(((*hSigma).first.second)-1,(*channel).getBin()-1);
351  // fill the cms summary histo if the percentual of SL which have not passed the test
352  // is more than a predefined treshold
353  cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)]++;
354  if(((*hSigma).first.second<13 &&
355  double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/11>double(percentual)/100 &&
356  SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false) ||
357  ((*hSigma).first.first>=13 &&
358  double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/2>double(percentual)/100 &&
359  SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false)){
360  SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]=true;
361  wheelSigmaHistos[3]->Fill((*hSigma).first.second-1,(*hSigma).first.first);
362  }
363  }
364  // FIXE ME: if the quality test fails this cout return a null pointer
365  //edm::LogWarning ("resolution") << "-------- wheel: "<<wheel.str()<<" sector: "<<sector.str()<<" "<<theSigmaQReport->getMessage()<<" ------- "<<theSigmaQReport->getStatus();
366  }
367  }
368  }
369 
370  // Slope test
371  if(parameters.getUntrackedParameter<bool>("slopeTest")){
372  string SlopeCriterionName = parameters.getUntrackedParameter<string>("slopeTestName","ResidualsSlopeInRange");
373  for(map<pair<int,int>, MonitorElement*>::const_iterator hSlope = SlopeHistos.begin();
374  hSlope != SlopeHistos.end();
375  hSlope++) {
376  const QReport * theSlopeQReport = (*hSlope).second->getQReport(SlopeCriterionName);
377  stringstream wheel; wheel << (*hSlope).first.first;
378  stringstream sector; sector << (*hSlope).first.second;
379  if(theSlopeQReport) {
380  vector<dqm::me_util::Channel> badChannels = theSlopeQReport->getBadChannels();
381  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
382  channel != badChannels.end(); channel++) {
383  edm::LogError("resolution") << "Bad slope: wh: " << wheel.str()
384  << " st: " << stationFromBin((*channel).getBin())
385  << " sect: " <<sector.str()
386  << " sl: " << slFromBin((*channel).getBin())
387  << " slope: " << (*channel).getContents();
388  string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
389  SlopeHistosSetRange.find(HistoName)->second->Fill((*channel).getBin());
390  SlopeHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents());
391  // fill the wheel summary histos if the SL has not passed the test
392  wheelSlopeHistos[(*hSlope).first.first]->Fill(((*hSlope).first.second)-1,(*channel).getBin()-1);
393  // fill the cms summary histo if the percentual of SL which have not passed the test
394  // is more than a predefined treshold
395  cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)]++;
396  if(((*hSlope).first.second<13 &&
397  double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/11>double(percentual)/100 &&
398  SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false) ||
399  ((*hSlope).first.first>=13 &&
400  double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/2>double(percentual)/100 &&
401  SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false)){
402  SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]=true;
403  wheelSlopeHistos[3]->Fill((*hSlope).first.second-1,(*hSlope).first.first);
404  }
405  }
406  // FIXE ME: if the quality test fails this cout return a null pointer
407  //edm::LogWarning ("resolution") << "-------- wheel: "<<wheel.str()<<" sector: "<<sector.str()<<" "<<theSlopeQReport->getMessage()<<" ------- "<<theSlopeQReport->getStatus();
408  }
409  }
410  }
411 
412 }
413 
414 
415 
417 
418  edm::LogVerbatim ("resolution") << "[DTResolutionTest] endjob called!";
419  //dbe->rmdir("DT/DTCalibValidation");
420  //dbe->rmdir("DT/Tests/DTResolution");
421  bool outputMEsInRootFile = parameters.getParameter<bool>("OutputMEsInRootFile");
422  if(outputMEsInRootFile){
423  std::string outputFileName = parameters.getParameter<std::string>("OutputFileName");
424  dbe->save(outputFileName,"DT/CalibrationSummary");
425  }
426 
427 }
428 
429 
430 
432 
433  stringstream wheel; wheel << slID.wheel();
434  stringstream station; station << slID.station();
435  stringstream sector; sector << slID.sector();
436  stringstream superLayer; superLayer << slID.superlayer();
437 
438  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
439  string folderName;
440 
441  if(parameters.getUntrackedParameter<bool>("calibModule", false)){
442  folderName =
443  folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() +
444  "/Station" + station.str() +
445  "/Sector" + sector.str() + "/";
446  }
447  else{
448  folderName =
449  folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() +
450  "/Station" + station.str() +
451  "/Sector" + sector.str() + "/";
452  }
453 
454  string histoTag = parameters.getUntrackedParameter<string>("histoTag", "hResDist");
455 
456  string histoname = folderName + histoTag
457  + "_W" + wheel.str()
458  + "_St" + station.str()
459  + "_Sec" + sector.str()
460  + "_SL" + superLayer.str();
461 
462  return histoname;
463 
464 }
465 
466 
468 
469  stringstream wheel; wheel << slID.wheel();
470  stringstream station; station << slID.station();
471  stringstream sector; sector << slID.sector();
472  stringstream superLayer; superLayer << slID.superlayer();
473 
474  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
475  string folderName;
476 
477  if(parameters.getUntrackedParameter<bool>("calibModule", false)){
478  folderName =
479  folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() +
480  "/Station" + station.str() +
481  "/Sector" + sector.str() + "/";
482  }
483  else{
484  folderName =
485  folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() +
486  "/Station" + station.str() +
487  "/Sector" + sector.str() + "/";
488  }
489 
490  string histoTag2D = parameters.getUntrackedParameter<string>("histoTag2D", "hResDistVsDist");
491 
492  string histoname = folderName + histoTag2D
493  + "_W" + wheel.str()
494  + "_St" + station.str()
495  + "_Sec" + sector.str()
496  + "_SL" + superLayer.str();
497 
498  return histoname;
499 
500 }
501 
502 
503 
505 
506  stringstream wheel; wheel << ch.wheel();
507  stringstream sector; sector << ch.sector();
508 
509 
510  string MeanHistoName = "MeanTest_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str();
511  string SigmaHistoName = "SigmaTest_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str();
512  string SlopeHistoName = "SlopeTest_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str();
513 
514  dbe->setCurrentFolder("DT/Tests/DTResolution");
515 
516  // Book the histo for the mean value and set the axis labels
517  MeanHistos[make_pair(ch.wheel(),ch.sector())] = dbe->book1D(MeanHistoName.c_str(),MeanHistoName.c_str(),11,0,11);
518  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1);
519  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1);
520  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1);
521  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1);
522  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1);
523  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1);
524  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1);
525  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1);
526  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1);
527  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1);
528  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1);
529 
530 
531  // Book the histo for the sigma value and set the axis labels
532  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
533  SigmaHistos[make_pair(ch.wheel(),ch.sector())] = dbe->book1D(SigmaHistoName.c_str(),SigmaHistoName.c_str(),11,0,11);
534  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1);
535  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1);
536  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1);
537  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1);
538  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1);
539  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1);
540  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1);
541  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1);
542  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1);
543  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1);
544  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1);
545  }
546 
547  // Book the histo for the slope value and set the axis labels
548  if(parameters.getUntrackedParameter<bool>("slopeTest")){
549  SlopeHistos[make_pair(ch.wheel(),ch.sector())] = dbe->book1D(SlopeHistoName.c_str(),SlopeHistoName.c_str(),11,0,11);
550  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1);
551  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1);
552  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1);
553  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1);
554  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1);
555  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1);
556  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1);
557  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1);
558  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1);
559  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1);
560  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1);
561  }
562 
563  string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
564 
565  if(parameters.getUntrackedParameter<bool>("meanWrongHisto")){
566  string MeanHistoNameSetRange = "MeanWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange";
567  MeanHistosSetRange[HistoName] = dbe->book1D(MeanHistoNameSetRange.c_str(),MeanHistoNameSetRange.c_str(),11,0.5,11.5);
568  string MeanHistoNameSetRange2D = "MeanWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D";
569  MeanHistosSetRange2D[HistoName] = dbe->book2D(MeanHistoNameSetRange2D.c_str(),MeanHistoNameSetRange2D.c_str(),11, 0.5, 11.5, 100, -0.05, 0.05);
570  }
571 
572  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
573  string SigmaHistoNameSetRange = "SigmaWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange";
574  SigmaHistosSetRange[HistoName] = dbe->book1D(SigmaHistoNameSetRange.c_str(),SigmaHistoNameSetRange.c_str(),11,0.5,11.5);
575  string SigmaHistoNameSetRange2D = "SigmaWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D";
576  SigmaHistosSetRange2D[HistoName] = dbe->book2D(SigmaHistoNameSetRange2D.c_str(),SigmaHistoNameSetRange2D.c_str(),11, 0.5, 11.5, 500, 0, 0.5);
577  }
578 
579  if(parameters.getUntrackedParameter<bool>("slopeTest")){
580  string SlopeHistoNameSetRange = "SlopeWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange";
581  SlopeHistosSetRange[HistoName] = dbe->book1D(SlopeHistoNameSetRange.c_str(),SlopeHistoNameSetRange.c_str(),11,0.5,11.5);
582  string SlopeHistoNameSetRange2D = "SlopeWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D";
583  SlopeHistosSetRange2D[HistoName] = dbe->book2D(SlopeHistoNameSetRange2D.c_str(),SlopeHistoNameSetRange2D.c_str(),11, 0.5, 11.5, 200, -0.1, 0.1);
584  }
585 
586 }
587 
588 
590 
591  dbe->setCurrentFolder("DT/CalibrationSummary");
592 
593  if(wheelMeanHistos.find(3) == wheelMeanHistos.end()){
594  string histoName = "MeanSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter<string>("STEP", "STEP3");
595  wheelMeanHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3);
596  wheelMeanHistos[3]->setBinLabel(1,"Sector1",1);
597  wheelMeanHistos[3]->setBinLabel(1,"Sector1",1);
598  wheelMeanHistos[3]->setBinLabel(2,"Sector2",1);
599  wheelMeanHistos[3]->setBinLabel(3,"Sector3",1);
600  wheelMeanHistos[3]->setBinLabel(4,"Sector4",1);
601  wheelMeanHistos[3]->setBinLabel(5,"Sector5",1);
602  wheelMeanHistos[3]->setBinLabel(6,"Sector6",1);
603  wheelMeanHistos[3]->setBinLabel(7,"Sector7",1);
604  wheelMeanHistos[3]->setBinLabel(8,"Sector8",1);
605  wheelMeanHistos[3]->setBinLabel(9,"Sector9",1);
606  wheelMeanHistos[3]->setBinLabel(10,"Sector10",1);
607  wheelMeanHistos[3]->setBinLabel(11,"Sector11",1);
608  wheelMeanHistos[3]->setBinLabel(12,"Sector12",1);
609  wheelMeanHistos[3]->setBinLabel(13,"Sector13",1);
610  wheelMeanHistos[3]->setBinLabel(14,"Sector14",1);
611  wheelMeanHistos[3]->setBinLabel(1,"Wheel-2",2);
612  wheelMeanHistos[3]->setBinLabel(2,"Wheel-1",2);
613  wheelMeanHistos[3]->setBinLabel(3,"Wheel0",2);
614  wheelMeanHistos[3]->setBinLabel(4,"Wheel+1",2);
615  wheelMeanHistos[3]->setBinLabel(5,"Wheel+2",2);
616  }
617 
618  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
619  if(wheelSigmaHistos.find(3) == wheelSigmaHistos.end()){
620  string histoName = "SigmaSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter<string>("STEP", "STEP3");
621  wheelSigmaHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3);
622  wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1);
623  wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1);
624  wheelSigmaHistos[3]->setBinLabel(2,"Sector2",1);
625  wheelSigmaHistos[3]->setBinLabel(3,"Sector3",1);
626  wheelSigmaHistos[3]->setBinLabel(4,"Sector4",1);
627  wheelSigmaHistos[3]->setBinLabel(5,"Sector5",1);
628  wheelSigmaHistos[3]->setBinLabel(6,"Sector6",1);
629  wheelSigmaHistos[3]->setBinLabel(7,"Sector7",1);
630  wheelSigmaHistos[3]->setBinLabel(8,"Sector8",1);
631  wheelSigmaHistos[3]->setBinLabel(9,"Sector9",1);
632  wheelSigmaHistos[3]->setBinLabel(10,"Sector10",1);
633  wheelSigmaHistos[3]->setBinLabel(11,"Sector11",1);
634  wheelSigmaHistos[3]->setBinLabel(12,"Sector12",1);
635  wheelSigmaHistos[3]->setBinLabel(13,"Sector13",1);
636  wheelSigmaHistos[3]->setBinLabel(14,"Sector14",1);
637  wheelSigmaHistos[3]->setBinLabel(1,"Wheel-2",2);
638  wheelSigmaHistos[3]->setBinLabel(2,"Wheel-1",2);
639  wheelSigmaHistos[3]->setBinLabel(3,"Wheel0",2);
640  wheelSigmaHistos[3]->setBinLabel(4,"Wheel+1",2);
641  wheelSigmaHistos[3]->setBinLabel(5,"Wheel+2",2);
642  }
643  }
644 
645  if(parameters.getUntrackedParameter<bool>("slopeTest")){
646  if(wheelSlopeHistos.find(3) == wheelSlopeHistos.end()){
647  string histoName = "SlopeSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter<string>("STEP", "STEP3");
648  wheelSlopeHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3);
649  wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1);
650  wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1);
651  wheelSlopeHistos[3]->setBinLabel(2,"Sector2",1);
652  wheelSlopeHistos[3]->setBinLabel(3,"Sector3",1);
653  wheelSlopeHistos[3]->setBinLabel(4,"Sector4",1);
654  wheelSlopeHistos[3]->setBinLabel(5,"Sector5",1);
655  wheelSlopeHistos[3]->setBinLabel(6,"Sector6",1);
656  wheelSlopeHistos[3]->setBinLabel(7,"Sector7",1);
657  wheelSlopeHistos[3]->setBinLabel(8,"Sector8",1);
658  wheelSlopeHistos[3]->setBinLabel(9,"Sector9",1);
659  wheelSlopeHistos[3]->setBinLabel(10,"Sector10",1);
660  wheelSlopeHistos[3]->setBinLabel(11,"Sector11",1);
661  wheelSlopeHistos[3]->setBinLabel(12,"Sector12",1);
662  wheelSlopeHistos[3]->setBinLabel(13,"Sector13",1);
663  wheelSlopeHistos[3]->setBinLabel(14,"Sector14",1);
664  wheelSlopeHistos[3]->setBinLabel(1,"Wheel-2",2);
665  wheelSlopeHistos[3]->setBinLabel(2,"Wheel-1",2);
666  wheelSlopeHistos[3]->setBinLabel(3,"Wheel0",2);
667  wheelSlopeHistos[3]->setBinLabel(4,"Wheel+1",2);
668  wheelSlopeHistos[3]->setBinLabel(5,"Wheel+2",2);
669  }
670  }
671 
672  stringstream wheel; wheel <<wh;
673 
674  if(wheelMeanHistos.find(wh) == wheelMeanHistos.end()){
675  string histoName = "MeanSummaryRes_testFailed_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str();
676  wheelMeanHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
677  wheelMeanHistos[wh]->setBinLabel(1,"Sector1",1);
678  wheelMeanHistos[wh]->setBinLabel(2,"Sector2",1);
679  wheelMeanHistos[wh]->setBinLabel(3,"Sector3",1);
680  wheelMeanHistos[wh]->setBinLabel(4,"Sector4",1);
681  wheelMeanHistos[wh]->setBinLabel(5,"Sector5",1);
682  wheelMeanHistos[wh]->setBinLabel(6,"Sector6",1);
683  wheelMeanHistos[wh]->setBinLabel(7,"Sector7",1);
684  wheelMeanHistos[wh]->setBinLabel(8,"Sector8",1);
685  wheelMeanHistos[wh]->setBinLabel(9,"Sector9",1);
686  wheelMeanHistos[wh]->setBinLabel(10,"Sector10",1);
687  wheelMeanHistos[wh]->setBinLabel(11,"Sector11",1);
688  wheelMeanHistos[wh]->setBinLabel(12,"Sector12",1);
689  wheelMeanHistos[wh]->setBinLabel(13,"Sector13",1);
690  wheelMeanHistos[wh]->setBinLabel(14,"Sector14",1);
691  wheelMeanHistos[wh]->setBinLabel(1,"MB1_SL1",2);
692  wheelMeanHistos[wh]->setBinLabel(2,"MB1_SL2",2);
693  wheelMeanHistos[wh]->setBinLabel(3,"MB1_SL3",2);
694  wheelMeanHistos[wh]->setBinLabel(4,"MB2_SL1",2);
695  wheelMeanHistos[wh]->setBinLabel(5,"MB2_SL2",2);
696  wheelMeanHistos[wh]->setBinLabel(6,"MB2_SL3",2);
697  wheelMeanHistos[wh]->setBinLabel(7,"MB3_SL1",2);
698  wheelMeanHistos[wh]->setBinLabel(8,"MB3_SL2",2);
699  wheelMeanHistos[wh]->setBinLabel(9,"MB3_SL3",2);
700  wheelMeanHistos[wh]->setBinLabel(10,"MB4_SL1",2);
701  wheelMeanHistos[wh]->setBinLabel(11,"MB4_SL3",2);
702  }
703 
704  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
705  if(wheelSigmaHistos.find(wh) == wheelSigmaHistos.end()){
706  string histoName = "SigmaSummaryRes_testFailed_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str();
707  wheelSigmaHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
708  wheelSigmaHistos[wh]->setBinLabel(1,"Sector1",1);
709  wheelSigmaHistos[wh]->setBinLabel(2,"Sector2",1);
710  wheelSigmaHistos[wh]->setBinLabel(3,"Sector3",1);
711  wheelSigmaHistos[wh]->setBinLabel(4,"Sector4",1);
712  wheelSigmaHistos[wh]->setBinLabel(5,"Sector5",1);
713  wheelSigmaHistos[wh]->setBinLabel(6,"Sector6",1);
714  wheelSigmaHistos[wh]->setBinLabel(7,"Sector7",1);
715  wheelSigmaHistos[wh]->setBinLabel(8,"Sector8",1);
716  wheelSigmaHistos[wh]->setBinLabel(9,"Sector9",1);
717  wheelSigmaHistos[wh]->setBinLabel(10,"Sector10",1);
718  wheelSigmaHistos[wh]->setBinLabel(11,"Sector11",1);
719  wheelSigmaHistos[wh]->setBinLabel(12,"Sector12",1);
720  wheelSigmaHistos[wh]->setBinLabel(13,"Sector13",1);
721  wheelSigmaHistos[wh]->setBinLabel(14,"Sector14",1);
722  wheelSigmaHistos[wh]->setBinLabel(1,"MB1_SL1",2);
723  wheelSigmaHistos[wh]->setBinLabel(2,"MB1_SL2",2);
724  wheelSigmaHistos[wh]->setBinLabel(3,"MB1_SL3",2);
725  wheelSigmaHistos[wh]->setBinLabel(4,"MB2_SL1",2);
726  wheelSigmaHistos[wh]->setBinLabel(5,"MB2_SL2",2);
727  wheelSigmaHistos[wh]->setBinLabel(6,"MB2_SL3",2);
728  wheelSigmaHistos[wh]->setBinLabel(7,"MB3_SL1",2);
729  wheelSigmaHistos[wh]->setBinLabel(8,"MB3_SL2",2);
730  wheelSigmaHistos[wh]->setBinLabel(9,"MB3_SL3",2);
731  wheelSigmaHistos[wh]->setBinLabel(10,"MB4_SL1",2);
732  wheelSigmaHistos[wh]->setBinLabel(11,"MB4_SL3",2);
733  }
734  }
735 
736  if(parameters.getUntrackedParameter<bool>("slopeTest")){
737  if(wheelSlopeHistos.find(wh) == wheelSlopeHistos.end()){
738  string histoName = "SlopeSummaryRes_testFailed_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str();
739  wheelSlopeHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
740  wheelSlopeHistos[wh]->setBinLabel(1,"Sector1",1);
741  wheelSlopeHistos[wh]->setBinLabel(2,"Sector2",1);
742  wheelSlopeHistos[wh]->setBinLabel(3,"Sector3",1);
743  wheelSlopeHistos[wh]->setBinLabel(4,"Sector4",1);
744  wheelSlopeHistos[wh]->setBinLabel(5,"Sector5",1);
745  wheelSlopeHistos[wh]->setBinLabel(6,"Sector6",1);
746  wheelSlopeHistos[wh]->setBinLabel(7,"Sector7",1);
747  wheelSlopeHistos[wh]->setBinLabel(8,"Sector8",1);
748  wheelSlopeHistos[wh]->setBinLabel(9,"Sector9",1);
749  wheelSlopeHistos[wh]->setBinLabel(10,"Sector10",1);
750  wheelSlopeHistos[wh]->setBinLabel(11,"Sector11",1);
751  wheelSlopeHistos[wh]->setBinLabel(12,"Sector12",1);
752  wheelSlopeHistos[wh]->setBinLabel(13,"Sector13",1);
753  wheelSlopeHistos[wh]->setBinLabel(14,"Sector14",1);
754  wheelSlopeHistos[wh]->setBinLabel(1,"MB1_SL1",2);
755  wheelSlopeHistos[wh]->setBinLabel(2,"MB1_SL2",2);
756  wheelSlopeHistos[wh]->setBinLabel(3,"MB1_SL3",2);
757  wheelSlopeHistos[wh]->setBinLabel(4,"MB2_SL1",2);
758  wheelSlopeHistos[wh]->setBinLabel(5,"MB2_SL2",2);
759  wheelSlopeHistos[wh]->setBinLabel(6,"MB2_SL3",2);
760  wheelSlopeHistos[wh]->setBinLabel(7,"MB3_SL1",2);
761  wheelSlopeHistos[wh]->setBinLabel(8,"MB3_SL2",2);
762  wheelSlopeHistos[wh]->setBinLabel(9,"MB3_SL3",2);
763  wheelSlopeHistos[wh]->setBinLabel(10,"MB4_SL1",2);
764  wheelSlopeHistos[wh]->setBinLabel(11,"MB4_SL3",2);
765  }
766  }
767 
768 }
769 
771  return (int) (bin /3.1)+1;
772 }
773 
774 
776  int ret = bin%3;
777  if(ret == 0 || bin == 11) ret = 3;
778 
779  return ret;
780 }
LuminosityBlockID id() const
DTResolutionTest(const edm::ParameterSet &ps)
Constructor.
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
static const double slope[3]
#define abs(x)
Definition: mlp_lapack.h:159
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
DQM Client Diagnostic.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
std::string getMEName(const DTSuperLayerId &slID)
Get the ME name.
void bookHistos()
Definition: Histogram.h:33
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
int superLayer() const
Return the superlayer number.
int j
Definition: DBlmapReader.cc:9
RunNumber_t run() const
int nevents
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
virtual ~DTResolutionTest()
Destructor.
int superlayer() const
Return the superlayer number (deprecated method name)
void bookHistos(const DTChamberId &ch)
book the new ME
void endJob()
Endjob.
std::string getMEName2D(const DTSuperLayerId &slID)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
const T & get() const
Definition: EventSetup.h:55
LuminosityBlockNumber_t luminosityBlock() const
std::string HistoName
int slFromBin(int bin) const
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
TH2F * getTH2F(void) const
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
int stationFromBin(int bin) const
Definition: Run.h:33