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 ()
 
- 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
 
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)
 
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 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_.

10  :
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 {
18  std::string table(_ps.getUntrackedParameter<std::string>("table"));
19  edm::ParameterSet const& workerParams(_ps.getUntrackedParameterSet("workerParams"));
20 
21  if(table == "CrystalConsistency") worker_ = new ecaldqm::CrystalConsistencyReader(workerParams);
22  if(table == "TTConsistency") worker_ = new ecaldqm::TTConsistencyReader(workerParams);
23  if(table == "MemChConsistency") worker_ = new ecaldqm::MemChConsistencyReader(workerParams);
24  if(table == "MemTTConsistency") worker_ = new ecaldqm::MemTTConsistencyReader(workerParams);
25  if(table == "LaserBlue") worker_ = new ecaldqm::LaserBlueReader(workerParams);
26  if(table == "TimingLaserBlueCrystal") worker_ = new ecaldqm::TimingLaserBlueCrystalReader(workerParams);
27  if(table == "PNBlue") worker_ = new ecaldqm::PNBlueReader(workerParams);
28  if(table == "LaserGreen") worker_ = new ecaldqm::LaserGreenReader(workerParams);
29  if(table == "TimingLaserGreenCrystal") worker_ = new ecaldqm::TimingLaserGreenCrystalReader(workerParams);
30  if(table == "PNGreen") worker_ = new ecaldqm::PNGreenReader(workerParams);
31  if(table == "LaserIRed") worker_ = new ecaldqm::LaserIRedReader(workerParams);
32  if(table == "TimingLaserIRedCrystal") worker_ = new ecaldqm::TimingLaserIRedCrystalReader(workerParams);
33  if(table == "PNIRed") worker_ = new ecaldqm::PNIRedReader(workerParams);
34  if(table == "LaserRed") worker_ = new ecaldqm::LaserRedReader(workerParams);
35  if(table == "TimingLaserRedCrystal") worker_ = new ecaldqm::TimingLaserRedCrystalReader(workerParams);
36  if(table == "PNRed") worker_ = new ecaldqm::PNRedReader(workerParams);
37  if(table == "Pedestals") worker_ = new ecaldqm::PedestalsReader(workerParams);
38  if(table == "PNPed") worker_ = new ecaldqm::PNPedReader(workerParams);
39  if(table == "PedestalsOnline") worker_ = new ecaldqm::PedestalsOnlineReader(workerParams);
40  if(table == "TestPulse") worker_ = new ecaldqm::TestPulseReader(workerParams);
41  if(table == "PulseShape") worker_ = new ecaldqm::PulseShapeReader(workerParams);
42  if(table == "PNMGPA") worker_ = new ecaldqm::PNMGPAReader(workerParams);
43  if(table == "TimingCrystal") worker_ = new ecaldqm::TimingCrystalReader(workerParams);
44  if(table == "Led1") worker_ = new ecaldqm::Led1Reader(workerParams);
45  if(table == "TimingLed1Crystal") worker_ = new ecaldqm::TimingLed1CrystalReader(workerParams);
46  if(table == "Led2") worker_ = new ecaldqm::Led2Reader(workerParams);
47  if(table == "TimingLed2Crystal") worker_ = new ecaldqm::TimingLed2CrystalReader(workerParams);
48  if(table == "Occupancy") worker_ = new ecaldqm::OccupancyReader(workerParams);
49 
50  if(!worker_)
51  throw cms::Exception("Configuration") << "Invalid worker type";
52 
53  std::string DBName(_ps.getUntrackedParameter<std::string>("DBName"));
54  std::string hostName(_ps.getUntrackedParameter<std::string>("hostName"));
55  int hostPort(_ps.getUntrackedParameter<int>("hostPort"));
56  std::string userName(_ps.getUntrackedParameter<std::string>("userName"));
57  std::string password(_ps.getUntrackedParameter<std::string>("password"));
58 
59  std::auto_ptr<EcalCondDBInterface> db(nullptr);
60 
61  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << "Establishing DB connection";
62 
63  try{
64  db = std::auto_ptr<EcalCondDBInterface>(new EcalCondDBInterface(DBName, userName, password));
65  }
66  catch(std::runtime_error& re){
67  if(!hostName.empty()){
68  try{
69  db = std::auto_ptr<EcalCondDBInterface>(new EcalCondDBInterface(hostName, DBName, userName, password, hostPort));
70  }
71  catch(std::runtime_error& re2){
72  throw cms::Exception("DBError") << re2.what();
73  }
74  }
75  else
76  throw cms::Exception("DBError") << re.what();
77  }
78 
79  db_ = db.release();
80 
81  std::string location(_ps.getUntrackedParameter<std::string>("location"));
82  int runNumber(_ps.getUntrackedParameter<int>("runNumber"));
83  std::string monRunGeneralTag(_ps.getUntrackedParameter<std::string>("monRunGeneralTag"));
84 
85  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << "Initializing DB entry";
86 
87  RunTag runTag;
88 
89  try{
90  runTag = db_->fetchRunIOV(location, runNumber).getRunTag();
91  }
92  catch(std::exception&){
93  edm::LogError("EcalDQM") << "Cannot fetch RunIOV for location=" << location << " runNumber=" << runNumber;
94  throw;
95  }
96 
97  MonVersionDef versionDef;
98  versionDef.setMonitoringVersion("test01"); // the only mon_ver in mon_version_def table as of September 2012
99  MonRunTag monTag;
100  monTag.setMonVersionDef(versionDef);
101  monTag.setGeneralTag(monRunGeneralTag);
102 
103  try{
104  monIOV_ = db_->fetchMonRunIOV(&runTag, &monTag, runNumber, 1);
105  }
106  catch(std::runtime_error& e){
107  edm::LogError("EcalDQM") << "Cannot fetch MonRunIOV for location=" << location << " runNumber=" << runNumber << " monVersion=test01 monRunGeneralTag=" << monRunGeneralTag;
108  throw;
109  }
110 
111  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << " Done.";
112 }
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:19
EcalCondDBReader::~EcalCondDBReader ( )

Definition at line 114 of file EcalCondDBReader.cc.

References meSet_, and worker_.

115 {
116  delete worker_;
117  delete meSet_;
118 }
ecaldqm::MESet * meSet_
ecaldqm::DBReaderWorker * worker_

Member Function Documentation

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

Implements DQMEDHarvester.

Definition at line 121 of file EcalCondDBReader.cc.

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

122 {
123  meSet_->book(_ibooker);
124 
125  std::map<DetId, double> values(worker_->run(db_, monIOV_, formula_));
126  for(std::map<DetId, double>::const_iterator vItr(values.begin()); vItr != values.end(); ++vItr)
127  meSet_->setBinContent(vItr->first, vItr->second);
128 }
ecaldqm::MESet * meSet_
virtual void book(DQMStore::IBooker &)
Definition: MESet.h:42
ecaldqm::DBReaderWorker * worker_
EcalCondDBInterface * db_
virtual void setBinContent(DetId const &, double)
Definition: MESet.h:51
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().