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
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:74
ecaldqm::IntegrityClient
Definition: IntegrityClient.h:11
ecaldqm
Definition: DQWorker.h:37
ecaldqm::MESet::iterator::toNextChannel
const_iterator & toNextChannel(EcalElectronicsMapping const *electronicsMap)
Definition: MESet.h:320
ecaldqm::IntegrityClient::IntegrityClient
IntegrityClient()
Definition: IntegrityClient.cc:13
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
EBDetId
Definition: EBDetId.h:17
EBDetId.h
EEDetId.h
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::DQWorkerClient::statusManager_
StatusManager const * statusManager_
Definition: DQWorkerClient.h:67
ecaldqm::IntegrityClient::chStatus
const EcalChannelStatus * chStatus
Definition: IntegrityClient.h:22
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:118
EcalBarrel
Definition: EcalSubdetector.h:10
EcalDQMStatusHelper.h
DetId
Definition: DetId.h:17
ecaldqm::DQWorkerClient::qualitySummaries_
std::set< std::string > qualitySummaries_
Definition: DQWorkerClient.h:63
ecaldqm::IntegrityClient::chStatusToken
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken
Definition: IntegrityClient.h:21
ecaldqm::DQWorkerClient::ProcessType
ProcessType
Definition: DQWorkerClient.h:19
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
ecaldqm::DQWorker::GetTrigTowerMap
const EcalTrigTowerConstituentsMap * GetTrigTowerMap()
Definition: DQWorker.cc:124
EcalDQMStatusHelper::TT_SIZE_ERROR
static const int TT_SIZE_ERROR
Definition: EcalDQMStatusHelper.h:15
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:125
EEDetId
Definition: EEDetId.h:14
ecaldqm::DQWorkerClient::kMBad
Definition: DQWorkerClient.h:44
EcalDQMStatusHelper::CH_ID_ERROR
static const int CH_ID_ERROR
Definition: EcalDQMStatusHelper.h:11
EcalDQMStatusHelper::TT_ID_ERROR
static const int TT_ID_ERROR
Definition: EcalDQMStatusHelper.h:14
ecaldqm::DQWorkerClient::kUnknown
Definition: DQWorkerClient.h:44
ecaldqm::DQWorkerClient::kBad
Definition: DQWorkerClient.h:44
ecaldqm::DQWorkerClient::sources_
MESetCollection sources_
Definition: DQWorkerClient.h:62
ecaldqm::IntegrityClient::errFractionThreshold_
float errFractionThreshold_
Definition: IntegrityClient.h:25
ecaldqm::DQWorkerClient::kMGood
Definition: DQWorkerClient.h:44
edm::ParameterSet
Definition: ParameterSet.h:47
EcalDQMStatusHelper::CH_GAIN_ZERO_ERROR
static const int CH_GAIN_ZERO_ERROR
Definition: EcalDQMStatusHelper.h:12
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:399
ecaldqm::MESet::iterator
Definition: MESet.h:297
ecaldqm::DQWorkerClient::kMUnknown
Definition: DQWorkerClient.h:44
ecaldqm::IntegrityClient::producePlots
void producePlots(ProcessType) override
Definition: IntegrityClient.cc:32
edm::EventSetup
Definition: EventSetup.h:58
ecaldqm::DQWorkerClient
Definition: DQWorkerClient.h:17
ecaldqm::dccId
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:16
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
edm::Transition::EndLuminosityBlock
ecaldqm::MESet::const_iterator
Definition: MESet.h:273
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
EcalDQMStatusHelper::CH_GAIN_SWITCH_ERROR
static const int CH_GAIN_SWITCH_ERROR
Definition: EcalDQMStatusHelper.h:13
ecaldqm::DQWorkerClient::kGood
Definition: DQWorkerClient.h:44
ecaldqm::IntegrityClient::setTokens
void setTokens(edm::ConsumesCollector &) override
Definition: IntegrityClient.cc:22
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:91
EcalCondObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:162
ParameterSet.h
IntegrityClient.h
ecaldqm::IntegrityClient::setParams
void setParams(edm::ParameterSet const &) override
Definition: IntegrityClient.cc:18
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
ecaldqm::IntegrityClient::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: IntegrityClient.cc:28
EcalDQMCommonUtils.h
ecaldqm::MESet
Definition: MESet.h:42