Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:15:07

0001 
0002 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImplOracle.hh"
0003 #include <iostream>  // std::cout
0004 
0005 #ifdef HAVE_XDAQ
0006 #include <toolbox/string.h>
0007 #else
0008 #include "CaloOnlineTools/HcalOnlineDb/interface/xdaq_compat.h"  // Replaces toolbox::toString
0009 #endif
0010 
0011 using namespace std;
0012 using namespace oracle::occi;
0013 using namespace hcal;
0014 //
0015 // provides factory method for instantion of ConfigurationDatabaseImplOracle application
0016 //
0017 DECLARE_PLUGGABLE(hcal::ConfigurationDatabaseImpl, ConfigurationDatabaseImplOracle)
0018 
0019 ConfigurationDatabaseImplOracle::ConfigurationDatabaseImplOracle() {}
0020 
0021 bool ConfigurationDatabaseImplOracle::canHandleMethod(const std::string& method) const { return (method == "occi"); }
0022 
0023 ConfigurationDatabaseImplOracle::~ConfigurationDatabaseImplOracle() { disconnect(); }
0024 
0025 void ConfigurationDatabaseImplOracle::connect(const std::string& accessor) noexcept(false) {
0026   std::map<std::string, std::string> params;
0027   std::string user, host, method, db, port, password;
0028   ConfigurationDatabaseImpl::parseAccessor(accessor, method, host, port, user, db, params);
0029 
0030   if (method != "occi")
0031     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
0032                 std::string("Invalid accessor for Oracle : ") + accessor);
0033 
0034   if (params.find("PASSWORD") != params.end())
0035     password = params["PASSWORD"];
0036   if (params.find("LHWM_VERSION") != params.end())
0037     lhwm_version = params["LHWM_VERSION"];
0038 
0039   try {
0040     env_ = oracle::occi::Environment::createEnvironment(oracle::occi::Environment::DEFAULT);
0041     conn_ = env_->createConnection(user, password, db);
0042   } catch (SQLException& e) {
0043     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
0044                 ::toolbox::toString("Oracle  exception : %s", e.getMessage().c_str()));
0045   }
0046 
0047   if (env_ == nullptr || conn_ == nullptr) {
0048     std::string message("Error connecting on accessor '");
0049     message += accessor;
0050     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, message);
0051   }
0052 }
0053 
0054 void ConfigurationDatabaseImplOracle::disconnect() {
0055   try {
0056     //terminate environment and connection
0057     env_->terminateConnection(conn_);
0058     Environment::terminateEnvironment(env_);
0059   } catch (SQLException& e) {
0060     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
0061                 ::toolbox::toString("Oracle  exception : %s", e.getMessage().c_str()));
0062   }
0063 }
0064 
0065 //Utility function that cnverts oracle::occi::Clob to std::string
0066 string ConfigurationDatabaseImplOracle::clobToString(const oracle::occi::Clob& _clob) {
0067   oracle::occi::Clob clob = _clob;
0068   Stream* instream = clob.getStream(1, 0);
0069   unsigned int size = clob.length();
0070   char* cbuffer = new char[size];
0071   memset(cbuffer, 0, size);
0072   instream->readBuffer(cbuffer, size);
0073   std::string str(cbuffer, size);
0074   return str;
0075 }
0076 //inline function to convert hex2integer
0077 inline static int cvtChar(int c) {
0078   if (c >= '0' && c <= '9')
0079     c -= '0';
0080   if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
0081     c -= 'A' + 10;
0082   return c & 0xF;
0083 }
0084 
0085 void ConfigurationDatabaseImplOracle::getLUTChecksums(
0086     const std::string& tag,
0087     std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::MD5Fingerprint>&
0088         checksums) noexcept(false) {
0089   if (env_ == nullptr || conn_ == nullptr)
0090     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Database is not open");
0091   checksums.clear();
0092 
0093   try {
0094     Statement* stmt = conn_->createStatement();
0095 
0096     std::string query =
0097         ("SELECT TRIG_PRIM_LOOKUPTBL_DATA_CLOB FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_TRIG_LOOKUP_TABLES");
0098     query += " WHERE CRATE=-1";
0099     //query+=toolbox::toString(" WHERE TAG_NAME='%s' CRATE=-1", tag.c_str());
0100 
0101     //SELECT
0102     ResultSet* rs = stmt->executeQuery(query);
0103 
0104     while (rs->next()) {
0105       oracle::occi::Clob clob = rs->getClob(1);
0106       std::list<ConfigurationDatabaseStandardXMLParser::Item> items;
0107       std::string buffer = clobToString(clob);
0108 
0109       m_parser.parseMultiple(buffer, items);
0110 
0111       for (std::list<ConfigurationDatabaseStandardXMLParser::Item>::iterator i = items.begin(); i != items.end(); ++i) {
0112         hcal::ConfigurationDatabase::FPGASelection ifpga =
0113             (hcal::ConfigurationDatabase::FPGASelection)atoi(i->parameters["topbottom"].c_str());
0114         int islot = atoi(i->parameters["slot"].c_str());
0115         hcal::ConfigurationDatabase::LUTType ilut_type =
0116             (hcal::ConfigurationDatabase::LUTType)atoi(i->parameters["luttype"].c_str());
0117         int crate = atoi(i->parameters["crate"].c_str());
0118         int islb = atoi(i->parameters["slb"].c_str());
0119         int islbch = atoi(i->parameters["slbchan"].c_str());
0120         hcal::ConfigurationDatabase::LUTId lut_id;
0121         lut_id = hcal::ConfigurationDatabase::LUTId(crate, islot, ifpga, islb, islbch, ilut_type);
0122 
0123         hcal::ConfigurationDatabase::MD5Fingerprint csum(16);
0124         std::string encoded = (std::string)i->items[0];
0125         for (int i = 0; i < 16; i++) {
0126           //converting hex2integer
0127           csum[i] = cvtChar(encoded[i * 2]) * 16 + cvtChar(encoded[i * 2 + 1]);
0128         }
0129 
0130         checksums[lut_id] = csum;
0131       }
0132     }
0133     //Always terminate statement
0134     conn_->terminateStatement(stmt);
0135   } catch (SQLException& e) {
0136     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
0137                 ::toolbox::toString("Oracle  exception : %s", e.getMessage().c_str()));
0138   }
0139 }
0140 
0141 void ConfigurationDatabaseImplOracle::getLUTs(
0142     const std::string& tag,
0143     int crate,
0144     int slot,
0145     std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT>& LUTs) noexcept(false) {
0146   if (m_lutCache.crate != crate || m_lutCache.tag != tag) {
0147     m_lutCache.clear();
0148     getLUTs_real(tag, crate, m_lutCache.luts);
0149     m_lutCache.crate = crate;
0150     m_lutCache.tag = tag;
0151   }
0152 
0153   LUTs.clear();
0154   std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT>::const_iterator i;
0155   for (i = m_lutCache.luts.begin(); i != m_lutCache.luts.end(); i++) {
0156     if (i->first.slot == slot)
0157       LUTs.insert(*i);
0158   }
0159 }
0160 
0161 void ConfigurationDatabaseImplOracle::getLUTs_real(
0162     const std::string& tag,
0163     int crate,
0164     std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT>& LUTs) noexcept(false) {
0165   try {
0166     //Lets run the SQl Query
0167     Statement* stmt = conn_->createStatement();
0168 
0169     std::string query =
0170         ("SELECT TRIG_PRIM_LOOKUPTBL_DATA_CLOB FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_TRIG_LOOKUP_TABLES");
0171     query += toolbox::toString(" WHERE TAG_NAME='%s' AND CRATE=%d", tag.c_str(), crate);
0172 
0173     //SELECT
0174     ResultSet* rs = stmt->executeQuery(query);
0175 
0176     LUTs.clear();
0177 
0178     while (rs->next()) {
0179       oracle::occi::Clob clob = rs->getClob(1);
0180       std::list<ConfigurationDatabaseStandardXMLParser::Item> items;
0181       std::string buffer = clobToString(clob);
0182       m_parser.parseMultiple(buffer, items);
0183 
0184       for (std::list<ConfigurationDatabaseStandardXMLParser::Item>::iterator i = items.begin(); i != items.end(); ++i) {
0185         hcal::ConfigurationDatabase::FPGASelection ifpga =
0186             (hcal::ConfigurationDatabase::FPGASelection)atoi(i->parameters["TOPBOTTOM"].c_str());
0187         int islot = atoi(i->parameters["SLOT"].c_str());
0188 
0189         //If this is the desired slot
0190         //if (islot == slot) {
0191         hcal::ConfigurationDatabase::LUTType ilut_type =
0192             (hcal::ConfigurationDatabase::LUTType)atoi(i->parameters["LUT_TYPE"].c_str());
0193         hcal::ConfigurationDatabase::LUTId lut_id;
0194         if (ilut_type == hcal::ConfigurationDatabase::LinearizerLUT) {
0195           int ifiber = atoi(i->parameters["FIBER"].c_str());
0196           int ifiberch = atoi(i->parameters["FIBERCHAN"].c_str());
0197           lut_id = hcal::ConfigurationDatabase::LUTId(crate, islot, ifpga, ifiber, ifiberch, ilut_type);
0198         } else {
0199           int islb = atoi(i->parameters["SLB"].c_str());
0200           int islbch = atoi(i->parameters["SLBCHAN"].c_str());
0201           lut_id = hcal::ConfigurationDatabase::LUTId(crate, islot, ifpga, islb, islbch, ilut_type);
0202         }
0203 
0204         hcal::ConfigurationDatabase::LUT lut;
0205         lut.reserve(i->items.size());
0206 
0207         int strtol_base = 0;
0208         if (i->encoding == "hex")
0209           strtol_base = 16;
0210         else if (i->encoding == "dec")
0211           strtol_base = 10;
0212 
0213         // convert the data
0214         for (unsigned int j = 0; j < i->items.size(); j++)
0215           lut.push_back(strtol(i->items[j].c_str(), nullptr, strtol_base));
0216 
0217         LUTs.insert(make_pair(lut_id, lut));
0218         //}
0219       }
0220     }
0221 
0222     //Always terminate statement
0223     conn_->terminateStatement(stmt);
0224   } catch (SQLException& e) {
0225     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
0226                 ::toolbox::toString("Oracle  exception : %s", e.getMessage().c_str()));
0227   }
0228 }
0229 
0230 void ConfigurationDatabaseImplOracle::getPatterns(
0231     const std::string& tag,
0232     int crate,
0233     int slot,
0234     std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern>& patterns) noexcept(false) {
0235   if (m_patternCache.crate != crate || m_patternCache.tag != tag) {
0236     m_patternCache.clear();
0237     getPatterns_real(tag, crate, m_patternCache.patterns);
0238     m_patternCache.crate = crate;
0239     m_patternCache.tag = tag;
0240   }
0241 
0242   patterns.clear();
0243   std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern>::const_iterator i;
0244   for (i = m_patternCache.patterns.begin(); i != m_patternCache.patterns.end(); i++) {
0245     if (i->first.slot == slot)
0246       patterns.insert(*i);
0247   }
0248 }
0249 
0250 void ConfigurationDatabaseImplOracle::getPatterns_real(
0251     const std::string& tag,
0252     int crate,
0253     std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern>& patterns) noexcept(false) {
0254   try {
0255     //Lets run the SQl Query
0256     Statement* stmt = conn_->createStatement();
0257 
0258     std::string query =
0259         ("SELECT HTR_DATA_PATTERNS_DATA_CLOB FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_HTR_DATA_PATTERNS");
0260     query += toolbox::toString(" WHERE TAG_NAME='%s' AND CRATE=%d", tag.c_str(), crate);
0261 
0262     //SELECT
0263     ResultSet* rs = stmt->executeQuery(query);
0264 
0265     patterns.clear();
0266 
0267     while (rs->next()) {
0268       oracle::occi::Clob clob = rs->getClob(1);
0269       std::list<ConfigurationDatabaseStandardXMLParser::Item> items;
0270       std::string buffer = clobToString(clob);
0271 
0272       m_parser.parseMultiple(buffer, items);
0273 
0274       for (std::list<ConfigurationDatabaseStandardXMLParser::Item>::iterator i = items.begin(); i != items.end(); ++i) {
0275         int islot = atoi(i->parameters["SLOT"].c_str());
0276         //If this is the desired slot
0277         //if (islot == slot) {
0278         hcal::ConfigurationDatabase::FPGASelection ifpga =
0279             (hcal::ConfigurationDatabase::FPGASelection)atoi(i->parameters["TOPBOTTOM"].c_str());
0280         int ifiber = atoi(i->parameters["FIBER"].c_str());
0281 
0282         hcal::ConfigurationDatabase::PatternId pat_id(crate, islot, ifpga, ifiber);
0283         hcal::ConfigurationDatabase::HTRPattern& pat = patterns[pat_id];
0284         pat.reserve(i->items.size());
0285 
0286         int strtol_base = 0;
0287         if (i->encoding == "hex")
0288           strtol_base = 16;
0289         else if (i->encoding == "dec")
0290           strtol_base = 10;
0291 
0292         // convert the data
0293         for (unsigned int j = 0; j < i->items.size(); j++)
0294           pat.push_back(strtol(i->items[j].c_str(), nullptr, strtol_base));
0295         //}
0296       }
0297     }
0298     //Always terminate statement
0299     conn_->terminateStatement(stmt);
0300   } catch (SQLException& e) {
0301     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
0302                 ::toolbox::toString("Oracle  exception : %s", e.getMessage().c_str()));
0303   }
0304 }
0305 
0306 void ConfigurationDatabaseImplOracle::getRBXdata(
0307     const std::string& tag,
0308     const std::string& rbx,
0309     hcal::ConfigurationDatabase::RBXdatumType dtype,
0310     std::map<ConfigurationDatabase::RBXdatumId, hcal::ConfigurationDatabase::RBXdatum>& RBXdata) noexcept(false) {
0311   RBXdata.clear();
0312 
0313   Statement* stmt = conn_->createStatement();
0314   std::string query;
0315 
0316   //std::string datatypestr;
0317   switch (dtype) {
0318     case (ConfigurationDatabase::eRBXpedestal):
0319       //datatypestr="PEDESTAL";
0320 
0321       //Lets run the SQl Query
0322       query = "SELECT MODULE_POSITION, QIE_CARD_POSITION, QIE_ADC_NUMBER, INTEGER_VALUE ";
0323       query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_RBX_PEDESTAL_CONFIG ";
0324       query += toolbox::toString(" WHERE TAG_NAME='%s' AND NAME_LABEL='%s'", tag.c_str(), rbx.c_str());
0325 
0326       break;
0327 
0328     case (ConfigurationDatabase::eRBXdelay):
0329       //datatypestr="DELAY";
0330 
0331       query = "SELECT MODULE_POSITION, QIE_CARD_POSITION, QIE_ADC_NUMBER, INTEGER_VALUE ";
0332       query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_RBX_DELAY_CONFIG ";
0333       query += toolbox::toString(" WHERE TAG_NAME='%s' AND NAME_LABEL='%s'", tag.c_str(), rbx.c_str());
0334 
0335       break;
0336 
0337     case (ConfigurationDatabase::eRBXgolCurrent):
0338       //datatypestr="GOL";
0339 
0340       query = "SELECT MODULE_POSITION, QIE_CARD_POSITION, FIBER_NUMBER, INTEGER_VALUE ";
0341       query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_RBX_GOL_CONFIG ";
0342       query += toolbox::toString(" WHERE TAG_NAME='%s' AND NAME_LABEL='%s'", tag.c_str(), rbx.c_str());
0343 
0344       break;
0345     case (ConfigurationDatabase::eRBXledData):
0346       //datatypestr="LED";
0347       query = "SELECT LED_AMPLITUDE, SET_LEDS_IS_CHECKED, BUNCH_NUMBER ";
0348       query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_RBX_INITPAR_T02_CONFIG ";
0349       query += toolbox::toString(" WHERE TAG_NAME='%s' AND NAME_LABEL='%s'", tag.c_str(), rbx.c_str());
0350       break;
0351 
0352     case (ConfigurationDatabase::eRBXbroadcast):
0353       //datatypestr="";
0354       printf("ConfigurationDatabaseImplMySQL::getRBXdata Can't handle BROADCAST yet\n");
0355       return;
0356     case (ConfigurationDatabase::eRBXttcrxPhase):
0357       //datatypestr="PHASE";
0358       printf("ConfigurationDatabaseImplMySQL::getRBXdata Can't handle TTCRX PHASE yet\n");
0359       return;
0360     case (ConfigurationDatabase::eRBXqieResetDelay):
0361       //datatypestr="";
0362       printf("ConfigurationDatabaseImplMySQL::getRBXdata Can't handle QIE RESET DELAY yet\n");
0363       return;
0364     case (ConfigurationDatabase::eRBXccaPatterns):
0365       XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Patterns must use getRBXPatterns, not getRBXData");
0366       return;
0367     default:
0368       printf("ConfigurationDatabaseImplMySQL::getRBXdata Can't handle dtype=%d yet\n", dtype);
0369       return;
0370   }
0371 
0372   try {
0373     //SELECT
0374     ResultSet* rs = stmt->executeQuery(query);
0375     while (rs->next()) {
0376       if (dtype == ConfigurationDatabase::eRBXledData) {
0377         //LED_AMPLITUDE, SET_LEDS_IS_CHECKED, BUNCH_NUMBER
0378         unsigned int ampl = rs->getInt(1);
0379         unsigned int enable = rs->getInt(2);
0380         unsigned int bunch = rs->getInt(3);
0381 
0382         if (enable)
0383           enable |= 0x1;  // global enable if either is on
0384         RBXdata.insert(std::pair<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXdatum>(
0385             ConfigurationDatabase::eLEDenable, enable));
0386         RBXdata.insert(std::pair<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXdatum>(
0387             ConfigurationDatabase::eLEDamplitude, ampl));
0388         RBXdata.insert(std::pair<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXdatum>(
0389             ConfigurationDatabase::eLEDtiming_hb, ((bunch & 0xFF00) >> 8)));
0390         RBXdata.insert(std::pair<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXdatum>(
0391             ConfigurationDatabase::eLEDtiming_lb, (bunch & 0xFF)));
0392       } else {
0393         //MODULE_POSITION, QIE_CARD_POSITION, QIE_ADC_NUMBER/FIBER_NUMBER, INTEGER_VALUE
0394         int rm = rs->getInt(1);
0395         int card = rs->getInt(2);
0396         int qie_or_gol = rs->getInt(3);
0397         unsigned int data = rs->getInt(4);
0398 
0399         ConfigurationDatabase::RBXdatumId id(rm, card, qie_or_gol, dtype);
0400         RBXdata.insert(
0401             std::pair<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXdatum>(id, (unsigned char)(data)));
0402       }
0403     }
0404 
0405     //Always terminate statement
0406     conn_->terminateStatement(stmt);
0407   } catch (SQLException& e) {
0408     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
0409                 ::toolbox::toString("Oracle  exception : %s", e.getMessage().c_str()));
0410   }
0411 }
0412 
0413 void ConfigurationDatabaseImplOracle::getZSThresholds(
0414     const std::string& tag,
0415     int crate,
0416     int slot,
0417     std::map<hcal::ConfigurationDatabase::ZSChannelId, int>& thresholds) noexcept(false) {
0418   try {
0419     //Lets run the SQl Query
0420     Statement* stmt = conn_->createStatement();
0421     //SELECT HTR_FIBER, FIBER_CHANNEL, ZERO_SUPPRESSION, HTR_FPGA
0422     //FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_ZERO_SUPPRESSION_LHWM
0423     //WHERE TAG_NAME='Kukartsev test 1' AND CRATE=2 AND HTR_SLOT=2
0424     //AND LHWM_VERSION='20'
0425 
0426     std::string query = ("SELECT HTR_FIBER, FIBER_CHANNEL, ZERO_SUPPRESSION, HTR_FPGA ");
0427     query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_ZERO_SUPPRESSION_LHWM ";
0428     query += toolbox::toString(" WHERE TAG_NAME='%s' AND CRATE=%d AND HTR_SLOT=%d", tag.c_str(), crate, slot);
0429     query += toolbox::toString(" AND LHWM_VERSION='%s'", lhwm_version.c_str());
0430 
0431     //SELECT
0432     ResultSet* rs = stmt->executeQuery(query);
0433 
0434     thresholds.clear();
0435 
0436     while (rs->next()) {
0437       unsigned int fiber = rs->getInt(1);
0438       unsigned int fc = rs->getInt(2);
0439       unsigned int zs = rs->getInt(3);
0440       std::string fpga = rs->getString(4);
0441       int tb;
0442       if (fpga == "top")
0443         tb = 1;
0444       else
0445         tb = 0;
0446       std::cout << "crate,slot,tb,fiber,fc:" << crate << slot << tb << fiber << fc << std::endl;
0447       hcal::ConfigurationDatabase::ZSChannelId id(
0448           crate, slot, (hcal::ConfigurationDatabase::FPGASelection)tb, fiber, fc);
0449       thresholds[id] = zs;
0450     }
0451     //Always terminate statement
0452     conn_->terminateStatement(stmt);
0453   } catch (SQLException& e) {
0454     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
0455                 ::toolbox::toString("Oracle  exception : %s", e.getMessage().c_str()));
0456   }
0457 }
0458 
0459 void ConfigurationDatabaseImplOracle::getHLXMasks(
0460     const std::string& tag,
0461     int crate,
0462     int slot,
0463     std::map<hcal::ConfigurationDatabase::FPGAId, hcal::ConfigurationDatabase::HLXMasks>& masks) noexcept(false) {
0464   if (m_hlxMaskCache.crate != crate || m_hlxMaskCache.tag != tag) {
0465     m_hlxMaskCache.clear();
0466     getHLXMasks_real(tag, crate, m_hlxMaskCache.masks);
0467     m_hlxMaskCache.crate = crate;
0468     m_hlxMaskCache.tag = tag;
0469   }
0470 
0471   masks.clear();
0472   std::map<ConfigurationDatabase::FPGAId, ConfigurationDatabase::HLXMasks>::const_iterator i;
0473   for (i = m_hlxMaskCache.masks.begin(); i != m_hlxMaskCache.masks.end(); i++) {
0474     if (i->first.slot == slot)
0475       masks.insert(*i);
0476   }
0477 }
0478 
0479 void ConfigurationDatabaseImplOracle::getHLXMasks_real(
0480     const std::string& tag,
0481     int crate,
0482     std::map<ConfigurationDatabase::FPGAId, ConfigurationDatabase::HLXMasks>& masks) noexcept(false) {
0483   try {
0484     //Lets run the SQl Query
0485     Statement* stmt = conn_->createStatement();
0486     std::string query = ("SELECT SLOT_NUMBER, FPGA, OCC_MASK, LHC_MASK, SUM_ET_MASK ");
0487     query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_HLX_MASKS ";
0488     query += toolbox::toString(" WHERE TAG_NAME='%s' AND CRATE_NUMBER=%d ", tag.c_str(), crate);
0489 
0490     //SELECT
0491     ResultSet* rs = stmt->executeQuery(query);
0492     masks.clear();
0493     while (rs->next()) {
0494       int islot = rs->getInt(1);
0495       std::string fpga = rs->getString(2);
0496 
0497       int ifpga;
0498       if (fpga == "top")
0499         ifpga = 1;
0500       else
0501         ifpga = 0;
0502 
0503       hcal::ConfigurationDatabase::FPGAId fpga_id;
0504       fpga_id =
0505           hcal::ConfigurationDatabase::FPGAId(crate, islot, (hcal::ConfigurationDatabase::FPGASelectionEnum)ifpga);
0506       hcal::ConfigurationDatabase::HLXMasks hlxMask;
0507       hlxMask.occMask = rs->getInt(3);
0508       hlxMask.lhcMask = rs->getInt(4);
0509       hlxMask.sumEtMask = rs->getInt(5);
0510 
0511       masks[fpga_id] = hlxMask;
0512     }
0513     //Always terminate statement
0514     conn_->terminateStatement(stmt);
0515   } catch (SQLException& e) {
0516     XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
0517                 ::toolbox::toString("Oracle  exception : %s", e.getMessage().c_str()));
0518   }
0519 }
0520 
0521 // added by Gena Kukartsev
0522 oracle::occi::Connection* ConfigurationDatabaseImplOracle::getConnection(void) { return conn_; }
0523 
0524 oracle::occi::Environment* ConfigurationDatabaseImplOracle::getEnvironment(void) { return env_; }