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

Definition at line 75 of file DBWriterWorkers.h.

75 {}

Member Function Documentation

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

Implements ecaldqm::DBWriterWorker.

Definition at line 776 of file DBWriterWorkers.cc.

References ecaldqm::crystalID(), AlCaHLTBitMon_QueryRunRegistry::data, alignCSCRings::e, Exception, spr::find(), EcalCondDBInterface::insertDataArraySet(), ecaldqm::kBad, ecaldqm::kMBad, timingPdfMaker::mean, ecaldqm::qualityOK(), mps_fire::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().

777  {
778  /*
779  uses
780  PresampleTask.Pedestal (h03)
781  PresampleClient.Quality (meg03)
782  */
783 
784  bool result(true);
785 
786  std::map<EcalLogicID, MonPedestalsOnlineDat> pedestals;
787 
788  MESet const& pedestalME(source_.at("Pedestal"));
789  MESet const& qualityME(source_.at("Quality"));
790 
791  MESet::const_iterator pEnd(pedestalME.end());
792  MESet::const_iterator qItr(qualityME);
793  for(MESet::const_iterator pItr(pedestalME.beginChannel()); pItr != pEnd; pItr.toNextChannel()){
794  float entries(pItr->getBinEntries());
795  if(entries < 1.) continue;
796 
797  qItr = pItr;
798 
799  float mean(pItr->getBinContent());
800  float rms(pItr->getBinError() * std::sqrt(entries));
801 
802  MonPedestalsOnlineDat& data(pedestals[crystalID(pItr->getId())]);
803  data.setADCMeanG12(mean);
804  data.setADCRMSG12(rms);
805 
806  int channelStatus(qItr->getBinContent());
807  bool channelBad(channelStatus == kBad || channelStatus == kMBad);
808  data.setTaskStatus(channelBad);
809 
810  result &= qualityOK(channelStatus);
811  }
812 
813  try{
814  if(pedestals.size() > 0)
815  _db->insertDataArraySet(&pedestals, &_iov);
816  }
817  catch(std::runtime_error& e){
818  if(std::string(e.what()).find("unique constraint") != std::string::npos)
819  edm::LogWarning("EcalDQM") << e.what();
820  else
821  throw cms::Exception("DBError") << e.what();
822  }
823 
824  return result;
825  }
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:95
T sqrt(T t)
Definition: SSEVec.h:18
MESetCollection source_
bool qualityOK(int _quality)
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov)
EcalLogicID crystalID(DetId const &)