59 (*histo).second->Reset();
64 (*histo).second->Reset();
67 edm::LogVerbatim(
"efficiency") <<
"[DTEfficiencyTest]: End of LS transition, performing the DQM client operation";
78 vector<const DTChamber*>::const_iterator ch_it =
muonGeom->
chambers().begin();
79 vector<const DTChamber*>::const_iterator ch_end =
muonGeom->
chambers().end();
81 edm::LogVerbatim(
"efficiency") <<
"[DTEfficiencyTest]: Efficiency tests results";
83 map<DTLayerId, vector<double> > LayerBadCells;
84 LayerBadCells.clear();
85 map<DTLayerId, vector<double> > LayerUnassBadCells;
86 LayerUnassBadCells.clear();
87 map<DTSuperLayerId, vector<double> > SuperLayerBadCells;
88 SuperLayerBadCells.clear();
89 map<DTSuperLayerId, vector<double> > SuperLayerUnassBadCells;
90 SuperLayerUnassBadCells.clear();
91 map<pair<int, int>,
int> cmsHistos;
93 map<pair<int, int>,
bool> filled;
94 for (
int i = -2;
i < 3;
i++) {
95 for (
int j = 1;
j < 15;
j++) {
96 filled[make_pair(
i,
j)] =
false;
99 map<pair<int, int>,
int> cmsUnassHistos;
100 cmsUnassHistos.clear();
101 map<pair<int, int>,
bool> UnassFilled;
102 for (
int i = -2;
i < 3;
i++) {
103 for (
int j = 1;
j < 15;
j++) {
104 UnassFilled[make_pair(
i,
j)] =
false;
109 for (; ch_it != ch_end; ++ch_it) {
111 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
112 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
115 for (; sl_it != sl_end; ++sl_it) {
117 vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
118 vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
121 for (; l_it != l_end; ++l_it) {
125 wheel << chID.
wheel();
130 stringstream superLayer;
133 layer << lID.
layer();
135 string HistoName =
"W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" +
136 superLayer.str() +
"_L" + layer.str();
144 if (occupancy_histo && unassOccupancy_histo && recSegmOccupancy_histo) {
145 TH1F* occupancy_histo_root = occupancy_histo->
getTH1F();
146 TH1F* unassOccupancy_histo_root = unassOccupancy_histo->
getTH1F();
147 TH1F* recSegmOccupancy_histo_root = recSegmOccupancy_histo->
getTH1F();
153 for (
int bin = firstWire;
bin <= lastWire;
bin++) {
154 if ((recSegmOccupancy_histo_root->GetBinContent(
bin)) != 0) {
156 bookHistos(ibooker, lID, firstWire, lastWire);
158 occupancy_histo_root->GetBinContent(
bin) / recSegmOccupancy_histo_root->GetBinContent(
bin);
159 float errorEff =
sqrt(efficiency * (1 - efficiency) / recSegmOccupancy_histo_root->GetBinContent(
bin));
164 bookHistos(ibooker, lID, firstWire, lastWire);
165 float unassEfficiency =
166 unassOccupancy_histo_root->GetBinContent(
bin) / recSegmOccupancy_histo_root->GetBinContent(
bin);
167 float errorUnassEff =
168 sqrt(unassEfficiency * (1 - unassEfficiency) / recSegmOccupancy_histo_root->GetBinContent(
bin));
183 const QReport* theEfficiencyQReport = (*hEff).second->getQReport(EfficiencyCriterionName);
185 if (theEfficiencyQReport) {
186 vector<dqm::me_util::Channel> badChannels = theEfficiencyQReport->
getBadChannels();
187 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
190 <<
" Bad efficiency channels: " << (*channel).getBin()
191 <<
" Contents : " << (*channel).getContents();
194 LayerBadCells[(*hEff).first].push_back(counter);
203 string UnassEfficiencyCriterionName =
208 const QReport* theUnassEfficiencyQReport = (*hUnassEff).second->getQReport(UnassEfficiencyCriterionName);
210 if (theUnassEfficiencyQReport) {
211 vector<dqm::me_util::Channel> badChannels = theUnassEfficiencyQReport->
getBadChannels();
212 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
214 edm::LogError(
"efficiency") <<
"Bad unassEfficiency channels: " << (*channel).getBin() <<
" "
215 << (*channel).getContents();
218 LayerUnassBadCells[(*hUnassEff).first].push_back(counter);
219 LayerUnassBadCells[(*hUnassEff).first].push_back(
226 vector<const DTChamber*>::const_iterator ch2_it =
muonGeom->
chambers().begin();
227 vector<const DTChamber*>::const_iterator ch2_end =
muonGeom->
chambers().end();
228 for (; ch2_it != ch2_end; ++ch2_it) {
229 vector<const DTSuperLayer*>::const_iterator sl2_it = (*ch2_it)->superLayers().begin();
230 vector<const DTSuperLayer*>::const_iterator sl2_end = (*ch2_it)->superLayers().end();
232 for (; sl2_it != sl2_end; ++sl2_it) {
234 double superLayerBadC = 0;
235 double superLayerTotC = 0;
236 double superLayerUnassBadC = 0;
237 double superLayerUnassTotC = 0;
239 vector<const DTLayer*>::const_iterator l2_it = (*sl2_it)->layers().begin();
240 vector<const DTLayer*>::const_iterator l2_end = (*sl2_it)->layers().end();
242 for (; l2_it != l2_end; ++l2_it) {
244 if (LayerBadCells.find(layerId) != LayerBadCells.end() &&
245 LayerUnassBadCells.find(layerId) != LayerUnassBadCells.end()) {
247 superLayerBadC += LayerBadCells[layerId][0];
248 superLayerTotC += LayerBadCells[layerId][1];
249 superLayerUnassBadC += LayerUnassBadCells[layerId][0];
250 superLayerUnassTotC += LayerUnassBadCells[layerId][1];
254 SuperLayerBadCells[sl].push_back(superLayerBadC);
255 SuperLayerBadCells[sl].push_back(superLayerTotC);
256 SuperLayerUnassBadCells[sl].push_back(superLayerUnassBadC);
257 SuperLayerUnassBadCells[sl].push_back(superLayerUnassTotC);
262 for (map<
DTSuperLayerId, vector<double> >::const_iterator SLBCells = SuperLayerBadCells.begin();
263 SLBCells != SuperLayerBadCells.end();
265 if ((*SLBCells).second[0] / (*SLBCells).second[1] >
double(
percentual / 100)) {
267 bookHistos(ibooker, (*SLBCells).first.wheel());
268 if (!((*SLBCells).first.station() == 4 && (*SLBCells).first.superlayer() == 3))
270 (*SLBCells).first.sector() - 1,
271 ((*SLBCells).first.superlayer() - 1) + 3 * ((*SLBCells).first.station() - 1));
273 wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector() - 1, 10);
276 cmsHistos[make_pair((*SLBCells).first.wheel(), (*SLBCells).first.sector())]++;
277 if (((*SLBCells).first.sector() < 13 &&
278 double(cmsHistos[make_pair((*SLBCells).first.wheel(), (*SLBCells).first.sector())]) / 11 >
280 filled[make_pair((*SLBCells).first.wheel(), (*SLBCells).first.sector())] ==
false) ||
281 ((*SLBCells).first.sector() >= 13 &&
282 double(cmsHistos[make_pair((*SLBCells).first.wheel(), (*SLBCells).first.sector())]) / 2 >
284 filled[make_pair((*SLBCells).first.wheel(), (*SLBCells).first.sector())] ==
false)) {
285 filled[make_pair((*SLBCells).first.wheel(), (*SLBCells).first.sector())] =
true;
286 wheelHistos[3]->Fill((*SLBCells).first.sector() - 1, (*SLBCells).first.wheel());
291 for (map<
DTSuperLayerId, vector<double> >::const_iterator SLUBCells = SuperLayerUnassBadCells.begin();
292 SLUBCells != SuperLayerUnassBadCells.end();
294 if ((*SLUBCells).second[0] / (*SLUBCells).second[1] >
double(
percentual / 100)) {
296 bookHistos(ibooker, (*SLUBCells).first.wheel());
297 if (!((*SLUBCells).first.station() == 4 && (*SLUBCells).first.superlayer() == 3))
299 (*SLUBCells).first.sector() - 1,
300 ((*SLUBCells).first.superlayer() - 1) + 3 * ((*SLUBCells).first.station() - 1));
302 wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector() - 1, 10);
305 cmsUnassHistos[make_pair((*SLUBCells).first.wheel(), (*SLUBCells).first.sector())]++;
306 if (((*SLUBCells).first.sector() < 13 &&
307 double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(), (*SLUBCells).first.sector())]) / 11 >
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 >
313 UnassFilled[make_pair((*SLUBCells).first.wheel(), (*SLUBCells).first.sector())] ==
false)) {
314 UnassFilled[make_pair((*SLUBCells).first.wheel(), (*SLUBCells).first.sector())] =
true;
315 wheelUnassHistos[3]->Fill((*SLUBCells).first.sector() - 1, (*SLUBCells).first.wheel());
332 stringstream superLayer;
335 layer << lID.
layer();
338 string folderName = folderRoot +
"DT/DTEfficiencyTask/Wheel" + wheel.str() +
"/Station" + station.str() +
"/Sector" +
339 sector.str() +
"/SuperLayer" + superLayer.str() +
"/";
341 string histoname = folderName + histoTag +
"_W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
342 "_SL" + superLayer.str() +
"_L" + layer.str();
354 stringstream superLayer;
357 layer << lId.
layer();
360 "W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str() +
"_L" + layer.str();
361 string EfficiencyHistoName =
"Efficiency_" +
HistoName;
362 string UnassEfficiencyHistoName =
"UnassEfficiency_" +
HistoName;
364 ibooker.
setCurrentFolder(
"DT/Tests/DTEfficiency/Wheel" + wheel.str() +
"/Station" + station.str() +
"/Sector" +
368 EfficiencyHistoName.c_str(),
369 lastWire - firstWire + 1,
373 UnassEfficiencyHistoName.c_str(),
374 lastWire - firstWire + 1,
383 string histoName =
"ESummary_testFailedByAtLeastBadSL";
384 wheelHistos[3] = ibooker.
book2D(histoName.c_str(), histoName.c_str(), 14, 0, 14, 5, -2, 2);
407 string histoName =
"UESummary_testFailedByAtLeastBadSL";
435 string histoName =
"ESummary_testFailed_W" + wheel.str();
436 wheelHistos[wh] = ibooker.
book2D(histoName.c_str(), histoName.c_str(), 14, 0, 14, 11, 0, 11);
464 string histoName =
"UESummary_testFailed_W" + wheel.str();
LuminosityBlockID id() const
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
beginrun
virtual void setCurrentFolder(std::string const &fullpath)
virtual TH1F * getTH1F() const
edm::ParameterSet parameters
~DTEfficiencyTest() override
Destructor.
int layer() const
Return the layer number.
Log< level::Error, false > LogError
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.
constexpr std::array< uint8_t, layerIndexSize > layer
int firstChannel() const
Returns the wire number of the first wire.
bool getData(T &iHolder) const
int lastChannel() const
Returns the wire number of the last wire.
const DTTopology & specificTopology() const
std::map< int, MonitorElement * > wheelHistos
std::map< DTLayerId, MonitorElement * > UnassEfficiencyHistos
virtual MonitorElement * get(std::string const &fullpath) const
std::map< int, MonitorElement * > wheelUnassHistos
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
int superlayer() const
Return the superlayer number (deprecated method name)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
DQM Client Diagnostic.
int channels() const
Returns the number of wires in the layer.
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
LuminosityBlockNumber_t luminosityBlock() const
const std::vector< DQMChannel > & getBadChannels() const
std::map< DTLayerId, MonitorElement * > EfficiencyHistos
static std::atomic< unsigned int > counter
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int station() const
Return the station number.
int wheel() const
Return the wheel number.
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
const DTGeometry * muonGeom
std::string getMEName(std::string histoTag, const DTLayerId &lID)
Get the ME name.