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) {
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);
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());
361 string EfficiencyHistoName =
"Efficiency_" +
HistoName;
362 string UnassEfficiencyHistoName =
"UnassEfficiency_" +
HistoName;
368 EfficiencyHistoName.c_str(),
369 lastWire - firstWire + 1,
373 UnassEfficiencyHistoName.c_str(),
374 lastWire - firstWire + 1,
383 string histoName =
"ESummary_testFailedByAtLeastBadSL";
407 string histoName =
"UESummary_testFailedByAtLeastBadSL";
Log< level::Info, true > LogVerbatim
int station() const
Return the station number.
LuminosityBlockNumber_t luminosityBlock() const
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
beginrun
virtual void setCurrentFolder(std::string const &fullpath)
const std::vector< DQMChannel > & getBadChannels() const
edm::ParameterSet parameters
~DTEfficiencyTest() override
Destructor.
Log< level::Error, false > LogError
void bookHistos(DQMStore::IBooker &, const DTLayerId &ch, int firstWire, int lastWire)
book the new ME
DTEfficiencyTest(const edm::ParameterSet &ps)
Constructor.
T getUntrackedParameter(std::string const &, T const &) const
int firstChannel() const
Returns the wire number of the first wire.
std::map< int, MonitorElement * > wheelHistos
std::map< DTLayerId, MonitorElement * > UnassEfficiencyHistos
std::map< int, MonitorElement * > wheelUnassHistos
const DTTopology & specificTopology() const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
DQM Client Diagnostic.
int superlayer() const
Return the superlayer number (deprecated method name)
LuminosityBlockID id() const
virtual TH1F * getTH1F() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
virtual MonitorElement * get(std::string const &fullpath) const
int layer() const
Return the layer number.
int wheel() const
Return the wheel number.
std::map< DTLayerId, MonitorElement * > EfficiencyHistos
int lastChannel() const
Returns the wire number of the last wire.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int channels() const
Returns the number of wires in the layer.
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
const DTGeometry * muonGeom
std::string getMEName(std::string histoTag, const DTLayerId &lID)
Get the ME name.
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.