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::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > 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 beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
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 dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 

Private Attributes

EcalCondDBInterfacedb_
 
bool executed_
 
std::string formula_
 
ecaldqm::MESetmeSet_
 
MonRunIOV monIOV_
 
int verbosity_
 
ecaldqm::DBReaderWorkerworker_
 

Additional Inherited Members

- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 9 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 18 of file EcalCondDBReader.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file EcalCondDBReader.cc.

References db_, MillePedeFileConverter_cfg::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, verbosity_, and worker_.

11  : db_(nullptr),
12  monIOV_(),
13  worker_(nullptr),
14  formula_(_ps.getUntrackedParameter<std::string>("formula")),
15  meSet_(ecaldqm::createMESet(_ps.getUntrackedParameterSet("plot"))),
16  verbosity_(_ps.getUntrackedParameter<int>("verbosity")) {
17  std::string table(_ps.getUntrackedParameter<std::string>("table"));
18  edm::ParameterSet const &workerParams(_ps.getUntrackedParameterSet("workerParams"));
19 
20  if (table == "CrystalConsistency")
21  worker_ = new ecaldqm::CrystalConsistencyReader(workerParams);
22  if (table == "TTConsistency")
23  worker_ = new ecaldqm::TTConsistencyReader(workerParams);
24  if (table == "MemChConsistency")
25  worker_ = new ecaldqm::MemChConsistencyReader(workerParams);
26  if (table == "MemTTConsistency")
27  worker_ = new ecaldqm::MemTTConsistencyReader(workerParams);
28  if (table == "LaserBlue")
29  worker_ = new ecaldqm::LaserBlueReader(workerParams);
30  if (table == "TimingLaserBlueCrystal")
32  if (table == "PNBlue")
33  worker_ = new ecaldqm::PNBlueReader(workerParams);
34  if (table == "LaserGreen")
35  worker_ = new ecaldqm::LaserGreenReader(workerParams);
36  if (table == "TimingLaserGreenCrystal")
38  if (table == "PNGreen")
39  worker_ = new ecaldqm::PNGreenReader(workerParams);
40  if (table == "LaserIRed")
41  worker_ = new ecaldqm::LaserIRedReader(workerParams);
42  if (table == "TimingLaserIRedCrystal")
44  if (table == "PNIRed")
45  worker_ = new ecaldqm::PNIRedReader(workerParams);
46  if (table == "LaserRed")
47  worker_ = new ecaldqm::LaserRedReader(workerParams);
48  if (table == "TimingLaserRedCrystal")
50  if (table == "PNRed")
51  worker_ = new ecaldqm::PNRedReader(workerParams);
52  if (table == "Pedestals")
53  worker_ = new ecaldqm::PedestalsReader(workerParams);
54  if (table == "PNPed")
55  worker_ = new ecaldqm::PNPedReader(workerParams);
56  if (table == "PedestalsOnline")
57  worker_ = new ecaldqm::PedestalsOnlineReader(workerParams);
58  if (table == "TestPulse")
59  worker_ = new ecaldqm::TestPulseReader(workerParams);
60  if (table == "PulseShape")
61  worker_ = new ecaldqm::PulseShapeReader(workerParams);
62  if (table == "PNMGPA")
63  worker_ = new ecaldqm::PNMGPAReader(workerParams);
64  if (table == "TimingCrystal")
65  worker_ = new ecaldqm::TimingCrystalReader(workerParams);
66  if (table == "Led1")
67  worker_ = new ecaldqm::Led1Reader(workerParams);
68  if (table == "TimingLed1Crystal")
69  worker_ = new ecaldqm::TimingLed1CrystalReader(workerParams);
70  if (table == "Led2")
71  worker_ = new ecaldqm::Led2Reader(workerParams);
72  if (table == "TimingLed2Crystal")
73  worker_ = new ecaldqm::TimingLed2CrystalReader(workerParams);
74  if (table == "Occupancy")
75  worker_ = new ecaldqm::OccupancyReader(workerParams);
76 
77  if (!worker_)
78  throw cms::Exception("Configuration") << "Invalid worker type";
79 
80  std::string DBName(_ps.getUntrackedParameter<std::string>("DBName"));
81  std::string hostName(_ps.getUntrackedParameter<std::string>("hostName"));
82  int hostPort(_ps.getUntrackedParameter<int>("hostPort"));
83  std::string userName(_ps.getUntrackedParameter<std::string>("userName"));
84  std::string password(_ps.getUntrackedParameter<std::string>("password"));
85 
86  std::unique_ptr<EcalCondDBInterface> db(nullptr);
87 
88  if (verbosity_ > 0)
89  edm::LogInfo("EcalDQM") << "Establishing DB connection";
90 
91  try {
92  db = std::unique_ptr<EcalCondDBInterface>(new EcalCondDBInterface(DBName, userName, password));
93  } catch (std::runtime_error &re) {
94  if (!hostName.empty()) {
95  try {
96  db = std::unique_ptr<EcalCondDBInterface>(
97  new EcalCondDBInterface(hostName, DBName, userName, password, hostPort));
98  } catch (std::runtime_error &re2) {
99  throw cms::Exception("DBError") << re2.what();
100  }
101  } else
102  throw cms::Exception("DBError") << re.what();
103  }
104 
105  db_ = db.release();
106 
107  std::string location(_ps.getUntrackedParameter<std::string>("location"));
108  int runNumber(_ps.getUntrackedParameter<int>("runNumber"));
109  std::string monRunGeneralTag(_ps.getUntrackedParameter<std::string>("monRunGeneralTag"));
110 
111  if (verbosity_ > 0)
112  edm::LogInfo("EcalDQM") << "Initializing DB entry";
113 
114  RunTag runTag;
115 
116  try {
117  runTag = db_->fetchRunIOV(location, runNumber).getRunTag();
118  } catch (std::exception &) {
119  edm::LogError("EcalDQM") << "Cannot fetch RunIOV for location=" << location << " runNumber=" << runNumber;
120  throw;
121  }
122 
123  MonVersionDef versionDef;
124  versionDef.setMonitoringVersion("test01"); // the only mon_ver in mon_version_def table as of September
125  // 2012
126  MonRunTag monTag;
127  monTag.setMonVersionDef(versionDef);
128  monTag.setGeneralTag(monRunGeneralTag);
129 
130  try {
131  monIOV_ = db_->fetchMonRunIOV(&runTag, &monTag, runNumber, 1);
132  } catch (std::runtime_error &e) {
133  edm::LogError("EcalDQM") << "Cannot fetch MonRunIOV for location=" << location << " runNumber=" << runNumber
134  << " monVersion=test01 monRunGeneralTag=" << monRunGeneralTag;
135  throw;
136  }
137 
138  if (verbosity_ > 0)
139  edm::LogInfo("EcalDQM") << " Done.";
140 }
ecaldqm::MESet * meSet_
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun) noexcept(false)
ecaldqm::DBReaderWorker * worker_
Definition: RunTag.h:13
EcalCondDBInterface * db_
void setGeneralTag(std::string tag)
Definition: MonRunTag.cc:33
RunTag getRunTag() const
Definition: RunIOV.cc:96
RunIOV fetchRunIOV(RunTag *tag, run_t run) noexcept(false)
void setMonVersionDef(const MonVersionDef &ver)
Definition: MonRunTag.cc:49
std::string formula_
void setMonitoringVersion(std::string ver)
MESet * createMESet(edm::ParameterSet const &)
Definition: MESetUtils.cc:17
EcalCondDBReader::~EcalCondDBReader ( )
override

Definition at line 142 of file EcalCondDBReader.cc.

References meSet_, and worker_.

142  {
143  delete worker_;
144  delete meSet_;
145 }
ecaldqm::MESet * meSet_
ecaldqm::DBReaderWorker * worker_

Member Function Documentation

void EcalCondDBReader::dqmEndJob ( DQMStore::IBooker _ibooker,
DQMStore::IGetter  
)
overrideprivatevirtual

Implements DQMEDHarvester.

Definition at line 147 of file EcalCondDBReader.cc.

References ecaldqm::MESet::book(), db_, formula_, meSet_, monIOV_, ecaldqm::DBReaderWorker::run(), ecaldqm::MESet::setBinContent(), MuonErrorMatrixValues_cff::values, and worker_.

147  {
148  meSet_->book(_ibooker);
149 
150  std::map<DetId, double> values(worker_->run(db_, monIOV_, formula_));
151  for (std::map<DetId, double>::const_iterator vItr(values.begin()); vItr != values.end(); ++vItr)
152  meSet_->setBinContent(vItr->first, vItr->second);
153 }
ecaldqm::MESet * meSet_
virtual void book(DQMStore::IBooker &)
Definition: MESet.h:41
ecaldqm::DBReaderWorker * worker_
EcalCondDBInterface * db_
virtual void setBinContent(DetId const &, double)
Definition: MESet.h:50
std::string formula_
virtual std::map< DetId, double > run(EcalCondDBInterface *, MonRunIOV &, std::string const &)=0

Member Data Documentation

EcalCondDBInterface* EcalCondDBReader::db_
private

Definition at line 36 of file EcalCondDBReader.h.

Referenced by dqmEndJob(), and EcalCondDBReader().

bool EcalCondDBReader::executed_
private

Definition at line 43 of file EcalCondDBReader.h.

std::string EcalCondDBReader::formula_
private

Definition at line 39 of file EcalCondDBReader.h.

Referenced by dqmEndJob().

ecaldqm::MESet* EcalCondDBReader::meSet_
private

Definition at line 40 of file EcalCondDBReader.h.

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

MonRunIOV EcalCondDBReader::monIOV_
private

Definition at line 37 of file EcalCondDBReader.h.

Referenced by dqmEndJob(), and EcalCondDBReader().

int EcalCondDBReader::verbosity_
private

Definition at line 42 of file EcalCondDBReader.h.

Referenced by EcalCondDBReader().

ecaldqm::DBReaderWorker* EcalCondDBReader::worker_
private

Definition at line 38 of file EcalCondDBReader.h.

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