CMS 3D CMS Logo

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