#include <OnlineDB/EcalCondDB/interface/LMFMatacqIRedDat.h>
Public Member Functions | |
float | getAmplitude () const |
std::string | getTable () |
float | getTimeOffset () const |
float | getWidth () const |
LMFMatacqIRedDat () | |
void | setAmplitude (float peak) |
void | setTimeOffset (float x) |
void | setWidth (float width) |
~LMFMatacqIRedDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, LMFMatacqIRedDat > *fillVec, LMFRunIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const LMFMatacqIRedDat *item, LMFRunIOV *iov) throw (std::runtime_error) |
Private Attributes | |
float | m_amplitude |
float | m_timeoffset |
float | m_width |
Friends | |
class | EcalCondDBInterface |
Definition at line 12 of file LMFMatacqIRedDat.h.
LMFMatacqIRedDat::LMFMatacqIRedDat | ( | ) |
Definition at line 12 of file LMFMatacqIRedDat.cc.
References m_amplitude, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, m_timeoffset, m_width, 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_amplitude = 0; 00020 m_timeoffset = 0; 00021 m_width = 0; 00022 }
LMFMatacqIRedDat::~LMFMatacqIRedDat | ( | ) |
void LMFMatacqIRedDat::fetchData | ( | std::map< EcalLogicID, LMFMatacqIRedDat > * | fillVec, | |
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 78 of file LMFMatacqIRedDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setAmplitude(), setTimeOffset(), and setWidth().
00080 { 00081 this->checkConnection(); 00082 fillMap->clear(); 00083 00084 iov->setConnection(m_env, m_conn); 00085 int iovID = iov->fetchID(); 00086 if (!iovID) { 00087 // throw(runtime_error("LMFMatacqIRedDat::writeDB: IOV not in DB")); 00088 return; 00089 } 00090 00091 try { 00092 00093 m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 00094 "d.amplitude, d.width, d.timeoffset " 00095 "FROM channelview cv JOIN lmf_matacq_ired_dat d " 00096 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 00097 "WHERE d.iov_id = :iov_id"); 00098 m_readStmt->setInt(1, iovID); 00099 ResultSet* rset = m_readStmt->executeQuery(); 00100 00101 std::pair< EcalLogicID, LMFMatacqIRedDat > p; 00102 LMFMatacqIRedDat dat; 00103 while(rset->next()) { 00104 p.first = EcalLogicID( rset->getString(1), // name 00105 rset->getInt(2), // logic_id 00106 rset->getInt(3), // id1 00107 rset->getInt(4), // id2 00108 rset->getInt(5), // id3 00109 rset->getString(6)); // maps_to 00110 00111 dat.setAmplitude( rset->getFloat(7) ); 00112 dat.setWidth( rset->getFloat(8) ); 00113 dat.setTimeOffset( rset->getFloat(9) ); 00114 00115 p.second = dat; 00116 fillMap->insert(p); 00117 } 00118 00119 } catch (SQLException &e) { 00120 throw(runtime_error("LMFMatacqIRedDat::fetchData(): "+e.getMessage())); 00121 } 00122 }
float LMFMatacqIRedDat::getAmplitude | ( | ) | const [inline] |
Definition at line 21 of file LMFMatacqIRedDat.h.
References m_amplitude.
00021 { return m_amplitude; }
std::string LMFMatacqIRedDat::getTable | ( | ) | [inline, virtual] |
float LMFMatacqIRedDat::getTimeOffset | ( | ) | const [inline] |
Definition at line 27 of file LMFMatacqIRedDat.h.
References m_timeoffset.
00027 { return m_timeoffset; }
float LMFMatacqIRedDat::getWidth | ( | ) | const [inline] |
void LMFMatacqIRedDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 32 of file LMFMatacqIRedDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00034 { 00035 this->checkConnection(); 00036 00037 try { 00038 m_writeStmt = m_conn->createStatement(); 00039 m_writeStmt->setSQL("INSERT INTO lmf_matacq_red_dat (iov_id, logic_id, " 00040 "amplitude, width, timeoffset) " 00041 "VALUES (:iov_id, :logic_id, " 00042 ":3, :4, :5)"); 00043 } catch (SQLException &e) { 00044 throw(runtime_error("LMFMatacqIRedDat::prepareWrite(): "+e.getMessage())); 00045 } 00046 }
void LMFMatacqIRedDat::setAmplitude | ( | float | peak | ) | [inline] |
Definition at line 20 of file LMFMatacqIRedDat.h.
References m_amplitude.
Referenced by fetchData().
00020 { m_amplitude = peak; }
void LMFMatacqIRedDat::setTimeOffset | ( | float | x | ) | [inline] |
Definition at line 26 of file LMFMatacqIRedDat.h.
References m_timeoffset.
Referenced by fetchData().
00026 { m_timeoffset = x; }
void LMFMatacqIRedDat::setWidth | ( | float | width | ) | [inline] |
void LMFMatacqIRedDat::writeDB | ( | const EcalLogicID * | ecid, | |
const LMFMatacqIRedDat * | item, | |||
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 50 of file LMFMatacqIRedDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00052 { 00053 this->checkConnection(); 00054 this->checkPrepare(); 00055 00056 int iovID = iov->fetchID(); 00057 if (!iovID) { throw(runtime_error("LMFMatacqIRedDat::writeDB: IOV not in DB")); } 00058 00059 int logicID = ecid->getLogicID(); 00060 if (!logicID) { throw(runtime_error("LMFMatacqIRedDat::writeDB: Bad EcalLogicID")); } 00061 00062 try { 00063 m_writeStmt->setInt(1, iovID); 00064 m_writeStmt->setInt(2, logicID); 00065 00066 m_writeStmt->setFloat(3, item->getAmplitude() ); 00067 m_writeStmt->setFloat(4, item->getWidth() ); 00068 m_writeStmt->setFloat(5, item->getTimeOffset() ); 00069 00070 m_writeStmt->executeUpdate(); 00071 } catch (SQLException &e) { 00072 throw(runtime_error("LMFMatacqIRedDat::writeDB(): "+e.getMessage())); 00073 } 00074 }
friend class EcalCondDBInterface [friend] |
float LMFMatacqIRedDat::m_amplitude [private] |
Definition at line 41 of file LMFMatacqIRedDat.h.
Referenced by getAmplitude(), LMFMatacqIRedDat(), and setAmplitude().
float LMFMatacqIRedDat::m_timeoffset [private] |
Definition at line 43 of file LMFMatacqIRedDat.h.
Referenced by getTimeOffset(), LMFMatacqIRedDat(), and setTimeOffset().
float LMFMatacqIRedDat::m_width [private] |
Definition at line 42 of file LMFMatacqIRedDat.h.
Referenced by getWidth(), LMFMatacqIRedDat(), and setWidth().