CMS 3D CMS Logo

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

#include <DBWriterWorkers.h>

Inheritance diagram for ecaldqm::TimingWriter:
ecaldqm::DBWriterWorker

Public Member Functions

bool run (EcalCondDBInterface *, MonRunIOV &) override
 
 TimingWriter (edm::ParameterSet const &_ps)
 
 ~TimingWriter () 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)
 
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 92 of file DBWriterWorkers.h.

Constructor & Destructor Documentation

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

Definition at line 94 of file DBWriterWorkers.h.

94 : DBWriterWorker("Timing", _ps) {}
DBWriterWorker(std::string const &, edm::ParameterSet const &)
ecaldqm::TimingWriter::~TimingWriter ( )
inlineoverride

Definition at line 95 of file DBWriterWorkers.h.

References ecaldqm::DBWriterWorker::run().

95 {}

Member Function Documentation

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

Implements ecaldqm::DBWriterWorker.

Definition at line 1031 of file DBWriterWorkers.cc.

References ecaldqm::crystalID(), data, MillePedeFileConverter_cfg::e, Exception, spr::find(), EcalCondDBInterface::insertDataArraySet(), ecaldqm::kBad, ecaldqm::kMBad, SiStripPI::mean, ecaldqm::qualityOK(), mps_fire::result, SiStripPI::rms, ecaldqm::DBWriterWorker::source_, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, and ecaldqm::MESet::const_iterator::toNextChannel().

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

1031  {
1032  /*
1033  uses
1034  TimingTask.TimeMap (h01)
1035  TimingClient.Quality (meg01)
1036  */
1037 
1038  bool result(true);
1039 
1040  std::map<EcalLogicID, MonTimingCrystalDat> timing;
1041 
1042  MESet const &timingME(source_.at("Timing"));
1043  MESet const &qualityME(source_.at("Quality"));
1044 
1045  MESet::const_iterator tEnd(timingME.end());
1046  MESet::const_iterator qItr(qualityME);
1047  for (MESet::const_iterator tItr(timingME.beginChannel()); tItr != tEnd; tItr.toNextChannel()) {
1048  float entries(tItr->getBinEntries());
1049  if (entries < 1.)
1050  continue;
1051 
1052  qItr = tItr;
1053 
1054  float mean(tItr->getBinContent());
1055  float rms(tItr->getBinError() * std::sqrt(entries));
1056 
1057  MonTimingCrystalDat &data(timing[crystalID(tItr->getId())]);
1058  data.setTimingMean(mean);
1059  data.setTimingRMS(rms);
1060 
1061  int channelStatus(qItr->getBinContent());
1062  bool channelBad(channelStatus == kBad || channelStatus == kMBad);
1063  data.setTaskStatus(channelBad);
1064 
1065  result &= qualityOK(channelStatus);
1066  }
1067 
1068  try {
1069  if (!timing.empty())
1070  _db->insertDataArraySet(&timing, &_iov);
1071  } catch (std::runtime_error &e) {
1072  if (std::string(e.what()).find("unique constraint") != std::string::npos)
1073  edm::LogWarning("EcalDQM") << e.what();
1074  else
1075  throw cms::Exception("DBError") << e.what();
1076  }
1077 
1078  return result;
1079  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
T sqrt(T t)
Definition: SSEVec.h:18
MESetCollection source_
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov) noexcept(false)
bool qualityOK(int _quality)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
EcalLogicID crystalID(DetId const &)