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

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 &)
 
const std::string & getName () const
 
bool isActive () const
 
void retrieveSource (DQMStore::IGetter &)
 
bool runsOn (std::string const &_runType) const
 
void setVerbosity (int _v)
 
virtual ~DBWriterWorker ()
 

Additional Inherited Members

- Public Types inherited from ecaldqm::DBWriterWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Attributes inherited from ecaldqm::DBWriterWorker
bool active_
 
const std::string name_
 
std::set< std::string > runTypes_
 
MESetCollection source_
 
int verbosity_
 

Detailed Description

Definition at line 41 of file DBWriterWorkers.h.

Constructor & Destructor Documentation

◆ IntegrityWriter()

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

Definition at line 43 of file DBWriterWorkers.h.

43 : DBWriterWorker("Integrity", _ps) {}

◆ ~IntegrityWriter()

ecaldqm::IntegrityWriter::~IntegrityWriter ( )
inlineoverride

Definition at line 44 of file DBWriterWorkers.h.

44 {}

Member Function Documentation

◆ run()

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

Implements ecaldqm::DBWriterWorker.

Definition at line 90 of file DBWriterWorkers.cc.

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());
140  MESet::const_iterator qItr(qualityME);
141  for (MESet::const_iterator dItr(digiME.beginChannel()); dItr != dEnd; dItr.toNextChannel()) {
142  DetId id(dItr->getId());
143 
144  int nDigis(dItr->getBinContent());
145  int gain(gainME.getBinContent(id));
146  int chid(chidME.getBinContent(id));
147  int gainswitch(gainswitchME.getBinContent(id));
148  qItr = dItr;
149 
150  if (gain > 0 || chid > 0 || gainswitch > 0) {
151  MonCrystalConsistencyDat &data(crystalConsistencies[crystalID(id)]);
152  data.setProcessedEvents(nDigis);
153  data.setProblematicEvents(gain + chid + gainswitch);
154  data.setProblemsGainZero(gain);
155  data.setProblemsID(chid);
156  data.setProblemsGainSwitch(gainswitch);
157 
158  int channelStatus(qItr->getBinContent());
159  bool channelBad(channelStatus == kBad || channelStatus == kMBad);
160  data.setTaskStatus(channelBad);
161 
162  result &= qualityOK(channelStatus);
163  }
164  }
165 
166  if (verbosity_ > 1)
167  edm::LogInfo("EcalDQM") << " Looping over towers";
168 
169  for (unsigned iDCC(kEEmLow); iDCC <= kEBpHigh; ++iDCC) {
170  for (unsigned iTower(1); iTower <= 68; ++iTower) {
171  if (!ccuExists(iDCC + 1, iTower))
172  continue;
173 
174  EcalElectronicsId eid(iDCC + 1, iTower, 1, 1);
175  std::vector<DetId> channels(getElectronicsMap()->dccTowerConstituents(iDCC + 1, iTower));
176  int nDigis(0);
177  bool towerBad(false);
178  for (unsigned iD(0); iD < channels.size(); ++iD) {
179  int n(digiME.getBinContent(channels[iD]));
180  if (n > nDigis)
181  nDigis = n;
182  int channelStatus(qualityME.getBinContent(channels[iD]));
183  if (channelStatus == kBad || channelStatus == kMBad)
184  towerBad = true;
185  }
186 
187  int towerid(toweridME.getBinContent(eid));
188  int blocksize(blocksizeME.getBinContent(eid));
189  int l1a(l1aME.getBinContent(iDCC + 1, iTower));
190  int bx(bxME.getBinContent(iDCC + 1, iTower));
191 
192  if (towerid > 0 || blocksize > 0 || l1a > 0 || bx > 0) {
193  MonTTConsistencyDat &data(towerConsistencies[towerID(eid)]);
194  data.setProcessedEvents(nDigis);
195  data.setProblematicEvents(towerid + blocksize + l1a + bx);
196  data.setProblemsID(towerid);
197  data.setProblemsSize(blocksize);
198  data.setProblemsLV1(l1a);
199  data.setProblemsBunchX(bx);
200  data.setTaskStatus(towerBad);
201 
202  result &= !towerBad;
203  }
204  }
205  }
206 
207  if (verbosity_ > 1)
208  edm::LogInfo("EcalDQM") << " Looping over MEM channels and towers";
209 
210  for (unsigned iMD(0); iMD < memDCC.size(); ++iMD) {
211  unsigned iDCC(memDCC[iMD]);
212 
213  int subdet(iDCC <= kEEmHigh || iDCC >= kEEpLow ? EcalEndcap : EcalBarrel);
214 
215  for (unsigned iPN(1); iPN <= 10; ++iPN) {
216  EcalPnDiodeDetId pnid(subdet, iDCC + 1, iPN);
217 
218  int nDigis(memdigiME.getBinContent(pnid));
219  int memchid(memchidME.getBinContent(pnid));
220  int memgain(memgainME.getBinContent(pnid));
221 
222  if (memchid > 0 || memgain > 0) {
223  MonMemChConsistencyDat &data(memChannelConsistencies[memChannelID(pnid)]);
224 
225  data.setProcessedEvents(nDigis);
226  data.setProblematicEvents(memchid + memgain);
227  data.setProblemsID(memchid);
228  data.setProblemsGainZero(memgain);
229 
230  int channelStatus(pnqualityME.getBinContent(pnid));
231  bool channelBad(channelStatus == kBad || channelStatus == kMBad);
232  data.setTaskStatus(channelBad);
233 
234  result &= qualityOK(channelStatus);
235  }
236  }
237 
238  for (unsigned iTower(69); iTower <= 70; ++iTower) {
239  EcalElectronicsId eid(iDCC + 1, iTower, 1, 1);
240 
241  int nDigis(0);
242  bool towerBad(false);
243  for (unsigned iPN(1); iPN <= 10; ++iPN) {
244  EcalPnDiodeDetId pnid(subdet, iDCC + 1, iPN);
245  int n(memdigiME.getBinContent(pnid));
246  if (n > nDigis)
247  nDigis = n;
248  int channelStatus(pnqualityME.getBinContent(pnid));
249  if (channelStatus == kBad || channelStatus == kMBad)
250  towerBad = true;
251  }
252 
253  int towerid(memtoweridME.getBinContent(eid));
254  int blocksize(memblocksizeME.getBinContent(eid));
255 
256  if (towerid > 0 || blocksize > 0) {
257  MonMemTTConsistencyDat &data(memTowerConsistencies[memTowerID(eid)]);
258 
259  data.setProcessedEvents(nDigis);
260  data.setProblematicEvents(towerid + blocksize);
261  data.setProblemsID(towerid);
262  data.setProblemsSize(blocksize);
263  data.setTaskStatus(towerBad);
264 
265  result &= !towerBad;
266  }
267  }
268  }
269 
270  if (verbosity_ > 1)
271  edm::LogInfo("EcalDQM") << " Inserting data";
272 
273  try {
274  if (!crystalConsistencies.empty()) {
275  if (verbosity_ > 2)
276  edm::LogInfo("EcalDQM") << " crystalConsistencies";
277  _db->insertDataArraySet(&crystalConsistencies, &_iov);
278  }
279  if (!towerConsistencies.empty()) {
280  if (verbosity_ > 2)
281  edm::LogInfo("EcalDQM") << " towerConsistencies";
282  _db->insertDataArraySet(&towerConsistencies, &_iov);
283  }
284  if (!memChannelConsistencies.empty()) {
285  if (verbosity_ > 2)
286  edm::LogInfo("EcalDQM") << " memChannelConsistencies";
287  _db->insertDataArraySet(&memChannelConsistencies, &_iov);
288  }
289  if (!memTowerConsistencies.empty()) {
290  if (verbosity_ > 2)
291  edm::LogInfo("EcalDQM") << " memTowerConsistencies";
292  _db->insertDataArraySet(&memTowerConsistencies, &_iov);
293  }
294  } catch (std::runtime_error &e) {
295  if (std::string(e.what()).find("unique constraint") != std::string::npos)
296  edm::LogWarning("EcalDQM") << e.what();
297  else
298  throw cms::Exception("DBError") << e.what();
299  }
300 
301  return result;
302  }

References l1GtPatternGenerator_cfi::bx, ecaldqm::ccuExists(), ewkTauDQM_cfi::channels, ecaldqm::crystalID(), data, MillePedeFileConverter_cfg::e, EcalBarrel, EcalEndcap, runTauDisplay::eid, Exception, spr::find(), PedestalClient_cfi::gain, ecaldqm::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().

EcalCondDBInterface::insertDataArraySet
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov) noexcept(false)
Definition: EcalCondDBInterface.h:298
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
edm::LogInfo
Definition: MessageLogger.h:254
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
ecaldqm::kEEmLow
Definition: EcalDQMCommonUtils.h:81
EcalPnDiodeDetId
Definition: EcalPnDiodeDetId.h:22
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalBarrel
Definition: EcalSubdetector.h:10
DetId
Definition: DetId.h:17
MonTTConsistencyDat
Definition: MonTTConsistencyDat.h:12
ecaldqm::ccuExists
bool ccuExists(unsigned, unsigned)
Definition: EcalDQMCommonUtils.cc:403
ecaldqm::kBad
Definition: DBWriterWorkers.cc:55
ecaldqm::kEBpHigh
Definition: EcalDQMCommonUtils.h:88
EcalElectronicsId
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Definition: EcalElectronicsId.h:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MonMemChConsistencyDat
Definition: MonMemChConsistencyDat.h:12
EcalEndcap
Definition: EcalSubdetector.h:10
edm::LogWarning
Definition: MessageLogger.h:141
ecaldqm::kMBad
Definition: DBWriterWorkers.cc:55
ecaldqm::qualityOK
bool qualityOK(int _quality)
Definition: DBWriterWorkers.cc:57
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
ecaldqm::memChannelID
EcalLogicID memChannelID(EcalPnDiodeDetId const &)
Definition: LogicIDTranslation.cc:48
ecaldqm::memDCC
const std::vector< unsigned > memDCC
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
ecaldqm::DBWriterWorker::DBWriterWorker
DBWriterWorker(std::string const &, edm::ParameterSet const &)
Definition: DBWriterWorkers.cc:59
ecaldqm::memTowerID
EcalLogicID memTowerID(EcalElectronicsId const &)
Definition: LogicIDTranslation.cc:61
ecaldqm::crystalID
EcalLogicID crystalID(DetId const &)
Definition: LogicIDTranslation.cc:21
MonCrystalConsistencyDat
Definition: MonCrystalConsistencyDat.h:12
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ecaldqm::kEEpLow
Definition: EcalDQMCommonUtils.h:83
Exception
Definition: hltDiff.cc:246
ewkTauDQM_cfi.channels
channels
Definition: ewkTauDQM_cfi.py:14
ecaldqm::towerID
EcalLogicID towerID(EcalElectronicsId const &)
Definition: LogicIDTranslation.cc:37
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
mps_fire.result
result
Definition: mps_fire.py:303
MonMemTTConsistencyDat
Definition: MonMemTTConsistencyDat.h:12
ecaldqm::DBWriterWorker::source_
MESetCollection source_
Definition: DBWriterWorkers.h:36
ecaldqm::getElectronicsMap
const EcalElectronicsMapping * getElectronicsMap()
Definition: EcalDQMCommonUtils.cc:438
ecaldqm::DBWriterWorker::verbosity_
int verbosity_
Definition: DBWriterWorkers.h:38
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37