CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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< T > 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< T >
 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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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,
EcalMappingRcd
elecMapHandle
 
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
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
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< B > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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

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 ( edm::ParameterSet const &  _ps)

Definition at line 12 of file EcalCondDBReader.cc.

References EcalCondDB::db, db_, alignCSCRings::e, cppFunctionSkipper::exception, Exception, EcalCondDBInterface::fetchMonRunIOV(), EcalCondDBInterface::fetchRunIOV(), RunIOV::getRunTag(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), monIOV_, convertSQLiteXML::runNumber, MonRunTag::setGeneralTag(), MonVersionDef::setMonitoringVersion(), MonRunTag::setMonVersionDef(), AlCaHLTBitMon_QueryRunRegistry::string, TableParser::table, verbosity_, and worker_.

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")
24  worker_ = new ecaldqm::CrystalConsistencyReader(workerParams);
25  if (table == "TTConsistency")
26  worker_ = new ecaldqm::TTConsistencyReader(workerParams);
27  if (table == "MemChConsistency")
28  worker_ = new ecaldqm::MemChConsistencyReader(workerParams);
29  if (table == "MemTTConsistency")
30  worker_ = new ecaldqm::MemTTConsistencyReader(workerParams);
31  if (table == "LaserBlue")
32  worker_ = new ecaldqm::LaserBlueReader(workerParams);
33  if (table == "TimingLaserBlueCrystal")
35  if (table == "PNBlue")
36  worker_ = new ecaldqm::PNBlueReader(workerParams);
37  if (table == "LaserGreen")
38  worker_ = new ecaldqm::LaserGreenReader(workerParams);
39  if (table == "TimingLaserGreenCrystal")
41  if (table == "PNGreen")
42  worker_ = new ecaldqm::PNGreenReader(workerParams);
43  if (table == "LaserIRed")
44  worker_ = new ecaldqm::LaserIRedReader(workerParams);
45  if (table == "TimingLaserIRedCrystal")
47  if (table == "PNIRed")
48  worker_ = new ecaldqm::PNIRedReader(workerParams);
49  if (table == "LaserRed")
50  worker_ = new ecaldqm::LaserRedReader(workerParams);
51  if (table == "TimingLaserRedCrystal")
53  if (table == "PNRed")
54  worker_ = new ecaldqm::PNRedReader(workerParams);
55  if (table == "Pedestals")
56  worker_ = new ecaldqm::PedestalsReader(workerParams);
57  if (table == "PNPed")
58  worker_ = new ecaldqm::PNPedReader(workerParams);
59  if (table == "PedestalsOnline")
60  worker_ = new ecaldqm::PedestalsOnlineReader(workerParams);
61  if (table == "TestPulse")
62  worker_ = new ecaldqm::TestPulseReader(workerParams);
63  if (table == "PulseShape")
64  worker_ = new ecaldqm::PulseShapeReader(workerParams);
65  if (table == "PNMGPA")
66  worker_ = new ecaldqm::PNMGPAReader(workerParams);
67  if (table == "TimingCrystal")
68  worker_ = new ecaldqm::TimingCrystalReader(workerParams);
69  if (table == "Led1")
70  worker_ = new ecaldqm::Led1Reader(workerParams);
71  if (table == "TimingLed1Crystal")
72  worker_ = new ecaldqm::TimingLed1CrystalReader(workerParams);
73  if (table == "Led2")
74  worker_ = new ecaldqm::Led2Reader(workerParams);
75  if (table == "TimingLed2Crystal")
76  worker_ = new ecaldqm::TimingLed2CrystalReader(workerParams);
77  if (table == "Occupancy")
78  worker_ = new ecaldqm::OccupancyReader(workerParams);
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 {
119  runTag = db_->fetchRunIOV(location, runNumber).getRunTag();
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);
130  monTag.setGeneralTag(monRunGeneralTag);
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
tuple db
Definition: EcalCondDB.py:153
Log< level::Error, false > LogError
EcalCondDBInterface * db_
void setGeneralTag(std::string tag)
Definition: MonRunTag.cc:21
RunTag getRunTag() const
Definition: RunIOV.cc:58
RunIOV fetchRunIOV(RunTag *tag, run_t run) noexcept(false)
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > elecMapHandle
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 ( )
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

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(), makeHLTPrescaleTable::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()
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
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
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

EcalCondDBInterface* EcalCondDBReader::db_
private

Definition at line 42 of file EcalCondDBReader.h.

Referenced by dqmEndRun(), and EcalCondDBReader().

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

Definition at line 50 of file EcalCondDBReader.h.

Referenced by setElectronicsMap().

EcalElectronicsMapping const* EcalCondDBReader::electronicsMap
private

Definition at line 18 of file EcalCondDBReader.h.

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

bool EcalCondDBReader::executed_
private

Definition at line 49 of file EcalCondDBReader.h.

std::string EcalCondDBReader::formula_
private

Definition at line 45 of file EcalCondDBReader.h.

Referenced by dqmEndRun().

ecaldqm::MESet* EcalCondDBReader::meSet_
private

Definition at line 46 of file EcalCondDBReader.h.

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

MonRunIOV EcalCondDBReader::monIOV_
private

Definition at line 43 of file EcalCondDBReader.h.

Referenced by dqmEndRun(), and EcalCondDBReader().

int EcalCondDBReader::verbosity_
private

Definition at line 48 of file EcalCondDBReader.h.

Referenced by EcalCondDBReader().

ecaldqm::DBReaderWorker* EcalCondDBReader::worker_
private

Definition at line 44 of file EcalCondDBReader.h.

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