CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from ecaldqm::DBWriterWorker
 DBWriterWorker (std::string const &, edm::ParameterSet const &)
 
std::string const & getName () const
 
bool isActive () const
 
virtual void retrieveSource (DQMStore const &)
 
bool runsOn (std::string const &_runType) const
 
void setVerbosity (int _v)
 
virtual ~DBWriterWorker ()
 

Additional Inherited Members

- Protected Attributes inherited from ecaldqm::DBWriterWorker
bool active_
 
std::string const name_
 
std::set< std::string > runTypes_
 
MESetCollection source_
 
int verbosity_
 

Detailed Description

Definition at line 39 of file DBWriterWorkers.h.

Constructor & Destructor Documentation

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

Definition at line 41 of file DBWriterWorkers.h.

41 : DBWriterWorker("Integrity", _ps) {}
DBWriterWorker(std::string const &, edm::ParameterSet const &)
ecaldqm::IntegrityWriter::~IntegrityWriter ( )
inline

Definition at line 42 of file DBWriterWorkers.h.

42 {}

Member Function Documentation

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

Implements ecaldqm::DBWriterWorker.

Definition at line 108 of file DBWriterWorkers.cc.

References ecaldqm::ccuExists(), ecaldqm::crystalID(), data, alignCSCRings::e, EcalBarrel, EcalEndcap, edm::hlt::Exception, spr::find(), ecaldqm::getElectronicsMap(), EcalCondDBInterface::insertDataArraySet(), ecaldqm::kBad, ecaldqm::kEBpHigh, ecaldqm::kEEmLow, ecaldqm::kEEpLow, ecaldqm::kMBad, ecaldqm::memChannelID(), ecaldqm::memDCC, ecaldqm::memTowerID(), n, ecaldqm::qualityOK(), query::result, MonMemChConsistencyDat::setProblematicEvents(), MonCrystalConsistencyDat::setProblematicEvents(), MonMemTTConsistencyDat::setProblematicEvents(), MonTTConsistencyDat::setProblematicEvents(), MonTTConsistencyDat::setProblemsBunchX(), MonCrystalConsistencyDat::setProblemsGainSwitch(), MonCrystalConsistencyDat::setProblemsGainZero(), MonMemChConsistencyDat::setProblemsGainZero(), MonCrystalConsistencyDat::setProblemsID(), MonMemTTConsistencyDat::setProblemsID(), MonTTConsistencyDat::setProblemsID(), MonMemChConsistencyDat::setProblemsID(), MonTTConsistencyDat::setProblemsLV1(), MonTTConsistencyDat::setProblemsSize(), MonMemTTConsistencyDat::setProblemsSize(), MonMemTTConsistencyDat::setProcessedEvents(), MonTTConsistencyDat::setProcessedEvents(), MonCrystalConsistencyDat::setProcessedEvents(), MonMemChConsistencyDat::setProcessedEvents(), MonCrystalConsistencyDat::setTaskStatus(), MonMemChConsistencyDat::setTaskStatus(), MonMemTTConsistencyDat::setTaskStatus(), MonTTConsistencyDat::setTaskStatus(), 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().

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