CMS 3D CMS Logo

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