46 percentual =
parameters.getUntrackedParameter<
int>(
"BadSLpercentual", 10);
74 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: Begin of LS transition";
98 for(map<int, MonitorElement*> ::const_iterator
histo = wheelHistos.begin();
99 histo != wheelHistos.end();
101 (*histo).second->Reset();
104 for(map<int, MonitorElement*> ::const_iterator
histo = wheelUnassHistos.begin();
105 histo != wheelUnassHistos.end();
107 (*histo).second->Reset();
110 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: End of LS transition, performing the DQM client operation";
118 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: "<<nLumiSegs<<
" updates";
120 vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
121 vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
123 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: Efficiency tests results";
126 map <DTLayerId, vector<double> > LayerBadCells;
127 LayerBadCells.clear();
128 map <DTLayerId, vector<double> > LayerUnassBadCells;
129 LayerUnassBadCells.clear();
130 map <DTSuperLayerId, vector<double> > SuperLayerBadCells;
131 SuperLayerBadCells.clear();
132 map <DTSuperLayerId,vector<double> > SuperLayerUnassBadCells;
133 SuperLayerUnassBadCells.clear();
134 map <pair<int,int>,
int> cmsHistos;
136 map <pair<int,int>,
bool> filled;
137 for(
int i=-2;
i<3;
i++){
138 for(
int j=1;
j<15;
j++){
139 filled[make_pair(
i,
j)]=
false;
142 map <pair<int,int>,
int> cmsUnassHistos;
143 cmsUnassHistos.clear();
144 map <pair<int,int>,
bool> UnassFilled;
145 for(
int i=-2;
i<3;
i++){
146 for(
int j=1;
j<15;
j++){
147 UnassFilled[make_pair(
i,
j)]=
false;
154 for (; ch_it != ch_end; ++ch_it) {
156 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
157 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
160 for(; sl_it != sl_end; ++sl_it) {
162 vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
163 vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
166 for(; l_it != l_end; ++l_it) {
169 stringstream wheel; wheel << chID.
wheel();
171 stringstream sector; sector << chID.
sector();
172 stringstream superLayer; superLayer << slID.
superlayer();
173 stringstream layer; layer << lID.
layer();
175 string HistoName =
"W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str() +
"_L" + layer.str();
178 MonitorElement * occupancy_histo = dbe->get(getMEName(
"hEffOccupancy", lID));
179 MonitorElement * unassOccupancy_histo = dbe->get(getMEName(
"hEffUnassOccupancy", lID));
180 MonitorElement * recSegmOccupancy_histo = dbe->get(getMEName(
"hRecSegmOccupancy", lID));
183 if(occupancy_histo && unassOccupancy_histo && recSegmOccupancy_histo) {
184 TH1F * occupancy_histo_root = occupancy_histo->
getTH1F();
185 TH1F * unassOccupancy_histo_root = unassOccupancy_histo->
getTH1F();
186 TH1F * recSegmOccupancy_histo_root = recSegmOccupancy_histo->
getTH1F();
188 const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel();
189 const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel();
192 for(
int bin=firstWire;
bin <= lastWire;
bin++) {
193 if((recSegmOccupancy_histo_root->GetBinContent(
bin))!=0) {
195 if (EfficiencyHistos.find(lID) == EfficiencyHistos.end())
bookHistos(lID, firstWire, lastWire);
196 float efficiency = occupancy_histo_root->GetBinContent(
bin) / recSegmOccupancy_histo_root->GetBinContent(
bin);
197 float errorEff =
sqrt(efficiency*(1-efficiency) / recSegmOccupancy_histo_root->GetBinContent(
bin));
198 EfficiencyHistos.find(lID)->second->setBinContent(
bin, efficiency);
199 EfficiencyHistos.find(lID)->second->setBinError(
bin, errorEff);
201 if (UnassEfficiencyHistos.find(lID) == EfficiencyHistos.end())
bookHistos(lID, firstWire, lastWire);
202 float unassEfficiency = unassOccupancy_histo_root->GetBinContent(
bin) / recSegmOccupancy_histo_root->GetBinContent(
bin);
203 float errorUnassEff =
sqrt(unassEfficiency*(1-unassEfficiency) / recSegmOccupancy_histo_root->GetBinContent(
bin));
204 UnassEfficiencyHistos.find(lID)->second->setBinContent(
bin, unassEfficiency);
205 UnassEfficiencyHistos.find(lID)->second->setBinError(
bin, errorUnassEff);
217 string EfficiencyCriterionName =
parameters.getUntrackedParameter<
string>(
"EfficiencyTestName",
"EfficiencyInRange");
218 for(map<DTLayerId, MonitorElement*>::const_iterator hEff = EfficiencyHistos.begin();
219 hEff != EfficiencyHistos.end();
221 const QReport * theEfficiencyQReport = (*hEff).second->getQReport(EfficiencyCriterionName);
223 if(theEfficiencyQReport) {
224 vector<dqm::me_util::Channel> badChannels = theEfficiencyQReport->
getBadChannels();
225 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
226 channel != badChannels.end(); channel++) {
227 edm::LogError (
"efficiency") <<
"LayerID : "<<getMEName(
"hEffOccupancy",(*hEff).first)<<
" Bad efficiency channels: "<<(*channel).getBin()<<
" Contents : "<<(*channel).getContents();
230 LayerBadCells[(*hEff).first].push_back(counter);
231 LayerBadCells[(*hEff).first].push_back(muonGeom->layer((*hEff).first)->specificTopology().channels());
241 string UnassEfficiencyCriterionName =
parameters.getUntrackedParameter<
string>(
"UnassEfficiencyTestName",
"UnassEfficiencyInRange");
242 for(map<DTLayerId, MonitorElement*>::const_iterator hUnassEff = UnassEfficiencyHistos.begin();
243 hUnassEff != UnassEfficiencyHistos.end();
245 const QReport * theUnassEfficiencyQReport = (*hUnassEff).second->getQReport(UnassEfficiencyCriterionName);
247 if(theUnassEfficiencyQReport) {
248 vector<dqm::me_util::Channel> badChannels = theUnassEfficiencyQReport->
getBadChannels();
249 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
250 channel != badChannels.end(); channel++) {
251 edm::LogError (
"efficiency") <<
"Bad unassEfficiency channels: "<<(*channel).getBin()<<
" "<<(*channel).getContents();
254 LayerUnassBadCells[(*hUnassEff).first].push_back(counter);
255 LayerUnassBadCells[(*hUnassEff).first].push_back(
double(muonGeom->layer((*hUnassEff).first)->specificTopology().channels()));
262 vector<DTChamber*>::const_iterator ch2_it = muonGeom->chambers().begin();
263 vector<DTChamber*>::const_iterator ch2_end = muonGeom->chambers().end();
264 for (; ch2_it != ch2_end; ++ch2_it) {
265 vector<const DTSuperLayer*>::const_iterator sl2_it = (*ch2_it)->superLayers().begin();
266 vector<const DTSuperLayer*>::const_iterator sl2_end = (*ch2_it)->superLayers().end();
268 for(; sl2_it != sl2_end; ++sl2_it) {
270 double superLayerBadC=0;
271 double superLayerTotC=0;
272 double superLayerUnassBadC=0;
273 double superLayerUnassTotC=0;
275 vector<const DTLayer*>::const_iterator l2_it = (*sl2_it)->layers().begin();
276 vector<const DTLayer*>::const_iterator l2_end = (*sl2_it)->layers().end();
278 for(; l2_it != l2_end; ++l2_it) {
280 if(LayerBadCells.find(layerId) != LayerBadCells.end() &&
281 LayerUnassBadCells.find(layerId) != LayerUnassBadCells.end()){
283 superLayerBadC+=LayerBadCells[layerId][0];
284 superLayerTotC+=LayerBadCells[layerId][1];
285 superLayerUnassBadC+=LayerUnassBadCells[layerId][0];
286 superLayerUnassTotC+=LayerUnassBadCells[layerId][1];
290 SuperLayerBadCells[sl].push_back(superLayerBadC);
291 SuperLayerBadCells[sl].push_back(superLayerTotC);
292 SuperLayerUnassBadCells[sl].push_back(superLayerUnassBadC);
293 SuperLayerUnassBadCells[sl].push_back(superLayerUnassTotC);
299 for(
map<
DTSuperLayerId, vector<double> >::const_iterator SLBCells = SuperLayerBadCells.begin();
300 SLBCells != SuperLayerBadCells.end();
302 if((*SLBCells).second[0]/(*SLBCells).second[1] >
double(percentual/100)){
303 if(wheelHistos.find((*SLBCells).first.wheel()) == wheelHistos.end())
bookHistos((*SLBCells).first.wheel());
304 if(!((*SLBCells).first.station() == 4 && (*SLBCells).first.superlayer() == 3))
305 wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,((*SLBCells).first.superlayer()-1)+3*((*SLBCells).first.station()-1));
307 wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,10);
310 cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]++;
311 if(((*SLBCells).first.sector()<13 &&
312 double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/11>double(percentual)/100 &&
313 filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==
false) ||
314 ((*SLBCells).first.sector()>=13 &&
315 double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/2>double(percentual)/100 &&
316 filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==
false)){
317 filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]=
true;
318 wheelHistos[3]->Fill((*SLBCells).first.sector()-1,(*SLBCells).first.wheel());
324 for(
map<
DTSuperLayerId, vector<double> >::const_iterator SLUBCells = SuperLayerUnassBadCells.begin();
325 SLUBCells != SuperLayerUnassBadCells.end();
327 if((*SLUBCells).second[0]/(*SLUBCells).second[1] >
double(percentual/100)){
328 if(wheelUnassHistos.find((*SLUBCells).first.wheel()) == wheelUnassHistos.end())
bookHistos((*SLUBCells).first.wheel());
329 if(!((*SLUBCells).first.station() == 4 && (*SLUBCells).first.superlayer() == 3))
330 wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,((*SLUBCells).first.superlayer()-1)+3*((*SLUBCells).first.station()-1));
332 wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,10);
335 cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]++;
336 if(((*SLUBCells).first.sector()<13 &&
337 double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/11>double(percentual)/100 &&
338 UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==
false) ||
339 ((*SLUBCells).first.sector()>=13 &&
340 double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/2>double(percentual)/100 &&
341 UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==
false)){
342 UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]=
true;
343 wheelUnassHistos[3]->Fill((*SLUBCells).first.sector()-1,(*SLUBCells).first.wheel());
357 dbe->rmdir(
"DT/Tests/DTEfficiency");
368 stringstream layer; layer << lID.
layer();
370 string folderRoot =
parameters.getUntrackedParameter<
string>(
"folderRoot",
"Collector/FU0/");
372 folderRoot +
"DT/DTEfficiencyTask/Wheel" + wheel.str() +
373 "/Station" + station.str() +
374 "/Sector" + sector.str() +
375 "/SuperLayer" + superLayer.str() +
"/";
377 string histoname = folderName + histoTag
379 +
"_St" + station.str()
380 +
"_Sec" + sector.str()
381 +
"_SL" + superLayer.str()
382 +
"_L" + layer.str();
395 stringstream layer; layer << lId.
layer();
397 string HistoName =
"W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str() +
"_L" + layer.str();
398 string EfficiencyHistoName =
"Efficiency_" +
HistoName;
399 string UnassEfficiencyHistoName =
"UnassEfficiency_" +
HistoName;
401 dbe->setCurrentFolder(
"DT/Tests/DTEfficiency/Wheel" + wheel.str() +
402 "/Station" + station.str() +
403 "/Sector" + sector.str());
405 EfficiencyHistos[lId] = dbe->book1D(EfficiencyHistoName.c_str(),EfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
406 UnassEfficiencyHistos[lId] = dbe->book1D(UnassEfficiencyHistoName.c_str(),UnassEfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
413 dbe->setCurrentFolder(
"DT/Tests/DTEfficiency/SummaryPlot");
415 if(wheelHistos.find(3) == wheelHistos.end()){
416 string histoName =
"ESummary_testFailedByAtLeastBadSL";
417 wheelHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
418 wheelHistos[3]->setBinLabel(1,
"Sector1",1);
419 wheelHistos[3]->setBinLabel(1,
"Sector1",1);
420 wheelHistos[3]->setBinLabel(2,
"Sector2",1);
421 wheelHistos[3]->setBinLabel(3,
"Sector3",1);
422 wheelHistos[3]->setBinLabel(4,
"Sector4",1);
423 wheelHistos[3]->setBinLabel(5,
"Sector5",1);
424 wheelHistos[3]->setBinLabel(6,
"Sector6",1);
425 wheelHistos[3]->setBinLabel(7,
"Sector7",1);
426 wheelHistos[3]->setBinLabel(8,
"Sector8",1);
427 wheelHistos[3]->setBinLabel(9,
"Sector9",1);
428 wheelHistos[3]->setBinLabel(10,
"Sector10",1);
429 wheelHistos[3]->setBinLabel(11,
"Sector11",1);
430 wheelHistos[3]->setBinLabel(12,
"Sector12",1);
431 wheelHistos[3]->setBinLabel(13,
"Sector13",1);
432 wheelHistos[3]->setBinLabel(14,
"Sector14",1);
433 wheelHistos[3]->setBinLabel(1,
"Wheel-2",2);
434 wheelHistos[3]->setBinLabel(2,
"Wheel-1",2);
435 wheelHistos[3]->setBinLabel(3,
"Wheel0",2);
436 wheelHistos[3]->setBinLabel(4,
"Wheel+1",2);
437 wheelHistos[3]->setBinLabel(5,
"Wheel+2",2);
439 if(wheelUnassHistos.find(3) == wheelUnassHistos.end()){
440 string histoName =
"UESummary_testFailedByAtLeastBadSL";
441 wheelUnassHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
442 wheelUnassHistos[3]->setBinLabel(1,
"Sector1",1);
443 wheelUnassHistos[3]->setBinLabel(1,
"Sector1",1);
444 wheelUnassHistos[3]->setBinLabel(2,
"Sector2",1);
445 wheelUnassHistos[3]->setBinLabel(3,
"Sector3",1);
446 wheelUnassHistos[3]->setBinLabel(4,
"Sector4",1);
447 wheelUnassHistos[3]->setBinLabel(5,
"Sector5",1);
448 wheelUnassHistos[3]->setBinLabel(6,
"Sector6",1);
449 wheelUnassHistos[3]->setBinLabel(7,
"Sector7",1);
450 wheelUnassHistos[3]->setBinLabel(8,
"Sector8",1);
451 wheelUnassHistos[3]->setBinLabel(9,
"Sector9",1);
452 wheelUnassHistos[3]->setBinLabel(10,
"Sector10",1);
453 wheelUnassHistos[3]->setBinLabel(11,
"Sector11",1);
454 wheelUnassHistos[3]->setBinLabel(12,
"Sector12",1);
455 wheelUnassHistos[3]->setBinLabel(13,
"Sector13",1);
456 wheelUnassHistos[3]->setBinLabel(14,
"Sector14",1);
457 wheelUnassHistos[3]->setBinLabel(1,
"Wheel-2",2);
458 wheelUnassHistos[3]->setBinLabel(2,
"Wheel-1",2);
459 wheelUnassHistos[3]->setBinLabel(3,
"Wheel0",2);
460 wheelUnassHistos[3]->setBinLabel(4,
"Wheel+1",2);
461 wheelUnassHistos[3]->setBinLabel(5,
"Wheel+2",2);
465 stringstream wheel; wheel <<wh;
467 if(wheelHistos.find(wh) == wheelHistos.end()){
468 string histoName =
"ESummary_testFailed_W" + wheel.str();
469 wheelHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
470 wheelHistos[wh]->setBinLabel(1,
"Sector1",1);
471 wheelHistos[wh]->setBinLabel(2,
"Sector2",1);
472 wheelHistos[wh]->setBinLabel(3,
"Sector3",1);
473 wheelHistos[wh]->setBinLabel(4,
"Sector4",1);
474 wheelHistos[wh]->setBinLabel(5,
"Sector5",1);
475 wheelHistos[wh]->setBinLabel(6,
"Sector6",1);
476 wheelHistos[wh]->setBinLabel(7,
"Sector7",1);
477 wheelHistos[wh]->setBinLabel(8,
"Sector8",1);
478 wheelHistos[wh]->setBinLabel(9,
"Sector9",1);
479 wheelHistos[wh]->setBinLabel(10,
"Sector10",1);
480 wheelHistos[wh]->setBinLabel(11,
"Sector11",1);
481 wheelHistos[wh]->setBinLabel(12,
"Sector12",1);
482 wheelHistos[wh]->setBinLabel(13,
"Sector13",1);
483 wheelHistos[wh]->setBinLabel(14,
"Sector14",1);
484 wheelHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
485 wheelHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
486 wheelHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
487 wheelHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
488 wheelHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
489 wheelHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
490 wheelHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
491 wheelHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
492 wheelHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
493 wheelHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
494 wheelHistos[wh]->setBinLabel(11,
"MB4_SL3",2);
496 if(wheelUnassHistos.find(wh) == wheelUnassHistos.end()){
497 string histoName =
"UESummary_testFailed_W" + wheel.str();
498 wheelUnassHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
499 wheelUnassHistos[wh]->setBinLabel(1,
"Sector1",1);
500 wheelUnassHistos[wh]->setBinLabel(2,
"Sector2",1);
501 wheelUnassHistos[wh]->setBinLabel(3,
"Sector3",1);
502 wheelUnassHistos[wh]->setBinLabel(4,
"Sector4",1);
503 wheelUnassHistos[wh]->setBinLabel(5,
"Sector5",1);
504 wheelUnassHistos[wh]->setBinLabel(6,
"Sector6",1);
505 wheelUnassHistos[wh]->setBinLabel(7,
"Sector7",1);
506 wheelUnassHistos[wh]->setBinLabel(8,
"Sector8",1);
507 wheelUnassHistos[wh]->setBinLabel(9,
"Sector9",1);
508 wheelUnassHistos[wh]->setBinLabel(10,
"Sector10",1);
509 wheelUnassHistos[wh]->setBinLabel(11,
"Sector11",1);
510 wheelUnassHistos[wh]->setBinLabel(12,
"Sector12",1);
511 wheelUnassHistos[wh]->setBinLabel(13,
"Sector13",1);
512 wheelUnassHistos[wh]->setBinLabel(14,
"Sector14",1);
513 wheelUnassHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
514 wheelUnassHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
515 wheelUnassHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
516 wheelUnassHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
517 wheelUnassHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
518 wheelUnassHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
519 wheelUnassHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
520 wheelUnassHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
521 wheelUnassHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
522 wheelUnassHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
523 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
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.