![]() |
![]() |
#include <OnlineDB/EcalCondDB/interface/RunList.h>
Public Member Functions | |
void | fetchRuns () throw (std::runtime_error) |
std::vector< RunIOV > | getRuns () |
RunTag | getRunTag () const |
RunList () | |
void | setRunTag (RunTag tag) |
~RunList () | |
Private Attributes | |
RunTag | m_runTag |
std::vector< RunIOV > | m_vec_runiov |
Friends | |
class | EcalCondDBInterface |
Definition at line 14 of file RunList.h.
RunList::RunList | ( | ) |
RunList::~RunList | ( | ) |
void RunList::fetchRuns | ( | ) | throw (std::runtime_error) |
Definition at line 40 of file RunList.cc.
References IDBObject::checkConnection(), GenMuonPlsPt100GeV_cfg::cout, DateHandler::dateToTm(), e, lat::endl(), RunTag::fetchID(), i, IDBObject::m_conn, IDBObject::m_env, m_runTag, m_vec_runiov, r, IDBObject::setConnection(), RunIOV::setID(), RunIOV::setRunEnd(), RunIOV::setRunNumber(), RunIOV::setRunStart(), and RunIOV::setRunTag().
Referenced by EcalCondDBInterface::fetchRunList().
00042 { 00043 00044 00045 this->checkConnection(); 00046 int nruns=0; 00047 00048 m_runTag.setConnection(m_env, m_conn); 00049 int tagID = m_runTag.fetchID(); 00050 cout <<"tag id="<< tagID << endl; 00051 if (!tagID) { 00052 return ; 00053 } 00054 00055 try { 00056 Statement* stmt0 = m_conn->createStatement(); 00057 stmt0->setSQL("SELECT count(iov_id) FROM run_iov " 00058 "WHERE tag_id = :tag_id " ); 00059 stmt0->setInt(1, tagID); 00060 00061 ResultSet* rset0 = stmt0->executeQuery(); 00062 if (rset0->next()) { 00063 nruns = rset0->getInt(1); 00064 } 00065 m_conn->terminateStatement(stmt0); 00066 00067 cout <<"nruns="<< nruns << endl; 00068 m_vec_runiov.reserve(nruns); 00069 00070 Statement* stmt = m_conn->createStatement(); 00071 stmt->setSQL("SELECT iov_id, tag_id, run_num, run_start, run_end FROM run_iov " 00072 "WHERE tag_id = :tag_id order by run_num " ); 00073 stmt->setInt(1, tagID); 00074 00075 DateHandler dh(m_env, m_conn); 00076 Tm runStart; 00077 Tm runEnd; 00078 00079 ResultSet* rset = stmt->executeQuery(); 00080 int i=0; 00081 while (i<nruns) { 00082 rset->next(); 00083 int iovID = rset->getInt(1); 00084 int tagID = rset->getInt(2); 00085 int runNum = rset->getInt(3); 00086 Date startDate = rset->getDate(4); 00087 Date endDate = rset->getDate(5); 00088 00089 runStart = dh.dateToTm( startDate ); 00090 runEnd = dh.dateToTm( endDate ); 00091 00092 RunIOV r ; 00093 r.setRunNumber(runNum); 00094 r.setRunStart(runStart); 00095 r.setRunEnd(runEnd); 00096 r.setRunTag(m_runTag); 00097 r.setID(iovID); 00098 m_vec_runiov.push_back(r); 00099 00100 i++; 00101 } 00102 00103 00104 m_conn->terminateStatement(stmt); 00105 } catch (SQLException &e) { 00106 throw(runtime_error("RunList::fetchRuns: "+e.getMessage())); 00107 } 00108 00109 00110 }
std::vector< RunIOV > RunList::getRuns | ( | ) |
Definition at line 35 of file RunList.cc.
References m_vec_runiov.
00036 { 00037 return m_vec_runiov; 00038 }
RunTag RunList::getRunTag | ( | ) | const |
Definition at line 30 of file RunList.cc.
References m_runTag.
00031 { 00032 return m_runTag; 00033 }
Definition at line 22 of file RunList.cc.
References m_runTag.
Referenced by EcalCondDBInterface::fetchRunList().
friend class EcalCondDBInterface [friend] |
RunTag RunList::m_runTag [private] |
std::vector<RunIOV> RunList::m_vec_runiov [private] |