1 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImpl.hh" 2 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabase.hh" 3 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationItemNotFoundException.hh" 4 #include "CaloOnlineTools/HcalOnlineDb/interface/PluginManager.hh" 8 #include <toolbox/string.h> 16 m_implementation =
nullptr;
19 void ConfigurationDatabase::open(
const std::string& accessor) noexcept(
false) {
20 if (m_implementationOptions.empty()) {
21 std::vector<hcal::AbstractPluginFactory*> facts;
22 hcal::PluginManager::getFactories(
"hcal::ConfigurationDatabaseImpl", facts);
23 for (std::vector<hcal::AbstractPluginFactory*>::iterator
j = facts.begin();
j != facts.end();
j++)
24 m_implementationOptions.push_back(dynamic_cast<hcal::ConfigurationDatabaseImpl*>((*j)->newInstance()));
27 std::map<std::string, std::string>
params;
31 if (m_implementation ==
nullptr || !m_implementation->canHandleMethod(
method)) {
32 m_implementation =
nullptr;
33 std::vector<ConfigurationDatabaseImpl*>::iterator
j;
34 for (
j = m_implementationOptions.begin();
j != m_implementationOptions.end();
j++)
35 if ((*j)->canHandleMethod(
method)) {
36 m_implementation = *
j;
41 if (m_implementation ==
nullptr)
42 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
44 m_implementation->setLogger(m_logger);
45 m_implementation->connect(accessor);
48 void ConfigurationDatabase::close() {
49 if (m_implementation !=
nullptr)
50 m_implementation->disconnect();
53 unsigned int ConfigurationDatabase::getFirmwareChecksum(
const std::string& board,
54 unsigned int version) noexcept(
false) {
55 if (m_implementation ==
nullptr) {
56 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
59 return m_implementation->getFirmwareChecksum(board,
version);
62 ConfigurationDatabase::ApplicationConfig ConfigurationDatabase::getApplicationConfig(
const std::string&
tag,
65 if (m_implementation ==
nullptr) {
66 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
72 if (m_implementation ==
nullptr) {
73 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
75 return m_implementation->getConfigurationDocument(
tag);
78 void ConfigurationDatabase::getFirmwareMCS(
const std::string& board,
80 std::vector<std::string>& mcsLines) noexcept(
false) {
81 if (m_implementation ==
nullptr) {
82 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
85 m_implementation->getFirmwareMCS(board,
version, mcsLines);
91 std::map<LUTId, LUT>& LUTs) noexcept(
false) {
92 if (m_implementation ==
nullptr) {
93 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
96 std::map<unsigned int, std::string>
results;
98 m_implementation->getLUTs(
tag, crate, slot, LUTs);
101 XCEPT_RAISE(hcal::exception::ConfigurationItemNotFoundException,
106 void ConfigurationDatabase::getLUTChecksums(
const std::string&
tag,
107 std::map<LUTId, MD5Fingerprint>& checksums) noexcept(
false) {
110 if (m_implementation ==
nullptr) {
111 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
114 m_implementation->getLUTChecksums(
tag, checksums);
120 std::map<PatternId, HTRPattern>& patterns) noexcept(
false) {
121 if (m_implementation ==
nullptr) {
122 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
125 m_implementation->getPatterns(
tag, crate, slot, patterns);
127 if (patterns.empty()) {
128 XCEPT_RAISE(hcal::exception::ConfigurationItemNotFoundException,
136 std::map<RBXdatumId, RBXdatum>& RBXdata) noexcept(
false) {
137 if (m_implementation ==
nullptr) {
138 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
141 m_implementation->getRBXdata(
tag, rbx,
dtype, RBXdata);
144 void ConfigurationDatabase::getRBXpatterns(
const std::string&
tag,
146 std::map<RBXdatumId, RBXpattern>& patterns) noexcept(
false) {
147 if (m_implementation ==
nullptr) {
148 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
151 m_implementation->getRBXpatterns(
tag, rbx, patterns);
154 void ConfigurationDatabase::getZSThresholds(
const std::string&
tag,
157 std::map<ZSChannelId, int>&
thresholds) noexcept(
false) {
158 if (m_implementation ==
nullptr) {
159 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
162 m_implementation->getZSThresholds(
tag, crate, slot,
thresholds);
168 std::map<FPGAId, HLXMasks>&
m) noexcept(
false) {
169 if (m_implementation ==
nullptr) {
170 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
"Database connection not open");
173 m_implementation->getHLXMasks(
tag, crate, slot,
m);
204 if (fiber_slb <
a.fiber_slb)
206 if (fiber_slb >
a.fiber_slb)
208 if (channel <
a.channel)
210 if (channel >
a.channel)
212 if (lut_type <
a.lut_type)
214 if (lut_type >
a.lut_type)
254 if (channel <
a.channel)
256 if (channel >
a.channel)
269 if (qie_or_gol <
a.qie_or_gol)
271 if (qie_or_gol >
a.qie_or_gol)
bool operator<(IOVSyncValue const &iLHS, IOVSyncValue const &iRHS)
static PFTauRenderPlugin instance