44 percentual =
parameters.getUntrackedParameter<
int>(
"BadSLpercentual", 10);
72 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: Begin of LS transition";
96 for(map<int, MonitorElement*> ::const_iterator
histo = wheelHistos.begin();
97 histo != wheelHistos.end();
99 (*histo).second->Reset();
102 for(map<int, MonitorElement*> ::const_iterator
histo = wheelUnassHistos.begin();
103 histo != wheelUnassHistos.end();
105 (*histo).second->Reset();
108 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: End of LS transition, performing the DQM client operation";
116 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: "<<nLumiSegs<<
" updates";
118 vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
119 vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
121 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: Efficiency tests results";
124 map <DTLayerId, vector<double> > LayerBadCells;
125 LayerBadCells.clear();
126 map <DTLayerId, vector<double> > LayerUnassBadCells;
127 LayerUnassBadCells.clear();
128 map <DTSuperLayerId, vector<double> > SuperLayerBadCells;
129 SuperLayerBadCells.clear();
130 map <DTSuperLayerId,vector<double> > SuperLayerUnassBadCells;
131 SuperLayerUnassBadCells.clear();
132 map <pair<int,int>,
int> cmsHistos;
134 map <pair<int,int>,
bool> filled;
135 for(
int i=-2;
i<3;
i++){
136 for(
int j=1;
j<15;
j++){
137 filled[make_pair(
i,
j)]=
false;
140 map <pair<int,int>,
int> cmsUnassHistos;
141 cmsUnassHistos.clear();
142 map <pair<int,int>,
bool> UnassFilled;
143 for(
int i=-2;
i<3;
i++){
144 for(
int j=1;
j<15;
j++){
145 UnassFilled[make_pair(
i,
j)]=
false;
152 for (; ch_it != ch_end; ++ch_it) {
154 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
155 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
158 for(; sl_it != sl_end; ++sl_it) {
160 vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
161 vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
164 for(; l_it != l_end; ++l_it) {
167 stringstream wheel; wheel << chID.
wheel();
169 stringstream sector; sector << chID.
sector();
170 stringstream superLayer; superLayer << slID.
superlayer();
171 stringstream layer; layer << lID.
layer();
173 string HistoName =
"W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str() +
"_L" + layer.str();
176 MonitorElement * occupancy_histo = dbe->get(getMEName(
"hEffOccupancy", lID));
177 MonitorElement * unassOccupancy_histo = dbe->get(getMEName(
"hEffUnassOccupancy", lID));
178 MonitorElement * recSegmOccupancy_histo = dbe->get(getMEName(
"hRecSegmOccupancy", lID));
181 if(occupancy_histo && unassOccupancy_histo && recSegmOccupancy_histo) {
182 TH1F * occupancy_histo_root = occupancy_histo->
getTH1F();
183 TH1F * unassOccupancy_histo_root = unassOccupancy_histo->
getTH1F();
184 TH1F * recSegmOccupancy_histo_root = recSegmOccupancy_histo->
getTH1F();
186 const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel();
187 const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel();
190 for(
int bin=firstWire;
bin <= lastWire;
bin++) {
191 if((recSegmOccupancy_histo_root->GetBinContent(
bin))!=0) {
193 if (EfficiencyHistos.find(lID) == EfficiencyHistos.end())
bookHistos(lID, firstWire, lastWire);
194 float efficiency = occupancy_histo_root->GetBinContent(
bin) / recSegmOccupancy_histo_root->GetBinContent(
bin);
195 float errorEff =
sqrt(efficiency*(1-efficiency) / recSegmOccupancy_histo_root->GetBinContent(
bin));
196 EfficiencyHistos.find(lID)->second->setBinContent(
bin, efficiency);
197 EfficiencyHistos.find(lID)->second->setBinError(
bin, errorEff);
199 if (UnassEfficiencyHistos.find(lID) == EfficiencyHistos.end())
bookHistos(lID, firstWire, lastWire);
200 float unassEfficiency = unassOccupancy_histo_root->GetBinContent(
bin) / recSegmOccupancy_histo_root->GetBinContent(
bin);
201 float errorUnassEff =
sqrt(unassEfficiency*(1-unassEfficiency) / recSegmOccupancy_histo_root->GetBinContent(
bin));
202 UnassEfficiencyHistos.find(lID)->second->setBinContent(
bin, unassEfficiency);
203 UnassEfficiencyHistos.find(lID)->second->setBinError(
bin, errorUnassEff);
215 string EfficiencyCriterionName =
parameters.getUntrackedParameter<
string>(
"EfficiencyTestName",
"EfficiencyInRange");
216 for(map<DTLayerId, MonitorElement*>::const_iterator hEff = EfficiencyHistos.begin();
217 hEff != EfficiencyHistos.end();
219 const QReport * theEfficiencyQReport = (*hEff).second->getQReport(EfficiencyCriterionName);
221 if(theEfficiencyQReport) {
222 vector<dqm::me_util::Channel> badChannels = theEfficiencyQReport->
getBadChannels();
223 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
224 channel != badChannels.end(); channel++) {
225 edm::LogError (
"efficiency") <<
"LayerID : "<<getMEName(
"hEffOccupancy",(*hEff).first)<<
" Bad efficiency channels: "<<(*channel).getBin()<<
" Contents : "<<(*channel).getContents();
228 LayerBadCells[(*hEff).first].push_back(counter);
229 LayerBadCells[(*hEff).first].push_back(muonGeom->layer((*hEff).first)->specificTopology().channels());
239 string UnassEfficiencyCriterionName =
parameters.getUntrackedParameter<
string>(
"UnassEfficiencyTestName",
"UnassEfficiencyInRange");
240 for(map<DTLayerId, MonitorElement*>::const_iterator hUnassEff = UnassEfficiencyHistos.begin();
241 hUnassEff != UnassEfficiencyHistos.end();
243 const QReport * theUnassEfficiencyQReport = (*hUnassEff).second->getQReport(UnassEfficiencyCriterionName);
245 if(theUnassEfficiencyQReport) {
246 vector<dqm::me_util::Channel> badChannels = theUnassEfficiencyQReport->
getBadChannels();
247 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
248 channel != badChannels.end(); channel++) {
249 edm::LogError (
"efficiency") <<
"Bad unassEfficiency channels: "<<(*channel).getBin()<<
" "<<(*channel).getContents();
252 LayerUnassBadCells[(*hUnassEff).first].push_back(counter);
253 LayerUnassBadCells[(*hUnassEff).first].push_back(
double(muonGeom->layer((*hUnassEff).first)->specificTopology().channels()));
260 vector<const DTChamber*>::const_iterator ch2_it = muonGeom->chambers().begin();
261 vector<const DTChamber*>::const_iterator ch2_end = muonGeom->chambers().end();
262 for (; ch2_it != ch2_end; ++ch2_it) {
263 vector<const DTSuperLayer*>::const_iterator sl2_it = (*ch2_it)->superLayers().begin();
264 vector<const DTSuperLayer*>::const_iterator sl2_end = (*ch2_it)->superLayers().end();
266 for(; sl2_it != sl2_end; ++sl2_it) {
268 double superLayerBadC=0;
269 double superLayerTotC=0;
270 double superLayerUnassBadC=0;
271 double superLayerUnassTotC=0;
273 vector<const DTLayer*>::const_iterator l2_it = (*sl2_it)->layers().begin();
274 vector<const DTLayer*>::const_iterator l2_end = (*sl2_it)->layers().end();
276 for(; l2_it != l2_end; ++l2_it) {
278 if(LayerBadCells.find(layerId) != LayerBadCells.end() &&
279 LayerUnassBadCells.find(layerId) != LayerUnassBadCells.end()){
281 superLayerBadC+=LayerBadCells[layerId][0];
282 superLayerTotC+=LayerBadCells[layerId][1];
283 superLayerUnassBadC+=LayerUnassBadCells[layerId][0];
284 superLayerUnassTotC+=LayerUnassBadCells[layerId][1];
288 SuperLayerBadCells[sl].push_back(superLayerBadC);
289 SuperLayerBadCells[sl].push_back(superLayerTotC);
290 SuperLayerUnassBadCells[sl].push_back(superLayerUnassBadC);
291 SuperLayerUnassBadCells[sl].push_back(superLayerUnassTotC);
297 for(
map<
DTSuperLayerId, vector<double> >::const_iterator SLBCells = SuperLayerBadCells.begin();
298 SLBCells != SuperLayerBadCells.end();
300 if((*SLBCells).second[0]/(*SLBCells).second[1] >
double(percentual/100)){
301 if(wheelHistos.find((*SLBCells).first.wheel()) == wheelHistos.end())
bookHistos((*SLBCells).first.wheel());
302 if(!((*SLBCells).first.station() == 4 && (*SLBCells).first.superlayer() == 3))
303 wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,((*SLBCells).first.superlayer()-1)+3*((*SLBCells).first.station()-1));
305 wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,10);
308 cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]++;
309 if(((*SLBCells).first.sector()<13 &&
310 double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/11>double(percentual)/100 &&
311 filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==
false) ||
312 ((*SLBCells).first.sector()>=13 &&
313 double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/2>double(percentual)/100 &&
314 filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==
false)){
315 filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]=
true;
316 wheelHistos[3]->Fill((*SLBCells).first.sector()-1,(*SLBCells).first.wheel());
322 for(
map<
DTSuperLayerId, vector<double> >::const_iterator SLUBCells = SuperLayerUnassBadCells.begin();
323 SLUBCells != SuperLayerUnassBadCells.end();
325 if((*SLUBCells).second[0]/(*SLUBCells).second[1] >
double(percentual/100)){
326 if(wheelUnassHistos.find((*SLUBCells).first.wheel()) == wheelUnassHistos.end())
bookHistos((*SLUBCells).first.wheel());
327 if(!((*SLUBCells).first.station() == 4 && (*SLUBCells).first.superlayer() == 3))
328 wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,((*SLUBCells).first.superlayer()-1)+3*((*SLUBCells).first.station()-1));
330 wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,10);
333 cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]++;
334 if(((*SLUBCells).first.sector()<13 &&
335 double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/11>double(percentual)/100 &&
336 UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==
false) ||
337 ((*SLUBCells).first.sector()>=13 &&
338 double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/2>double(percentual)/100 &&
339 UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==
false)){
340 UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]=
true;
341 wheelUnassHistos[3]->Fill((*SLUBCells).first.sector()-1,(*SLUBCells).first.wheel());
355 dbe->rmdir(
"DT/Tests/DTEfficiency");
366 stringstream layer; layer << lID.
layer();
368 string folderRoot =
parameters.getUntrackedParameter<
string>(
"folderRoot",
"Collector/FU0/");
370 folderRoot +
"DT/DTEfficiencyTask/Wheel" + wheel.str() +
371 "/Station" + station.str() +
372 "/Sector" + sector.str() +
373 "/SuperLayer" + superLayer.str() +
"/";
377 +
"_St" + station.str()
378 +
"_Sec" + sector.str()
379 +
"_SL" + superLayer.str()
380 +
"_L" + layer.str();
393 stringstream layer; layer << lId.
layer();
395 string HistoName =
"W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str() +
"_L" + layer.str();
396 string EfficiencyHistoName =
"Efficiency_" +
HistoName;
397 string UnassEfficiencyHistoName =
"UnassEfficiency_" +
HistoName;
399 dbe->setCurrentFolder(
"DT/Tests/DTEfficiency/Wheel" + wheel.str() +
400 "/Station" + station.str() +
401 "/Sector" + sector.str());
403 EfficiencyHistos[lId] = dbe->book1D(EfficiencyHistoName.c_str(),EfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
404 UnassEfficiencyHistos[lId] = dbe->book1D(UnassEfficiencyHistoName.c_str(),UnassEfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
411 dbe->setCurrentFolder(
"DT/Tests/DTEfficiency/SummaryPlot");
413 if(wheelHistos.find(3) == wheelHistos.end()){
414 string histoName =
"ESummary_testFailedByAtLeastBadSL";
415 wheelHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
416 wheelHistos[3]->setBinLabel(1,
"Sector1",1);
417 wheelHistos[3]->setBinLabel(1,
"Sector1",1);
418 wheelHistos[3]->setBinLabel(2,
"Sector2",1);
419 wheelHistos[3]->setBinLabel(3,
"Sector3",1);
420 wheelHistos[3]->setBinLabel(4,
"Sector4",1);
421 wheelHistos[3]->setBinLabel(5,
"Sector5",1);
422 wheelHistos[3]->setBinLabel(6,
"Sector6",1);
423 wheelHistos[3]->setBinLabel(7,
"Sector7",1);
424 wheelHistos[3]->setBinLabel(8,
"Sector8",1);
425 wheelHistos[3]->setBinLabel(9,
"Sector9",1);
426 wheelHistos[3]->setBinLabel(10,
"Sector10",1);
427 wheelHistos[3]->setBinLabel(11,
"Sector11",1);
428 wheelHistos[3]->setBinLabel(12,
"Sector12",1);
429 wheelHistos[3]->setBinLabel(13,
"Sector13",1);
430 wheelHistos[3]->setBinLabel(14,
"Sector14",1);
431 wheelHistos[3]->setBinLabel(1,
"Wheel-2",2);
432 wheelHistos[3]->setBinLabel(2,
"Wheel-1",2);
433 wheelHistos[3]->setBinLabel(3,
"Wheel0",2);
434 wheelHistos[3]->setBinLabel(4,
"Wheel+1",2);
435 wheelHistos[3]->setBinLabel(5,
"Wheel+2",2);
437 if(wheelUnassHistos.find(3) == wheelUnassHistos.end()){
438 string histoName =
"UESummary_testFailedByAtLeastBadSL";
439 wheelUnassHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
440 wheelUnassHistos[3]->setBinLabel(1,
"Sector1",1);
441 wheelUnassHistos[3]->setBinLabel(1,
"Sector1",1);
442 wheelUnassHistos[3]->setBinLabel(2,
"Sector2",1);
443 wheelUnassHistos[3]->setBinLabel(3,
"Sector3",1);
444 wheelUnassHistos[3]->setBinLabel(4,
"Sector4",1);
445 wheelUnassHistos[3]->setBinLabel(5,
"Sector5",1);
446 wheelUnassHistos[3]->setBinLabel(6,
"Sector6",1);
447 wheelUnassHistos[3]->setBinLabel(7,
"Sector7",1);
448 wheelUnassHistos[3]->setBinLabel(8,
"Sector8",1);
449 wheelUnassHistos[3]->setBinLabel(9,
"Sector9",1);
450 wheelUnassHistos[3]->setBinLabel(10,
"Sector10",1);
451 wheelUnassHistos[3]->setBinLabel(11,
"Sector11",1);
452 wheelUnassHistos[3]->setBinLabel(12,
"Sector12",1);
453 wheelUnassHistos[3]->setBinLabel(13,
"Sector13",1);
454 wheelUnassHistos[3]->setBinLabel(14,
"Sector14",1);
455 wheelUnassHistos[3]->setBinLabel(1,
"Wheel-2",2);
456 wheelUnassHistos[3]->setBinLabel(2,
"Wheel-1",2);
457 wheelUnassHistos[3]->setBinLabel(3,
"Wheel0",2);
458 wheelUnassHistos[3]->setBinLabel(4,
"Wheel+1",2);
459 wheelUnassHistos[3]->setBinLabel(5,
"Wheel+2",2);
463 stringstream wheel; wheel <<wh;
465 if(wheelHistos.find(wh) == wheelHistos.end()){
466 string histoName =
"ESummary_testFailed_W" + wheel.str();
467 wheelHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
468 wheelHistos[wh]->setBinLabel(1,
"Sector1",1);
469 wheelHistos[wh]->setBinLabel(2,
"Sector2",1);
470 wheelHistos[wh]->setBinLabel(3,
"Sector3",1);
471 wheelHistos[wh]->setBinLabel(4,
"Sector4",1);
472 wheelHistos[wh]->setBinLabel(5,
"Sector5",1);
473 wheelHistos[wh]->setBinLabel(6,
"Sector6",1);
474 wheelHistos[wh]->setBinLabel(7,
"Sector7",1);
475 wheelHistos[wh]->setBinLabel(8,
"Sector8",1);
476 wheelHistos[wh]->setBinLabel(9,
"Sector9",1);
477 wheelHistos[wh]->setBinLabel(10,
"Sector10",1);
478 wheelHistos[wh]->setBinLabel(11,
"Sector11",1);
479 wheelHistos[wh]->setBinLabel(12,
"Sector12",1);
480 wheelHistos[wh]->setBinLabel(13,
"Sector13",1);
481 wheelHistos[wh]->setBinLabel(14,
"Sector14",1);
482 wheelHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
483 wheelHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
484 wheelHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
485 wheelHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
486 wheelHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
487 wheelHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
488 wheelHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
489 wheelHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
490 wheelHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
491 wheelHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
492 wheelHistos[wh]->setBinLabel(11,
"MB4_SL3",2);
494 if(wheelUnassHistos.find(wh) == wheelUnassHistos.end()){
495 string histoName =
"UESummary_testFailed_W" + wheel.str();
496 wheelUnassHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
497 wheelUnassHistos[wh]->setBinLabel(1,
"Sector1",1);
498 wheelUnassHistos[wh]->setBinLabel(2,
"Sector2",1);
499 wheelUnassHistos[wh]->setBinLabel(3,
"Sector3",1);
500 wheelUnassHistos[wh]->setBinLabel(4,
"Sector4",1);
501 wheelUnassHistos[wh]->setBinLabel(5,
"Sector5",1);
502 wheelUnassHistos[wh]->setBinLabel(6,
"Sector6",1);
503 wheelUnassHistos[wh]->setBinLabel(7,
"Sector7",1);
504 wheelUnassHistos[wh]->setBinLabel(8,
"Sector8",1);
505 wheelUnassHistos[wh]->setBinLabel(9,
"Sector9",1);
506 wheelUnassHistos[wh]->setBinLabel(10,
"Sector10",1);
507 wheelUnassHistos[wh]->setBinLabel(11,
"Sector11",1);
508 wheelUnassHistos[wh]->setBinLabel(12,
"Sector12",1);
509 wheelUnassHistos[wh]->setBinLabel(13,
"Sector13",1);
510 wheelUnassHistos[wh]->setBinLabel(14,
"Sector14",1);
511 wheelUnassHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
512 wheelUnassHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
513 wheelUnassHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
514 wheelUnassHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
515 wheelUnassHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
516 wheelUnassHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
517 wheelUnassHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
518 wheelUnassHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
519 wheelUnassHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
520 wheelUnassHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
521 wheelUnassHistos[wh]->setBinLabel(11,
"MB4_SL3",2);
LuminosityBlockID id() const
virtual ~DTEfficiencyTest()
Destructor.
void beginRun(const edm::Run &r, const edm::EventSetup &c)
Analyze.
int layer() const
Return the layer number.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
void bookHistos(const DTLayerId &ch, int firstWire, int lastWire)
book the new ME
DTEfficiencyTest(const edm::ParameterSet &ps)
Constructor.
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
const std::vector< DQMChannel > & getBadChannels(void) const
int superlayer() const
Return the superlayer number (deprecated method name)
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
DQM Client Diagnostic.
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
static std::atomic< unsigned int > counter
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
int station() const
Return the station number.
int wheel() const
Return the wheel number.
std::string getMEName(std::string histoTag, const DTLayerId &lID)
Get the ME name.