#include <OnlineDB/EcalCondDB/interface/LMFLaserIRedTimeDat.h>
Public Member Functions | |
std::string | getTable () |
float | getTiming () const |
LMFLaserIRedTimeDat () | |
void | setTiming (float mean) |
~LMFLaserIRedTimeDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, LMFLaserIRedTimeDat > *fillVec, LMFRunIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const LMFLaserIRedTimeDat *item, LMFRunIOV *iov) throw (std::runtime_error) |
Private Attributes | |
float | m_timing |
Friends | |
class | EcalCondDBInterface |
Definition at line 12 of file LMFLaserIRedTimeDat.h.
LMFLaserIRedTimeDat::LMFLaserIRedTimeDat | ( | ) |
Definition at line 12 of file LMFLaserIRedTimeDat.cc.
References IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, m_timing, IDataItem::m_writeStmt, and NULL.
00013 { 00014 m_env = NULL; 00015 m_conn = NULL; 00016 m_writeStmt = NULL; 00017 m_readStmt = NULL; 00018 00019 m_timing = 0; 00020 }
LMFLaserIRedTimeDat::~LMFLaserIRedTimeDat | ( | ) |
void LMFLaserIRedTimeDat::fetchData | ( | std::map< EcalLogicID, LMFLaserIRedTimeDat > * | fillVec, | |
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 74 of file LMFLaserIRedTimeDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, and setTiming().
00076 { 00077 this->checkConnection(); 00078 fillMap->clear(); 00079 00080 iov->setConnection(m_env, m_conn); 00081 int iovID = iov->fetchID(); 00082 if (!iovID) { 00083 // throw(runtime_error("LMFLaserIRedTimeDat::writeDB: IOV not in DB")); 00084 return; 00085 } 00086 00087 try { 00088 00089 m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 00090 "d.timing " 00091 "FROM channelview cv JOIN lmf_laser_ired_time_dat d " 00092 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 00093 "WHERE d.iov_id = :iov_id"); 00094 m_readStmt->setInt(1, iovID); 00095 ResultSet* rset = m_readStmt->executeQuery(); 00096 00097 std::pair< EcalLogicID, LMFLaserIRedTimeDat > p; 00098 LMFLaserIRedTimeDat dat; 00099 while(rset->next()) { 00100 p.first = EcalLogicID( rset->getString(1), // name 00101 rset->getInt(2), // logic_id 00102 rset->getInt(3), // id1 00103 rset->getInt(4), // id2 00104 rset->getInt(5), // id3 00105 rset->getString(6)); // maps_to 00106 00107 dat.setTiming( rset->getFloat(7) ); 00108 00109 00110 p.second = dat; 00111 fillMap->insert(p); 00112 } 00113 00114 } catch (SQLException &e) { 00115 throw(runtime_error("LMFLaserIRedTimeDat::fetchData(): "+e.getMessage())); 00116 } 00117 }
std::string LMFLaserIRedTimeDat::getTable | ( | ) | [inline, virtual] |
float LMFLaserIRedTimeDat::getTiming | ( | ) | const [inline] |
Definition at line 21 of file LMFLaserIRedTimeDat.h.
References m_timing.
00021 { return m_timing; }
void LMFLaserIRedTimeDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 30 of file LMFLaserIRedTimeDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00032 { 00033 this->checkConnection(); 00034 00035 try { 00036 m_writeStmt = m_conn->createStatement(); 00037 m_writeStmt->setSQL("INSERT INTO lmf_laser_ired_time_dat (iov_id, logic_id, " 00038 "timing ) " 00039 "VALUES (:iov_id, :logic_id, " 00040 ":3 )"); 00041 } catch (SQLException &e) { 00042 throw(runtime_error("LMFLaserIRedTimeDat::prepareWrite(): "+e.getMessage())); 00043 } 00044 }
void LMFLaserIRedTimeDat::setTiming | ( | float | mean | ) | [inline] |
Definition at line 20 of file LMFLaserIRedTimeDat.h.
References m_timing.
Referenced by fetchData().
void LMFLaserIRedTimeDat::writeDB | ( | const EcalLogicID * | ecid, | |
const LMFLaserIRedTimeDat * | item, | |||
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 48 of file LMFLaserIRedTimeDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00050 { 00051 this->checkConnection(); 00052 this->checkPrepare(); 00053 00054 int iovID = iov->fetchID(); 00055 if (!iovID) { throw(runtime_error("LMFLaserIRedTimeDat::writeDB: IOV not in DB")); } 00056 00057 int logicID = ecid->getLogicID(); 00058 if (!logicID) { throw(runtime_error("LMFLaserIRedTimeDat::writeDB: Bad EcalLogicID")); } 00059 00060 try { 00061 m_writeStmt->setInt(1, iovID); 00062 m_writeStmt->setInt(2, logicID); 00063 00064 m_writeStmt->setFloat(3, item->getTiming() ); 00065 00066 m_writeStmt->executeUpdate(); 00067 } catch (SQLException &e) { 00068 throw(runtime_error("LMFLaserIRedTimeDat::writeDB(): "+e.getMessage())); 00069 } 00070 }
friend class EcalCondDBInterface [friend] |
float LMFLaserIRedTimeDat::m_timing [private] |
Definition at line 35 of file LMFLaserIRedTimeDat.h.
Referenced by getTiming(), LMFLaserIRedTimeDat(), and setTiming().