CMS 3D CMS Logo

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

#include <DBWriterWorkers.h>

Inheritance diagram for ecaldqm::OccupancyWriter:
ecaldqm::DBWriterWorker

Public Member Functions

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

Constructor & Destructor Documentation

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

Definition at line 113 of file DBWriterWorkers.h.

113 : DBWriterWorker("Occupancy", _ps) {}
DBWriterWorker(std::string const &, edm::ParameterSet const &)
ecaldqm::OccupancyWriter::~OccupancyWriter ( )
inlineoverride

Definition at line 114 of file DBWriterWorkers.h.

References ecaldqm::DBWriterWorker::run().

114 {}

Member Function Documentation

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

Implements ecaldqm::DBWriterWorker.

Definition at line 1287 of file DBWriterWorkers.cc.

References ecaldqm::crystalID(), data, MillePedeFileConverter_cfg::e, Exception, spr::find(), EcalCondDBInterface::insertDataArraySet(), MonOccupancyDat::setAvgEnergy(), MonOccupancyDat::setEventsOverHighThreshold(), MonOccupancyDat::setEventsOverLowThreshold(), ecaldqm::DBWriterWorker::source_, AlCaHLTBitMon_QueryRunRegistry::string, and ecaldqm::MESet::const_iterator::toNextChannel().

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

1287  {
1288  /*
1289  uses
1290  OccupancyTask.Digi (i01)
1291  EnergyTask.HitMap (i02)
1292  */
1293  std::map<EcalLogicID, MonOccupancyDat> occupancy;
1294 
1295  MESet const &occupancyME(source_.at("Occupancy"));
1296  MESet const &energyME(source_.at("Energy"));
1297 
1298  MESet::const_iterator oEnd(occupancyME.end());
1299  MESet::const_iterator eItr(energyME);
1300  for (MESet::const_iterator oItr(occupancyME.beginChannel()); oItr != oEnd; oItr.toNextChannel()) {
1301  if (oItr->getME()->getTH1()->GetEntries() < 1000.)
1302  continue;
1303 
1304  int entries(oItr->getBinContent());
1305  if (entries < 10)
1306  continue;
1307 
1308  eItr = oItr;
1309 
1310  int eEntries(eItr->getBinEntries());
1311  float energy(eEntries > 10 ? eItr->getBinContent() : -1.);
1312 
1313  MonOccupancyDat &data(occupancy[crystalID(oItr->getId())]);
1314  data.setEventsOverLowThreshold(entries);
1315  data.setEventsOverHighThreshold(eEntries);
1316  data.setAvgEnergy(energy);
1317  }
1318 
1319  try {
1320  if (!occupancy.empty())
1321  _db->insertDataArraySet(&occupancy, &_iov);
1322  } catch (std::runtime_error &e) {
1323  if (std::string(e.what()).find("unique constraint") != std::string::npos)
1324  edm::LogWarning("EcalDQM") << e.what();
1325  else
1326  throw cms::Exception("DBError") << e.what();
1327  }
1328 
1329  return true;
1330  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
MESetCollection source_
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov) noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
EcalLogicID crystalID(DetId const &)