00001
00002
00003 #include <iostream>
00004 #include <string>
00005 #include <vector>
00006 #include <sstream>
00007 #include <stdlib.h>
00008 #include <cstdlib>
00009 #include <time.h>
00010 #include <stdexcept>
00011 #include "OnlineDB/Oracle/interface/Oracle.h"
00012
00013 #include "OnlineDB/EcalCondDB/interface/IDBObject.h"
00014 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00015 #include "OnlineDB/EcalCondDB/interface/EcalDBConnection.h"
00016 #include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"
00017 #include "OnlineDB/EcalCondDB/interface/DCSPTMTempList.h"
00018
00019 #include "OnlineDB/EcalCondDB/interface/RunTag.h"
00020 #include "OnlineDB/EcalCondDB/interface/RunIOV.h"
00021 #include "OnlineDB/EcalCondDB/interface/RunList.h"
00022 #include "OnlineDB/EcalCondDB/interface/MonRunList.h"
00023 #include "OnlineDB/EcalCondDB/interface/MonRunTag.h"
00024 #include "OnlineDB/EcalCondDB/interface/LMFRunTag.h"
00025
00026 using namespace std;
00027 using namespace oracle::occi;
00028
00029
00030 EcalLogicID EcalCondDBInterface::getEcalLogicID( int logicID )
00031 throw(std::runtime_error)
00032 {
00033
00034 string sql = "SELECT name, logic_id, id1, id2, id3, maps_to FROM channelView WHERE logic_id = :logicID AND name=maps_to";
00035
00036 int id1, id2, id3;
00037 string name, mapsTo;
00038
00039 try {
00040 stmt->setSQL(sql);
00041 stmt->setInt(1, logicID);
00042 ResultSet* rset = stmt->executeQuery();
00043
00044 if (rset->next()) {
00045 name = rset->getString(1);
00046 logicID = rset->getInt(2);
00047 id1 = rset->getInt(3);
00048 if (rset->isNull(3)) { id1 = EcalLogicID::NULLID; }
00049 id2 = rset->getInt(4);
00050 if (rset->isNull(4)) { id2 = EcalLogicID::NULLID; }
00051 id3 = rset->getInt(5);
00052 if (rset->isNull(5)) { id3 = EcalLogicID::NULLID; }
00053 mapsTo = rset->getString(6);
00054 } else {
00055 stringstream msg;
00056 msg << "ERROR: Cannot build EcalLogicID for logic_id " << logicID;
00057 throw(std::runtime_error(msg.str()));
00058 }
00059
00060 } catch (SQLException &e) {
00061 throw(std::runtime_error("ERROR: Failed to retrive ids: " + e.getMessage() ));
00062 }
00063
00064 return EcalLogicID( name, logicID, id1, id2, id3, mapsTo );
00065 }
00066
00067
00068
00069 EcalLogicID EcalCondDBInterface::getEcalLogicID( string name,
00070 int id1,
00071 int id2,
00072 int id3,
00073 string mapsTo )
00074 throw(std::runtime_error)
00075 {
00076
00077 if (mapsTo == "") {
00078 mapsTo = name;
00079 }
00080
00081
00082 stringstream ss;
00083 ss << "SELECT logic_id FROM channelView WHERE name = :n AND";
00084 int idarray[] = {id1, id2, id3};
00085 for (int i=1; i<=3; i++) {
00086 if (idarray[i-1] == EcalLogicID::NULLID) {
00087 ss << " id"<<i<<" IS NULL AND";
00088 } else {
00089 ss << " id"<<i<<" = :id"<<i<<" AND";
00090 }
00091 }
00092 ss <<" maps_to = :m";
00093
00094
00095
00096 int logic_id;
00097 try {
00098 stmt->setSQL(ss.str());
00099
00100
00101 int j = 1;
00102 stmt->setString(j, name);
00103 j++;
00104 for (int i=0; i<3; i++) {
00105 if (idarray[i] != EcalLogicID::NULLID) {
00106 stmt->setInt(j, idarray[i]);
00107 j++;
00108 }
00109 }
00110 stmt->setString(j, mapsTo);
00111
00112
00113 ResultSet* rset = stmt->executeQuery();
00114 if ( rset->next() ) {
00115 logic_id = rset->getInt(1);
00116 } else {
00117 stringstream msg;
00118 msg << "ERROR: Query for EcalLogicID failed for parameters [" <<
00119 "name=" << name << ",maps_to=" << mapsTo <<
00120 ",id1=" << id1 << ",id2=" << id2 << ",id3=" << id3 << "]";
00121 throw(std::runtime_error(msg.str()));
00122 }
00123 } catch (SQLException &e) {
00124 throw(std::runtime_error("ERROR: Failed to retrive logic_id: " + e.getMessage() ));
00125 }
00126
00127
00128 return EcalLogicID(name, logic_id, id1, id2, id3, mapsTo);
00129 }
00130
00131 std::vector<EcalLogicID> EcalCondDBInterface::getEcalLogicIDSet( string name,
00132 int fromId1, int toId1,
00133 int fromId2, int toId2,
00134 int fromId3, int toId3,
00135 string mapsTo )
00136 throw(std::runtime_error)
00137 {
00138 if (mapsTo == "") {
00139 mapsTo = name;
00140 }
00141
00142 int idArray[] = { fromId1, toId1, fromId2, toId2, fromId3, toId3 };
00143 int from, to;
00144
00145 stringstream ss;
00146 ss << "SELECT name, logic_id, id1, id2, id3, maps_to FROM channelView WHERE name = :name AND ";
00147
00148
00149 for (int i=1; i<=3; i++) {
00150 from = idArray[2*(i-1)];
00151 to = idArray[2*(i-1) + 1];
00152
00153
00154 if ((from == EcalLogicID::NULLID && to != EcalLogicID::NULLID) ||
00155 (from != EcalLogicID::NULLID && to == EcalLogicID::NULLID) ||
00156 (from > to)) {
00157 throw(std::runtime_error("ERROR: Bad arguments for getEcalLogicIDSet"));
00158 }
00159
00160
00161 if (from == EcalLogicID::NULLID && to == EcalLogicID::NULLID) {
00162 ss << "id" << i << " IS NULL AND ";
00163 } else {
00164 ss << "id" << i << " >= :id" << i << "from AND " <<
00165 "id" << i << " <= :id" << i << "to AND ";
00166 }
00167 }
00168 ss << "maps_to = :maps_to ORDER BY id1, id2, id3";
00169
00170 std::vector<EcalLogicID> result;
00171
00172 try {
00173 stmt->setSQL(ss.str());
00174
00175
00176 int j = 1;
00177 stmt->setString(j, name);
00178 j++;
00179
00180 for (int i=0; i<3; i++) {
00181 from = idArray[2*i];
00182 to = idArray[2*i + 1];
00183 if (from != EcalLogicID::NULLID) {
00184 stmt->setInt(j, from);
00185 j++;
00186 stmt->setInt(j, to);
00187 j++;
00188 }
00189 }
00190
00191 stmt->setString(j, mapsTo);
00192
00193
00194 stmt->setPrefetchRowCount(IDBObject::ECALDB_NROWS);
00195
00196 ResultSet* rset = stmt->executeQuery();
00197
00198 int id1, id2, id3, logicId;
00199
00200 while (rset->next()) {
00201 name = rset->getString(1);
00202 logicId = rset->getInt(2);
00203 id1 = rset->getInt(3);
00204 if (rset->isNull(3)) { id1 = EcalLogicID::NULLID; }
00205 id2 = rset->getInt(4);
00206 if (rset->isNull(4)) { id2 = EcalLogicID::NULLID; }
00207 id3 = rset->getInt(5);
00208 if (rset->isNull(5)) { id3 = EcalLogicID::NULLID; }
00209 mapsTo = rset->getString(6);
00210
00211 EcalLogicID ecid = EcalLogicID( name, logicId, id1, id2, id3, mapsTo );
00212 result.push_back(ecid);
00213 }
00214 stmt->setPrefetchRowCount(0);
00215
00216 } catch (SQLException &e) {
00217 throw(std::runtime_error("ERROR: Failure while getting EcalLogicID set: " + e.getMessage() ));
00218 }
00219
00220 return result;
00221 }
00222
00223 std::map<int, int> EcalCondDBInterface::getEcalLogicID2LmrMap() {
00224 std::map<int, int> ret;
00225 std::vector<EcalLogicID> crystals_EB =
00226 getEcalLogicIDSetOrdered( "EB_crystal_number",
00227 1,36,1,1700,
00228 EcalLogicID::NULLID,EcalLogicID::NULLID,
00229 "EB_crystal_number", EcalLogicID::NULLID);
00230 std::vector<EcalLogicID> crystals_EE =
00231 getEcalLogicIDSetOrdered( "EE_crystal_number",
00232 -1,1,1,100,
00233 1,100,
00234 "EE_crystal_number", EcalLogicID::NULLID);
00235 std::vector<EcalLogicID> EB_lmr =
00236 getEcalLogicIDSetOrdered( "EB_crystal_number",
00237 1,36,1,1700,
00238 EcalLogicID::NULLID,EcalLogicID::NULLID,
00239 "ECAL_LMR", EcalLogicID::NULLID);
00240 std::vector<EcalLogicID> EE_lmr =
00241 getEcalLogicIDSetOrdered( "EE_crystal_number",
00242 -1,1,1,100,
00243 1,100,
00244 "ECAL_LMR", EcalLogicID::NULLID);
00245 unsigned int neb = crystals_EB.size();
00246 unsigned int nee = crystals_EE.size();
00247 if (neb != EB_lmr.size()) {
00248 throw(std::runtime_error("ERROR: EB Vectors size do not agree"));
00249 }
00250 if (nee != EE_lmr.size()) {
00251 throw(std::runtime_error("ERROR: EE Vectors size do not agree"));
00252 }
00253 for (unsigned int i = 0; i < neb; i++) {
00254 ret[crystals_EB[i].getLogicID()] = EB_lmr[i].getLogicID() % 100;
00255 }
00256 for (unsigned int i = 0; i < nee; i++) {
00257 ret[crystals_EE[i].getLogicID()] = EE_lmr[i].getLogicID() % 100;
00258 }
00259 return ret;
00260 }
00261
00262 std::vector<EcalLogicID> EcalCondDBInterface::getEcalLogicIDSetOrdered( string name,
00263 int fromId1, int toId1,
00264 int fromId2, int toId2,
00265 int fromId3, int toId3,
00266 string mapsTo, int orderedBy )
00267
00268
00269 throw(std::runtime_error)
00270 {
00271 if (mapsTo == "") {
00272 mapsTo = name;
00273 }
00274
00275 int idArray[] = { fromId1, toId1, fromId2, toId2, fromId3, toId3 };
00276 int from, to;
00277
00278 stringstream ss;
00279 ss << "SELECT name, logic_id, id1, id2, id3, maps_to FROM channelView WHERE name = :name AND ";
00280
00281
00282 for (int i=1; i<=3; i++) {
00283 from = idArray[2*(i-1)];
00284 to = idArray[2*(i-1) + 1];
00285
00286
00287 if ((from == EcalLogicID::NULLID && to != EcalLogicID::NULLID) ||
00288 (from != EcalLogicID::NULLID && to == EcalLogicID::NULLID) ||
00289 (from > to)) {
00290 throw(std::runtime_error("ERROR: Bad arguments for getEcalLogicIDSet"));
00291 }
00292
00293
00294 if (from == EcalLogicID::NULLID && to == EcalLogicID::NULLID) {
00295 ss << "id" << i << " IS NULL AND ";
00296 } else {
00297 ss << "id" << i << " >= :id" << i << "from AND " <<
00298 "id" << i << " <= :id" << i << "to AND ";
00299 }
00300 }
00301 ss << "maps_to = :maps_to ";
00302
00303 if(orderedBy==EcalLogicID::NULLID){
00304 ss<<" ORDER BY id1, id2, id3";
00305 } else if(orderedBy==1 || orderedBy==12 || orderedBy==123){
00306 ss<<" ORDER BY id1, id2, id3 ";
00307 } else if (orderedBy==213 || orderedBy==21 ){
00308 ss<<" ORDER BY id2, id1, id3 ";
00309 } else if (orderedBy==231|| orderedBy==23){
00310 ss<<" ORDER BY id2, id3, id1 ";
00311 } else if (orderedBy==321|| orderedBy==32){
00312 ss<<" ORDER BY id3, id2, id1 ";
00313 } else if (orderedBy==312|| orderedBy==31){
00314 ss<<" ORDER BY id3, id1, id2 ";
00315 } else if (orderedBy==132|| orderedBy==13){
00316 ss<<" ORDER BY id1, id3, id2 ";
00317 } else if (orderedBy==1234 ){
00318 ss<<" ORDER BY id1, id2, id3, logic_id ";
00319 } else if (orderedBy==4) {
00320 ss<<" ORDER BY logic_id ";
00321 } else {
00322 ss<<" ORDER BY id1, id2, id3";
00323 }
00324
00325 std::vector<EcalLogicID> result;
00326
00327 try {
00328 stmt->setSQL(ss.str());
00329
00330
00331 int j = 1;
00332 stmt->setString(j, name);
00333 j++;
00334
00335 for (int i=0; i<3; i++) {
00336 from = idArray[2*i];
00337 to = idArray[2*i + 1];
00338 if (from != EcalLogicID::NULLID) {
00339 stmt->setInt(j, from);
00340 j++;
00341 stmt->setInt(j, to);
00342 j++;
00343 }
00344 }
00345
00346 stmt->setString(j, mapsTo);
00347
00348
00349 stmt->setPrefetchRowCount(IDBObject::ECALDB_NROWS);
00350
00351 ResultSet* rset = stmt->executeQuery();
00352
00353 int id1, id2, id3, logicId;
00354
00355 while (rset->next()) {
00356 name = rset->getString(1);
00357 logicId = rset->getInt(2);
00358 id1 = rset->getInt(3);
00359 if (rset->isNull(3)) { id1 = EcalLogicID::NULLID; }
00360 id2 = rset->getInt(4);
00361 if (rset->isNull(4)) { id2 = EcalLogicID::NULLID; }
00362 id3 = rset->getInt(5);
00363 if (rset->isNull(5)) { id3 = EcalLogicID::NULLID; }
00364 mapsTo = rset->getString(6);
00365
00366 EcalLogicID ecid = EcalLogicID( name, logicId, id1, id2, id3, mapsTo );
00367 result.push_back(ecid);
00368 }
00369 stmt->setPrefetchRowCount(0);
00370
00371 } catch (SQLException &e) {
00372 throw(std::runtime_error("ERROR: Failure while getting EcalLogicID set: " + e.getMessage() ));
00373 }
00374
00375 return result;
00376 }
00377
00378
00379
00380 void EcalCondDBInterface::insertRunIOV(RunIOV* iov)
00381 throw(std::runtime_error)
00382 {
00383 try {
00384 iov->setConnection(env, conn);
00385 iov->writeDB();
00386 } catch(std::runtime_error &e) {
00387 conn->rollback();
00388 throw(e);
00389 }
00390 conn->commit();
00391 }
00392
00393 void EcalCondDBInterface::insertLmfSeq(LMFSeqDat *iov)
00394 throw(std::runtime_error)
00395 {
00396 try {
00397 iov->setConnection(env, conn);
00398 iov->writeDB();
00399 } catch(std::runtime_error &e) {
00400 conn->rollback();
00401 throw(e);
00402 }
00403 conn->commit();
00404 }
00405
00406 void EcalCondDBInterface::insertLmfLmrSubIOV(LMFLmrSubIOV *iov)
00407 throw(std::runtime_error)
00408 {
00409 try {
00410 iov->setConnection(env, conn);
00411 iov->writeDB();
00412 } catch(std::runtime_error &e) {
00413 conn->rollback();
00414 throw(e);
00415 }
00416 conn->commit();
00417 }
00418
00419 void EcalCondDBInterface::insertLmfIOV(LMFIOV *iov)
00420 throw(std::runtime_error)
00421 {
00422 try {
00423 iov->setConnection(env, conn);
00424 iov->writeDB();
00425 } catch(std::runtime_error &e) {
00426 conn->rollback();
00427 throw(e);
00428 }
00429 conn->commit();
00430 }
00431
00432 void EcalCondDBInterface::insertLmfDat(LMFDat *dat)
00433 throw(std::runtime_error)
00434 {
00435 try {
00436 dat->setConnection(env, conn);
00437 dat->writeDB();
00438 } catch(std::runtime_error &e) {
00439 conn->rollback();
00440 throw(e);
00441 }
00442 conn->commit();
00443 }
00444
00445 void EcalCondDBInterface::insertLmfDat(std::list<LMFDat *> dat)
00446 throw(std::runtime_error)
00447 {
00448 try {
00449 std::list<LMFDat *>::iterator i = dat.begin();
00450 std::list<LMFDat *>::iterator e = dat.end();
00451 while (i != e) {
00452 (*i)->setConnection(env, conn);
00453 (*i)->writeDB();
00454 i++;
00455 }
00456 } catch(std::runtime_error &e) {
00457 conn->rollback();
00458 throw(e);
00459 }
00460 conn->commit();
00461 }
00462
00463 void EcalCondDBInterface::insertLmfRunIOV(LMFRunIOV *iov)
00464 throw(std::runtime_error)
00465 {
00466 try {
00467 iov->setConnection(env, conn);
00468 iov->writeDB();
00469 } catch(std::runtime_error &e) {
00470 conn->rollback();
00471 throw(e);
00472 }
00473 conn->commit();
00474 }
00475
00476 void EcalCondDBInterface::updateRunIOV(RunIOV* iov)
00477 throw(std::runtime_error)
00478 {
00479 try {
00480 iov->setConnection(env, conn);
00481 iov->updateEndTimeDB();
00482 } catch(std::runtime_error &e) {
00483 conn->rollback();
00484 throw(e);
00485 }
00486 conn->commit();
00487 }
00488
00489 void EcalCondDBInterface::updateRunIOVEndTime(RunIOV* iov)
00490 throw(std::runtime_error)
00491 {
00492 try {
00493 iov->setConnection(env, conn);
00494 iov->updateEndTimeDB();
00495 } catch(std::runtime_error &e) {
00496 conn->rollback();
00497 throw(e);
00498 }
00499 conn->commit();
00500 }
00501
00502 void EcalCondDBInterface::updateRunIOVStartTime(RunIOV* iov)
00503 throw(std::runtime_error)
00504 {
00505 try {
00506 iov->setConnection(env, conn);
00507 iov->updateStartTimeDB();
00508 } catch(std::runtime_error &e) {
00509 conn->rollback();
00510 throw(e);
00511 }
00512 conn->commit();
00513 }
00514
00515 void EcalCondDBInterface::updateRunConfig(ODRunConfigInfo* od)
00516 throw(std::runtime_error)
00517 {
00518 try {
00519 od->setConnection(env, conn);
00520 od->updateDefaultCycle();
00521 } catch(std::runtime_error &e) {
00522 conn->rollback();
00523 throw(e);
00524 }
00525 conn->commit();
00526 }
00527
00528 RunIOV EcalCondDBInterface::fetchRunIOV(RunTag* tag, run_t run)
00529 throw(std::runtime_error)
00530 {
00531 RunIOV iov;
00532 iov.setConnection(env, conn);
00533 iov.setByRun(tag, run);
00534 return iov;
00535 }
00536
00537
00538
00539 RunIOV EcalCondDBInterface::fetchRunIOV(std::string location, run_t run)
00540 throw(std::runtime_error)
00541 {
00542 RunIOV iov;
00543 iov.setConnection(env, conn);
00544 iov.setByRun(location, run);
00545 return iov;
00546 }
00547
00548
00549
00550
00551 void EcalCondDBInterface::insertMonRunIOV(MonRunIOV* iov)
00552 throw(std::runtime_error)
00553 {
00554 try {
00555 iov->setConnection(env, conn);
00556 iov->writeDB();
00557 } catch(std::runtime_error &e) {
00558 conn->rollback();
00559 throw(e);
00560 }
00561 conn->commit();
00562 }
00563
00564 void EcalCondDBInterface::insertDCUIOV(DCUIOV* iov)
00565 throw(std::runtime_error)
00566 {
00567 try {
00568 iov->setConnection(env, conn);
00569 iov->writeDB();
00570 } catch(std::runtime_error &e) {
00571 conn->rollback();
00572 throw(e);
00573 }
00574 conn->commit();
00575 }
00576
00577
00578
00579
00580 MonRunIOV EcalCondDBInterface::fetchMonRunIOV(RunTag* runtag, MonRunTag* montag, run_t run, subrun_t subrun)
00581 throw(std::runtime_error)
00582 {
00583 RunIOV runiov = fetchRunIOV(runtag, run);
00584 MonRunIOV moniov;
00585 moniov.setConnection(env, conn);
00586 moniov.setByRun(montag, &runiov, subrun);
00587 return moniov;
00588 }
00589
00590
00591
00592 DCUIOV EcalCondDBInterface::fetchDCUIOV(DCUTag* tag, Tm eventTm)
00593 throw(std::runtime_error)
00594 {
00595 DCUIOV dcuiov;
00596 dcuiov.setConnection(env, conn);
00597 dcuiov.setByTm(tag, eventTm);
00598 return dcuiov;
00599 }
00600
00601 RunIOV EcalCondDBInterface::fetchLMFLastRun() const {
00602 LMFSeqDat seq(env, conn);
00603 return seq.fetchLastRun();
00604 }
00605
00606 LMFRunIOV EcalCondDBInterface::fetchLMFRunIOV(RunTag* runtag, LMFRunTag* lmftag, run_t run, subrun_t subrun)
00607 throw(std::runtime_error)
00608 {
00609 RunIOV runiov = fetchRunIOV(runtag, run);
00610 LMFRunIOV lmfiov;
00611 lmfiov.setConnection(env, conn);
00612
00613 return lmfiov;
00614 }
00615
00616 bool EcalCondDBInterface::fetchLMFRunIOV(const LMFSeqDat &seq, LMFRunIOV& iov,
00617 int lmr, int type, int color ) const {
00618 bool ret = false;
00619 iov.setConnection(env, conn);
00620 std::list<LMFRunIOV> iovlist = iov.fetchBySequence(seq, lmr, type, color);
00621 int s = iovlist.size();
00622 if (s > 0) {
00623 iov = iovlist.front();
00624 ret = true;
00625 if (s > 1) {
00626
00627 std::cout << "################################" << std::endl;
00628 std::cout << "################################" << std::endl;
00629 std::cout << "WARNING: More than one LMFRUNIOV" << std::endl;
00630 std::cout << " Found for seq " << seq.getID() << std::endl;
00631 std::cout << " lmr " << lmr << " type " << type << std::endl;
00632 std::cout << " and color " << color << std::endl;
00633 std::cout << "################################" << std::endl;
00634 std::cout << "################################" << std::endl;
00635 }
00636 } else {
00637
00638 iovlist = iov.fetchLastBeforeSequence(seq, lmr, type, color);
00639 s = iovlist.size();
00640 if (s == 1) {
00641 iov = iovlist.front();
00642 }
00643 }
00644 return ret;
00645 }
00646
00647 CaliIOV EcalCondDBInterface::fetchCaliIOV(CaliTag* tag, Tm eventTm)
00648 throw(std::runtime_error)
00649 {
00650 CaliIOV caliiov;
00651 caliiov.setConnection(env, conn);
00652 caliiov.setByTm(tag, eventTm);
00653 return caliiov;
00654 }
00655
00656 DCSPTMTempList EcalCondDBInterface::fetchDCSPTMTempList(EcalLogicID ecid)
00657 throw(std::runtime_error)
00658 {
00659 DCSPTMTempList r;
00660 r.setConnection(env, conn);
00661 r.fetchValuesForECID(ecid);
00662 return r;
00663 }
00664
00665 DCSPTMTempList EcalCondDBInterface::fetchDCSPTMTempList(EcalLogicID ecid, Tm start, Tm end)
00666 throw(std::runtime_error)
00667 {
00668 DCSPTMTempList r;
00669 r.setConnection(env, conn);
00670 r.fetchValuesForECIDAndTime(ecid, start, end);
00671 return r;
00672 }
00673
00674 RunList EcalCondDBInterface::fetchRunList(RunTag tag)
00675 throw(std::runtime_error)
00676 {
00677 RunList r;
00678 r.setConnection(env, conn);
00679 r.setRunTag(tag);
00680 r.fetchRuns();
00681 return r;
00682 }
00683
00684 RunList EcalCondDBInterface::fetchRunList(RunTag tag, int min_run, int max_run) throw(std::runtime_error){
00685 RunList r;
00686 r.setConnection(env, conn);
00687 r.setRunTag(tag);
00688 r.fetchRuns( min_run, max_run);
00689 return r;
00690 }
00691
00692 RunList EcalCondDBInterface::fetchNonEmptyRunList(RunTag tag, int min_run, int max_run) throw(std::runtime_error){
00693 RunList r;
00694 r.setConnection(env, conn);
00695 r.setRunTag(tag);
00696 r.fetchNonEmptyRuns( min_run, max_run);
00697 return r;
00698 }
00699
00700 RunList EcalCondDBInterface::fetchNonEmptyGlobalRunList(RunTag tag, int min_run, int max_run) throw(std::runtime_error){
00701 RunList r;
00702 r.setConnection(env, conn);
00703 r.setRunTag(tag);
00704 r.fetchNonEmptyGlobalRuns( min_run, max_run);
00705 return r;
00706 }
00707
00708 RunList EcalCondDBInterface::fetchRunListByLocation(RunTag tag, int min_run, int max_run , const LocationDef locDef)
00709 throw(std::runtime_error) {
00710 RunList r;
00711 r.setConnection(env, conn);
00712 r.setRunTag(tag);
00713 r.fetchRunsByLocation( min_run, max_run, locDef);
00714 return r;
00715 }
00716
00717 RunList EcalCondDBInterface::fetchGlobalRunListByLocation(RunTag tag, int min_run, int max_run , const LocationDef locDef)
00718 throw(std::runtime_error) {
00719 RunList r;
00720 r.setConnection(env, conn);
00721 r.setRunTag(tag);
00722 r.fetchGlobalRunsByLocation( min_run, max_run, locDef);
00723 return r;
00724 }
00725
00726 RunList EcalCondDBInterface::fetchRunListLastNRuns(RunTag tag, int max_run, int n_runs)
00727 throw(std::runtime_error){
00728 RunList r;
00729 r.setConnection(env, conn);
00730 r.setRunTag(tag);
00731 r.fetchLastNRuns( max_run, n_runs);
00732 return r;
00733 }
00734
00735
00736
00737
00738
00739
00740 MonRunList EcalCondDBInterface::fetchMonRunList(RunTag tag, MonRunTag monrunTag)
00741 throw(std::runtime_error)
00742 {
00743 MonRunList r;
00744 r.setConnection(env, conn);
00745 r.setRunTag(tag);
00746 r.setMonRunTag(monrunTag);
00747 r.fetchRuns();
00748 return r;
00749 }
00750
00751 MonRunList EcalCondDBInterface::fetchMonRunList(RunTag tag, MonRunTag monrunTag,int min_run, int max_run)
00752 throw(std::runtime_error)
00753 {
00754 MonRunList r;
00755 r.setConnection(env, conn);
00756 r.setRunTag(tag);
00757 r.setMonRunTag(monrunTag);
00758 r.fetchRuns(min_run, max_run);
00759 return r;
00760 }
00761
00762 MonRunList EcalCondDBInterface::fetchMonRunListLastNRuns(RunTag tag, MonRunTag monrunTag,int max_run, int n_runs )
00763 throw(std::runtime_error)
00764 {
00765 MonRunList r;
00766 r.setConnection(env, conn);
00767 r.setRunTag(tag);
00768 r.setMonRunTag(monrunTag);
00769 r.fetchLastNRuns(max_run, n_runs );
00770 return r;
00771 }
00772
00773
00774
00775 void EcalCondDBInterface::dummy()
00776 {
00777 }