#include <OnlineDB/EcalCondDB/interface/CaliHVScanRatioDat.h>
Public Member Functions | |
CaliHVScanRatioDat () | |
float | getHVRatio () const |
float | getHVRatioRMS () const |
std::string | getTable () |
bool | getTaskStatus () const |
void | setHVRatio (float c) |
void | setHVRatioRMS (float c) |
void | setTaskStatus (bool s) |
~CaliHVScanRatioDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, CaliHVScanRatioDat > *fillVec, CaliIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const CaliHVScanRatioDat *item, CaliIOV *iov) throw (std::runtime_error) |
Private Attributes | |
float | m_hvratio |
float | m_hvratioRMS |
bool | m_taskStatus |
Friends | |
class | EcalCondDBInterface |
Definition at line 12 of file CaliHVScanRatioDat.h.
CaliHVScanRatioDat::CaliHVScanRatioDat | ( | ) |
Definition at line 12 of file CaliHVScanRatioDat.cc.
References IDBObject::m_conn, IDBObject::m_env, m_hvratio, m_hvratioRMS, m_taskStatus, IDataItem::m_writeStmt, and NULL.
00013 { 00014 m_env = NULL; 00015 m_conn = NULL; 00016 m_writeStmt = NULL; 00017 00018 m_hvratio = 0; 00019 m_hvratioRMS = 0; 00020 m_taskStatus = false; 00021 }
CaliHVScanRatioDat::~CaliHVScanRatioDat | ( | ) |
void CaliHVScanRatioDat::fetchData | ( | std::map< EcalLogicID, CaliHVScanRatioDat > * | fillVec, | |
CaliIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 77 of file CaliHVScanRatioDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, p, setHVRatio(), setHVRatioRMS(), and setTaskStatus().
00079 { 00080 this->checkConnection(); 00081 fillMap->clear(); 00082 00083 iov->setConnection(m_env, m_conn); 00084 int iovID = iov->fetchID(); 00085 if (!iovID) { 00086 // throw(runtime_error("CaliHVScanRatioDat::writeDB: IOV not in DB")); 00087 return; 00088 } 00089 00090 try { 00091 Statement* stmt = m_conn->createStatement(); 00092 stmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 00093 "d.hvratio, d.hvratio_rms, d.task_status " 00094 "FROM channelview cv JOIN cali_hv_scan_ratio_dat d " 00095 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 00096 "WHERE d.iov_id = :iov_id"); 00097 stmt->setInt(1, iovID); 00098 ResultSet* rset = stmt->executeQuery(); 00099 00100 std::pair< EcalLogicID, CaliHVScanRatioDat > p; 00101 CaliHVScanRatioDat dat; 00102 while(rset->next()) { 00103 p.first = EcalLogicID( rset->getString(1), // name 00104 rset->getInt(2), // logic_id 00105 rset->getInt(3), // id1 00106 rset->getInt(4), // id2 00107 rset->getInt(5), // id3 00108 rset->getString(6)); // maps_to 00109 00110 dat.setHVRatio( rset->getFloat(7) ); 00111 dat.setHVRatioRMS( rset->getFloat(8) ); 00112 dat.setTaskStatus( rset->getInt(9) ); 00113 00114 p.second = dat; 00115 fillMap->insert(p); 00116 } 00117 } catch (SQLException &e) { 00118 throw(runtime_error("CaliHVScanRatioDat::fetchData(): "+e.getMessage())); 00119 } 00120 }
float CaliHVScanRatioDat::getHVRatio | ( | ) | const [inline] |
Definition at line 22 of file CaliHVScanRatioDat.h.
References m_hvratio.
00022 { return m_hvratio; }
float CaliHVScanRatioDat::getHVRatioRMS | ( | ) | const [inline] |
Definition at line 25 of file CaliHVScanRatioDat.h.
References m_hvratioRMS.
00025 { return m_hvratioRMS; }
std::string CaliHVScanRatioDat::getTable | ( | ) | [inline, virtual] |
bool CaliHVScanRatioDat::getTaskStatus | ( | ) | const [inline] |
Definition at line 28 of file CaliHVScanRatioDat.h.
References m_taskStatus.
00028 { return m_taskStatus; }
void CaliHVScanRatioDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 31 of file CaliHVScanRatioDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00033 { 00034 this->checkConnection(); 00035 00036 try { 00037 m_writeStmt = m_conn->createStatement(); 00038 m_writeStmt->setSQL("INSERT INTO cali_hv_scan_ratio_dat (iov_id, logic_id, " 00039 "hvratio, hvratio_rms, task_status) " 00040 "VALUES (:iov_id, :logic_id, " 00041 ":3, :4, :5)"); 00042 } catch (SQLException &e) { 00043 throw(runtime_error("CaliHVScanRatioDat::prepareWrite(): "+e.getMessage())); 00044 } 00045 }
void CaliHVScanRatioDat::setHVRatio | ( | float | c | ) | [inline] |
Definition at line 21 of file CaliHVScanRatioDat.h.
References m_hvratio.
Referenced by fetchData().
void CaliHVScanRatioDat::setHVRatioRMS | ( | float | c | ) | [inline] |
Definition at line 24 of file CaliHVScanRatioDat.h.
References m_hvratioRMS.
Referenced by fetchData().
00024 { m_hvratioRMS = c; }
Definition at line 27 of file CaliHVScanRatioDat.h.
References m_taskStatus.
Referenced by fetchData().
00027 { m_taskStatus = s; }
void CaliHVScanRatioDat::writeDB | ( | const EcalLogicID * | ecid, | |
const CaliHVScanRatioDat * | item, | |||
CaliIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 49 of file CaliHVScanRatioDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00051 { 00052 this->checkConnection(); 00053 this->checkPrepare(); 00054 00055 int iovID = iov->fetchID(); 00056 if (!iovID) { throw(runtime_error("CaliHVScanRatioDat::writeDB: IOV not in DB")); } 00057 00058 int logicID = ecid->getLogicID(); 00059 if (!logicID) { throw(runtime_error("CaliHVScanRatioDat::writeDB: Bad EcalLogicID")); } 00060 00061 try { 00062 m_writeStmt->setInt(1, iovID); 00063 m_writeStmt->setInt(2, logicID); 00064 00065 m_writeStmt->setFloat(3, item->getHVRatio() ); 00066 m_writeStmt->setFloat(4, item->getHVRatioRMS() ); 00067 m_writeStmt->setInt(5, item->getTaskStatus() ); 00068 00069 m_writeStmt->executeUpdate(); 00070 } catch (SQLException &e) { 00071 throw(runtime_error("CaliHVScanRatioDat::writeDB(): "+e.getMessage())); 00072 } 00073 }
friend class EcalCondDBInterface [friend] |
float CaliHVScanRatioDat::m_hvratio [private] |
Definition at line 41 of file CaliHVScanRatioDat.h.
Referenced by CaliHVScanRatioDat(), getHVRatio(), and setHVRatio().
float CaliHVScanRatioDat::m_hvratioRMS [private] |
Definition at line 42 of file CaliHVScanRatioDat.h.
Referenced by CaliHVScanRatioDat(), getHVRatioRMS(), and setHVRatioRMS().
bool CaliHVScanRatioDat::m_taskStatus [private] |
Definition at line 43 of file CaliHVScanRatioDat.h.
Referenced by CaliHVScanRatioDat(), getTaskStatus(), and setTaskStatus().