test
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  try {
260  prof->Fit("pol1","Q0");
261  } catch (cms::Exception& iException) {
262  edm::LogError ("resolution") << "[DTResolutionTest]: Exception when fitting..."
263  << "SuperLayer : " << slID << "\n"
264  << " STEP : " << parameters.getUntrackedParameter<string>("STEP", "STEP3") << "\n"
265  << "Filling slope histogram with standard value -99. for bin " << BinNumber;
266  SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, -99.);
267  continue;
268  }
269  TF1 *fitting = prof->GetFunction("pol1");
270  double slope = fitting->GetParameter(1);
271  SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, slope);
272  }
273  }
274 
275  }
276  }
277 
278  // Mean test
279  string MeanCriterionName = parameters.getUntrackedParameter<string>("meanTestName","ResidualsMeanInRange");
280  for(map<pair<int,int>, MonitorElement*>::const_iterator hMean = MeanHistos.begin();
281  hMean != MeanHistos.end();
282  hMean++) {
283  const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName);
284  stringstream wheel; wheel << (*hMean).first.first;
285  stringstream sector; sector << (*hMean).first.second;
286  // Report the channels failing the test on the mean
287  if(theMeanQReport) {
288  vector<dqm::me_util::Channel> badChannels = theMeanQReport->getBadChannels();
289  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
290  channel != badChannels.end(); channel++) {
291  edm::LogError("resolution") << "Bad mean channel: wh: " << wheel.str()
292  << " st: " << stationFromBin((*channel).getBin())
293  << " sect: " <<sector.str()
294  << " sl: " << slFromBin((*channel).getBin())
295  << " mean (cm): " << (*channel).getContents();
296  string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
297  if(parameters.getUntrackedParameter<bool>("meanWrongHisto")){
298  MeanHistosSetRange.find(HistoName)->second->Fill((*channel).getBin());
299  MeanHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents());
300  }
301  // fill the wheel summary histos if the SL has not passed the test
302  if(abs((*channel).getContents())<parameters.getUntrackedParameter<double>("meanMaxLimit"))
303  wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,1);
304  else
305  wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,2);
306  // fill the cms summary histo if the percentual of SL which have not passed the test
307  // is more than a predefined treshold
308  if(abs((*channel).getContents())>parameters.getUntrackedParameter<double>("meanMaxLimit")){
309  cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)]++;
310  if(((*hMean).first.second<13 &&
311  double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/11>double(percentual)/100 &&
312  MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false) ||
313  ((*hMean).first.first>=13 &&
314  double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/2>double(percentual)/100 &&
315  MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false)){
316  MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]=true;
317  wheelMeanHistos[3]->Fill(((*hMean).first.second)-1,(*hMean).first.first);
318  }
319  }
320  }
321  // FIXE ME: if the quality test fails this cout return a null pointer
322  //edm::LogWarning ("resolution") << "-------- wheel: "<<wheel.str()<<" sector: "<<sector.str()<<" "<<theMeanQReport->getMessage()<<" ------- "<<theMeanQReport->getStatus();
323  }
324  }
325 
326  // Sigma test
327  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
328  string SigmaCriterionName = parameters.getUntrackedParameter<string>("sigmaTestName","ResidualsSigmaInRange");
329  for(map<pair<int,int>, MonitorElement*>::const_iterator hSigma = SigmaHistos.begin();
330  hSigma != SigmaHistos.end();
331  hSigma++) {
332  const QReport * theSigmaQReport = (*hSigma).second->getQReport(SigmaCriterionName);
333  stringstream wheel; wheel << (*hSigma).first.first;
334  stringstream sector; sector << (*hSigma).first.second;
335  if(theSigmaQReport) {
336  vector<dqm::me_util::Channel> badChannels = theSigmaQReport->getBadChannels();
337  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
338  channel != badChannels.end(); channel++) {
339  edm::LogError("resolution") << "Bad sigma: wh: " << wheel.str()
340  << " st: " << stationFromBin((*channel).getBin())
341  << " sect: " <<sector.str()
342  << " sl: " << slFromBin((*channel).getBin())
343  << " sigma (cm): " << (*channel).getContents();
344  string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
345  SigmaHistosSetRange.find(HistoName)->second->Fill((*channel).getBin());
346  SigmaHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents());
347  // fill the wheel summary histos if the SL has not passed the test
348  wheelSigmaHistos[(*hSigma).first.first]->Fill(((*hSigma).first.second)-1,(*channel).getBin()-1);
349  // fill the cms summary histo if the percentual of SL which have not passed the test
350  // is more than a predefined treshold
351  cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)]++;
352  if(((*hSigma).first.second<13 &&
353  double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/11>double(percentual)/100 &&
354  SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false) ||
355  ((*hSigma).first.first>=13 &&
356  double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/2>double(percentual)/100 &&
357  SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false)){
358  SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]=true;
359  wheelSigmaHistos[3]->Fill((*hSigma).first.second-1,(*hSigma).first.first);
360  }
361  }
362  // FIXE ME: if the quality test fails this cout return a null pointer
363  //edm::LogWarning ("resolution") << "-------- wheel: "<<wheel.str()<<" sector: "<<sector.str()<<" "<<theSigmaQReport->getMessage()<<" ------- "<<theSigmaQReport->getStatus();
364  }
365  }
366  }
367 
368  // Slope test
369  if(parameters.getUntrackedParameter<bool>("slopeTest")){
370  string SlopeCriterionName = parameters.getUntrackedParameter<string>("slopeTestName","ResidualsSlopeInRange");
371  for(map<pair<int,int>, MonitorElement*>::const_iterator hSlope = SlopeHistos.begin();
372  hSlope != SlopeHistos.end();
373  hSlope++) {
374  const QReport * theSlopeQReport = (*hSlope).second->getQReport(SlopeCriterionName);
375  stringstream wheel; wheel << (*hSlope).first.first;
376  stringstream sector; sector << (*hSlope).first.second;
377  if(theSlopeQReport) {
378  vector<dqm::me_util::Channel> badChannels = theSlopeQReport->getBadChannels();
379  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
380  channel != badChannels.end(); channel++) {
381  edm::LogError("resolution") << "Bad slope: wh: " << wheel.str()
382  << " st: " << stationFromBin((*channel).getBin())
383  << " sect: " <<sector.str()
384  << " sl: " << slFromBin((*channel).getBin())
385  << " slope: " << (*channel).getContents();
386  string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
387  SlopeHistosSetRange.find(HistoName)->second->Fill((*channel).getBin());
388  SlopeHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents());
389  // fill the wheel summary histos if the SL has not passed the test
390  wheelSlopeHistos[(*hSlope).first.first]->Fill(((*hSlope).first.second)-1,(*channel).getBin()-1);
391  // fill the cms summary histo if the percentual of SL which have not passed the test
392  // is more than a predefined treshold
393  cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)]++;
394  if(((*hSlope).first.second<13 &&
395  double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/11>double(percentual)/100 &&
396  SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false) ||
397  ((*hSlope).first.first>=13 &&
398  double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/2>double(percentual)/100 &&
399  SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false)){
400  SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]=true;
401  wheelSlopeHistos[3]->Fill((*hSlope).first.second-1,(*hSlope).first.first);
402  }
403  }
404  // FIXE ME: if the quality test fails this cout return a null pointer
405  //edm::LogWarning ("resolution") << "-------- wheel: "<<wheel.str()<<" sector: "<<sector.str()<<" "<<theSlopeQReport->getMessage()<<" ------- "<<theSlopeQReport->getStatus();
406  }
407  }
408  }
409 
410 }
411 
412 
413 
415 
416  edm::LogVerbatim ("resolution") << "[DTResolutionTest] endjob called!";
417  //dbe->rmdir("DT/DTCalibValidation");
418  //dbe->rmdir("DT/Tests/DTResolution");
419  bool outputMEsInRootFile = parameters.getParameter<bool>("OutputMEsInRootFile");
420  if(outputMEsInRootFile){
421  std::string outputFileName = parameters.getParameter<std::string>("OutputFileName");
422  dbe->save(outputFileName,"DT/CalibrationSummary");
423  }
424 
425 }
426 
427 
428 
430 
431  stringstream wheel; wheel << slID.wheel();
432  stringstream station; station << slID.station();
433  stringstream sector; sector << slID.sector();
434  stringstream superLayer; superLayer << slID.superlayer();
435 
436  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
437  string folderName;
438 
439  if(parameters.getUntrackedParameter<bool>("calibModule", false)){
440  folderName =
441  folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() +
442  "/Station" + station.str() +
443  "/Sector" + sector.str() + "/";
444  }
445  else{
446  folderName =
447  folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() +
448  "/Station" + station.str() +
449  "/Sector" + sector.str() + "/";
450  }
451 
452  string histoTag = parameters.getUntrackedParameter<string>("histoTag", "hResDist");
453 
454  string histoname = folderName + histoTag
455  + "_W" + wheel.str()
456  + "_St" + station.str()
457  + "_Sec" + sector.str()
458  + "_SL" + superLayer.str();
459 
460  return histoname;
461 
462 }
463 
464 
466 
467  stringstream wheel; wheel << slID.wheel();
468  stringstream station; station << slID.station();
469  stringstream sector; sector << slID.sector();
470  stringstream superLayer; superLayer << slID.superlayer();
471 
472  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
473  string folderName;
474 
475  if(parameters.getUntrackedParameter<bool>("calibModule", false)){
476  folderName =
477  folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() +
478  "/Station" + station.str() +
479  "/Sector" + sector.str() + "/";
480  }
481  else{
482  folderName =
483  folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() +
484  "/Station" + station.str() +
485  "/Sector" + sector.str() + "/";
486  }
487 
488  string histoTag2D = parameters.getUntrackedParameter<string>("histoTag2D", "hResDistVsDist");
489 
490  string histoname = folderName + histoTag2D
491  + "_W" + wheel.str()
492  + "_St" + station.str()
493  + "_Sec" + sector.str()
494  + "_SL" + superLayer.str();
495 
496  return histoname;
497 
498 }
499 
500 
501 
503 
504  stringstream wheel; wheel << ch.wheel();
505  stringstream sector; sector << ch.sector();
506 
507 
508  string MeanHistoName = "MeanTest_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str();
509  string SigmaHistoName = "SigmaTest_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str();
510  string SlopeHistoName = "SlopeTest_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str();
511 
512  dbe->setCurrentFolder("DT/Tests/DTResolution");
513 
514  // Book the histo for the mean value and set the axis labels
515  MeanHistos[make_pair(ch.wheel(),ch.sector())] = dbe->book1D(MeanHistoName.c_str(),MeanHistoName.c_str(),11,0,11);
516  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1);
517  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1);
518  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1);
519  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1);
520  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1);
521  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1);
522  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1);
523  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1);
524  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1);
525  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1);
526  (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1);
527 
528 
529  // Book the histo for the sigma value and set the axis labels
530  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
531  SigmaHistos[make_pair(ch.wheel(),ch.sector())] = dbe->book1D(SigmaHistoName.c_str(),SigmaHistoName.c_str(),11,0,11);
532  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1);
533  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1);
534  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1);
535  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1);
536  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1);
537  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1);
538  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1);
539  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1);
540  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1);
541  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1);
542  (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1);
543  }
544 
545  // Book the histo for the slope value and set the axis labels
546  if(parameters.getUntrackedParameter<bool>("slopeTest")){
547  SlopeHistos[make_pair(ch.wheel(),ch.sector())] = dbe->book1D(SlopeHistoName.c_str(),SlopeHistoName.c_str(),11,0,11);
548  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1);
549  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1);
550  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1);
551  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1);
552  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1);
553  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1);
554  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1);
555  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1);
556  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1);
557  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1);
558  (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1);
559  }
560 
561  string HistoName = "W" + wheel.str() + "_Sec" + sector.str();
562 
563  if(parameters.getUntrackedParameter<bool>("meanWrongHisto")){
564  string MeanHistoNameSetRange = "MeanWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange";
565  MeanHistosSetRange[HistoName] = dbe->book1D(MeanHistoNameSetRange.c_str(),MeanHistoNameSetRange.c_str(),11,0.5,11.5);
566  string MeanHistoNameSetRange2D = "MeanWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D";
567  MeanHistosSetRange2D[HistoName] = dbe->book2D(MeanHistoNameSetRange2D.c_str(),MeanHistoNameSetRange2D.c_str(),11, 0.5, 11.5, 100, -0.05, 0.05);
568  }
569 
570  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
571  string SigmaHistoNameSetRange = "SigmaWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange";
572  SigmaHistosSetRange[HistoName] = dbe->book1D(SigmaHistoNameSetRange.c_str(),SigmaHistoNameSetRange.c_str(),11,0.5,11.5);
573  string SigmaHistoNameSetRange2D = "SigmaWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D";
574  SigmaHistosSetRange2D[HistoName] = dbe->book2D(SigmaHistoNameSetRange2D.c_str(),SigmaHistoNameSetRange2D.c_str(),11, 0.5, 11.5, 500, 0, 0.5);
575  }
576 
577  if(parameters.getUntrackedParameter<bool>("slopeTest")){
578  string SlopeHistoNameSetRange = "SlopeWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange";
579  SlopeHistosSetRange[HistoName] = dbe->book1D(SlopeHistoNameSetRange.c_str(),SlopeHistoNameSetRange.c_str(),11,0.5,11.5);
580  string SlopeHistoNameSetRange2D = "SlopeWrong_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D";
581  SlopeHistosSetRange2D[HistoName] = dbe->book2D(SlopeHistoNameSetRange2D.c_str(),SlopeHistoNameSetRange2D.c_str(),11, 0.5, 11.5, 200, -0.1, 0.1);
582  }
583 
584 }
585 
586 
588 
589  dbe->setCurrentFolder("DT/CalibrationSummary");
590 
591  if(wheelMeanHistos.find(3) == wheelMeanHistos.end()){
592  string histoName = "MeanSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter<string>("STEP", "STEP3");
593  wheelMeanHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3);
594  wheelMeanHistos[3]->setBinLabel(1,"Sector1",1);
595  wheelMeanHistos[3]->setBinLabel(1,"Sector1",1);
596  wheelMeanHistos[3]->setBinLabel(2,"Sector2",1);
597  wheelMeanHistos[3]->setBinLabel(3,"Sector3",1);
598  wheelMeanHistos[3]->setBinLabel(4,"Sector4",1);
599  wheelMeanHistos[3]->setBinLabel(5,"Sector5",1);
600  wheelMeanHistos[3]->setBinLabel(6,"Sector6",1);
601  wheelMeanHistos[3]->setBinLabel(7,"Sector7",1);
602  wheelMeanHistos[3]->setBinLabel(8,"Sector8",1);
603  wheelMeanHistos[3]->setBinLabel(9,"Sector9",1);
604  wheelMeanHistos[3]->setBinLabel(10,"Sector10",1);
605  wheelMeanHistos[3]->setBinLabel(11,"Sector11",1);
606  wheelMeanHistos[3]->setBinLabel(12,"Sector12",1);
607  wheelMeanHistos[3]->setBinLabel(13,"Sector13",1);
608  wheelMeanHistos[3]->setBinLabel(14,"Sector14",1);
609  wheelMeanHistos[3]->setBinLabel(1,"Wheel-2",2);
610  wheelMeanHistos[3]->setBinLabel(2,"Wheel-1",2);
611  wheelMeanHistos[3]->setBinLabel(3,"Wheel0",2);
612  wheelMeanHistos[3]->setBinLabel(4,"Wheel+1",2);
613  wheelMeanHistos[3]->setBinLabel(5,"Wheel+2",2);
614  }
615 
616  if(parameters.getUntrackedParameter<bool>("sigmaTest")){
617  if(wheelSigmaHistos.find(3) == wheelSigmaHistos.end()){
618  string histoName = "SigmaSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter<string>("STEP", "STEP3");
619  wheelSigmaHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3);
620  wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1);
621  wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1);
622  wheelSigmaHistos[3]->setBinLabel(2,"Sector2",1);
623  wheelSigmaHistos[3]->setBinLabel(3,"Sector3",1);
624  wheelSigmaHistos[3]->setBinLabel(4,"Sector4",1);
625  wheelSigmaHistos[3]->setBinLabel(5,"Sector5",1);
626  wheelSigmaHistos[3]->setBinLabel(6,"Sector6",1);
627  wheelSigmaHistos[3]->setBinLabel(7,"Sector7",1);
628  wheelSigmaHistos[3]->setBinLabel(8,"Sector8",1);
629  wheelSigmaHistos[3]->setBinLabel(9,"Sector9",1);
630  wheelSigmaHistos[3]->setBinLabel(10,"Sector10",1);
631  wheelSigmaHistos[3]->setBinLabel(11,"Sector11",1);
632  wheelSigmaHistos[3]->setBinLabel(12,"Sector12",1);
633  wheelSigmaHistos[3]->setBinLabel(13,"Sector13",1);
634  wheelSigmaHistos[3]->setBinLabel(14,"Sector14",1);
635  wheelSigmaHistos[3]->setBinLabel(1,"Wheel-2",2);
636  wheelSigmaHistos[3]->setBinLabel(2,"Wheel-1",2);
637  wheelSigmaHistos[3]->setBinLabel(3,"Wheel0",2);
638  wheelSigmaHistos[3]->setBinLabel(4,"Wheel+1",2);
639  wheelSigmaHistos[3]->setBinLabel(5,"Wheel+2",2);
640  }
641  }
642 
643  if(parameters.getUntrackedParameter<bool>("slopeTest")){
644  if(wheelSlopeHistos.find(3) == wheelSlopeHistos.end()){
645  string histoName = "SlopeSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter<string>("STEP", "STEP3");
646  wheelSlopeHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3);
647  wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1);
648  wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1);
649  wheelSlopeHistos[3]->setBinLabel(2,"Sector2",1);
650  wheelSlopeHistos[3]->setBinLabel(3,"Sector3",1);
651  wheelSlopeHistos[3]->setBinLabel(4,"Sector4",1);
652  wheelSlopeHistos[3]->setBinLabel(5,"Sector5",1);
653  wheelSlopeHistos[3]->setBinLabel(6,"Sector6",1);
654  wheelSlopeHistos[3]->setBinLabel(7,"Sector7",1);
655  wheelSlopeHistos[3]->setBinLabel(8,"Sector8",1);
656  wheelSlopeHistos[3]->setBinLabel(9,"Sector9",1);
657  wheelSlopeHistos[3]->setBinLabel(10,"Sector10",1);
658  wheelSlopeHistos[3]->setBinLabel(11,"Sector11",1);
659  wheelSlopeHistos[3]->setBinLabel(12,"Sector12",1);
660  wheelSlopeHistos[3]->setBinLabel(13,"Sector13",1);
661  wheelSlopeHistos[3]->setBinLabel(14,"Sector14",1);
662  wheelSlopeHistos[3]->setBinLabel(1,"Wheel-2",2);
663  wheelSlopeHistos[3]->setBinLabel(2,"Wheel-1",2);
664  wheelSlopeHistos[3]->setBinLabel(3,"Wheel0",2);
665  wheelSlopeHistos[3]->setBinLabel(4,"Wheel+1",2);
666  wheelSlopeHistos[3]->setBinLabel(5,"Wheel+2",2);
667  }
668  }
669 
670  stringstream wheel; wheel <<wh;
671 
672  if(wheelMeanHistos.find(wh) == wheelMeanHistos.end()){
673  string histoName = "MeanSummaryRes_testFailed_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str();
674  wheelMeanHistos[wh] = dbe->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") + "_W" + wheel.str();
705  wheelSigmaHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
706  wheelSigmaHistos[wh]->setBinLabel(1,"Sector1",1);
707  wheelSigmaHistos[wh]->setBinLabel(2,"Sector2",1);
708  wheelSigmaHistos[wh]->setBinLabel(3,"Sector3",1);
709  wheelSigmaHistos[wh]->setBinLabel(4,"Sector4",1);
710  wheelSigmaHistos[wh]->setBinLabel(5,"Sector5",1);
711  wheelSigmaHistos[wh]->setBinLabel(6,"Sector6",1);
712  wheelSigmaHistos[wh]->setBinLabel(7,"Sector7",1);
713  wheelSigmaHistos[wh]->setBinLabel(8,"Sector8",1);
714  wheelSigmaHistos[wh]->setBinLabel(9,"Sector9",1);
715  wheelSigmaHistos[wh]->setBinLabel(10,"Sector10",1);
716  wheelSigmaHistos[wh]->setBinLabel(11,"Sector11",1);
717  wheelSigmaHistos[wh]->setBinLabel(12,"Sector12",1);
718  wheelSigmaHistos[wh]->setBinLabel(13,"Sector13",1);
719  wheelSigmaHistos[wh]->setBinLabel(14,"Sector14",1);
720  wheelSigmaHistos[wh]->setBinLabel(1,"MB1_SL1",2);
721  wheelSigmaHistos[wh]->setBinLabel(2,"MB1_SL2",2);
722  wheelSigmaHistos[wh]->setBinLabel(3,"MB1_SL3",2);
723  wheelSigmaHistos[wh]->setBinLabel(4,"MB2_SL1",2);
724  wheelSigmaHistos[wh]->setBinLabel(5,"MB2_SL2",2);
725  wheelSigmaHistos[wh]->setBinLabel(6,"MB2_SL3",2);
726  wheelSigmaHistos[wh]->setBinLabel(7,"MB3_SL1",2);
727  wheelSigmaHistos[wh]->setBinLabel(8,"MB3_SL2",2);
728  wheelSigmaHistos[wh]->setBinLabel(9,"MB3_SL3",2);
729  wheelSigmaHistos[wh]->setBinLabel(10,"MB4_SL1",2);
730  wheelSigmaHistos[wh]->setBinLabel(11,"MB4_SL3",2);
731  }
732  }
733 
734  if(parameters.getUntrackedParameter<bool>("slopeTest")){
735  if(wheelSlopeHistos.find(wh) == wheelSlopeHistos.end()){
736  string histoName = "SlopeSummaryRes_testFailed_" + parameters.getUntrackedParameter<string>("STEP", "STEP3") + "_W" + wheel.str();
737  wheelSlopeHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
738  wheelSlopeHistos[wh]->setBinLabel(1,"Sector1",1);
739  wheelSlopeHistos[wh]->setBinLabel(2,"Sector2",1);
740  wheelSlopeHistos[wh]->setBinLabel(3,"Sector3",1);
741  wheelSlopeHistos[wh]->setBinLabel(4,"Sector4",1);
742  wheelSlopeHistos[wh]->setBinLabel(5,"Sector5",1);
743  wheelSlopeHistos[wh]->setBinLabel(6,"Sector6",1);
744  wheelSlopeHistos[wh]->setBinLabel(7,"Sector7",1);
745  wheelSlopeHistos[wh]->setBinLabel(8,"Sector8",1);
746  wheelSlopeHistos[wh]->setBinLabel(9,"Sector9",1);
747  wheelSlopeHistos[wh]->setBinLabel(10,"Sector10",1);
748  wheelSlopeHistos[wh]->setBinLabel(11,"Sector11",1);
749  wheelSlopeHistos[wh]->setBinLabel(12,"Sector12",1);
750  wheelSlopeHistos[wh]->setBinLabel(13,"Sector13",1);
751  wheelSlopeHistos[wh]->setBinLabel(14,"Sector14",1);
752  wheelSlopeHistos[wh]->setBinLabel(1,"MB1_SL1",2);
753  wheelSlopeHistos[wh]->setBinLabel(2,"MB1_SL2",2);
754  wheelSlopeHistos[wh]->setBinLabel(3,"MB1_SL3",2);
755  wheelSlopeHistos[wh]->setBinLabel(4,"MB2_SL1",2);
756  wheelSlopeHistos[wh]->setBinLabel(5,"MB2_SL2",2);
757  wheelSlopeHistos[wh]->setBinLabel(6,"MB2_SL3",2);
758  wheelSlopeHistos[wh]->setBinLabel(7,"MB3_SL1",2);
759  wheelSlopeHistos[wh]->setBinLabel(8,"MB3_SL2",2);
760  wheelSlopeHistos[wh]->setBinLabel(9,"MB3_SL3",2);
761  wheelSlopeHistos[wh]->setBinLabel(10,"MB4_SL1",2);
762  wheelSlopeHistos[wh]->setBinLabel(11,"MB4_SL3",2);
763  }
764  }
765 
766 }
767 
769  return (int) (bin /3.1)+1;
770 }
771 
772 
774  int ret = bin%3;
775  if(ret == 0 || bin == 11) ret = 3;
776 
777  return ret;
778 }
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