CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ConfigurationDatabaseImplOracle.cc
Go to the documentation of this file.
1 
2 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImplOracle.hh"
3 #include <iostream> // std::cout
4 
5 #ifdef HAVE_XDAQ
6 #include <toolbox/string.h>
7 #else
8 #include "CaloOnlineTools/HcalOnlineDb/interface/xdaq_compat.h" // Replaces toolbox::toString
9 #endif
10 
11 using namespace std;
12 using namespace oracle::occi;
13 using namespace hcal;
14 //
15 // provides factory method for instantion of ConfigurationDatabaseImplOracle application
16 //
17 DECLARE_PLUGGABLE(hcal::ConfigurationDatabaseImpl,ConfigurationDatabaseImplOracle)
18 
19 ConfigurationDatabaseImplOracle::ConfigurationDatabaseImplOracle()
20 {
21 
22 }
23 
24 bool ConfigurationDatabaseImplOracle::canHandleMethod(const std::string& method) const {
25  return (method=="occi");
26 }
27 
28 ConfigurationDatabaseImplOracle::~ConfigurationDatabaseImplOracle() {
29  disconnect();
30 
31 }
32 
33 void ConfigurationDatabaseImplOracle::connect(const std::string& accessor) throw (hcal::exception::ConfigurationDatabaseException) {
34  std::map<std::string,std::string> params;
35  std::string user, host, method, db, port,password;
36  ConfigurationDatabaseImpl::parseAccessor(accessor,method,host,port,user,db,params);
37 
38  if (method!="occi") XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,std::string("Invalid accessor for Oracle : ")+accessor);
39 
40  if (params.find("PASSWORD")!=params.end()) password=params["PASSWORD"];
41  if (params.find("LHWM_VERSION")!=params.end()) lhwm_version=params["LHWM_VERSION"];
42 
43  try {
44  env_ = oracle::occi::Environment::createEnvironment (oracle::occi::Environment::DEFAULT);
45  conn_ = env_->createConnection (user, password, db);
46  } catch (SQLException& e) {
47  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
48  }
49 
50 
51  if (env_ == NULL || conn_ == NULL) {
52  std::string message("Error connecting on accessor '");
53  message+=accessor;
54  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,message);
55  }
56 }
57 
58 void ConfigurationDatabaseImplOracle::disconnect() {
59 
60  try {
61  //terminate environment and connection
62  env_->terminateConnection(conn_);
63  Environment::terminateEnvironment(env_);
64  } catch (SQLException& e) {
65  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
66  }
67 
68 
69 }
70 
71 //Utility function that cnverts oracle::occi::Clob to std::string
72 string ConfigurationDatabaseImplOracle::clobToString(const oracle::occi::Clob& _clob){
73  oracle::occi::Clob clob = _clob;
74  Stream *instream = clob.getStream (1,0);
75  unsigned int size = clob.length();
76  char *cbuffer = new char[size];
77  memset (cbuffer, 0, size);
78  instream->readBuffer (cbuffer, size);
79  std::string str(cbuffer,size);
80  return str;
81 }
82 //inline function to convert hex2integer
83 inline static int cvtChar(int c) {
84  if (c>='0' && c<='9') c-='0';
85  if ((c>='a' && c<='f')||(c>='A' && c<='F')) c-='A'+10;
86  return c&0xF;
87 }
88 
89 void ConfigurationDatabaseImplOracle::getLUTChecksums(const std::string& tag,
90  std::map<hcal::ConfigurationDatabase::LUTId,
91  hcal::ConfigurationDatabase::MD5Fingerprint>& checksums) throw (hcal::exception::ConfigurationDatabaseException) {
92 
93  if (env_ == NULL || conn_ == NULL) XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,"Database is not open");
94  checksums.clear();
95 
96  try {
97  Statement* stmt = conn_->createStatement();
98 
99  std::string query = ("SELECT TRIG_PRIM_LOOKUPTBL_DATA_CLOB FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_TRIG_LOOKUP_TABLES");
100  query+=" WHERE CRATE=-1";
101  //query+=toolbox::toString(" WHERE TAG_NAME='%s' CRATE=-1", tag.c_str());
102 
103  //SELECT
104  ResultSet *rs = stmt->executeQuery(query.c_str());
105 
106  while (rs->next()) {
107  oracle::occi::Clob clob = rs->getClob (1);
108  std::list<ConfigurationDatabaseStandardXMLParser::Item> items;
109  std::string buffer = clobToString(clob);
110 
111  m_parser.parseMultiple(buffer,items);
112 
113  for (std::list<ConfigurationDatabaseStandardXMLParser::Item>::iterator i=items.begin(); i!=items.end(); ++i) {
114 
115  hcal::ConfigurationDatabase::FPGASelection ifpga =
116  (hcal::ConfigurationDatabase::FPGASelection)atoi(i->parameters["topbottom"].c_str());
117  int islot = atoi(i->parameters["slot"].c_str());
118  hcal::ConfigurationDatabase::LUTType ilut_type =
119  (hcal::ConfigurationDatabase::LUTType)atoi(i->parameters["luttype"].c_str());
120  int crate=atoi(i->parameters["crate"].c_str());
121  int islb=atoi(i->parameters["slb"].c_str());
122  int islbch=atoi(i->parameters["slbchan"].c_str());
123  hcal::ConfigurationDatabase::LUTId lut_id;
124  lut_id=hcal::ConfigurationDatabase::LUTId(crate, islot, ifpga, islb, islbch, ilut_type);
125 
126  hcal::ConfigurationDatabase::MD5Fingerprint csum(16);
127  std::string encoded = (std::string)i->items[0];
128  for (int i=0; i<16; i++) {
129  //converting hex2integer
130  csum[i]=cvtChar(encoded[i*2])*16+cvtChar(encoded[i*2+1]);
131  }
132 
133  checksums[lut_id]=csum;
134  }
135  }
136  //Always terminate statement
137  conn_->terminateStatement(stmt);
138  } catch (SQLException& e) {
139  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
140  }
141 
142 }
143 
144 void ConfigurationDatabaseImplOracle::getLUTs(const std::string& tag, int crate, int slot, std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT >& LUTs) throw (hcal::exception::ConfigurationDatabaseException) {
145  if (m_lutCache.crate!=crate || m_lutCache.tag!=tag) {
146  m_lutCache.clear();
147  getLUTs_real(tag,crate,m_lutCache.luts);
148  m_lutCache.crate=crate;
149  m_lutCache.tag=tag;
150  }
151 
152  LUTs.clear();
153  std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT >::const_iterator i;
154  for (i=m_lutCache.luts.begin(); i!=m_lutCache.luts.end(); i++) {
155  if (i->first.slot==slot)
156  LUTs.insert(*i);
157  }
158 }
159 
160 
161 void ConfigurationDatabaseImplOracle::getLUTs_real(const std::string& tag, int crate,
162  std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT >& LUTs)
163  throw (hcal::exception::ConfigurationDatabaseException)
164 {
165 
166  try {
167  //Lets run the SQl Query
168  Statement* stmt = conn_->createStatement();
169 
170  std::string query = ("SELECT TRIG_PRIM_LOOKUPTBL_DATA_CLOB FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_TRIG_LOOKUP_TABLES");
171  query+=toolbox::toString(" WHERE TAG_NAME='%s' AND CRATE=%d", tag.c_str(), crate);
172 
173  //SELECT
174  ResultSet *rs = stmt->executeQuery(query.c_str());
175 
176  LUTs.clear();
177 
178  while (rs->next()) {
179  oracle::occi::Clob clob = rs->getClob (1);
180  std::list<ConfigurationDatabaseStandardXMLParser::Item> items;
181  std::string buffer = clobToString(clob);
182  m_parser.parseMultiple(buffer,items);
183 
184  for (std::list<ConfigurationDatabaseStandardXMLParser::Item>::iterator i=items.begin(); i!=items.end(); ++i) {
185  hcal::ConfigurationDatabase::FPGASelection ifpga =
186  (hcal::ConfigurationDatabase::FPGASelection)atoi(i->parameters["TOPBOTTOM"].c_str());
187  int islot = atoi(i->parameters["SLOT"].c_str());
188 
189  //If this is the desired slot
190  //if (islot == slot) {
191  hcal::ConfigurationDatabase::LUTType ilut_type =
192  (hcal::ConfigurationDatabase::LUTType)atoi(i->parameters["LUT_TYPE"].c_str());
193  hcal::ConfigurationDatabase::LUTId lut_id;
194  if (ilut_type==hcal::ConfigurationDatabase::LinearizerLUT) {
195  int ifiber=atoi(i->parameters["FIBER"].c_str());
196  int ifiberch=atoi(i->parameters["FIBERCHAN"].c_str());
197  lut_id=hcal::ConfigurationDatabase::LUTId(crate, islot, ifpga, ifiber, ifiberch, ilut_type);
198  } else {
199  int islb=atoi(i->parameters["SLB"].c_str());
200  int islbch=atoi(i->parameters["SLBCHAN"].c_str());
201  lut_id=hcal::ConfigurationDatabase::LUTId(crate, islot, ifpga, islb, islbch, ilut_type);
202  }
203 
205  lut.reserve(i->items.size());
206 
207  int strtol_base=0;
208  if (i->encoding=="hex") strtol_base=16;
209  else if (i->encoding=="dec") strtol_base=10;
210 
211  // convert the data
212  for (unsigned int j=0; j<i->items.size(); j++)
213  lut.push_back(strtol(i->items[j].c_str(),0,strtol_base));
214 
215  LUTs.insert(make_pair(lut_id, lut));
216  //}
217  }
218  }
219 
220  //Always terminate statement
221  conn_->terminateStatement(stmt);
222  } catch (SQLException& e) {
223  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
224  }
225 
226 }
227 
228 void ConfigurationDatabaseImplOracle::getPatterns(const std::string& tag, int crate, int slot, std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern >& patterns) throw (hcal::exception::ConfigurationDatabaseException) {
229  if (m_patternCache.crate!=crate || m_patternCache.tag!=tag) {
230  m_patternCache.clear();
231  getPatterns_real(tag,crate,m_patternCache.patterns);
232  m_patternCache.crate=crate;
233  m_patternCache.tag=tag;
234  }
235 
236  patterns.clear();
237  std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern >::const_iterator i;
238  for (i=m_patternCache.patterns.begin(); i!=m_patternCache.patterns.end(); i++) {
239  if (i->first.slot==slot)
240  patterns.insert(*i);
241  }
242 }
243 
244 void ConfigurationDatabaseImplOracle::getPatterns_real(const std::string& tag, int crate,
245  std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern >& patterns)
246  throw (hcal::exception::ConfigurationDatabaseException) {
247  try {
248  //Lets run the SQl Query
249  Statement* stmt = conn_->createStatement();
250 
251  std::string query = ("SELECT HTR_DATA_PATTERNS_DATA_CLOB FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_HTR_DATA_PATTERNS");
252  query+=toolbox::toString(" WHERE TAG_NAME='%s' AND CRATE=%d", tag.c_str(), crate);
253 
254  //SELECT
255  ResultSet *rs = stmt->executeQuery(query.c_str());
256 
257  patterns.clear();
258 
259  while (rs->next()) {
260  oracle::occi::Clob clob = rs->getClob (1);
261  std::list<ConfigurationDatabaseStandardXMLParser::Item> items;
262  std::string buffer = clobToString(clob);
263 
264  m_parser.parseMultiple(buffer,items);
265 
266  for (std::list<ConfigurationDatabaseStandardXMLParser::Item>::iterator i=items.begin(); i!=items.end(); ++i) {
267  int islot=atoi(i->parameters["SLOT"].c_str());
268  //If this is the desired slot
269  //if (islot == slot) {
270  hcal::ConfigurationDatabase::FPGASelection ifpga =
271  (hcal::ConfigurationDatabase::FPGASelection)atoi(i->parameters["TOPBOTTOM"].c_str());
272  int ifiber=atoi(i->parameters["FIBER"].c_str());
273 
274  hcal::ConfigurationDatabase::PatternId pat_id(crate, islot, ifpga, ifiber);
275  hcal::ConfigurationDatabase::HTRPattern& pat=patterns[pat_id];
276  pat.reserve(i->items.size());
277 
278  int strtol_base=0;
279  if (i->encoding=="hex") strtol_base=16;
280  else if (i->encoding=="dec") strtol_base=10;
281 
282  // convert the data
283  for (unsigned int j=0; j<i->items.size(); j++)
284  pat.push_back(strtol(i->items[j].c_str(),0,strtol_base));
285  //}
286  }
287  }
288  //Always terminate statement
289  conn_->terminateStatement(stmt);
290  } catch (SQLException& e) {
291  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
292  }
293 
294 
295 }
296 
297 void ConfigurationDatabaseImplOracle::getRBXdata(const std::string& tag, const std::string& rbx,
298  hcal::ConfigurationDatabase::RBXdatumType dtype,
299  std::map<ConfigurationDatabase::RBXdatumId, hcal::ConfigurationDatabase::RBXdatum>& RBXdata)
300  throw (hcal::exception::ConfigurationDatabaseException) {
301 
302  RBXdata.clear();
303 
304  Statement* stmt = conn_->createStatement();
306 
307  //std::string datatypestr;
308  switch (dtype) {
309 
310  case (ConfigurationDatabase::eRBXpedestal):
311  //datatypestr="PEDESTAL";
312 
313  //Lets run the SQl Query
314  query = "SELECT MODULE_POSITION, QIE_CARD_POSITION, QIE_ADC_NUMBER, INTEGER_VALUE ";
315  query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_RBX_PEDESTAL_CONFIG ";
316  query += toolbox::toString(" WHERE TAG_NAME='%s' AND NAME_LABEL='%s'", tag.c_str(), rbx.c_str());
317 
318  break;
319 
320  case (ConfigurationDatabase::eRBXdelay):
321  //datatypestr="DELAY";
322 
323  query = "SELECT MODULE_POSITION, QIE_CARD_POSITION, QIE_ADC_NUMBER, INTEGER_VALUE ";
324  query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_RBX_DELAY_CONFIG ";
325  query += toolbox::toString(" WHERE TAG_NAME='%s' AND NAME_LABEL='%s'", tag.c_str(), rbx.c_str());
326 
327  break;
328 
329  case (ConfigurationDatabase::eRBXgolCurrent):
330  //datatypestr="GOL";
331 
332  query = "SELECT MODULE_POSITION, QIE_CARD_POSITION, FIBER_NUMBER, INTEGER_VALUE ";
333  query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_RBX_GOL_CONFIG ";
334  query += toolbox::toString(" WHERE TAG_NAME='%s' AND NAME_LABEL='%s'", tag.c_str(), rbx.c_str());
335 
336  break;
337  case (ConfigurationDatabase::eRBXledData):
338  //datatypestr="LED";
339  query = "SELECT LED_AMPLITUDE, SET_LEDS_IS_CHECKED, BUNCH_NUMBER ";
340  query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_RBX_INITPAR_T02_CONFIG ";
341  query += toolbox::toString(" WHERE TAG_NAME='%s' AND NAME_LABEL='%s'", tag.c_str(), rbx.c_str());
342  break;
343 
344 
345  case (ConfigurationDatabase::eRBXbroadcast):
346  //datatypestr="";
347  printf("ConfigurationDatabaseImplMySQL::getRBXdata Can't handle BROADCAST yet\n");
348  return;
349  case (ConfigurationDatabase::eRBXttcrxPhase):
350  //datatypestr="PHASE";
351  printf("ConfigurationDatabaseImplMySQL::getRBXdata Can't handle TTCRX PHASE yet\n");
352  return;
353  case (ConfigurationDatabase::eRBXqieResetDelay):
354  //datatypestr="";
355  printf("ConfigurationDatabaseImplMySQL::getRBXdata Can't handle QIE RESET DELAY yet\n");
356  return;
357  case (ConfigurationDatabase::eRBXccaPatterns):
358  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,"Patterns must use getRBXPatterns, not getRBXData");
359  return;
360  default:
361  printf("ConfigurationDatabaseImplMySQL::getRBXdata Can't handle dtype=%d yet\n",dtype);
362  return;
363  }
364 
365  try {
366  //SELECT
367  ResultSet *rs = stmt->executeQuery(query.c_str());
368  while (rs->next()) {
369 
370  if (dtype==ConfigurationDatabase::eRBXledData) {
371  //LED_AMPLITUDE, SET_LEDS_IS_CHECKED, BUNCH_NUMBER
372  unsigned int ampl = rs->getInt(1);
373  unsigned int enable = rs->getInt(2);
374  unsigned int bunch = rs->getInt(3);
375 
376  if (enable) enable|=0x1; // global enable if either is on
377  RBXdata.insert(std::pair<ConfigurationDatabase::RBXdatumId,ConfigurationDatabase::RBXdatum>
378  (ConfigurationDatabase::eLEDenable,enable));
379  RBXdata.insert(std::pair<ConfigurationDatabase::RBXdatumId,ConfigurationDatabase::RBXdatum>
380  (ConfigurationDatabase::eLEDamplitude,ampl));
381  RBXdata.insert(std::pair<ConfigurationDatabase::RBXdatumId,ConfigurationDatabase::RBXdatum>
382  (ConfigurationDatabase::eLEDtiming_hb,((bunch&0xFF00)>>8)));
383  RBXdata.insert(std::pair<ConfigurationDatabase::RBXdatumId,ConfigurationDatabase::RBXdatum>
384  (ConfigurationDatabase::eLEDtiming_lb,(bunch&0xFF)));
385  } else {
386  //MODULE_POSITION, QIE_CARD_POSITION, QIE_ADC_NUMBER/FIBER_NUMBER, INTEGER_VALUE
387  int rm = rs->getInt(1);
388  int card = rs->getInt(2);
389  int qie_or_gol = rs->getInt(3);
390  unsigned int data = rs->getInt(4);
391 
392  ConfigurationDatabase::RBXdatumId id(rm,card,qie_or_gol,dtype);
393  RBXdata.insert(std::pair<ConfigurationDatabase::RBXdatumId,ConfigurationDatabase::RBXdatum>(id,(unsigned char)(data)));
394  }
395  }
396 
397  //Always terminate statement
398  conn_->terminateStatement(stmt);
399  } catch (SQLException& e) {
400  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
401  }
402 
403 }
404 
405 void ConfigurationDatabaseImplOracle::getZSThresholds(const std::string& tag, int crate, int slot,
406  std::map<hcal::ConfigurationDatabase::ZSChannelId, int>& thresholds)
407  throw (hcal::exception::ConfigurationDatabaseException) {
408 
409  try {
410  //Lets run the SQl Query
411  Statement* stmt = conn_->createStatement();
412  //SELECT HTR_FIBER, FIBER_CHANNEL, ZERO_SUPPRESSION, HTR_FPGA
413  //FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_ZERO_SUPPRESSION_LHWM
414  //WHERE TAG_NAME='Kukartsev test 1' AND CRATE=2 AND HTR_SLOT=2
415  //AND LHWM_VERSION='20'
416 
417  std::string query = ("SELECT HTR_FIBER, FIBER_CHANNEL, ZERO_SUPPRESSION, HTR_FPGA ");
418  query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_ZERO_SUPPRESSION_LHWM ";
419  query+=toolbox::toString(" WHERE TAG_NAME='%s' AND CRATE=%d AND HTR_SLOT=%d", tag.c_str(), crate, slot);
420  query+=toolbox::toString(" AND LHWM_VERSION='%s'", lhwm_version.c_str());
421 
422  //SELECT
423  ResultSet *rs = stmt->executeQuery(query.c_str());
424 
425  thresholds.clear();
426 
427  while (rs->next()) {
428  unsigned int fiber = rs->getInt(1);
429  unsigned int fc = rs->getInt(2);
430  unsigned int zs = rs->getInt(3);
431  std::string fpga = rs->getString(4);
432  int tb;
433  if (fpga=="top") tb = 1;
434  else tb = 0;
435  std::cout << "crate,slot,tb,fiber,fc:" << crate<<slot<<tb<<fiber<<fc<<std::endl;
436  hcal::ConfigurationDatabase::ZSChannelId id(crate,slot,(hcal::ConfigurationDatabase::FPGASelection)tb,fiber,fc);
437  thresholds[id] = zs;
438  }
439  //Always terminate statement
440  conn_->terminateStatement(stmt);
441  } catch (SQLException& e) {
442  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
443  }
444 
445 }
446 
447 
448 void ConfigurationDatabaseImplOracle::getHLXMasks(const std::string& tag, int crate, int slot,
449  std::map<hcal::ConfigurationDatabase::FPGAId, hcal::ConfigurationDatabase::HLXMasks>& masks)
450  throw (hcal::exception::ConfigurationDatabaseException) {
451  if (m_hlxMaskCache.crate!=crate || m_hlxMaskCache.tag!=tag) {
452  m_hlxMaskCache.clear();
453  getHLXMasks_real(tag,crate,m_hlxMaskCache.masks);
454  m_hlxMaskCache.crate=crate;
455  m_hlxMaskCache.tag=tag;
456  }
457 
458  masks.clear();
459  std::map<ConfigurationDatabase::FPGAId, ConfigurationDatabase::HLXMasks>::const_iterator i;
460  for (i=m_hlxMaskCache.masks.begin(); i!=m_hlxMaskCache.masks.end(); i++) {
461  if (i->first.slot==slot)
462  masks.insert(*i);
463  }
464 }
465 
466 
467 void ConfigurationDatabaseImplOracle::getHLXMasks_real(const std::string& tag, int crate,
468  std::map<ConfigurationDatabase::FPGAId, ConfigurationDatabase::HLXMasks>& masks)
469  throw (hcal::exception::ConfigurationDatabaseException) {
470  try {
471  //Lets run the SQl Query
472  Statement* stmt = conn_->createStatement();
473  std::string query = ("SELECT SLOT_NUMBER, FPGA, OCC_MASK, LHC_MASK, SUM_ET_MASK ");
474  query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.V_HCAL_HLX_MASKS ";
475  query += toolbox::toString(" WHERE TAG_NAME='%s' AND CRATE_NUMBER=%d ", tag.c_str(), crate);
476 
477  //SELECT
478  ResultSet *rs = stmt->executeQuery(query.c_str());
479  masks.clear();
480  while (rs->next()) {
481  int islot = rs->getInt(1);
482  std::string fpga = rs->getString(2);
483 
484  int ifpga;
485  if (fpga=="top") ifpga = 1;
486  else ifpga = 0;
487 
488  hcal::ConfigurationDatabase::FPGAId fpga_id;
489  fpga_id=hcal::ConfigurationDatabase::FPGAId(crate, islot,
490  (hcal::ConfigurationDatabase::FPGASelectionEnum)ifpga);
491  hcal::ConfigurationDatabase::HLXMasks hlxMask;
492  hlxMask.occMask = rs->getInt(3);
493  hlxMask.lhcMask = rs->getInt(4);
494  hlxMask.sumEtMask = rs->getInt(5);
495 
496  masks[fpga_id]=hlxMask;
497  }
498  //Always terminate statement
499  conn_->terminateStatement(stmt);
500  } catch (SQLException& e) {
501  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
502  }
503 }
504 
505 // added by Gena Kukartsev
506 oracle::occi::Connection * ConfigurationDatabaseImplOracle::getConnection( void ){
507  return conn_;
508 }
509 
510 oracle::occi::Environment * ConfigurationDatabaseImplOracle::getEnvironment( void ){
511  return env_;
512 }
513 
int i
Definition: DBlmapReader.cc:9
static int cvtChar(int c)
tuple db
Definition: EcalCondDB.py:151
#define NULL
Definition: scimark2.h:8
int port
Definition: query.py:115
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
std::string toString(const char *format,...)
Definition: xdaq_compat.cc:4
string rm
Definition: submit.py:76
int j
Definition: DBlmapReader.cc:9
tuple lut
Definition: lumiPlot.py:244
string host
Definition: query.py:114
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple query
Definition: o2o.py:269
tuple cout
Definition: gather_cfg.py:121
RecoEventOutputModuleForFU< RecoEventWriterForFU > Stream
Definition: SealModule.cc:26
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:32
tuple size
Write out results.
static const uint32_t masks[]
Definition: CaloRecHit.cc:12