CMS 3D CMS Logo

IntegrityClient.cc
Go to the documentation of this file.
2 
4 
6 
9 
11 
12 namespace ecaldqm {
13  IntegrityClient::IntegrityClient() : DQWorkerClient(), errFractionThreshold_(0.) {
14  qualitySummaries_.insert("Quality");
15  qualitySummaries_.insert("QualitySummary");
16  }
17 
19  errFractionThreshold_ = _params.getUntrackedParameter<double>("errFractionThreshold");
20  }
21 
24  }
25 
26  // Check Channel Status Record at every endLumi
27  // Used to fill Channel Status Map MEs
30  }
31 
36 
37  MESet& meQuality(MEs_.at("Quality"));
38  MESet& meQualitySummary(MEs_.at("QualitySummary"));
39  MESet& meChStatus(MEs_.at("ChStatus"));
40 
41  MESet const& sOccupancy(sources_.at("Occupancy"));
42  MESet const& sGain(sources_.at("Gain"));
43  MESet const& sChId(sources_.at("ChId"));
44  MESet const& sGainSwitch(sources_.at("GainSwitch"));
45  MESet const& sTowerId(sources_.at("TowerId"));
46  MESet const& sBlockSize(sources_.at("BlockSize"));
47 
48  // Fill Channel Status Map MEs
49  // Record is checked for updates at every endLumi and filled here
50  MESet::iterator chSEnd(meChStatus.end(GetElectronicsMap()));
51  for (MESet::iterator chSItr(meChStatus.beginChannel(GetElectronicsMap())); chSItr != chSEnd;
52  chSItr.toNextChannel(GetElectronicsMap())) {
53  DetId id(chSItr->getId());
54 
56 
57  // Set appropriate channel map (EB or EE)
58  if (id.subdetId() == EcalBarrel) {
59  EBDetId ebid(id);
60  chIt = chStatus->find(ebid);
61  } else {
62  EEDetId eeid(id);
63  chIt = chStatus->find(eeid);
64  }
65 
66  // Get status code and fill ME
67  if (chIt != chStatus->end()) {
68  uint16_t code(chIt->getEncodedStatusCode());
69  chSItr->setBinContent(code);
70  }
71 
72  } // Channel Status Map
73 
74  MESet::iterator qEnd(meQuality.end(GetElectronicsMap()));
75  MESet::const_iterator occItr(GetElectronicsMap(), sOccupancy);
76  for (MESet::iterator qItr(meQuality.beginChannel(GetElectronicsMap())); qItr != qEnd;
78  occItr = qItr;
79 
80  DetId id(qItr->getId());
81 
82  bool doMask(meQuality.maskMatches(id, mask, statusManager_, GetTrigTowerMap()));
83 
84  float entries(occItr->getBinContent());
85 
86  float gain(sGain.getBinContent(getEcalDQMSetupObjects(), id));
87  float chid(sChId.getBinContent(getEcalDQMSetupObjects(), id));
88  float gainswitch(sGainSwitch.getBinContent(getEcalDQMSetupObjects(), id));
89 
90  float towerid(sTowerId.getBinContent(getEcalDQMSetupObjects(), id));
91  float blocksize(sBlockSize.getBinContent(getEcalDQMSetupObjects(), id));
92 
93  if (entries + gain + chid + gainswitch + towerid + blocksize < 1.) {
94  qItr->setBinContent(doMask ? kMUnknown : kUnknown);
95  meQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, doMask ? kMUnknown : kUnknown);
96  continue;
97  }
98 
99  float chErr((gain + chid + gainswitch + towerid + blocksize) /
100  (entries + gain + chid + gainswitch + towerid + blocksize));
101 
102  if (chErr > errFractionThreshold_) {
103  qItr->setBinContent(doMask ? kMBad : kBad);
104  meQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, doMask ? kMBad : kBad);
105  } else {
106  qItr->setBinContent(doMask ? kMGood : kGood);
107  meQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, doMask ? kMGood : kGood);
108  }
109  }
110 
111  // Quality check: set an entire FED to BAD if "any" DCC-SRP or DCC-TCC mismatch errors are detected
112  // Fill mismatch statistics
113  MESet const& sBXSRP(sources_.at("BXSRP"));
114  MESet const& sBXTCC(sources_.at("BXTCC"));
115  std::vector<bool> hasMismatchDCC(nDCC, false);
116  for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) {
117  if (sBXSRP.getBinContent(getEcalDQMSetupObjects(), iDCC + 1) > 50. ||
118  sBXTCC.getBinContent(getEcalDQMSetupObjects(), iDCC + 1) > 50.) // "any" => 50
119  hasMismatchDCC[iDCC] = true;
120  }
121  // Analyze mismatch statistics
122  for (MESet::iterator qsItr(meQualitySummary.beginChannel(GetElectronicsMap()));
123  qsItr != meQualitySummary.end(GetElectronicsMap());
124  qsItr.toNextChannel(GetElectronicsMap())) {
125  DetId id(qsItr->getId());
126  unsigned iDCC(dccId(id, GetElectronicsMap()) - 1);
127  if (hasMismatchDCC[iDCC])
128  meQualitySummary.setBinContent(
130  id,
131  meQualitySummary.maskMatches(id, mask, statusManager_, GetTrigTowerMap()) ? kMBad : kBad);
132  }
133 
134  } // producePlots()
135 
137 } // namespace ecaldqm
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:168
void producePlots(ProcessType) override
MESet & at(const std::string &key)
Definition: MESet.h:399
const_iterator & toNextChannel(EcalElectronicsMapping const *electronicsMap)
Definition: MESet.h:320
static const int TT_SIZE_ERROR
static const int CH_GAIN_SWITCH_ERROR
void setParams(edm::ParameterSet const &) override
std::set< std::string > qualitySummaries_
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
void setTokens(edm::ConsumesCollector &) override
StatusManager const * statusManager_
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const_iterator find(uint32_t rawId) const
MESetCollection sources_
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
Definition: DetId.h:17
const EcalChannelStatus * chStatus
static const int CH_GAIN_ZERO_ERROR
std::vector< Item >::const_iterator const_iterator
MESetCollection MEs_
Definition: DQWorker.h:131
static const int TT_ID_ERROR
const_iterator end() const
EcalTrigTowerConstituentsMap const * GetTrigTowerMap()
Definition: DQWorker.cc:155
static const int CH_ID_ERROR