CMS 3D CMS Logo

EcalCondDBReader.cc
Go to the documentation of this file.
2 
5 
9 
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")) {
18  edm::ParameterSet const &workerParams(_ps.getUntrackedParameterSet("workerParams"));
19 
20  if (table == "CrystalConsistency")
22  if (table == "TTConsistency")
24  if (table == "MemChConsistency")
26  if (table == "MemTTConsistency")
28  if (table == "LaserBlue")
30  if (table == "TimingLaserBlueCrystal")
32  if (table == "PNBlue")
34  if (table == "LaserGreen")
36  if (table == "TimingLaserGreenCrystal")
38  if (table == "PNGreen")
40  if (table == "LaserIRed")
42  if (table == "TimingLaserIRedCrystal")
44  if (table == "PNIRed")
46  if (table == "LaserRed")
48  if (table == "TimingLaserRedCrystal")
50  if (table == "PNRed")
52  if (table == "Pedestals")
54  if (table == "PNPed")
56  if (table == "PedestalsOnline")
58  if (table == "TestPulse")
60  if (table == "PulseShape")
62  if (table == "PNMGPA")
64  if (table == "TimingCrystal")
66  if (table == "Led1")
68  if (table == "TimingLed1Crystal")
70  if (table == "Led2")
72  if (table == "TimingLed2Crystal")
74  if (table == "Occupancy")
76 
77  if (!worker_)
78  throw cms::Exception("Configuration") << "Invalid worker type";
79 
82  int hostPort(_ps.getUntrackedParameter<int>("hostPort"));
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>(
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 
108  int runNumber(_ps.getUntrackedParameter<int>("runNumber"));
110 
111  if (verbosity_ > 0)
112  edm::LogInfo("EcalDQM") << "Initializing DB entry";
113 
114  RunTag runTag;
115 
116  try {
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);
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 }
141 
143  delete worker_;
144  delete meSet_;
145 }
146 
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 }
EcalCondDBInterface
Definition: EcalCondDBInterface.h:37
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:2129
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
edm::LogInfo
Definition: MessageLogger.h:254
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
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:10
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:36
edm::LogError
Definition: MessageLogger.h:183
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
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:142
ecaldqm::LaserRedReader
Definition: DBReaderWorkers.h:135
EcalCondDBReader::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: EcalCondDBReader.cc:147
ecaldqm::TimingLaserBlueCrystalReader
Definition: DBReaderWorkers.h:70
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37