43 percentual =
parameters.getUntrackedParameter<
int>(
"BadSLpercentual", 10);
69 for(map<int, MonitorElement*> ::const_iterator
histo = wheelHistos.begin();
70 histo != wheelHistos.end();
72 (*histo).second->Reset();
75 for(map<int, MonitorElement*> ::const_iterator
histo = wheelUnassHistos.begin();
76 histo != wheelUnassHistos.end();
78 (*histo).second->Reset();
81 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: End of LS transition, performing the DQM client operation";
89 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: "<<nLumiSegs<<
" updates";
91 vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
92 vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
94 edm::LogVerbatim (
"efficiency") <<
"[DTEfficiencyTest]: Efficiency tests results";
97 map <DTLayerId, vector<double> > LayerBadCells;
98 LayerBadCells.clear();
99 map <DTLayerId, vector<double> > LayerUnassBadCells;
100 LayerUnassBadCells.clear();
101 map <DTSuperLayerId, vector<double> > SuperLayerBadCells;
102 SuperLayerBadCells.clear();
103 map <DTSuperLayerId,vector<double> > SuperLayerUnassBadCells;
104 SuperLayerUnassBadCells.clear();
105 map <pair<int,int>,
int> cmsHistos;
107 map <pair<int,int>,
bool> filled;
108 for(
int i=-2;
i<3;
i++){
109 for(
int j=1;
j<15;
j++){
110 filled[make_pair(
i,
j)]=
false;
113 map <pair<int,int>,
int> cmsUnassHistos;
114 cmsUnassHistos.clear();
115 map <pair<int,int>,
bool> UnassFilled;
116 for(
int i=-2;
i<3;
i++){
117 for(
int j=1;
j<15;
j++){
118 UnassFilled[make_pair(
i,
j)]=
false;
125 for (; ch_it != ch_end; ++ch_it) {
127 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
128 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
131 for(; sl_it != sl_end; ++sl_it) {
133 vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
134 vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
137 for(; l_it != l_end; ++l_it) {
140 stringstream wheel; wheel << chID.
wheel();
142 stringstream sector; sector << chID.
sector();
143 stringstream superLayer; superLayer << slID.
superlayer();
144 stringstream layer; layer << lID.
layer();
146 string HistoName =
"W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str() +
"_L" + layer.str();
150 MonitorElement * unassOccupancy_histo = igetter.
get(getMEName(
"hEffUnassOccupancy", lID));
151 MonitorElement * recSegmOccupancy_histo = igetter.
get(getMEName(
"hRecSegmOccupancy", lID));
154 if(occupancy_histo && unassOccupancy_histo && recSegmOccupancy_histo) {
155 TH1F * occupancy_histo_root = occupancy_histo->
getTH1F();
156 TH1F * unassOccupancy_histo_root = unassOccupancy_histo->
getTH1F();
157 TH1F * recSegmOccupancy_histo_root = recSegmOccupancy_histo->
getTH1F();
159 const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel();
160 const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel();
163 for(
int bin=firstWire;
bin <= lastWire;
bin++) {
164 if((recSegmOccupancy_histo_root->GetBinContent(
bin))!=0) {
166 if (EfficiencyHistos.find(lID) == EfficiencyHistos.end())
bookHistos(ibooker,lID, firstWire, lastWire);
167 float efficiency = occupancy_histo_root->GetBinContent(
bin) / recSegmOccupancy_histo_root->GetBinContent(
bin);
168 float errorEff =
sqrt(efficiency*(1-efficiency) / recSegmOccupancy_histo_root->GetBinContent(
bin));
169 EfficiencyHistos.find(lID)->second->setBinContent(
bin, efficiency);
170 EfficiencyHistos.find(lID)->second->setBinError(
bin, errorEff);
172 if (UnassEfficiencyHistos.find(lID) == EfficiencyHistos.end())
bookHistos(ibooker,lID, firstWire, lastWire);
173 float unassEfficiency = unassOccupancy_histo_root->GetBinContent(
bin) / recSegmOccupancy_histo_root->GetBinContent(
bin);
174 float errorUnassEff =
sqrt(unassEfficiency*(1-unassEfficiency) / recSegmOccupancy_histo_root->GetBinContent(
bin));
175 UnassEfficiencyHistos.find(lID)->second->setBinContent(
bin, unassEfficiency);
176 UnassEfficiencyHistos.find(lID)->second->setBinError(
bin, errorUnassEff);
188 string EfficiencyCriterionName =
parameters.getUntrackedParameter<
string>(
"EfficiencyTestName",
"EfficiencyInRange");
189 for(map<DTLayerId, MonitorElement*>::const_iterator hEff = EfficiencyHistos.begin();
190 hEff != EfficiencyHistos.end();
192 const QReport * theEfficiencyQReport = (*hEff).second->getQReport(EfficiencyCriterionName);
194 if(theEfficiencyQReport) {
195 vector<dqm::me_util::Channel> badChannels = theEfficiencyQReport->
getBadChannels();
196 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
197 channel != badChannels.end(); channel++) {
198 edm::LogError (
"efficiency") <<
"LayerID : "<<getMEName(
"hEffOccupancy",(*hEff).first)<<
" Bad efficiency channels: "<<(*channel).getBin()<<
" Contents : "<<(*channel).getContents();
201 LayerBadCells[(*hEff).first].push_back(counter);
202 LayerBadCells[(*hEff).first].push_back(muonGeom->layer((*hEff).first)->specificTopology().channels());
212 string UnassEfficiencyCriterionName =
parameters.getUntrackedParameter<
string>(
"UnassEfficiencyTestName",
"UnassEfficiencyInRange");
213 for(map<DTLayerId, MonitorElement*>::const_iterator hUnassEff = UnassEfficiencyHistos.begin();
214 hUnassEff != UnassEfficiencyHistos.end();
216 const QReport * theUnassEfficiencyQReport = (*hUnassEff).second->getQReport(UnassEfficiencyCriterionName);
218 if(theUnassEfficiencyQReport) {
219 vector<dqm::me_util::Channel> badChannels = theUnassEfficiencyQReport->
getBadChannels();
220 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
221 channel != badChannels.end(); channel++) {
222 edm::LogError (
"efficiency") <<
"Bad unassEfficiency channels: "<<(*channel).getBin()<<
" "<<(*channel).getContents();
225 LayerUnassBadCells[(*hUnassEff).first].push_back(counter);
226 LayerUnassBadCells[(*hUnassEff).first].push_back(
double(muonGeom->layer((*hUnassEff).first)->specificTopology().channels()));
233 vector<const DTChamber*>::const_iterator ch2_it = muonGeom->chambers().begin();
234 vector<const DTChamber*>::const_iterator ch2_end = muonGeom->chambers().end();
235 for (; ch2_it != ch2_end; ++ch2_it) {
236 vector<const DTSuperLayer*>::const_iterator sl2_it = (*ch2_it)->superLayers().begin();
237 vector<const DTSuperLayer*>::const_iterator sl2_end = (*ch2_it)->superLayers().end();
239 for(; sl2_it != sl2_end; ++sl2_it) {
241 double superLayerBadC=0;
242 double superLayerTotC=0;
243 double superLayerUnassBadC=0;
244 double superLayerUnassTotC=0;
246 vector<const DTLayer*>::const_iterator l2_it = (*sl2_it)->layers().begin();
247 vector<const DTLayer*>::const_iterator l2_end = (*sl2_it)->layers().end();
249 for(; l2_it != l2_end; ++l2_it) {
251 if(LayerBadCells.find(layerId) != LayerBadCells.end() &&
252 LayerUnassBadCells.find(layerId) != LayerUnassBadCells.end()){
254 superLayerBadC+=LayerBadCells[layerId][0];
255 superLayerTotC+=LayerBadCells[layerId][1];
256 superLayerUnassBadC+=LayerUnassBadCells[layerId][0];
257 superLayerUnassTotC+=LayerUnassBadCells[layerId][1];
261 SuperLayerBadCells[sl].push_back(superLayerBadC);
262 SuperLayerBadCells[sl].push_back(superLayerTotC);
263 SuperLayerUnassBadCells[sl].push_back(superLayerUnassBadC);
264 SuperLayerUnassBadCells[sl].push_back(superLayerUnassTotC);
270 for(map<
DTSuperLayerId, vector<double> >::const_iterator SLBCells = SuperLayerBadCells.begin();
271 SLBCells != SuperLayerBadCells.end();
273 if((*SLBCells).second[0]/(*SLBCells).second[1] >
double(percentual/100)){
274 if(wheelHistos.find((*SLBCells).first.wheel()) == wheelHistos.end())
bookHistos(ibooker,(*SLBCells).first.wheel());
275 if(!((*SLBCells).first.station() == 4 && (*SLBCells).first.superlayer() == 3))
276 wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,((*SLBCells).first.superlayer()-1)+3*((*SLBCells).first.station()-1));
278 wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,10);
281 cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]++;
282 if(((*SLBCells).first.sector()<13 &&
283 double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/11>double(percentual)/100 &&
284 filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==
false) ||
285 ((*SLBCells).first.sector()>=13 &&
286 double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/2>double(percentual)/100 &&
287 filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==
false)){
288 filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]=
true;
289 wheelHistos[3]->Fill((*SLBCells).first.sector()-1,(*SLBCells).first.wheel());
295 for(map<
DTSuperLayerId, vector<double> >::const_iterator SLUBCells = SuperLayerUnassBadCells.begin();
296 SLUBCells != SuperLayerUnassBadCells.end();
298 if((*SLUBCells).second[0]/(*SLUBCells).second[1] >
double(percentual/100)){
299 if(wheelUnassHistos.find((*SLUBCells).first.wheel()) == wheelUnassHistos.end())
bookHistos(ibooker,(*SLUBCells).first.wheel());
300 if(!((*SLUBCells).first.station() == 4 && (*SLUBCells).first.superlayer() == 3))
301 wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,((*SLUBCells).first.superlayer()-1)+3*((*SLUBCells).first.station()-1));
303 wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,10);
306 cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]++;
307 if(((*SLUBCells).first.sector()<13 &&
308 double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/11>double(percentual)/100 &&
309 UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==
false) ||
310 ((*SLUBCells).first.sector()>=13 &&
311 double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/2>double(percentual)/100 &&
312 UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==
false)){
313 UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]=
true;
314 wheelUnassHistos[3]->Fill((*SLUBCells).first.sector()-1,(*SLUBCells).first.wheel());
335 stringstream layer; layer << lID.
layer();
337 string folderRoot =
parameters.getUntrackedParameter<
string>(
"folderRoot",
"Collector/FU0/");
339 folderRoot +
"DT/DTEfficiencyTask/Wheel" + wheel.str() +
340 "/Station" + station.str() +
341 "/Sector" + sector.str() +
342 "/SuperLayer" + superLayer.str() +
"/";
344 string histoname = folderName + histoTag
346 +
"_St" + station.str()
347 +
"_Sec" + sector.str()
348 +
"_SL" + superLayer.str()
349 +
"_L" + layer.str();
361 stringstream layer; layer << lId.
layer();
363 string HistoName =
"W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str() +
"_L" + layer.str();
364 string EfficiencyHistoName =
"Efficiency_" +
HistoName;
365 string UnassEfficiencyHistoName =
"UnassEfficiency_" +
HistoName;
368 "/Station" + station.str() +
369 "/Sector" + sector.str());
371 EfficiencyHistos[lId] = ibooker.
book1D(EfficiencyHistoName.c_str(),EfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
372 UnassEfficiencyHistos[lId] = ibooker.
book1D(UnassEfficiencyHistoName.c_str(),UnassEfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
380 if(wheelHistos.find(3) == wheelHistos.end()){
381 string histoName =
"ESummary_testFailedByAtLeastBadSL";
382 wheelHistos[3] = ibooker.
book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
384 wheelHistos[3]->setBinLabel(1,
"Sector1",1);
385 wheelHistos[3]->setBinLabel(2,
"Sector2",1);
386 wheelHistos[3]->setBinLabel(3,
"Sector3",1);
387 wheelHistos[3]->setBinLabel(4,
"Sector4",1);
388 wheelHistos[3]->setBinLabel(5,
"Sector5",1);
389 wheelHistos[3]->setBinLabel(6,
"Sector6",1);
390 wheelHistos[3]->setBinLabel(7,
"Sector7",1);
391 wheelHistos[3]->setBinLabel(8,
"Sector8",1);
392 wheelHistos[3]->setBinLabel(9,
"Sector9",1);
393 wheelHistos[3]->setBinLabel(10,
"Sector10",1);
394 wheelHistos[3]->setBinLabel(11,
"Sector11",1);
395 wheelHistos[3]->setBinLabel(12,
"Sector12",1);
396 wheelHistos[3]->setBinLabel(13,
"Sector13",1);
397 wheelHistos[3]->setBinLabel(14,
"Sector14",1);
398 wheelHistos[3]->setBinLabel(1,
"Wheel-2",2);
399 wheelHistos[3]->setBinLabel(2,
"Wheel-1",2);
400 wheelHistos[3]->setBinLabel(3,
"Wheel0",2);
401 wheelHistos[3]->setBinLabel(4,
"Wheel+1",2);
402 wheelHistos[3]->setBinLabel(5,
"Wheel+2",2);
404 if(wheelUnassHistos.find(3) == wheelUnassHistos.end()){
405 string histoName =
"UESummary_testFailedByAtLeastBadSL";
406 wheelUnassHistos[3] = ibooker.
book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
408 wheelUnassHistos[3]->setBinLabel(1,
"Sector1",1);
409 wheelUnassHistos[3]->setBinLabel(2,
"Sector2",1);
410 wheelUnassHistos[3]->setBinLabel(3,
"Sector3",1);
411 wheelUnassHistos[3]->setBinLabel(4,
"Sector4",1);
412 wheelUnassHistos[3]->setBinLabel(5,
"Sector5",1);
413 wheelUnassHistos[3]->setBinLabel(6,
"Sector6",1);
414 wheelUnassHistos[3]->setBinLabel(7,
"Sector7",1);
415 wheelUnassHistos[3]->setBinLabel(8,
"Sector8",1);
416 wheelUnassHistos[3]->setBinLabel(9,
"Sector9",1);
417 wheelUnassHistos[3]->setBinLabel(10,
"Sector10",1);
418 wheelUnassHistos[3]->setBinLabel(11,
"Sector11",1);
419 wheelUnassHistos[3]->setBinLabel(12,
"Sector12",1);
420 wheelUnassHistos[3]->setBinLabel(13,
"Sector13",1);
421 wheelUnassHistos[3]->setBinLabel(14,
"Sector14",1);
422 wheelUnassHistos[3]->setBinLabel(1,
"Wheel-2",2);
423 wheelUnassHistos[3]->setBinLabel(2,
"Wheel-1",2);
424 wheelUnassHistos[3]->setBinLabel(3,
"Wheel0",2);
425 wheelUnassHistos[3]->setBinLabel(4,
"Wheel+1",2);
426 wheelUnassHistos[3]->setBinLabel(5,
"Wheel+2",2);
430 stringstream wheel; wheel <<wh;
432 if(wheelHistos.find(wh) == wheelHistos.end()){
433 string histoName =
"ESummary_testFailed_W" + wheel.str();
434 wheelHistos[wh] = ibooker.
book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
436 wheelHistos[wh]->setBinLabel(2,
"Sector2",1);
437 wheelHistos[wh]->setBinLabel(3,
"Sector3",1);
438 wheelHistos[wh]->setBinLabel(4,
"Sector4",1);
439 wheelHistos[wh]->setBinLabel(5,
"Sector5",1);
440 wheelHistos[wh]->setBinLabel(6,
"Sector6",1);
441 wheelHistos[wh]->setBinLabel(7,
"Sector7",1);
442 wheelHistos[wh]->setBinLabel(8,
"Sector8",1);
443 wheelHistos[wh]->setBinLabel(9,
"Sector9",1);
444 wheelHistos[wh]->setBinLabel(10,
"Sector10",1);
445 wheelHistos[wh]->setBinLabel(11,
"Sector11",1);
446 wheelHistos[wh]->setBinLabel(12,
"Sector12",1);
447 wheelHistos[wh]->setBinLabel(13,
"Sector13",1);
448 wheelHistos[wh]->setBinLabel(14,
"Sector14",1);
449 wheelHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
450 wheelHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
451 wheelHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
452 wheelHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
453 wheelHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
454 wheelHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
455 wheelHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
456 wheelHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
457 wheelHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
458 wheelHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
459 wheelHistos[wh]->setBinLabel(11,
"MB4_SL3",2);
461 if(wheelUnassHistos.find(wh) == wheelUnassHistos.end()){
462 string histoName =
"UESummary_testFailed_W" + wheel.str();
463 wheelUnassHistos[wh] = ibooker.
book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
465 wheelUnassHistos[wh]->setBinLabel(2,
"Sector2",1);
466 wheelUnassHistos[wh]->setBinLabel(3,
"Sector3",1);
467 wheelUnassHistos[wh]->setBinLabel(4,
"Sector4",1);
468 wheelUnassHistos[wh]->setBinLabel(5,
"Sector5",1);
469 wheelUnassHistos[wh]->setBinLabel(6,
"Sector6",1);
470 wheelUnassHistos[wh]->setBinLabel(7,
"Sector7",1);
471 wheelUnassHistos[wh]->setBinLabel(8,
"Sector8",1);
472 wheelUnassHistos[wh]->setBinLabel(9,
"Sector9",1);
473 wheelUnassHistos[wh]->setBinLabel(10,
"Sector10",1);
474 wheelUnassHistos[wh]->setBinLabel(11,
"Sector11",1);
475 wheelUnassHistos[wh]->setBinLabel(12,
"Sector12",1);
476 wheelUnassHistos[wh]->setBinLabel(13,
"Sector13",1);
477 wheelUnassHistos[wh]->setBinLabel(14,
"Sector14",1);
478 wheelUnassHistos[wh]->setBinLabel(1,
"MB1_SL1",2);
479 wheelUnassHistos[wh]->setBinLabel(2,
"MB1_SL2",2);
480 wheelUnassHistos[wh]->setBinLabel(3,
"MB1_SL3",2);
481 wheelUnassHistos[wh]->setBinLabel(4,
"MB2_SL1",2);
482 wheelUnassHistos[wh]->setBinLabel(5,
"MB2_SL2",2);
483 wheelUnassHistos[wh]->setBinLabel(6,
"MB2_SL3",2);
484 wheelUnassHistos[wh]->setBinLabel(7,
"MB3_SL1",2);
485 wheelUnassHistos[wh]->setBinLabel(8,
"MB3_SL2",2);
486 wheelUnassHistos[wh]->setBinLabel(9,
"MB3_SL3",2);
487 wheelUnassHistos[wh]->setBinLabel(10,
"MB4_SL1",2);
488 wheelUnassHistos[wh]->setBinLabel(11,
"MB4_SL3",2);
LuminosityBlockID id() const
virtual ~DTEfficiencyTest()
Destructor.
MonitorElement * get(const std::string &path)
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)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
beginrun
int layer() const
Return the layer number.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
void bookHistos(DQMStore::IBooker &, const DTLayerId &ch, int firstWire, int lastWire)
book the new ME
DTEfficiencyTest(const edm::ParameterSet &ps)
Constructor.
MonitorElement * book1D(Args &&...args)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
DQM Client Diagnostic.
const std::vector< DQMChannel > & getBadChannels(void) const
int superlayer() const
Return the superlayer number (deprecated method name)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
static std::atomic< unsigned int > counter
int station() const
Return the station number.
int wheel() const
Return the wheel number.
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)
std::string getMEName(std::string histoTag, const DTLayerId &lID)
Get the ME name.