#include <OnlineDB/EcalCondDB/interface/LMFLaserIRedRawDat.h>
Public Member Functions | |
float | getAPDErr () const |
float | getAPDPeak () const |
std::string | getTable () |
LMFLaserIRedRawDat () | |
void | setAPDErr (float err) |
void | setAPDPeak (float peak) |
~LMFLaserIRedRawDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, LMFLaserIRedRawDat > *fillVec, LMFRunIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const LMFLaserIRedRawDat *item, LMFRunIOV *iov) throw (std::runtime_error) |
Private Attributes | |
float | m_apdErr |
float | m_apdPeak |
Friends | |
class | EcalCondDBInterface |
Definition at line 12 of file LMFLaserIRedRawDat.h.
LMFLaserIRedRawDat::LMFLaserIRedRawDat | ( | ) |
Definition at line 12 of file LMFLaserIRedRawDat.cc.
References m_apdErr, m_apdPeak, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, 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_apdPeak = 0; 00020 m_apdErr = 0; 00021 }
LMFLaserIRedRawDat::~LMFLaserIRedRawDat | ( | ) |
void LMFLaserIRedRawDat::fetchData | ( | std::map< EcalLogicID, LMFLaserIRedRawDat > * | fillVec, | |
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 76 of file LMFLaserIRedRawDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setAPDErr(), and setAPDPeak().
00078 { 00079 this->checkConnection(); 00080 fillMap->clear(); 00081 00082 iov->setConnection(m_env, m_conn); 00083 int iovID = iov->fetchID(); 00084 if (!iovID) { 00085 // throw(runtime_error("LMFLaserIRedRawDat::writeDB: IOV not in DB")); 00086 return; 00087 } 00088 00089 try { 00090 00091 m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 00092 "d.apd_peak, d.apd_err " 00093 "FROM channelview cv JOIN lmf_laser_ired_raw_dat d " 00094 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 00095 "WHERE d.iov_id = :iov_id"); 00096 m_readStmt->setInt(1, iovID); 00097 ResultSet* rset = m_readStmt->executeQuery(); 00098 00099 std::pair< EcalLogicID, LMFLaserIRedRawDat > p; 00100 LMFLaserIRedRawDat dat; 00101 while(rset->next()) { 00102 p.first = EcalLogicID( rset->getString(1), // name 00103 rset->getInt(2), // logic_id 00104 rset->getInt(3), // id1 00105 rset->getInt(4), // id2 00106 rset->getInt(5), // id3 00107 rset->getString(6)); // maps_to 00108 00109 dat.setAPDPeak( rset->getFloat(7) ); 00110 dat.setAPDErr( rset->getFloat(8) ); 00111 00112 p.second = dat; 00113 fillMap->insert(p); 00114 } 00115 00116 } catch (SQLException &e) { 00117 throw(runtime_error("LMFLaserIRedRawDat::fetchData(): "+e.getMessage())); 00118 } 00119 }
float LMFLaserIRedRawDat::getAPDErr | ( | ) | const [inline] |
float LMFLaserIRedRawDat::getAPDPeak | ( | ) | const [inline] |
Definition at line 22 of file LMFLaserIRedRawDat.h.
References m_apdPeak.
00022 { return m_apdPeak; }
std::string LMFLaserIRedRawDat::getTable | ( | ) | [inline, virtual] |
void LMFLaserIRedRawDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 31 of file LMFLaserIRedRawDat.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 lmf_laser_ired_raw_dat (iov_id, logic_id, " 00039 "apd_peak, apd_err) " 00040 "VALUES (:iov_id, :logic_id, " 00041 ":3, :4)"); 00042 } catch (SQLException &e) { 00043 throw(runtime_error("LMFLaserIRedRawDat::prepareWrite(): "+e.getMessage())); 00044 } 00045 }
void LMFLaserIRedRawDat::setAPDErr | ( | float | err | ) | [inline] |
void LMFLaserIRedRawDat::setAPDPeak | ( | float | peak | ) | [inline] |
Definition at line 21 of file LMFLaserIRedRawDat.h.
References m_apdPeak.
Referenced by fetchData().
00021 { m_apdPeak = peak; }
void LMFLaserIRedRawDat::writeDB | ( | const EcalLogicID * | ecid, | |
const LMFLaserIRedRawDat * | item, | |||
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 49 of file LMFLaserIRedRawDat.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("LMFLaserIRedRawDat::writeDB: IOV not in DB")); } 00057 00058 int logicID = ecid->getLogicID(); 00059 if (!logicID) { throw(runtime_error("LMFLaserIRedRawDat::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->getAPDPeak() ); 00066 m_writeStmt->setFloat(4, item->getAPDErr() ); 00067 00068 m_writeStmt->executeUpdate(); 00069 } catch (SQLException &e) { 00070 throw(runtime_error("LMFLaserIRedRawDat::writeDB(): "+e.getMessage())); 00071 } 00072 }
friend class EcalCondDBInterface [friend] |
float LMFLaserIRedRawDat::m_apdErr [private] |
Definition at line 40 of file LMFLaserIRedRawDat.h.
Referenced by getAPDErr(), LMFLaserIRedRawDat(), and setAPDErr().
float LMFLaserIRedRawDat::m_apdPeak [private] |
Definition at line 39 of file LMFLaserIRedRawDat.h.
Referenced by getAPDPeak(), LMFLaserIRedRawDat(), and setAPDPeak().