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::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
 
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 109 of file DBWriterWorkers.h.

Constructor & Destructor Documentation

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

Definition at line 111 of file DBWriterWorkers.h.

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

Definition at line 112 of file DBWriterWorkers.h.

112 {}

Member Function Documentation

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

Implements ecaldqm::DBWriterWorker.

Definition at line 1326 of file DBWriterWorkers.cc.

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

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