CMS 3D CMS Logo

EcalCondDBInterface.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <string>
4 #include <vector>
5 #include <sstream>
6 #include <cstdlib>
7 #include <cstdlib>
8 #include <ctime>
9 #include <stdexcept>
11 
17 
24 
25 using namespace std;
26 using namespace oracle::occi;
27 
29  // retrieve the lists of logic_ids, to build the detids
30  std::vector<EcalLogicID> crystals_EB = getEcalLogicIDSetOrdered(
31  "EB_crystal_angle", -85, 85, 1, 360, EcalLogicID::NULLID, EcalLogicID::NULLID, "EB_crystal_number", 4);
32  std::vector<EcalLogicID> crystals_EE =
33  getEcalLogicIDSetOrdered("EE_crystal_number", -1, 1, 1, 100, 1, 100, "EE_crystal_number", 4);
34  // fill the barrel map
35  std::vector<EcalLogicID>::const_iterator ieb = crystals_EB.begin();
36  std::vector<EcalLogicID>::const_iterator eeb = crystals_EB.end();
37  while (ieb != eeb) {
38  int iEta = ieb->getID1();
39  int iPhi = ieb->getID2();
40  EBDetId ebdetid(iEta, iPhi);
41  _logicId2DetId[ieb->getLogicID()] = ebdetid;
42  _detId2LogicId[ebdetid] = ieb->getLogicID();
43  ieb++;
44  }
45 
46  // fill the endcap map
47  std::vector<EcalLogicID>::const_iterator iee = crystals_EE.begin();
48  std::vector<EcalLogicID>::const_iterator eee = crystals_EE.end();
49 
50  while (iee != eee) {
51  int iSide = iee->getID1();
52  int iX = iee->getID2();
53  int iY = iee->getID3();
54  EEDetId eedetidpos(iX, iY, iSide);
55  _logicId2DetId[iee->getLogicID()] = eedetidpos;
56  _detId2LogicId[eedetidpos] = iee->getLogicID();
57  iee++;
58  }
59 }
60 
61 EcalLogicID EcalCondDBInterface::getEcalLogicID(int logicID) noexcept(false) {
62  string sql =
63  "SELECT name, logic_id, id1, id2, id3, maps_to FROM channelView WHERE logic_id = :logicID AND name=maps_to";
64 
65  int id1, id2, id3;
66  string name, mapsTo;
67 
68  try {
69  stmt->setSQL(sql);
70  stmt->setInt(1, logicID);
71  ResultSet* rset = stmt->executeQuery();
72 
73  if (rset->next()) {
74  name = rset->getString(1);
75  logicID = rset->getInt(2);
76  id1 = rset->getInt(3);
77  if (rset->isNull(3)) {
79  }
80  id2 = rset->getInt(4);
81  if (rset->isNull(4)) {
83  }
84  id3 = rset->getInt(5);
85  if (rset->isNull(5)) {
86  id3 = EcalLogicID::NULLID;
87  }
88  mapsTo = rset->getString(6);
89  } else {
90  stringstream msg;
91  msg << "ERROR: Cannot build EcalLogicID for logic_id " << logicID;
92  throw(std::runtime_error(msg.str()));
93  }
94 
95  } catch (SQLException& e) {
96  throw(std::runtime_error(std::string("ERROR: Failed to retrive ids: ") + e.getMessage()));
97  }
98 
99  return EcalLogicID(name, logicID, id1, id2, id3, mapsTo);
100 }
101 
102 std::list<ODDelaysDat> EcalCondDBInterface::fetchFEDelaysForRun(RunIOV* iov) noexcept(false) {
103  std::list<ODDelaysDat> ret;
105  std::map<EcalLogicID, RunFEConfigDat> fillMap;
106  try {
107  d.setConnection(env, conn);
108  d.fetchData(&fillMap, iov);
109  } catch (std::runtime_error& e) {
110  throw e;
111  }
112  std::map<EcalLogicID, RunFEConfigDat>::const_iterator i = fillMap.begin();
113  std::map<EcalLogicID, RunFEConfigDat>::const_iterator e = fillMap.end();
114  while (i != e) {
115  ODFEDAQConfig feDaqConfig;
117  temp.setId(i->second.getConfigId());
118  feDaqConfig.setConnection(env, conn);
119  feDaqConfig.fetchData(&temp);
120  std::vector<ODDelaysDat> delays;
121  ODDelaysDat temp2;
122  temp2.setConnection(env, conn);
123  temp2.fetchData(&delays, temp.getDelayId());
124  std::vector<ODDelaysDat>::const_iterator di = delays.begin();
125  std::vector<ODDelaysDat>::const_iterator de = delays.end();
126  while (di != de) {
127  ret.push_back(*di++);
128  }
129  i++;
130  }
131  return ret;
132 }
133 
134 EcalLogicID EcalCondDBInterface::getEcalLogicID(string name, int id1, int id2, int id3, string mapsTo) noexcept(false) {
135  if (mapsTo.empty()) {
136  mapsTo = name;
137  }
138 
139  // build the sql string
140  stringstream ss;
141  ss << "SELECT logic_id FROM channelView WHERE name = :n AND";
142  int idarray[] = {id1, id2, id3};
143  for (int i = 1; i <= 3; i++) {
144  if (idarray[i - 1] == EcalLogicID::NULLID) {
145  ss << " id" << i << " IS NULL AND";
146  } else {
147  ss << " id" << i << " = :id" << i << " AND";
148  }
149  }
150  ss << " maps_to = :m";
151 
152  // cout << "SQL: " << ss.str() << endl;
153 
154  int logic_id;
155  try {
156  stmt->setSQL(ss.str());
157 
158  // bind the parameters
159  int j = 1; // parameter number counter
160  stmt->setString(j, name);
161  j++;
162  for (int i = 0; i < 3; i++) {
163  if (idarray[i] != EcalLogicID::NULLID) {
164  stmt->setInt(j, idarray[i]);
165  j++;
166  }
167  }
168  stmt->setString(j, mapsTo);
169 
170  // execute the statement and retrieve the logic_id
171  ResultSet* rset = stmt->executeQuery();
172  if (rset->next()) {
173  logic_id = rset->getInt(1);
174  } else {
175  stringstream msg;
176  msg << "ERROR: Query for EcalLogicID failed for parameters ["
177  << "name=" << name << ",maps_to=" << mapsTo << ",id1=" << id1 << ",id2=" << id2 << ",id3=" << id3 << "]";
178  throw(std::runtime_error(msg.str()));
179  }
180  } catch (SQLException& e) {
181  throw(std::runtime_error(std::string("ERROR: Failed to retrive logic_id: ") + e.getMessage()));
182  }
183 
184  // create and return the EcalLogicID object
185  return EcalLogicID(name, logic_id, id1, id2, id3, mapsTo);
186 }
187 
188 std::vector<EcalLogicID> EcalCondDBInterface::getEcalLogicIDSet(
189  string name, int fromId1, int toId1, int fromId2, int toId2, int fromId3, int toId3, string mapsTo) noexcept(false) {
190  if (mapsTo.empty()) {
191  mapsTo = name;
192  }
193 
194  int idArray[] = {fromId1, toId1, fromId2, toId2, fromId3, toId3};
195  int from, to;
196 
197  stringstream ss;
198  ss << "SELECT name, logic_id, id1, id2, id3, maps_to FROM channelView WHERE name = :name AND ";
199 
200  // loop through the three ids
201  for (int i = 1; i <= 3; i++) {
202  from = idArray[2 * (i - 1)];
203  to = idArray[2 * (i - 1) + 1];
204 
205  // check the id arguments in pairs
206  if ((from == EcalLogicID::NULLID && to != EcalLogicID::NULLID) || // one is null
207  (from != EcalLogicID::NULLID && to == EcalLogicID::NULLID) || // but not the other
208  (from > to)) { // negative interval
209  throw(std::runtime_error("ERROR: Bad arguments for getEcalLogicIDSet"));
210  }
211 
212  // build the sql
213  if (from == EcalLogicID::NULLID && to == EcalLogicID::NULLID) {
214  ss << "id" << i << " IS NULL AND ";
215  } else {
216  ss << "id" << i << " >= :id" << i << "from AND "
217  << "id" << i << " <= :id" << i << "to AND ";
218  }
219  }
220  ss << "maps_to = :maps_to ORDER BY id1, id2, id3";
221 
222  std::vector<EcalLogicID> result;
223 
224  try {
225  stmt->setSQL(ss.str());
226 
227  // bind the parameters
228  int j = 1; // parameter number counter
229  stmt->setString(j, name);
230  j++;
231 
232  for (int i = 0; i < 3; i++) {
233  from = idArray[2 * i];
234  to = idArray[2 * i + 1];
235  if (from != EcalLogicID::NULLID) {
236  stmt->setInt(j, from);
237  j++;
238  stmt->setInt(j, to);
239  j++;
240  }
241  }
242 
243  stmt->setString(j, mapsTo);
244 
245  stmt->setPrefetchRowCount(IDBObject::ECALDB_NROWS);
246 
247  ResultSet* rset = stmt->executeQuery();
248 
249  int id1, id2, id3, logicId;
250 
251  while (rset->next()) {
252  name = rset->getString(1);
253  logicId = rset->getInt(2);
254  id1 = rset->getInt(3);
255  if (rset->isNull(3)) {
257  }
258  id2 = rset->getInt(4);
259  if (rset->isNull(4)) {
261  }
262  id3 = rset->getInt(5);
263  if (rset->isNull(5)) {
264  id3 = EcalLogicID::NULLID;
265  }
266  mapsTo = rset->getString(6);
267 
268  EcalLogicID ecid = EcalLogicID(name, logicId, id1, id2, id3, mapsTo);
269  result.push_back(ecid);
270  }
271  stmt->setPrefetchRowCount(0);
272 
273  } catch (SQLException& e) {
274  throw(std::runtime_error(std::string("ERROR: Failure while getting EcalLogicID set: ") + e.getMessage()));
275  }
276 
277  return result;
278 }
279 
281  std::map<int, int> ret;
282  std::vector<EcalLogicID> crystals_EB = getEcalLogicIDSetOrdered("EB_crystal_number",
283  1,
284  36,
285  1,
286  1700,
289  "EB_crystal_number",
291  std::vector<EcalLogicID> crystals_EE =
292  getEcalLogicIDSetOrdered("EE_crystal_number", -1, 1, 1, 100, 1, 100, "EE_crystal_number", EcalLogicID::NULLID);
293  std::vector<EcalLogicID> EB_lmr = getEcalLogicIDSetOrdered(
294  "EB_crystal_number", 1, 36, 1, 1700, EcalLogicID::NULLID, EcalLogicID::NULLID, "ECAL_LMR", EcalLogicID::NULLID);
295  std::vector<EcalLogicID> EE_lmr =
296  getEcalLogicIDSetOrdered("EE_crystal_number", -1, 1, 1, 100, 1, 100, "ECAL_LMR", EcalLogicID::NULLID);
297  unsigned int neb = crystals_EB.size();
298  unsigned int nee = crystals_EE.size();
299  if (neb != EB_lmr.size()) {
300  throw(std::runtime_error("ERROR: EB Vectors size do not agree"));
301  }
302  if (nee != EE_lmr.size()) {
303  throw(std::runtime_error("ERROR: EE Vectors size do not agree"));
304  }
305  for (unsigned int i = 0; i < neb; i++) {
306  ret[crystals_EB[i].getLogicID()] = EB_lmr[i].getLogicID() % 100;
307  }
308  for (unsigned int i = 0; i < nee; i++) {
309  ret[crystals_EE[i].getLogicID()] = EE_lmr[i].getLogicID() % 100;
310  }
311  return ret;
312 }
313 
314 std::vector<EcalLogicID> EcalCondDBInterface::getEcalLogicIDMappedTo(int lmr_logic_id, std::string maps_to) {
315  std::string name = "EB_crystal_angle";
316  std::string sql =
317  "SELECT LOGIC_ID, ID1, ID2, ID3 "
318  "FROM CHANNELVIEW WHERE NAME = 'EB_crystal_angle' AND LOGIC_ID IN "
319  "(SELECT LOGIC_ID FROM CHANNELVIEW WHERE NAME = 'EB_crystal_number' AND "
320  "ID1*10000+ID2 IN (SELECT DISTINCT ID1*10000+ID2 FROM CHANNELVIEW "
321  "WHERE LOGIC_ID = :1 AND NAME = 'EB_crystal_number' AND MAPS_TO = :2) "
322  "AND NAME = MAPS_TO)";
323  if ((lmr_logic_id / 1000000000) == 2) {
324  name = "EE_crystal_number";
325  sql =
326  "SELECT LOGIC_ID, ID1, ID2, ID3 "
327  "FROM CHANNELVIEW WHERE NAME = 'EE_crystal_number' AND LOGIC_ID IN "
328  "(SELECT LOGIC_ID FROM CHANNELVIEW WHERE NAME = 'EE_crystal_number' AND "
329  "ID1*10000000+ID2*10000+ID3 IN (SELECT DISTINCT "
330  "ID1*10000000+ID2*10000+ID3 FROM CHANNELVIEW "
331  "WHERE LOGIC_ID = :1 AND NAME = 'EE_crystal_number' AND MAPS_TO = :2) "
332  "AND NAME = MAPS_TO) AND NAME = MAPS_TO";
333  }
334  std::vector<EcalLogicID> ret;
335  try {
336  stmt->setSQL(sql);
337  stmt->setInt(1, lmr_logic_id);
338  stmt->setString(2, maps_to);
339  stmt->setPrefetchRowCount(IDBObject::ECALDB_NROWS);
340 
341  ResultSet* rset = stmt->executeQuery();
342 
343  while (rset->next()) {
344  int logic_id = rset->getInt(1);
345  int id1 = rset->getInt(2);
346  if (rset->isNull(2)) {
348  }
349  int id2 = rset->getInt(3);
350  if (rset->isNull(3)) {
352  }
353  int id3 = rset->getInt(4);
354  if (rset->isNull(4)) {
355  id3 = EcalLogicID::NULLID;
356  }
357 
358  EcalLogicID ecid = EcalLogicID(name, logic_id, id1, id2, id3, maps_to);
359  ret.push_back(ecid);
360  }
361  stmt->setPrefetchRowCount(0);
362  } catch (SQLException& e) {
363  throw(std::runtime_error(std::string("ERROR: Failure while getting EcalLogicID set: ") + e.getMessage()));
364  }
365  return ret;
366 }
367 
368 std::vector<EcalLogicID> EcalCondDBInterface::getEcalLogicIDForLMR(int lmr) {
369  return getEcalLogicIDMappedTo(lmr, "ECAL_LMR");
370 }
371 
372 std::vector<EcalLogicID> EcalCondDBInterface::getEcalLogicIDForLMR(const EcalLogicID& lmr) {
373  return getEcalLogicIDForLMR(lmr.getLogicID());
374 }
375 
376 std::vector<EcalLogicID> EcalCondDBInterface::getEcalLogicIDForLMPN(int lmr) {
377  if ((lmr / 1000000000) == 2) {
378  return getEcalLogicIDMappedTo(lmr, "EE_LM_PN");
379  } else {
380  return getEcalLogicIDMappedTo(lmr, "EB_LM_PN");
381  }
382 }
383 
384 std::vector<EcalLogicID> EcalCondDBInterface::getEcalLogicIDForLMPN(const EcalLogicID& lmr) {
385  return getEcalLogicIDForLMR(lmr.getLogicID());
386 }
387 
389  string name, int fromId1, int toId1, int fromId2, int toId2, int fromId3, int toId3, string mapsTo, int orderedBy)
390  // the orderedBy can be 1, 2, 3, 4
391  // corresponding to id1 id2 id3 or logic_id
392  noexcept(false) {
393  if (mapsTo.empty()) {
394  mapsTo = name;
395  }
396 
397  int idArray[] = {fromId1, toId1, fromId2, toId2, fromId3, toId3};
398  int from, to;
399 
400  stringstream ss;
401  ss << "SELECT name, logic_id, id1, id2, id3, maps_to FROM channelView WHERE name = :name AND ";
402 
403  // loop through the three ids
404  for (int i = 1; i <= 3; i++) {
405  from = idArray[2 * (i - 1)];
406  to = idArray[2 * (i - 1) + 1];
407 
408  // check the id arguments in pairs
409  if ((from == EcalLogicID::NULLID && to != EcalLogicID::NULLID) || // one is null
410  (from != EcalLogicID::NULLID && to == EcalLogicID::NULLID) || // but not the other
411  (from > to)) { // negative interval
412  throw(std::runtime_error("ERROR: Bad arguments for getEcalLogicIDSet"));
413  }
414 
415  // build the sql
416  if (from == EcalLogicID::NULLID && to == EcalLogicID::NULLID) {
417  ss << "id" << i << " IS NULL AND ";
418  } else {
419  ss << "id" << i << " >= :id" << i << "from AND "
420  << "id" << i << " <= :id" << i << "to AND ";
421  }
422  }
423  ss << "maps_to = :maps_to ";
424 
425  if (orderedBy == EcalLogicID::NULLID) {
426  ss << " ORDER BY id1, id2, id3";
427  } else if (orderedBy == 1 || orderedBy == 12 || orderedBy == 123) {
428  ss << " ORDER BY id1, id2, id3 ";
429  } else if (orderedBy == 213 || orderedBy == 21) {
430  ss << " ORDER BY id2, id1, id3 ";
431  } else if (orderedBy == 231 || orderedBy == 23) {
432  ss << " ORDER BY id2, id3, id1 ";
433  } else if (orderedBy == 321 || orderedBy == 32) {
434  ss << " ORDER BY id3, id2, id1 ";
435  } else if (orderedBy == 312 || orderedBy == 31) {
436  ss << " ORDER BY id3, id1, id2 ";
437  } else if (orderedBy == 132 || orderedBy == 13) {
438  ss << " ORDER BY id1, id3, id2 ";
439  } else if (orderedBy == 1234) {
440  ss << " ORDER BY id1, id2, id3, logic_id ";
441  } else if (orderedBy == 4) {
442  ss << " ORDER BY logic_id ";
443  } else {
444  ss << " ORDER BY id1, id2, id3";
445  }
446 
447  std::vector<EcalLogicID> result;
448 
449  try {
450  stmt->setSQL(ss.str());
451 
452  // bind the parameters
453  int j = 1; // parameter number counter
454  stmt->setString(j, name);
455  j++;
456 
457  for (int i = 0; i < 3; i++) {
458  from = idArray[2 * i];
459  to = idArray[2 * i + 1];
460  if (from != EcalLogicID::NULLID) {
461  stmt->setInt(j, from);
462  j++;
463  stmt->setInt(j, to);
464  j++;
465  }
466  }
467 
468  stmt->setString(j, mapsTo);
469 
470  stmt->setPrefetchRowCount(IDBObject::ECALDB_NROWS);
471 
472  ResultSet* rset = stmt->executeQuery();
473 
474  int id1, id2, id3, logicId;
475 
476  while (rset->next()) {
477  name = rset->getString(1);
478  logicId = rset->getInt(2);
479  id1 = rset->getInt(3);
480  if (rset->isNull(3)) {
482  }
483  id2 = rset->getInt(4);
484  if (rset->isNull(4)) {
486  }
487  id3 = rset->getInt(5);
488  if (rset->isNull(5)) {
489  id3 = EcalLogicID::NULLID;
490  }
491  mapsTo = rset->getString(6);
492 
493  EcalLogicID ecid = EcalLogicID(name, logicId, id1, id2, id3, mapsTo);
494  result.push_back(ecid);
495  }
496  stmt->setPrefetchRowCount(0);
497 
498  } catch (SQLException& e) {
499  throw(std::runtime_error(std::string("ERROR: Failure while getting EcalLogicID set: ") + e.getMessage()));
500  }
501 
502  return result;
503 }
504 
505 void EcalCondDBInterface::insertRunIOV(RunIOV* iov) noexcept(false) {
506  try {
507  iov->setConnection(env, conn);
508  iov->writeDB();
509  } catch (std::runtime_error& e) {
510  conn->rollback();
511  throw(e);
512  }
513  conn->commit();
514 }
515 
516 void EcalCondDBInterface::insertLmfSeq(LMFSeqDat* iov) noexcept(false) {
517  try {
518  iov->setConnection(env, conn);
519  iov->writeDB();
520  } catch (std::runtime_error& e) {
521  conn->rollback();
522  throw(e);
523  }
524  conn->commit();
525 }
526 
528  try {
529  iov->setConnection(env, conn);
530  iov->writeDB();
531  } catch (std::runtime_error& e) {
532  conn->rollback();
533  throw(e);
534  }
535  conn->commit();
536 }
537 
538 void EcalCondDBInterface::insertLmfIOV(LMFIOV* iov) noexcept(false) {
539  try {
540  iov->setConnection(env, conn);
541  iov->writeDB();
542  } catch (std::runtime_error& e) {
543  conn->rollback();
544  throw(e);
545  }
546  conn->commit();
547 }
548 
549 void EcalCondDBInterface::insertLmfDat(LMFDat* dat) noexcept(false) {
550  try {
551  dat->setConnection(env, conn);
552  dat->writeDB();
553  } catch (std::runtime_error& e) {
554  conn->rollback();
555  throw(e);
556  }
557  conn->commit();
558 }
559 
560 void EcalCondDBInterface::insertLmfDat(std::list<LMFDat*> dat) noexcept(false) {
561  try {
562  std::list<LMFDat*>::iterator i = dat.begin();
563  std::list<LMFDat*>::iterator e = dat.end();
564  while (i != e) {
565  (*i)->setConnection(env, conn);
566  (*i)->writeDB();
567  i++;
568  }
569  } catch (std::runtime_error& e) {
570  conn->rollback();
571  throw(e);
572  }
573  conn->commit();
574 }
575 
577  try {
578  iov->setConnection(env, conn);
579  iov->writeDB();
580  } catch (std::runtime_error& e) {
581  conn->rollback();
582  throw(e);
583  }
584  conn->commit();
585 }
586 
587 void EcalCondDBInterface::updateRunIOV(RunIOV* iov) noexcept(false) {
588  try {
589  iov->setConnection(env, conn);
590  iov->updateEndTimeDB();
591  } catch (std::runtime_error& e) {
592  conn->rollback();
593  throw(e);
594  }
595  conn->commit();
596 }
597 
599  try {
600  iov->setConnection(env, conn);
601  iov->updateEndTimeDB();
602  } catch (std::runtime_error& e) {
603  conn->rollback();
604  throw(e);
605  }
606  conn->commit();
607 }
608 
610  try {
611  iov->setConnection(env, conn);
612  iov->updateStartTimeDB();
613  } catch (std::runtime_error& e) {
614  conn->rollback();
615  throw(e);
616  }
617  conn->commit();
618 }
619 
621  try {
622  od->setConnection(env, conn);
623  od->updateDefaultCycle();
624  } catch (std::runtime_error& e) {
625  conn->rollback();
626  throw(e);
627  }
628  conn->commit();
629 }
630 
632  RunIOV iov;
633  iov.setConnection(env, conn);
634  iov.setByRun(tag, run);
635  return iov;
636 }
637 
639  RunIOV iov;
640  iov.setConnection(env, conn);
641  iov.setByRun(location, run);
642  return iov;
643 }
644 
646  RunIOV iov;
647  iov.setConnection(env, conn);
648  iov.setByTime(location, t);
649  return iov;
650 }
651 
653  try {
654  iov->setConnection(env, conn);
655  iov->writeDB();
656  } catch (std::runtime_error& e) {
657  conn->rollback();
658  throw(e);
659  }
660  conn->commit();
661 }
662 
663 void EcalCondDBInterface::insertDCUIOV(DCUIOV* iov) noexcept(false) {
664  try {
665  iov->setConnection(env, conn);
666  iov->writeDB();
667  } catch (std::runtime_error& e) {
668  conn->rollback();
669  throw(e);
670  }
671  conn->commit();
672 }
673 
675  MonRunTag* montag,
676  run_t run,
677  subrun_t subrun) noexcept(false) {
678  RunIOV runiov = fetchRunIOV(runtag, run);
679  MonRunIOV moniov;
680  moniov.setConnection(env, conn);
681  moniov.setByRun(montag, &runiov, subrun);
682  return moniov;
683 }
684 
685 DCUIOV EcalCondDBInterface::fetchDCUIOV(DCUTag* tag, const Tm& eventTm) noexcept(false) {
686  DCUIOV dcuiov;
687  dcuiov.setConnection(env, conn);
688  dcuiov.setByTm(tag, eventTm);
689  return dcuiov;
690 }
691 
693  LMFSeqDat seq(env, conn);
694  return seq.fetchLastRun();
695 }
696 
698  LMFRunTag* lmftag,
699  run_t run,
700  subrun_t subrun) noexcept(false) {
701  RunIOV runiov = fetchRunIOV(runtag, run);
702  LMFRunIOV lmfiov;
703  lmfiov.setConnection(env, conn);
704  // lmfiov.setByRun(lmftag, &runiov, subrun);
705  return lmfiov;
706 }
707 
708 bool EcalCondDBInterface::fetchLMFRunIOV(const LMFSeqDat& seq, LMFRunIOV& iov, int lmr, int type, int color) const {
709  bool ret = false;
710  iov.setConnection(env, conn);
711  std::list<LMFRunIOV> iovlist = iov.fetchBySequence(seq, lmr, type, color);
712  int s = iovlist.size();
713  if (s > 0) {
714  iov = iovlist.front();
715  ret = true;
716  if (s > 1) {
717  // should not happen
718  std::cout << "################################" << std::endl;
719  std::cout << "################################" << std::endl;
720  std::cout << "WARNING: More than one LMFRUNIOV" << std::endl;
721  std::cout << " Found for seq " << seq.getID() << std::endl;
722  std::cout << " lmr " << lmr << " type " << type << std::endl;
723  std::cout << " and color " << color << std::endl;
724  std::cout << "################################" << std::endl;
725  std::cout << "################################" << std::endl;
726  }
727  } else {
728  // find the most recent data
729  iovlist = iov.fetchLastBeforeSequence(seq, lmr, type, color);
730  s = iovlist.size();
731  if (s == 1) {
732  iov = iovlist.front();
733  }
734  }
735  return ret;
736 }
737 
738 CaliIOV EcalCondDBInterface::fetchCaliIOV(CaliTag* tag, const Tm& eventTm) noexcept(false) {
739  CaliIOV caliiov;
740  caliiov.setConnection(env, conn);
741  caliiov.setByTm(tag, eventTm);
742  return caliiov;
743 }
744 
747  r.setConnection(env, conn);
748  r.fetchValuesForECID(ecid);
749  return r;
750 }
751 
753  const Tm& start,
754  const Tm& end) noexcept(false) {
756  r.setConnection(env, conn);
757  r.fetchValuesForECIDAndTime(ecid, start, end);
758  return r;
759 }
760 
762  RunList r;
763  r.setConnection(env, conn);
764  r.setRunTag(tag);
765  r.fetchRuns();
766  return r;
767 }
768 
769 RunList EcalCondDBInterface::fetchRunList(const RunTag& tag, int min_run, int max_run) noexcept(false) {
770  RunList r;
771  r.setConnection(env, conn);
772  r.setRunTag(tag);
773  r.fetchRuns(min_run, max_run);
774  return r;
775 }
776 
777 RunList EcalCondDBInterface::fetchNonEmptyRunList(const RunTag& tag, int min_run, int max_run) noexcept(false) {
778  RunList r;
779  r.setConnection(env, conn);
780  r.setRunTag(tag);
781  r.fetchNonEmptyRuns(min_run, max_run);
782  return r;
783 }
784 
785 RunList EcalCondDBInterface::fetchNonEmptyGlobalRunList(const RunTag& tag, int min_run, int max_run) noexcept(false) {
786  RunList r;
787  r.setConnection(env, conn);
788  r.setRunTag(tag);
789  r.fetchNonEmptyGlobalRuns(min_run, max_run);
790  return r;
791 }
792 
794  int min_run,
795  int max_run,
796  const LocationDef& locDef) noexcept(false) {
797  RunList r;
798  r.setConnection(env, conn);
799  r.setRunTag(tag);
800  r.fetchRunsByLocation(min_run, max_run, locDef);
801  return r;
802 }
803 
805  int min_run,
806  int max_run,
807  const LocationDef& locDef) noexcept(false) {
808  RunList r;
809  r.setConnection(env, conn);
810  r.setRunTag(tag);
811  r.fetchGlobalRunsByLocation(min_run, max_run, locDef);
812  return r;
813 }
814 
815 RunList EcalCondDBInterface::fetchRunListLastNRuns(const RunTag& tag, int max_run, int n_runs) noexcept(false) {
816  RunList r;
817  r.setConnection(env, conn);
818  r.setRunTag(tag);
819  r.fetchLastNRuns(max_run, n_runs);
820  return r;
821 }
822 
823 // from here it is for the MonRunList
824 
825 MonRunList EcalCondDBInterface::fetchMonRunList(const RunTag& tag, const MonRunTag& monrunTag) noexcept(false) {
826  MonRunList r;
827  r.setConnection(env, conn);
828  r.setRunTag(tag);
829  r.setMonRunTag(monrunTag);
830  r.fetchRuns();
831  return r;
832 }
833 
835  const MonRunTag& monrunTag,
836  int min_run,
837  int max_run) noexcept(false) {
838  MonRunList r;
839  r.setConnection(env, conn);
840  r.setRunTag(tag);
841  r.setMonRunTag(monrunTag);
842  r.fetchRuns(min_run, max_run);
843  return r;
844 }
845 
847  const MonRunTag& monrunTag,
848  int max_run,
849  int n_runs) noexcept(false) {
850  MonRunList r;
851  r.setConnection(env, conn);
852  r.setRunTag(tag);
853  r.setMonRunTag(monrunTag);
854  r.fetchLastNRuns(max_run, n_runs);
855  return r;
856 }
857 
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
RunIOV
Definition: RunIOV.h:13
mps_fire.i
i
Definition: mps_fire.py:428
CaliIOV
Definition: CaliIOV.h:13
start
Definition: start.py:1
MonRunList
Definition: MonRunList.h:16
cmsswSequenceInfo.seq
seq
Definition: cmsswSequenceInfo.py:539
subrun_t
int subrun_t
Definition: MODRunIOV.h:11
EcalCondDBInterface::dummy
void dummy()
Definition: EcalCondDBInterface.cc:858
MonRunList.h
RunList.h
run_t
int run_t
Definition: CaliIOV.h:11
RunList
Definition: RunList.h:16
LMFRunTag
Definition: LMFRunTag.h:16
EcalCondDBInterface::updateRunIOVStartTime
void updateRunIOVStartTime(RunIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:609
EBDetId
Definition: EBDetId.h:17
EcalCondDBInterface::fetchMonRunList
MonRunList fetchMonRunList(const RunTag &tag, const MonRunTag &monruntag) noexcept(false)
Definition: EcalCondDBInterface.cc:825
RunIOV.h
RunTag
Definition: RunTag.h:13
globals_cff.id1
id1
Definition: globals_cff.py:33
CaliTag
Definition: CaliTag.h:13
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalCondDBInterface::fetchRunListByLocation
RunList fetchRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
Definition: EcalCondDBInterface.cc:793
EcalCondDBInterface::insertDCUIOV
void insertDCUIOV(DCUIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:663
RunIOV::setByTime
void setByTime(std::string location, const Tm &t) noexcept(false)
Definition: RunIOV.cc:353
DCUIOV
Definition: DCUIOV.h:13
LocationDef
Definition: LocationDef.h:12
EcalCondDBInterface::fetchMonRunIOV
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun) noexcept(false)
Definition: EcalCondDBInterface.cc:674
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
to
EcalCondDBInterface::fetchRunList
RunList fetchRunList(const RunTag &tag) noexcept(false)
Definition: EcalCondDBInterface.cc:761
EcalCondDBInterface::fetchNonEmptyGlobalRunList
RunList fetchNonEmptyGlobalRunList(const RunTag &tag, int min_run, int max_run) noexcept(false)
Definition: EcalCondDBInterface.cc:785
EcalCondDBInterface::insertRunIOV
void insertRunIOV(RunIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:505
mps_check.msg
tuple msg
Definition: mps_check.py:285
EcalCondDBInterface::getEcalLogicIDMappedTo
std::vector< EcalLogicID > getEcalLogicIDMappedTo(int logic_id, std::string maps_to)
Definition: EcalCondDBInterface.cc:314
EcalCondDBInterface::updateRunIOV
void updateRunIOV(RunIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:587
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
LMFDat
Definition: LMFDat.h:18
EcalCondDBInterface::updateRunIOVEndTime
void updateRunIOVEndTime(RunIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:598
LMFRunIOV::fetchLastBeforeSequence
std::list< LMFRunIOV > fetchLastBeforeSequence(const LMFSeqDat &s, int lmr, int type, int color)
Definition: LMFRunIOV.cc:391
LMFIOV
Definition: LMFIOV.h:17
EcalCondDBInterface::getEcalLogicID2LmrMap
std::map< int, int > getEcalLogicID2LmrMap()
Definition: EcalCondDBInterface.cc:280
LMFRunIOV
Definition: LMFRunIOV.h:18
LMFLmrSubIOV
Definition: LMFLmrSubIOV.h:13
oracle::occi
Definition: ConnectionManager.h:7
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
EcalCondDBInterface::getEcalLogicIDForLMR
std::vector< EcalLogicID > getEcalLogicIDForLMR(int lmr_logic_id)
Definition: EcalCondDBInterface.cc:368
mps_fire.end
end
Definition: mps_fire.py:242
EcalLogicID
Definition: EcalLogicID.h:7
EcalCondDBInterface::insertLmfLmrSubIOV
void insertLmfLmrSubIOV(LMFLmrSubIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:527
Tm
Definition: Tm.h:13
EcalCondDBInterface::updateRunConfig
void updateRunConfig(ODRunConfigInfo *od) noexcept(false)
Definition: EcalCondDBInterface.cc:620
EEDetId
Definition: EEDetId.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
web.browse_db.env
env
Definition: browse_db.py:18
EcalCondDBInterface::fetchLMFRunIOV
LMFRunIOV fetchLMFRunIOV(RunTag *runtag, LMFRunTag *lmftag, run_t run, subrun_t lmfrun) noexcept(false)
Definition: EcalCondDBInterface.cc:697
LMFRunTag.h
EcalCondDBInterface::insertLmfIOV
void insertLmfIOV(LMFIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:538
ODDelaysDat::fetchData
void fetchData(std::vector< ODDelaysDat > *fillMap, int id) noexcept(false)
Definition: ODDelaysDat.cc:59
EcalCondDBInterface::fillLogicId2DetIdMaps
void fillLogicId2DetIdMaps()
Definition: EcalCondDBInterface.cc:28
CaliIOV::setByTm
void setByTm(CaliTag *tag, const Tm &time) noexcept(false)
Definition: CaliIOV.cc:174
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
RunFEConfigDat
Definition: RunFEConfigDat.h:12
EcalDBConnection.h
EcalCondDBInterface::fetchGlobalRunListByLocation
RunList fetchGlobalRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
Definition: EcalCondDBInterface.cc:804
EcalCondDBInterface::insertLmfDat
void insertLmfDat(LMFDat *dat) noexcept(false)
Definition: EcalCondDBInterface.cc:549
test_db_connect.runtag
runtag
Definition: test_db_connect.py:16
EcalCondDBInterface::insertMonRunIOV
void insertMonRunIOV(MonRunIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:652
MonRunIOV
Definition: MonRunIOV.h:14
LMFRunIOV::fetchBySequence
std::list< LMFRunIOV > fetchBySequence(const LMFSeqDat &s)
Definition: LMFRunIOV.cc:353
MonRunTag
Definition: MonRunTag.h:13
LMFSeqDat
Definition: LMFSeqDat.h:14
DCSPTMTempList
Definition: DCSPTMTempList.h:15
EcalCondDBInterface::getEcalLogicID
EcalLogicID getEcalLogicID(std::string name, int id1=EcalLogicID::NULLID, int id2=EcalLogicID::NULLID, int id3=EcalLogicID::NULLID, std::string mapsTo="") noexcept(false)
MonRunIOV::setByRun
void setByRun(MonRunTag *montag, RunIOV *runiov, subrun_t subrun) noexcept(false)
Definition: MonRunIOV.cc:231
EcalCondDBInterface::insertLmfSeq
void insertLmfSeq(LMFSeqDat *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:516
RunIOV::setByRun
void setByRun(RunTag *tag, run_t run) noexcept(false)
Definition: RunIOV.cc:314
ODRunConfigInfo
Definition: ODRunConfigInfo.h:12
alignCSCRings.r
r
Definition: alignCSCRings.py:93
MonRunTag.h
EcalCondDBInterface::fetchCaliIOV
CaliIOV fetchCaliIOV(CaliTag *tag, const Tm &evenTm) noexcept(false)
Definition: EcalCondDBInterface.cc:738
EcalLogicID.h
EcalCondDBInterface::fetchLMFLastRun
RunIOV fetchLMFLastRun() const
Definition: EcalCondDBInterface.cc:692
IDBObject.h
EcalLogicID::NULLID
static const int NULLID
Definition: EcalLogicID.h:35
ODDelaysDat
Definition: ODDelaysDat.h:10
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
EcalCondDBInterface::fetchDCSPTMTempList
DCSPTMTempList fetchDCSPTMTempList(const EcalLogicID &ecid) noexcept(false)
Definition: EcalCondDBInterface.cc:745
ODFEDAQConfig
Definition: ODFEDAQConfig.h:9
ODFEDAQConfig::fetchData
void fetchData(ODFEDAQConfig *result) noexcept(false)
Definition: ODFEDAQConfig.cc:149
DCUIOV::setByTm
void setByTm(DCUTag *tag, const Tm &time) noexcept(false)
Definition: DCUIOV.cc:173
DCSPTMTempList.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EcalCondDBInterface::getEcalLogicIDSet
std::vector< EcalLogicID > getEcalLogicIDSet(std::string name, int fromId1=EcalLogicID::NULLID, int toId1=EcalLogicID::NULLID, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="") noexcept(false)
Definition: EcalCondDBInterface.cc:188
EcalCondDBInterface::getEcalLogicIDForLMPN
std::vector< EcalLogicID > getEcalLogicIDForLMPN(int lmr_logic_id)
Definition: EcalCondDBInterface.cc:376
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
EcalCondDBWriter_cfi.location
location
Definition: EcalCondDBWriter_cfi.py:63
ztail.d
d
Definition: ztail.py:151
Oracle.h
EcalCondDBInterface::insertLmfRunIOV
void insertLmfRunIOV(LMFRunIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:576
mps_fire.result
result
Definition: mps_fire.py:311
RunTag.h
ntuplemaker.iovlist
iovlist
Definition: ntuplemaker.py:184
globals_cff.id2
id2
Definition: globals_cff.py:34
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
submitPVValidationJobs.od
od
Definition: submitPVValidationJobs.py:891
EcalCondDBInterface::fetchDCUIOV
DCUIOV fetchDCUIOV(DCUTag *tag, const Tm &evenTm) noexcept(false)
Definition: EcalCondDBInterface.cc:685
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
EcalCondDBInterface::fetchRunIOV
RunIOV fetchRunIOV(RunTag *tag, run_t run) noexcept(false)
Definition: EcalCondDBInterface.cc:631
EcalCondDBInterface.h
EcalCondDBInterface::fetchNonEmptyRunList
RunList fetchNonEmptyRunList(const RunTag &tag, int min_run, int max_run) noexcept(false)
Definition: EcalCondDBInterface.cc:777
EcalCondDBInterface::fetchFEDelaysForRun
std::list< ODDelaysDat > fetchFEDelaysForRun(RunIOV *iov) noexcept(false)
Definition: EcalCondDBInterface.cc:102
EcalCondDBInterface::fetchMonRunListLastNRuns
MonRunList fetchMonRunListLastNRuns(const RunTag &tag, const MonRunTag &monruntag, int max_run, int n_runs) noexcept(false)
Definition: EcalCondDBInterface.cc:846
EcalCondDBInterface::getEcalLogicIDSetOrdered
std::vector< EcalLogicID > getEcalLogicIDSetOrdered(std::string name, int fromId1, int toId1, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="", int orderedBy=EcalLogicID::NULLID) noexcept(false)
Definition: EcalCondDBInterface.cc:388
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
EcalCondDBInterface::fetchRunListLastNRuns
RunList fetchRunListLastNRuns(const RunTag &tag, int max_run, int n_runs) noexcept(false)
Definition: EcalCondDBInterface.cc:815
DCUTag
Definition: DCUTag.h:13
IDBObject::ECALDB_NROWS
static const int ECALDB_NROWS
Definition: IDBObject.h:18