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