CMS 3D CMS Logo

EcalCondDBReader.cc
Go to the documentation of this file.
1 #include <memory>
2 
4 
7 
11 
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")) {
20  edm::ParameterSet const &workerParams(_ps.getUntrackedParameterSet("workerParams"));
21 
22  if (table == "CrystalConsistency")
24  if (table == "TTConsistency")
26  if (table == "MemChConsistency")
28  if (table == "MemTTConsistency")
30  if (table == "LaserBlue")
32  if (table == "TimingLaserBlueCrystal")
34  if (table == "PNBlue")
36  if (table == "LaserGreen")
38  if (table == "TimingLaserGreenCrystal")
40  if (table == "PNGreen")
42  if (table == "LaserIRed")
44  if (table == "TimingLaserIRedCrystal")
46  if (table == "PNIRed")
48  if (table == "LaserRed")
50  if (table == "TimingLaserRedCrystal")
52  if (table == "PNRed")
54  if (table == "Pedestals")
56  if (table == "PNPed")
58  if (table == "PedestalsOnline")
60  if (table == "TestPulse")
62  if (table == "PulseShape")
64  if (table == "PNMGPA")
66  if (table == "TimingCrystal")
68  if (table == "Led1")
70  if (table == "TimingLed1Crystal")
72  if (table == "Led2")
74  if (table == "TimingLed2Crystal")
76  if (table == "Occupancy")
78 
79  if (!worker_)
80  throw cms::Exception("Configuration") << "Invalid worker type";
81 
84  int hostPort(_ps.getUntrackedParameter<int>("hostPort"));
87 
88  std::unique_ptr<EcalCondDBInterface> db(nullptr);
89 
90  if (verbosity_ > 0)
91  edm::LogInfo("EcalDQM") << "Establishing DB connection";
92 
93  try {
94  db = std::make_unique<EcalCondDBInterface>(DBName, userName, password);
95  } catch (std::runtime_error &re) {
96  if (!hostName.empty()) {
97  try {
98  db = std::make_unique<EcalCondDBInterface>(hostName, DBName, userName, password, hostPort);
99  } catch (std::runtime_error &re2) {
100  throw cms::Exception("DBError") << re2.what();
101  }
102  } else
103  throw cms::Exception("DBError") << re.what();
104  }
105 
106  db_ = db.release();
107 
109  int runNumber(_ps.getUntrackedParameter<int>("runNumber"));
111 
112  if (verbosity_ > 0)
113  edm::LogInfo("EcalDQM") << "Initializing DB entry";
114 
115  RunTag runTag;
116 
117  try {
119  } catch (std::exception &) {
120  edm::LogError("EcalDQM") << "Cannot fetch RunIOV for location=" << location << " runNumber=" << runNumber;
121  throw;
122  }
123 
124  MonVersionDef versionDef;
125  versionDef.setMonitoringVersion("test01"); // the only mon_ver in mon_version_def table as of September
126  // 2012
127  MonRunTag monTag;
128  monTag.setMonVersionDef(versionDef);
130 
131  try {
132  monIOV_ = db_->fetchMonRunIOV(&runTag, &monTag, runNumber, 1);
133  } catch (std::runtime_error &e) {
134  edm::LogError("EcalDQM") << "Cannot fetch MonRunIOV for location=" << location << " runNumber=" << runNumber
135  << " monVersion=test01 monRunGeneralTag=" << monRunGeneralTag;
136  throw;
137  }
138 
139  if (verbosity_ > 0)
140  edm::LogInfo("EcalDQM") << " Done.";
141 }
142 
144  delete worker_;
145  delete meSet_;
146 }
147 
149  meSet_->book(_ibooker);
150 
151  std::map<DetId, double> values(worker_->run(db_, monIOV_, formula_));
152  for (std::map<DetId, double>::const_iterator vItr(values.begin()); vItr != values.end(); ++vItr)
153  meSet_->setBinContent(vItr->first, vItr->second);
154 }
MonVersionDef::setMonitoringVersion
void setMonitoringVersion(std::string ver)
Definition: MonVersionDef.cc:21
EcalCondDBReader.h
MessageLogger.h
ecaldqm::TestPulseReader
Definition: DBReaderWorkers.h:183
ecaldqm
Definition: DQWorker.h:24
edm::ParameterSet::getUntrackedParameterSet
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: ParameterSet.cc:2136
EcalCondDBWriter_cfi.hostPort
hostPort
Definition: EcalCondDBWriter_cfi.py:60
RunTag
Definition: RunTag.h:13
EcalCondDBWriter_cfi.monRunGeneralTag
monRunGeneralTag
Definition: EcalCondDBWriter_cfi.py:66
ecaldqm::CrystalConsistencyReader
Definition: DBReaderWorkers.h:30
EcalCondDBInterface::fetchMonRunIOV
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun) noexcept(false)
Definition: EcalCondDBInterface.cc:674
EcalCondDBWriter_cfi.DBName
DBName
Definition: EcalCondDBWriter_cfi.py:58
DQMStore.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ecaldqm::TimingLed2CrystalReader
Definition: DBReaderWorkers.h:239
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
EcalCondDBReader::formula_
std::string formula_
Definition: EcalCondDBReader.h:39
MonRunTag::setGeneralTag
void setGeneralTag(std::string tag)
Definition: MonRunTag.cc:21
ecaldqm::TimingLaserGreenCrystalReader
Definition: DBReaderWorkers.h:94
EcalCondDBWriter_cfi.userName
userName
Definition: EcalCondDBWriter_cfi.py:61
convertSQLiteXML.runNumber
runNumber
Definition: convertSQLiteXML.py:91
dqmiodatasetharvest.db
db
Definition: dqmiodatasetharvest.py:119
EcalCondDBWriter_cfi.password
password
Definition: EcalCondDBWriter_cfi.py:62
EcalCondDBReader::EcalCondDBReader
EcalCondDBReader(edm::ParameterSet const &)
Definition: EcalCondDBReader.cc:12
Service.h
RunIOV::getRunTag
RunTag getRunTag() const
Definition: RunIOV.cc:58
ecaldqm::PNBlueReader
Definition: DBReaderWorkers.h:78
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
ecaldqm::Led2Reader
Definition: DBReaderWorkers.h:231
ecaldqm::LaserGreenReader
Definition: DBReaderWorkers.h:86
ecaldqm::PNRedReader
Definition: DBReaderWorkers.h:151
ecaldqm::DBReaderWorker::run
virtual std::map< DetId, double > run(EcalCondDBInterface *, MonRunIOV &, std::string const &)=0
ecaldqm::PedestalsReader
Definition: DBReaderWorkers.h:159
ecaldqm::PNPedReader
Definition: DBReaderWorkers.h:167
MonVersionDef
Definition: MonVersionDef.h:12
ecaldqm::TimingCrystalReader
Definition: DBReaderWorkers.h:207
ecaldqm::PNIRedReader
Definition: DBReaderWorkers.h:127
EcalCondDBReader::worker_
ecaldqm::DBReaderWorker * worker_
Definition: EcalCondDBReader.h:38
EcalCondDBReader::verbosity_
int verbosity_
Definition: EcalCondDBReader.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ecaldqm::MESet::book
virtual void book(DQMStore::IBooker &)
Definition: MESet.h:42
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
EcalCondDBWriter_cfi.workerParams
workerParams
Definition: EcalCondDBWriter_cfi.py:68
ecaldqm::PedestalsOnlineReader
Definition: DBReaderWorkers.h:175
edm::ParameterSet
Definition: ParameterSet.h:47
EcalCondDBWriter_cfi.hostName
hostName
Definition: EcalCondDBWriter_cfi.py:59
ecaldqm::PNMGPAReader
Definition: DBReaderWorkers.h:199
ecaldqm::MemTTConsistencyReader
Definition: DBReaderWorkers.h:54
createfilelist.int
int
Definition: createfilelist.py:10
ecaldqm::Led1Reader
Definition: DBReaderWorkers.h:215
EcalCondDBReader::meSet_
ecaldqm::MESet * meSet_
Definition: EcalCondDBReader.h:40
MonRunTag
Definition: MonRunTag.h:13
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
ecaldqm::TimingLaserIRedCrystalReader
Definition: DBReaderWorkers.h:119
ecaldqm::TimingLed1CrystalReader
Definition: DBReaderWorkers.h:223
ecaldqm::TTConsistencyReader
Definition: DBReaderWorkers.h:38
std
Definition: JetResolutionObject.h:76
EcalCondDBReader::db_
EcalCondDBInterface * db_
Definition: EcalCondDBReader.h:36
ecaldqm::MESet::setBinContent
virtual void setBinContent(DetId const &, double)
Definition: MESet.h:51
ecaldqm::createMESet
MESet * createMESet(edm::ParameterSet const &)
Definition: MESetUtils.cc:18
ecaldqm::LaserIRedReader
Definition: DBReaderWorkers.h:111
ecaldqm::PulseShapeReader
Definition: DBReaderWorkers.h:191
dqm::implementation::IGetter
Definition: DQMStore.h:484
Exception
Definition: hltDiff.cc:246
MESetUtils.h
ecaldqm::PNGreenReader
Definition: DBReaderWorkers.h:103
ecaldqm::TimingLaserRedCrystalReader
Definition: DBReaderWorkers.h:143
ecaldqm::OccupancyReader
Definition: DBReaderWorkers.h:247
dqm::implementation::IBooker
Definition: DQMStore.h:43
ecaldqm::MemChConsistencyReader
Definition: DBReaderWorkers.h:46
EcalCondDBWriter_cfi.location
location
Definition: EcalCondDBWriter_cfi.py:63
MonRunTag::setMonVersionDef
void setMonVersionDef(const MonVersionDef &ver)
Definition: MonRunTag.cc:30
ParameterSet.h
EcalCondDBReader::monIOV_
MonRunIOV monIOV_
Definition: EcalCondDBReader.h:37
ecaldqm::LaserBlueReader
Definition: DBReaderWorkers.h:62
TableParser.table
table
Definition: TableParser.py:111
EcalCondDBInterface::fetchRunIOV
RunIOV fetchRunIOV(RunTag *tag, run_t run) noexcept(false)
Definition: EcalCondDBInterface.cc:631
EcalCondDBReader::~EcalCondDBReader
~EcalCondDBReader() override
Definition: EcalCondDBReader.cc:143
ecaldqm::LaserRedReader
Definition: DBReaderWorkers.h:135
EcalCondDBReader::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: EcalCondDBReader.cc:148
ecaldqm::TimingLaserBlueCrystalReader
Definition: DBReaderWorkers.h:70
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37