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
 
virtual void retrieveSource (DQMStore const &)
 
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 70 of file DBWriterWorkers.h.

Constructor & Destructor Documentation

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

Definition at line 72 of file DBWriterWorkers.h.

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

Definition at line 73 of file DBWriterWorkers.h.

73 {}

Member Function Documentation

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

Implements ecaldqm::DBWriterWorker.

Definition at line 777 of file DBWriterWorkers.cc.

References ecaldqm::crystalID(), data, alignCSCRings::e, python.tagInventory::entries, edm::hlt::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().

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