#include <OnlineDB/EcalCondDB/interface/LMFLaserIRedShapeDat.h>
Public Member Functions | |
float | getAlpha () const |
float | getAlphaRMS () const |
float | getBeta () const |
float | getBetaRMS () const |
std::string | getTable () |
LMFLaserIRedShapeDat () | |
void | setAlpha (float alpha) |
void | setAlphaRMS (float rms) |
void | setBeta (float beta) |
void | setBetaRMS (float rms) |
~LMFLaserIRedShapeDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, LMFLaserIRedShapeDat > *fillVec, LMFRunIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const LMFLaserIRedShapeDat *item, LMFRunIOV *iov) throw (std::runtime_error) |
Private Attributes | |
float | m_alpha |
float | m_alphaRMS |
float | m_beta |
float | m_betaRMS |
Friends | |
class | EcalCondDBInterface |
Definition at line 12 of file LMFLaserIRedShapeDat.h.
LMFLaserIRedShapeDat::LMFLaserIRedShapeDat | ( | ) |
Definition at line 12 of file LMFLaserIRedShapeDat.cc.
References m_alpha, m_alphaRMS, m_beta, m_betaRMS, 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_alpha = 0; 00020 m_alphaRMS = 0; 00021 m_beta = 0; 00022 m_betaRMS = 0; 00023 }
LMFLaserIRedShapeDat::~LMFLaserIRedShapeDat | ( | ) |
void LMFLaserIRedShapeDat::fetchData | ( | std::map< EcalLogicID, LMFLaserIRedShapeDat > * | fillVec, | |
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 81 of file LMFLaserIRedShapeDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setAlpha(), setAlphaRMS(), setBeta(), and setBetaRMS().
00083 { 00084 this->checkConnection(); 00085 fillMap->clear(); 00086 00087 iov->setConnection(m_env, m_conn); 00088 int iovID = iov->fetchID(); 00089 if (!iovID) { 00090 // throw(runtime_error("LMFLaserIRedShapeDat::writeDB: IOV not in DB")); 00091 return; 00092 } 00093 00094 try { 00095 00096 m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 00097 "d.alpha, d.alpha_rms, d.beta, d.beta_rms " 00098 "FROM channelview cv JOIN lmf_laser_ired_shape_dat d " 00099 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 00100 "WHERE d.iov_id = :iov_id"); 00101 m_readStmt->setInt(1, iovID); 00102 ResultSet* rset = m_readStmt->executeQuery(); 00103 00104 std::pair< EcalLogicID, LMFLaserIRedShapeDat > p; 00105 LMFLaserIRedShapeDat dat; 00106 while(rset->next()) { 00107 p.first = EcalLogicID( rset->getString(1), // name 00108 rset->getInt(2), // logic_id 00109 rset->getInt(3), // id1 00110 rset->getInt(4), // id2 00111 rset->getInt(5), // id3 00112 rset->getString(6)); // maps_to 00113 00114 dat.setAlpha( rset->getFloat(7) ); 00115 dat.setAlphaRMS( rset->getFloat(8) ); 00116 dat.setBeta( rset->getFloat(9) ); 00117 dat.setBetaRMS( rset->getFloat(10) ); 00118 00119 p.second = dat; 00120 fillMap->insert(p); 00121 } 00122 00123 } catch (SQLException &e) { 00124 throw(runtime_error("LMFLaserIRedShapeDat::fetchData(): "+e.getMessage())); 00125 } 00126 }
float LMFLaserIRedShapeDat::getAlpha | ( | ) | const [inline] |
float LMFLaserIRedShapeDat::getAlphaRMS | ( | ) | const [inline] |
Definition at line 25 of file LMFLaserIRedShapeDat.h.
References m_alphaRMS.
00025 { return m_alphaRMS; }
float LMFLaserIRedShapeDat::getBeta | ( | ) | const [inline] |
float LMFLaserIRedShapeDat::getBetaRMS | ( | ) | const [inline] |
Definition at line 31 of file LMFLaserIRedShapeDat.h.
References m_betaRMS.
00031 { return m_betaRMS; }
std::string LMFLaserIRedShapeDat::getTable | ( | ) | [inline, virtual] |
void LMFLaserIRedShapeDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 33 of file LMFLaserIRedShapeDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00035 { 00036 this->checkConnection(); 00037 00038 try { 00039 m_writeStmt = m_conn->createStatement(); 00040 m_writeStmt->setSQL("INSERT INTO lmf_laser_ired_shape_dat (iov_id, logic_id, " 00041 "alpha, alpha_rms, beta, beta_rms) " 00042 "VALUES (:iov_id, :logic_id, " 00043 ":3, :4, :5, :6)"); 00044 } catch (SQLException &e) { 00045 throw(runtime_error("LMFLaserIRedShapeDat::prepareWrite(): "+e.getMessage())); 00046 } 00047 }
void LMFLaserIRedShapeDat::setAlpha | ( | float | alpha | ) | [inline] |
Definition at line 21 of file LMFLaserIRedShapeDat.h.
References m_alpha.
Referenced by fetchData().
00021 { m_alpha = alpha; }
void LMFLaserIRedShapeDat::setAlphaRMS | ( | float | rms | ) | [inline] |
Definition at line 24 of file LMFLaserIRedShapeDat.h.
References m_alphaRMS.
Referenced by fetchData().
00024 { m_alphaRMS = rms; }
void LMFLaserIRedShapeDat::setBeta | ( | float | beta | ) | [inline] |
void LMFLaserIRedShapeDat::setBetaRMS | ( | float | rms | ) | [inline] |
Definition at line 30 of file LMFLaserIRedShapeDat.h.
References m_betaRMS.
Referenced by fetchData().
00030 { m_betaRMS = rms; }
void LMFLaserIRedShapeDat::writeDB | ( | const EcalLogicID * | ecid, | |
const LMFLaserIRedShapeDat * | item, | |||
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 51 of file LMFLaserIRedShapeDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00053 { 00054 this->checkConnection(); 00055 this->checkPrepare(); 00056 00057 int iovID = iov->fetchID(); 00058 if (!iovID) { throw(runtime_error("LMFLaserIRedShapeDat::writeDB: IOV not in DB")); } 00059 00060 int logicID = ecid->getLogicID(); 00061 if (!logicID) { throw(runtime_error("LMFLaserIRedShapeDat::writeDB: Bad EcalLogicID")); } 00062 00063 try { 00064 m_writeStmt->setInt(1, iovID); 00065 m_writeStmt->setInt(2, logicID); 00066 00067 m_writeStmt->setFloat(3, item->getAlpha() ); 00068 m_writeStmt->setFloat(4, item->getAlphaRMS() ); 00069 00070 m_writeStmt->setFloat(5, item->getBeta() ); 00071 m_writeStmt->setFloat(6, item->getBetaRMS() ); 00072 00073 m_writeStmt->executeUpdate(); 00074 } catch (SQLException &e) { 00075 throw(runtime_error("LMFLaserIRedShapeDat::writeDB(): "+e.getMessage())); 00076 } 00077 }
friend class EcalCondDBInterface [friend] |
float LMFLaserIRedShapeDat::m_alpha [private] |
Definition at line 45 of file LMFLaserIRedShapeDat.h.
Referenced by getAlpha(), LMFLaserIRedShapeDat(), and setAlpha().
float LMFLaserIRedShapeDat::m_alphaRMS [private] |
Definition at line 46 of file LMFLaserIRedShapeDat.h.
Referenced by getAlphaRMS(), LMFLaserIRedShapeDat(), and setAlphaRMS().
float LMFLaserIRedShapeDat::m_beta [private] |
Definition at line 47 of file LMFLaserIRedShapeDat.h.
Referenced by getBeta(), LMFLaserIRedShapeDat(), and setBeta().
float LMFLaserIRedShapeDat::m_betaRMS [private] |
Definition at line 48 of file LMFLaserIRedShapeDat.h.
Referenced by getBetaRMS(), LMFLaserIRedShapeDat(), and setBetaRMS().