CMS 3D CMS Logo

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

#include <DBWriterWorkers.h>

Inheritance diagram for ecaldqm::PresampleWriter:
ecaldqm::DBWriterWorker

Public Member Functions

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

Constructor & Destructor Documentation

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

Definition at line 74 of file DBWriterWorkers.h.

74 : DBWriterWorker("Presample", _ps) {}
DBWriterWorker(std::string const &, edm::ParameterSet const &)
ecaldqm::PresampleWriter::~PresampleWriter ( )
inlineoverride

Definition at line 75 of file DBWriterWorkers.h.

References ecaldqm::DBWriterWorker::run().

75 {}

Member Function Documentation

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

Implements ecaldqm::DBWriterWorker.

Definition at line 747 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().

747  {
748  /*
749  uses
750  PresampleTask.Pedestal (h03)
751  PresampleClient.Quality (meg03)
752  */
753 
754  bool result(true);
755 
756  std::map<EcalLogicID, MonPedestalsOnlineDat> pedestals;
757 
758  MESet const &pedestalME(source_.at("Pedestal"));
759  MESet const &qualityME(source_.at("Quality"));
760 
761  MESet::const_iterator pEnd(pedestalME.end());
762  MESet::const_iterator qItr(qualityME);
763  for (MESet::const_iterator pItr(pedestalME.beginChannel()); pItr != pEnd; pItr.toNextChannel()) {
764  float entries(pItr->getBinEntries());
765  if (entries < 1.)
766  continue;
767 
768  qItr = pItr;
769 
770  float mean(pItr->getBinContent());
771  float rms(pItr->getBinError() * std::sqrt(entries));
772 
773  MonPedestalsOnlineDat &data(pedestals[crystalID(pItr->getId())]);
774  data.setADCMeanG12(mean);
775  data.setADCRMSG12(rms);
776 
777  int channelStatus(qItr->getBinContent());
778  bool channelBad(channelStatus == kBad || channelStatus == kMBad);
779  data.setTaskStatus(channelBad);
780 
781  result &= qualityOK(channelStatus);
782  }
783 
784  try {
785  if (!pedestals.empty())
786  _db->insertDataArraySet(&pedestals, &_iov);
787  } catch (std::runtime_error &e) {
788  if (std::string(e.what()).find("unique constraint") != std::string::npos)
789  edm::LogWarning("EcalDQM") << e.what();
790  else
791  throw cms::Exception("DBError") << e.what();
792  }
793 
794  return result;
795  }
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 &)