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 ecaldqm::DQWorker

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)
 
 ~DBWriterWorker () override
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void bookMEs (DQMStore::IBooker &)
 
 DQWorker ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
const EcalDQMSetupObjects getEcalDQMSetupObjects ()
 
const EcalElectronicsMappingGetElectronicsMap ()
 
const CaloGeometryGetGeometry ()
 
const std::string & getName () const
 
const CaloTopologyGetTopology ()
 
const EcalTrigTowerConstituentsMapGetTrigTowerMap ()
 
bool onlineMode () const
 
virtual void releaseMEs ()
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setSetupObjects (edm::EventSetup const &)
 
void setTime (time_t _t)
 
virtual ~DQWorker () noexcept(false)
 

Additional Inherited Members

- Public Types inherited from ecaldqm::DBWriterWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void fillDescriptions (edm::ParameterSetDescription &_desc)
 
- Protected Types inherited from ecaldqm::DQWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from ecaldqm::DQWorker
void initialize (std::string const &_name, edm::ParameterSet const &)
 
void print_ (std::string const &, int=0) const
 
virtual void setME (edm::ParameterSet const &)
 
virtual void setParams (edm::ParameterSet const &)
 
virtual void setSource (edm::ParameterSet const &)
 
void setVerbosity (int _verbosity)
 
- Protected Attributes inherited from ecaldqm::DBWriterWorker
bool active_
 
const std::string name_
 
std::set< std::string > runTypes_
 
MESetCollection source_
 
int verbosity_
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool booked_
 
MESetCollection MEs_
 
std::string name_
 
bool onlineMode_
 
Timestamp timestamp_
 
int verbosity_
 
bool willConvertToEDM_
 

Detailed Description

Definition at line 113 of file DBWriterWorkers.h.

Constructor & Destructor Documentation

◆ OccupancyWriter()

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

Definition at line 115 of file DBWriterWorkers.h.

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

◆ ~OccupancyWriter()

ecaldqm::OccupancyWriter::~OccupancyWriter ( )
inlineoverride

Definition at line 116 of file DBWriterWorkers.h.

116 {}

Member Function Documentation

◆ run()

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

Implements ecaldqm::DBWriterWorker.

Definition at line 1294 of file DBWriterWorkers.cc.

1294  {
1295  /*
1296  uses
1297  OccupancyTask.Digi (i01)
1298  EnergyTask.HitMap (i02)
1299  */
1300  std::map<EcalLogicID, MonOccupancyDat> occupancy;
1301 
1302  MESet const &occupancyME(source_.at("Occupancy"));
1303  MESet const &energyME(source_.at("Energy"));
1304 
1305  MESet::const_iterator oEnd(occupancyME.end(GetElectronicsMap()));
1306  MESet::const_iterator eItr(GetElectronicsMap(), energyME);
1307  for (MESet::const_iterator oItr(occupancyME.beginChannel(GetElectronicsMap())); oItr != oEnd;
1308  oItr.toNextChannel(GetElectronicsMap())) {
1309  if (oItr->getME()->getTH1()->GetEntries() < 1000.)
1310  continue;
1311 
1312  int entries(oItr->getBinContent());
1313  if (entries < 10)
1314  continue;
1315 
1316  eItr = oItr;
1317 
1318  int eEntries(eItr->getBinEntries());
1319  float energy(eEntries > 10 ? eItr->getBinContent() : -1.);
1320 
1321  MonOccupancyDat &data(occupancy[crystalID(oItr->getId(), GetElectronicsMap())]);
1322  data.setEventsOverLowThreshold(entries);
1323  data.setEventsOverHighThreshold(eEntries);
1324  data.setAvgEnergy(energy);
1325  }
1326 
1327  try {
1328  if (!occupancy.empty())
1329  _db->insertDataArraySet(&occupancy, &_iov);
1330  } catch (std::runtime_error &e) {
1331  if (std::string(e.what()).find("unique constraint") != std::string::npos)
1332  edm::LogWarning("EcalDQM") << e.what();
1333  else
1334  throw cms::Exception("DBError") << e.what();
1335  }
1336 
1337  return true;
1338  }

References ecaldqm::MESetCollection::at(), ecaldqm::crystalID(), data, MillePedeFileConverter_cfg::e, HCALHighEnergyHPDFilter_cfi::energy, Exception, spr::find(), ecaldqm::DQWorker::GetElectronicsMap(), 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
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:104
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:399
ecaldqm::DBWriterWorker::DBWriterWorker
DBWriterWorker(std::string const &, edm::ParameterSet const &)
Definition: DBWriterWorkers.cc:59
Exception
Definition: hltDiff.cc:245
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MonOccupancyDat
Definition: MonOccupancyDat.h:12
ecaldqm::DBWriterWorker::source_
MESetCollection source_
Definition: DBWriterWorkers.h:38
edm::Log
Definition: MessageLogger.h:70
ecaldqm::crystalID
EcalLogicID crystalID(DetId const &, EcalElectronicsMapping const *)
Definition: LogicIDTranslation.cc:21
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37