test
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
 
void retrieveSource (DQMStore::IGetter &)
 
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 41 of file DBWriterWorkers.h.

Constructor & Destructor Documentation

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

Definition at line 43 of file DBWriterWorkers.h.

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

Definition at line 44 of file DBWriterWorkers.h.

44 {}

Member Function Documentation

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

Implements ecaldqm::DBWriterWorker.

Definition at line 107 of file DBWriterWorkers.cc.

References ecaldqm::ccuExists(), ecaldqm::crystalID(), data, alignCSCRings::e, EcalBarrel, EcalEndcap, Exception, spr::find(), ecaldqm::getElectronicsMap(), EcalCondDBInterface::insertDataArraySet(), ecaldqm::kBad, ecaldqm::kEBpHigh, ecaldqm::kEEmLow, ecaldqm::kEEpLow, ecaldqm::kMBad, ecaldqm::memChannelID(), ecaldqm::memDCC, ecaldqm::memTowerID(), gen::n, ecaldqm::qualityOK(), mps_fire::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().

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