CMS 3D CMS Logo

List of all members | Public Member Functions
ecaldqm::IntegrityWriter Class Reference

#include <DBWriterWorkers.h>

Inheritance diagram for ecaldqm::IntegrityWriter:
ecaldqm::DBWriterWorker ecaldqm::DQWorker

Public Member Functions

 IntegrityWriter (edm::ParameterSet const &_ps)
 
bool run (EcalCondDBInterface *, MonRunIOV &) override
 
 ~IntegrityWriter () override
 
- Public Member Functions inherited from ecaldqm::DBWriterWorker
 DBWriterWorker (std::string const &, edm::ParameterSet const &)
 
std::string const & getName () const
 
bool isActive () const
 
void retrieveSource (DQMStore::IGetter &)
 
bool runsOn (std::string const &_runType) const
 
void setVerbosity (int _v)
 
 ~DBWriterWorker () override
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void bookMEs (DQMStore::IBooker &)
 
bool checkElectronicsMap (bool=true)
 
bool checkGeometry (bool=true)
 
bool checkTopology (bool=true)
 
bool checkTrigTowerMap (bool=true)
 
 DQWorker ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
EcalDQMSetupObjects const getEcalDQMSetupObjects ()
 
EcalElectronicsMapping const * GetElectronicsMap ()
 
CaloGeometry const * GetGeometry ()
 
std::string const & getName () const
 
CaloTopology const * GetTopology ()
 
EcalTrigTowerConstituentsMap const * GetTrigTowerMap ()
 
bool onlineMode () const
 
virtual void releaseMEs ()
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setSetupObjects (edm::EventSetup const &)
 
void setSetupObjectsEndLumi (edm::EventSetup const &)
 
void setTime (time_t _t)
 
void setTokens (edm::ConsumesCollector &)
 
virtual ~DQWorker () noexcept(false)
 

Additional Inherited Members

- Public Types inherited from ecaldqm::DBWriterWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void fillDescriptions (edm::ParameterSetDescription &_desc)
 
- Public Attributes inherited from ecaldqm::DQWorker
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandle
 
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandleEndLumi
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandle
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandleEndLumi
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandle
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandleEndLumi
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandle
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandleEndLumi
 
- Protected Types inherited from ecaldqm::DQWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from ecaldqm::DQWorker
void initialize (std::string const &_name, edm::ParameterSet const &)
 
void print_ (std::string const &, int=0) const
 
virtual void setME (edm::ParameterSet const &)
 
virtual void setParams (edm::ParameterSet const &)
 
virtual void setSource (edm::ParameterSet const &)
 
void setVerbosity (int _verbosity)
 
- Protected Attributes inherited from ecaldqm::DBWriterWorker
bool active_
 
std::string const name_
 
std::set< std::string > runTypes_
 
MESetCollection source_
 
int verbosity_
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool booked_
 
MESetCollection MEs_
 
std::string name_
 
bool onlineMode_
 
Timestamp timestamp_
 
int verbosity_
 
bool willConvertToEDM_
 

Detailed Description

Definition at line 43 of file DBWriterWorkers.h.

Constructor & Destructor Documentation

◆ IntegrityWriter()

ecaldqm::IntegrityWriter::IntegrityWriter ( edm::ParameterSet const &  _ps)
inline

Definition at line 45 of file DBWriterWorkers.h.

45 : DBWriterWorker("Integrity", _ps) {}
DBWriterWorker(std::string const &, edm::ParameterSet const &)

◆ ~IntegrityWriter()

ecaldqm::IntegrityWriter::~IntegrityWriter ( )
inlineoverride

Definition at line 46 of file DBWriterWorkers.h.

46 {}

Member Function Documentation

◆ run()

bool ecaldqm::IntegrityWriter::run ( EcalCondDBInterface _db,
MonRunIOV _iov 
)
overridevirtual

Implements ecaldqm::DBWriterWorker.

Definition at line 90 of file DBWriterWorkers.cc.

References ecaldqm::MESetCollection::at(), simKBmtfDigis_cfi::bx, ecaldqm::ccuExists(), ewkTauDQM_cfi::channels, ecaldqm::crystalID(), data, MillePedeFileConverter_cfg::e, EcalBarrel, EcalEndcap, runTauDisplay::eid, Exception, spr::find(), PedestalClient_cfi::gain, ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), triggerObjects_cff::id, EcalCondDBInterface::insertDataArraySet(), ecaldqm::kBad, ecaldqm::kEBpHigh, ecaldqm::kEEmLow, ecaldqm::kEEpLow, ecaldqm::kMBad, ecaldqm::memChannelID(), ecaldqm::memDCC, ecaldqm::memTowerID(), dqmiodumpmetadata::n, ecaldqm::qualityOK(), mps_fire::result, ecaldqm::DBWriterWorker::source_, AlCaHLTBitMon_QueryRunRegistry::string, ecaldqm::MESet::const_iterator::toNextChannel(), ecaldqm::towerID(), and ecaldqm::DBWriterWorker::verbosity_.

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

90  {
91  /*
92  uses
93  OccupancyTask.Digi (h_)
94  PNDiodeTask.Occupancy (hmem_)
95  IntegrityTask.Gain (h01_)
96  IntegrityTask.ChId (h02_)
97  IntegrityTask.GainSwitch (h03_)
98  IntegrityTask.TowerId (h04_)
99  IntegrityTask.BlockSize (h05_)
100  RawDataTask.L1AFE
101  RawDataTask.BXFE
102  PNDiodeTask.MemChId (h06_)
103  PNDiodeTask.MemGain (h07_)
104  PNDiodeTask.MemTowerId (h08_)
105  PNDiodeTask.MomBlockSize (h09_)
106  IntegrityClient.Quality
107  PNIntegrityClient.QualitySummary
108  */
109 
110  bool result(true);
111 
112  std::map<EcalLogicID, MonCrystalConsistencyDat> crystalConsistencies;
113  std::map<EcalLogicID, MonTTConsistencyDat> towerConsistencies;
114  std::map<EcalLogicID, MonMemChConsistencyDat> memChannelConsistencies;
115  std::map<EcalLogicID, MonMemTTConsistencyDat> memTowerConsistencies;
116 
117  MESet const &digiME(source_.at("Digi"));
118  MESet const &gainME(source_.at("Gain"));
119  MESet const &chidME(source_.at("ChId"));
120  MESet const &gainswitchME(source_.at("GainSwitch"));
121  MESet const &qualityME(source_.at("Quality"));
122 
123  MESet const &toweridME(source_.at("TowerId"));
124  MESet const &blocksizeME(source_.at("BlockSize"));
125  MESet const &l1aME(source_.at("L1AFE"));
126  MESet const &bxME(source_.at("BXFE"));
127 
128  MESet const &memdigiME(source_.at("MEMDigi"));
129  MESet const &memchidME(source_.at("MEMChId"));
130  MESet const &memgainME(source_.at("MEMGain"));
131  MESet const &pnqualityME(source_.at("PNQuality"));
132 
133  MESet const &memtoweridME(source_.at("MEMTowerId"));
134  MESet const &memblocksizeME(source_.at("MEMBlockSize"));
135 
136  if (verbosity_ > 1)
137  edm::LogInfo("EcalDQM") << " Looping over crystals";
138 
139  MESet::const_iterator dEnd(digiME.end(GetElectronicsMap()));
140  MESet::const_iterator qItr(GetElectronicsMap(), qualityME);
141  for (MESet::const_iterator dItr(digiME.beginChannel(GetElectronicsMap())); dItr != dEnd;
142  dItr.toNextChannel(GetElectronicsMap())) {
143  DetId id(dItr->getId());
144 
145  int nDigis(dItr->getBinContent());
146  int gain(gainME.getBinContent(getEcalDQMSetupObjects(), id));
147  int chid(chidME.getBinContent(getEcalDQMSetupObjects(), id));
148  int gainswitch(gainswitchME.getBinContent(getEcalDQMSetupObjects(), id));
149  qItr = dItr;
150 
151  if (gain > 0 || chid > 0 || gainswitch > 0) {
152  MonCrystalConsistencyDat &data(crystalConsistencies[crystalID(id, GetElectronicsMap())]);
153  data.setProcessedEvents(nDigis);
154  data.setProblematicEvents(gain + chid + gainswitch);
155  data.setProblemsGainZero(gain);
156  data.setProblemsID(chid);
157  data.setProblemsGainSwitch(gainswitch);
158 
159  int channelStatus(qItr->getBinContent());
160  bool channelBad(channelStatus == kBad || channelStatus == kMBad);
161  data.setTaskStatus(channelBad);
162 
163  result &= qualityOK(channelStatus);
164  }
165  }
166 
167  if (verbosity_ > 1)
168  edm::LogInfo("EcalDQM") << " Looping over towers";
169 
170  for (unsigned iDCC(kEEmLow); iDCC <= kEBpHigh; ++iDCC) {
171  for (unsigned iTower(1); iTower <= 68; ++iTower) {
172  if (!ccuExists(iDCC + 1, iTower))
173  continue;
174 
175  EcalElectronicsId eid(iDCC + 1, iTower, 1, 1);
176  std::vector<DetId> channels(GetElectronicsMap()->dccTowerConstituents(iDCC + 1, iTower));
177  int nDigis(0);
178  bool towerBad(false);
179  for (unsigned iD(0); iD < channels.size(); ++iD) {
180  int n(digiME.getBinContent(getEcalDQMSetupObjects(), channels[iD]));
181  if (n > nDigis)
182  nDigis = n;
183  int channelStatus(qualityME.getBinContent(getEcalDQMSetupObjects(), channels[iD]));
184  if (channelStatus == kBad || channelStatus == kMBad)
185  towerBad = true;
186  }
187 
188  int towerid(toweridME.getBinContent(getEcalDQMSetupObjects(), eid));
189  int blocksize(blocksizeME.getBinContent(getEcalDQMSetupObjects(), eid));
190  int l1a(l1aME.getBinContent(getEcalDQMSetupObjects(), iDCC + 1, iTower));
191  int bx(bxME.getBinContent(getEcalDQMSetupObjects(), iDCC + 1, iTower));
192 
193  if (towerid > 0 || blocksize > 0 || l1a > 0 || bx > 0) {
194  MonTTConsistencyDat &data(towerConsistencies[towerID(eid)]);
195  data.setProcessedEvents(nDigis);
196  data.setProblematicEvents(towerid + blocksize + l1a + bx);
197  data.setProblemsID(towerid);
198  data.setProblemsSize(blocksize);
199  data.setProblemsLV1(l1a);
200  data.setProblemsBunchX(bx);
201  data.setTaskStatus(towerBad);
202 
203  result &= !towerBad;
204  }
205  }
206  }
207 
208  if (verbosity_ > 1)
209  edm::LogInfo("EcalDQM") << " Looping over MEM channels and towers";
210 
211  for (unsigned iMD(0); iMD < memDCC.size(); ++iMD) {
212  unsigned iDCC(memDCC[iMD]);
213 
214  int subdet(iDCC <= kEEmHigh || iDCC >= kEEpLow ? EcalEndcap : EcalBarrel);
215 
216  for (unsigned iPN(1); iPN <= 10; ++iPN) {
217  EcalPnDiodeDetId pnid(subdet, iDCC + 1, iPN);
218 
219  int nDigis(memdigiME.getBinContent(getEcalDQMSetupObjects(), pnid));
220  int memchid(memchidME.getBinContent(getEcalDQMSetupObjects(), pnid));
221  int memgain(memgainME.getBinContent(getEcalDQMSetupObjects(), pnid));
222 
223  if (memchid > 0 || memgain > 0) {
224  MonMemChConsistencyDat &data(memChannelConsistencies[memChannelID(pnid)]);
225 
226  data.setProcessedEvents(nDigis);
227  data.setProblematicEvents(memchid + memgain);
228  data.setProblemsID(memchid);
229  data.setProblemsGainZero(memgain);
230 
231  int channelStatus(pnqualityME.getBinContent(getEcalDQMSetupObjects(), pnid));
232  bool channelBad(channelStatus == kBad || channelStatus == kMBad);
233  data.setTaskStatus(channelBad);
234 
235  result &= qualityOK(channelStatus);
236  }
237  }
238 
239  for (unsigned iTower(69); iTower <= 70; ++iTower) {
240  EcalElectronicsId eid(iDCC + 1, iTower, 1, 1);
241 
242  int nDigis(0);
243  bool towerBad(false);
244  for (unsigned iPN(1); iPN <= 10; ++iPN) {
245  EcalPnDiodeDetId pnid(subdet, iDCC + 1, iPN);
246  int n(memdigiME.getBinContent(getEcalDQMSetupObjects(), pnid));
247  if (n > nDigis)
248  nDigis = n;
249  int channelStatus(pnqualityME.getBinContent(getEcalDQMSetupObjects(), pnid));
250  if (channelStatus == kBad || channelStatus == kMBad)
251  towerBad = true;
252  }
253 
254  int towerid(memtoweridME.getBinContent(getEcalDQMSetupObjects(), eid));
255  int blocksize(memblocksizeME.getBinContent(getEcalDQMSetupObjects(), eid));
256 
257  if (towerid > 0 || blocksize > 0) {
258  MonMemTTConsistencyDat &data(memTowerConsistencies[memTowerID(eid)]);
259 
260  data.setProcessedEvents(nDigis);
261  data.setProblematicEvents(towerid + blocksize);
262  data.setProblemsID(towerid);
263  data.setProblemsSize(blocksize);
264  data.setTaskStatus(towerBad);
265 
266  result &= !towerBad;
267  }
268  }
269  }
270 
271  if (verbosity_ > 1)
272  edm::LogInfo("EcalDQM") << " Inserting data";
273 
274  try {
275  if (!crystalConsistencies.empty()) {
276  if (verbosity_ > 2)
277  edm::LogInfo("EcalDQM") << " crystalConsistencies";
278  _db->insertDataArraySet(&crystalConsistencies, &_iov);
279  }
280  if (!towerConsistencies.empty()) {
281  if (verbosity_ > 2)
282  edm::LogInfo("EcalDQM") << " towerConsistencies";
283  _db->insertDataArraySet(&towerConsistencies, &_iov);
284  }
285  if (!memChannelConsistencies.empty()) {
286  if (verbosity_ > 2)
287  edm::LogInfo("EcalDQM") << " memChannelConsistencies";
288  _db->insertDataArraySet(&memChannelConsistencies, &_iov);
289  }
290  if (!memTowerConsistencies.empty()) {
291  if (verbosity_ > 2)
292  edm::LogInfo("EcalDQM") << " memTowerConsistencies";
293  _db->insertDataArraySet(&memTowerConsistencies, &_iov);
294  }
295  } catch (std::runtime_error &e) {
296  if (std::string(e.what()).find("unique constraint") != std::string::npos)
297  edm::LogWarning("EcalDQM") << e.what();
298  else
299  throw cms::Exception("DBError") << e.what();
300  }
301 
302  return result;
303  }
std::vector< unsigned > const memDCC
EcalLogicID crystalID(DetId const &, EcalElectronicsMapping const *)
MESet & at(const std::string &key)
Definition: MESet.h:399
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
bool ccuExists(unsigned, unsigned)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
MESetCollection source_
EcalLogicID memChannelID(EcalPnDiodeDetId const &)
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov) noexcept(false)
Log< level::Info, false > LogInfo
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
Definition: DetId.h:17
bool qualityOK(int _quality)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
EcalLogicID towerID(EcalElectronicsId const &)
EcalLogicID memTowerID(EcalElectronicsId const &)