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

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 1325 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().

1326  {
1327  /*
1328  uses
1329  OccupancyTask.Digi (i01)
1330  EnergyTask.HitMap (i02)
1331  */
1332  std::map<EcalLogicID, MonOccupancyDat> occupancy;
1333 
1334  MESet const& occupancyME(source_.at("Occupancy"));
1335  MESet const& energyME(source_.at("Energy"));
1336 
1337  MESet::const_iterator oEnd(occupancyME.end());
1338  MESet::const_iterator eItr(energyME);
1339  for(MESet::const_iterator oItr(occupancyME.beginChannel()); oItr != oEnd; oItr.toNextChannel()){
1340 
1341  if(oItr->getME()->getTH1()->GetEntries() < 1000.) continue;
1342 
1343  int entries(oItr->getBinContent());
1344  if(entries < 10) continue;
1345 
1346  eItr = oItr;
1347 
1348  int eEntries(eItr->getBinEntries());
1349  float energy(eEntries > 10 ? eItr->getBinContent() : -1.);
1350 
1351  MonOccupancyDat& data(occupancy[crystalID(oItr->getId())]);
1352  data.setEventsOverLowThreshold(entries);
1353  data.setEventsOverHighThreshold(eEntries);
1354  data.setAvgEnergy(energy);
1355  }
1356 
1357  try{
1358  if(occupancy.size() > 0)
1359  _db->insertDataArraySet(&occupancy, &_iov);
1360  }
1361  catch(std::runtime_error& e){
1362  if(std::string(e.what()).find("unique constraint") != std::string::npos)
1363  edm::LogWarning("EcalDQM") << e.what();
1364  else
1365  throw cms::Exception("DBError") << e.what();
1366  }
1367 
1368  return true;
1369  }
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 &)