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::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 ()
 
- 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 ( )
inline

Definition at line 95 of file DBWriterWorkers.h.

95 {}

Member Function Documentation

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

Implements ecaldqm::DBWriterWorker.

Definition at line 1061 of file DBWriterWorkers.cc.

References ecaldqm::crystalID(), data, alignCSCRings::e, python.tagInventory::entries, Exception, spr::find(), EcalCondDBInterface::insertDataArraySet(), ecaldqm::kBad, ecaldqm::kMBad, timingPdfMaker::mean, ecaldqm::qualityOK(), query::result, plotscripts::rms(), ecaldqm::DBWriterWorker::source_, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, and ecaldqm::MESet::const_iterator::toNextChannel().

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

1062  {
1063  /*
1064  uses
1065  TimingTask.TimeMap (h01)
1066  TimingClient.Quality (meg01)
1067  */
1068 
1069  bool result(true);
1070 
1071  std::map<EcalLogicID, MonTimingCrystalDat> timing;
1072 
1073  MESet const& timingME(source_.at("Timing"));
1074  MESet const& qualityME(source_.at("Quality"));
1075 
1076  MESet::const_iterator tEnd(timingME.end());
1077  MESet::const_iterator qItr(qualityME);
1078  for(MESet::const_iterator tItr(timingME.beginChannel()); tItr != tEnd; tItr.toNextChannel()){
1079  float entries(tItr->getBinEntries());
1080  if(entries < 1.) continue;
1081 
1082  qItr = tItr;
1083 
1084  float mean(tItr->getBinContent());
1085  float rms(tItr->getBinError() * std::sqrt(entries));
1086 
1087  MonTimingCrystalDat& data(timing[crystalID(tItr->getId())]);
1088  data.setTimingMean(mean);
1089  data.setTimingRMS(rms);
1090 
1091  int channelStatus(qItr->getBinContent());
1092  bool channelBad(channelStatus == kBad || channelStatus == kMBad);
1093  data.setTaskStatus(channelBad);
1094 
1095  result &= qualityOK(channelStatus);
1096  }
1097 
1098  try{
1099  if(timing.size() > 0)
1100  _db->insertDataArraySet(&timing, &_iov);
1101  }
1102  catch(std::runtime_error& e){
1103  if(std::string(e.what()).find("unique constraint") != std::string::npos)
1104  edm::LogWarning("EcalDQM") << e.what();
1105  else
1106  throw cms::Exception("DBError") << e.what();
1107  }
1108 
1109  return result;
1110  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
T sqrt(T t)
Definition: SSEVec.h:48
MESetCollection source_
tuple result
Definition: query.py:137
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 crystalID(DetId const &)