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 &)
 
const std::string & 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

- Public Types inherited from ecaldqm::DBWriterWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Attributes inherited from ecaldqm::DBWriterWorker
bool active_
 
const std::string name_
 
std::set< std::string > runTypes_
 
MESetCollection source_
 
int verbosity_
 

Detailed Description

Definition at line 111 of file DBWriterWorkers.h.

Constructor & Destructor Documentation

◆ OccupancyWriter()

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

Definition at line 113 of file DBWriterWorkers.h.

113 : DBWriterWorker("Occupancy", _ps) {}

◆ ~OccupancyWriter()

ecaldqm::OccupancyWriter::~OccupancyWriter ( )
inlineoverride

Definition at line 114 of file DBWriterWorkers.h.

114 {}

Member Function Documentation

◆ run()

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

Implements ecaldqm::DBWriterWorker.

Definition at line 1287 of file DBWriterWorkers.cc.

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  }

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

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

EcalCondDBInterface::insertDataArraySet
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov) noexcept(false)
Definition: EcalCondDBInterface.h:298
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
ecaldqm::DBWriterWorker::DBWriterWorker
DBWriterWorker(std::string const &, edm::ParameterSet const &)
Definition: DBWriterWorkers.cc:59
ecaldqm::crystalID
EcalLogicID crystalID(DetId const &)
Definition: LogicIDTranslation.cc:21
Exception
Definition: hltDiff.cc:246
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MonOccupancyDat
Definition: MonOccupancyDat.h:12
ecaldqm::DBWriterWorker::source_
MESetCollection source_
Definition: DBWriterWorkers.h:36
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37