CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
EcalCondDBReader Class Reference

#include <EcalCondDBReader.h>

Inheritance diagram for EcalCondDBReader:
DQMEDHarvester edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalCondDBReader (edm::ParameterSet const &)
 
 ~EcalCondDBReader () override
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
virtual void dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
virtual void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &)=0
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

enum  Tasks {
  Integrity = 0, Cosmic = 1, Laser = 2, Pedestal = 3,
  Presample = 4, TestPulse = 5, BeamCalo = 6, BeamHodo = 7,
  TriggerPrimitives = 8, Cluster = 9, Timing = 10, Led = 11,
  RawData = 12, Occupancy = 13, nTasks = 14
}
 

Private Member Functions

void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &) override
 
ecaldqm::EcalDQMSetupObjects const getEcalDQMSetupObjects ()
 
EcalElectronicsMapping const * GetElectronicsMap ()
 
void setElectronicsMap (edm::EventSetup const &)
 

Private Attributes

EcalCondDBInterfacedb_
 
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandle
 
EcalElectronicsMapping const * electronicsMap
 
bool executed_
 
std::string formula_
 
ecaldqm::MESetmeSet_
 
MonRunIOV monIOV_
 
int verbosity_
 
ecaldqm::DBReaderWorkerworker_
 

Additional Inherited Members

- Public Types inherited from DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 10 of file EcalCondDBReader.h.

Member Enumeration Documentation

◆ Tasks

Enumerator
Integrity 
Cosmic 
Laser 
Pedestal 
Presample 
TestPulse 
BeamCalo 
BeamHodo 
TriggerPrimitives 
Cluster 
Timing 
Led 
RawData 
Occupancy 
nTasks 

Definition at line 24 of file EcalCondDBReader.h.

Constructor & Destructor Documentation

◆ EcalCondDBReader()

EcalCondDBReader::EcalCondDBReader ( edm::ParameterSet const &  _ps)

Definition at line 12 of file EcalCondDBReader.cc.

References dqmiodatasetharvest::db, db_, EcalCondDBWriter_cfi::DBName, MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, Exception, EcalCondDBInterface::fetchMonRunIOV(), EcalCondDBInterface::fetchRunIOV(), RunIOV::getRunTag(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), EcalCondDBWriter_cfi::hostName, EcalCondDBWriter_cfi::hostPort, EcalCondDBWriter_cfi::location, monIOV_, EcalCondDBWriter_cfi::monRunGeneralTag, EcalCondDBWriter_cfi::password, convertSQLiteXML::runNumber, MonRunTag::setGeneralTag(), MonVersionDef::setMonitoringVersion(), MonRunTag::setMonVersionDef(), AlCaHLTBitMon_QueryRunRegistry::string, TableParser::table, EcalCondDBWriter_cfi::userName, verbosity_, worker_, and EcalCondDBWriter_cfi::workerParams.

13  : db_(nullptr),
14  monIOV_(),
15  worker_(nullptr),
16  formula_(_ps.getUntrackedParameter<std::string>("formula")),
17  meSet_(ecaldqm::createMESet(_ps.getUntrackedParameterSet("plot"))),
18  verbosity_(_ps.getUntrackedParameter<int>("verbosity")),
19  elecMapHandle(esConsumes<edm::Transition::EndRun>()) {
20  std::string table(_ps.getUntrackedParameter<std::string>("table"));
21  edm::ParameterSet const &workerParams(_ps.getUntrackedParameterSet("workerParams"));
22 
23  if (table == "CrystalConsistency")
25  if (table == "TTConsistency")
27  if (table == "MemChConsistency")
29  if (table == "MemTTConsistency")
31  if (table == "LaserBlue")
33  if (table == "TimingLaserBlueCrystal")
35  if (table == "PNBlue")
37  if (table == "LaserGreen")
39  if (table == "TimingLaserGreenCrystal")
41  if (table == "PNGreen")
43  if (table == "LaserIRed")
45  if (table == "TimingLaserIRedCrystal")
47  if (table == "PNIRed")
49  if (table == "LaserRed")
51  if (table == "TimingLaserRedCrystal")
53  if (table == "PNRed")
55  if (table == "Pedestals")
57  if (table == "PNPed")
59  if (table == "PedestalsOnline")
61  if (table == "TestPulse")
63  if (table == "PulseShape")
65  if (table == "PNMGPA")
67  if (table == "TimingCrystal")
69  if (table == "Led1")
71  if (table == "TimingLed1Crystal")
73  if (table == "Led2")
75  if (table == "TimingLed2Crystal")
77  if (table == "Occupancy")
79 
80  if (!worker_)
81  throw cms::Exception("Configuration") << "Invalid worker type";
82 
83  std::string DBName(_ps.getUntrackedParameter<std::string>("DBName"));
84  std::string hostName(_ps.getUntrackedParameter<std::string>("hostName"));
85  int hostPort(_ps.getUntrackedParameter<int>("hostPort"));
86  std::string userName(_ps.getUntrackedParameter<std::string>("userName"));
87  std::string password(_ps.getUntrackedParameter<std::string>("password"));
88 
89  std::unique_ptr<EcalCondDBInterface> db(nullptr);
90 
91  if (verbosity_ > 0)
92  edm::LogInfo("EcalDQM") << "Establishing DB connection";
93 
94  try {
95  db = std::make_unique<EcalCondDBInterface>(DBName, userName, password);
96  } catch (std::runtime_error &re) {
97  if (!hostName.empty()) {
98  try {
99  db = std::make_unique<EcalCondDBInterface>(hostName, DBName, userName, password, hostPort);
100  } catch (std::runtime_error &re2) {
101  throw cms::Exception("DBError") << re2.what();
102  }
103  } else
104  throw cms::Exception("DBError") << re.what();
105  }
106 
107  db_ = db.release();
108 
109  std::string location(_ps.getUntrackedParameter<std::string>("location"));
110  int runNumber(_ps.getUntrackedParameter<int>("runNumber"));
111  std::string monRunGeneralTag(_ps.getUntrackedParameter<std::string>("monRunGeneralTag"));
112 
113  if (verbosity_ > 0)
114  edm::LogInfo("EcalDQM") << "Initializing DB entry";
115 
116  RunTag runTag;
117 
118  try {
120  } catch (std::exception &) {
121  edm::LogError("EcalDQM") << "Cannot fetch RunIOV for location=" << location << " runNumber=" << runNumber;
122  throw;
123  }
124 
125  MonVersionDef versionDef;
126  versionDef.setMonitoringVersion("test01"); // the only mon_ver in mon_version_def table as of September
127  // 2012
128  MonRunTag monTag;
129  monTag.setMonVersionDef(versionDef);
131 
132  try {
133  monIOV_ = db_->fetchMonRunIOV(&runTag, &monTag, runNumber, 1);
134  } catch (std::runtime_error &e) {
135  edm::LogError("EcalDQM") << "Cannot fetch MonRunIOV for location=" << location << " runNumber=" << runNumber
136  << " monVersion=test01 monRunGeneralTag=" << monRunGeneralTag;
137  throw;
138  }
139 
140  if (verbosity_ > 0)
141  edm::LogInfo("EcalDQM") << " Done.";
142 }
ecaldqm::MESet * meSet_
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun) noexcept(false)
ecaldqm::DBReaderWorker * worker_
Definition: RunTag.h:13
Log< level::Error, false > LogError
EcalCondDBInterface * db_
void setGeneralTag(std::string tag)
Definition: MonRunTag.cc:21
RunIOV fetchRunIOV(RunTag *tag, run_t run) noexcept(false)
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > elecMapHandle
RunTag getRunTag() const
Definition: RunIOV.cc:58
void setMonVersionDef(const MonVersionDef &ver)
Definition: MonRunTag.cc:30
Log< level::Info, false > LogInfo
std::string formula_
void setMonitoringVersion(std::string ver)
MESet * createMESet(edm::ParameterSet const &)
Definition: MESetUtils.cc:18

◆ ~EcalCondDBReader()

EcalCondDBReader::~EcalCondDBReader ( )
override

Definition at line 144 of file EcalCondDBReader.cc.

References meSet_, and worker_.

144  {
145  delete worker_;
146  delete meSet_;
147 }
ecaldqm::MESet * meSet_
ecaldqm::DBReaderWorker * worker_

Member Function Documentation

◆ dqmEndRun()

void EcalCondDBReader::dqmEndRun ( DQMStore::IBooker _ibooker,
DQMStore::IGetter ,
edm::Run const &  ,
edm::EventSetup const &  _es 
)
overrideprivatevirtual

Reimplemented from DQMEDHarvester.

Definition at line 149 of file EcalCondDBReader.cc.

References ecaldqm::MESet::book(), db_, formula_, getEcalDQMSetupObjects(), GetElectronicsMap(), meSet_, monIOV_, ecaldqm::DBReaderWorker::run(), ecaldqm::MESet::setBinContent(), setElectronicsMap(), contentValuesCheck::values, and worker_.

152  {
153  setElectronicsMap(_es);
154  meSet_->book(_ibooker, GetElectronicsMap());
155 
156  std::map<DetId, double> values(worker_->run(db_, monIOV_, formula_));
157  for (std::map<DetId, double>::const_iterator vItr(values.begin()); vItr != values.end(); ++vItr)
158  meSet_->setBinContent(getEcalDQMSetupObjects(), vItr->first, vItr->second);
159 }
virtual void setBinContent(EcalDQMSetupObjects const, DetId const &, double)
Definition: MESet.h:79
ecaldqm::MESet * meSet_
ecaldqm::DBReaderWorker * worker_
EcalElectronicsMapping const * GetElectronicsMap()
EcalCondDBInterface * db_
virtual void book(DQMStore::IBooker &, EcalElectronicsMapping const *)
Definition: MESet.h:57
void setElectronicsMap(edm::EventSetup const &)
std::string formula_
virtual std::map< DetId, double > run(EcalCondDBInterface *, MonRunIOV &, std::string const &)=0
ecaldqm::EcalDQMSetupObjects const getEcalDQMSetupObjects()

◆ getEcalDQMSetupObjects()

ecaldqm::EcalDQMSetupObjects const EcalCondDBReader::getEcalDQMSetupObjects ( )
private

Definition at line 169 of file EcalCondDBReader.cc.

References electronicsMap, and Exception.

Referenced by dqmEndRun().

169  {
170  if (!electronicsMap)
171  throw cms::Exception("InvalidCall") << "Electronics Mapping not initialized";
172  ecaldqm::EcalDQMSetupObjects edso = {electronicsMap, nullptr, nullptr, nullptr};
173  return edso;
174 }
EcalElectronicsMapping const * electronicsMap

◆ GetElectronicsMap()

EcalElectronicsMapping const * EcalCondDBReader::GetElectronicsMap ( )
private

Definition at line 163 of file EcalCondDBReader.cc.

References electronicsMap, and Exception.

Referenced by dqmEndRun().

163  {
164  if (!electronicsMap)
165  throw cms::Exception("InvalidCall") << "Electronics Mapping not initialized";
166  return electronicsMap;
167 }
EcalElectronicsMapping const * electronicsMap

◆ setElectronicsMap()

void EcalCondDBReader::setElectronicsMap ( edm::EventSetup const &  _es)
private

Definition at line 161 of file EcalCondDBReader.cc.

References elecMapHandle, electronicsMap, and edm::EventSetup::getData().

Referenced by dqmEndRun().

161 { electronicsMap = &_es.getData(elecMapHandle); }
EcalElectronicsMapping const * electronicsMap
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > elecMapHandle

Member Data Documentation

◆ db_

EcalCondDBInterface* EcalCondDBReader::db_
private

Definition at line 42 of file EcalCondDBReader.h.

Referenced by dqmEndRun(), and EcalCondDBReader().

◆ elecMapHandle

edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> EcalCondDBReader::elecMapHandle
private

Definition at line 50 of file EcalCondDBReader.h.

Referenced by setElectronicsMap().

◆ electronicsMap

EcalElectronicsMapping const* EcalCondDBReader::electronicsMap
private

Definition at line 18 of file EcalCondDBReader.h.

Referenced by getEcalDQMSetupObjects(), GetElectronicsMap(), and setElectronicsMap().

◆ executed_

bool EcalCondDBReader::executed_
private

Definition at line 49 of file EcalCondDBReader.h.

◆ formula_

std::string EcalCondDBReader::formula_
private

Definition at line 45 of file EcalCondDBReader.h.

Referenced by dqmEndRun().

◆ meSet_

ecaldqm::MESet* EcalCondDBReader::meSet_
private

Definition at line 46 of file EcalCondDBReader.h.

Referenced by dqmEndRun(), and ~EcalCondDBReader().

◆ monIOV_

MonRunIOV EcalCondDBReader::monIOV_
private

Definition at line 43 of file EcalCondDBReader.h.

Referenced by dqmEndRun(), and EcalCondDBReader().

◆ verbosity_

int EcalCondDBReader::verbosity_
private

Definition at line 48 of file EcalCondDBReader.h.

Referenced by EcalCondDBReader().

◆ worker_

ecaldqm::DBReaderWorker* EcalCondDBReader::worker_
private

Definition at line 44 of file EcalCondDBReader.h.

Referenced by dqmEndRun(), EcalCondDBReader(), and ~EcalCondDBReader().