#include <OnlineDB/EcalCondDB/interface/LMFLaserPulseDat.h>
Public Types | |
enum | laserColorNum { iBlue = 0, iGreen, iRed, iIRed } |
Public Member Functions | |
float | getAmplitude () const |
int | getFitMethod () const |
float | getFW20 () const |
float | getFW80 () const |
float | getFWHM () const |
float | getRise () const |
float | getSliding () const |
std::string | getTable () |
float | getTime () const |
LMFLaserPulseDat () | |
void | setAmplitude (float x) |
void | setFitMethod (int x) |
void | setFW20 (float x) |
void | setFW80 (float x) |
void | setFWHM (float x) |
void | setRise (float x) |
void | setSliding (float x) |
void | setTime (float x) |
~LMFLaserPulseDat () | |
Static Public Member Functions | |
static void | setColor (int color) |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, LMFLaserPulseDat > *fillVec, LMFRunIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const LMFLaserPulseDat *item, LMFRunIOV *iov) throw (std::runtime_error) |
Private Attributes | |
float | m_ampl |
int | m_fit_method |
float | m_fw20 |
float | m_fw80 |
float | m_fwhm |
float | m_rise |
float | m_sliding |
float | m_time |
Static Private Attributes | |
static int | _color = LMFLaserPulseDat::iBlue |
Friends | |
class | EcalCondDBInterface |
Definition at line 12 of file LMFLaserPulseDat.h.
LMFLaserPulseDat::LMFLaserPulseDat | ( | ) |
Definition at line 15 of file LMFLaserPulseDat.cc.
References _color, iBlue, iIRed, m_ampl, IDBObject::m_conn, IDBObject::m_env, m_fit_method, m_fw20, m_fw80, m_fwhm, IDataItem::m_readStmt, m_rise, m_sliding, m_time, IDataItem::m_writeStmt, and NULL.
00016 { 00017 assert( _color>=iBlue && _color<=iIRed ); // GHM 00018 00019 m_env = NULL; 00020 m_conn = NULL; 00021 m_writeStmt = NULL; 00022 m_readStmt = NULL; 00023 00024 // m_fit_method=""; 00025 m_fit_method = 0; 00026 m_ampl = 0; 00027 m_time = 0; 00028 m_rise = 0; 00029 m_fwhm = 0; 00030 m_fw20 = 0; 00031 m_fw80 = 0; 00032 m_sliding = 0; 00033 00034 }
LMFLaserPulseDat::~LMFLaserPulseDat | ( | ) |
void LMFLaserPulseDat::fetchData | ( | std::map< EcalLogicID, LMFLaserPulseDat > * | fillVec, | |
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 97 of file LMFLaserPulseDat.cc.
References IDBObject::checkConnection(), e, getTable(), IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setAmplitude(), setFitMethod(), setFW20(), setFW80(), setFWHM(), setRise(), setSliding(), and setTime().
00099 { 00100 this->checkConnection(); 00101 fillMap->clear(); 00102 00103 iov->setConnection(m_env, m_conn); 00104 int iovID = iov->fetchID(); 00105 if (!iovID) { 00106 // throw(runtime_error("LMFLaserPulseDat::writeDB: IOV not in DB")); 00107 return; 00108 } 00109 00110 // GHM 00111 std::string command_ = "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, d.fit_method, d.mtq_ampl, d.mtq_time, d.mtq_rise, d.mtq_fwhm, d.mtq_fw20, d.mtq_fw80, d.mtq_sliding FROM channelview cv JOIN XXXXXX d ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to WHERE d.lmf_iov_id = :lmf_iov_id"; 00112 command_.replace( command_.find("XXXXXX",0), 6, getTable() ); 00113 00114 try { 00115 00116 m_readStmt->setSQL( command_.c_str() ); // GHM 00117 m_readStmt->setInt(1, iovID); 00118 ResultSet* rset = m_readStmt->executeQuery(); 00119 00120 std::pair< EcalLogicID, LMFLaserPulseDat > p; 00121 LMFLaserPulseDat dat; 00122 while(rset->next()) { 00123 p.first = EcalLogicID( rset->getString(1), // name 00124 rset->getInt(2), // logic_id 00125 rset->getInt(3), // id1 00126 rset->getInt(4), // id2 00127 rset->getInt(5), // id3 00128 rset->getString(6)); // maps_to 00129 00130 // dat.setFitMethod( rset->getString(7) ); 00131 dat.setFitMethod( rset->getInt(7) ); 00132 dat.setAmplitude( rset->getFloat(8) ); 00133 dat.setTime( rset->getFloat(9) ); 00134 dat.setRise( rset->getFloat(10) ); 00135 dat.setFWHM( rset->getFloat(11) ); 00136 dat.setFW20( rset->getFloat(12) ); 00137 dat.setFW80( rset->getFloat(13) ); 00138 dat.setSliding( rset->getFloat(14) ); 00139 00140 p.second = dat; 00141 fillMap->insert(p); 00142 } 00143 00144 } catch (SQLException &e) { 00145 throw(runtime_error("LMFLaserPulseDat::fetchData(): "+e.getMessage())); 00146 } 00147 }
float LMFLaserPulseDat::getAmplitude | ( | ) | const [inline] |
int LMFLaserPulseDat::getFitMethod | ( | ) | const [inline] |
Definition at line 54 of file LMFLaserPulseDat.h.
References m_fit_method.
00054 { return m_fit_method; }
float LMFLaserPulseDat::getFW20 | ( | ) | const [inline] |
float LMFLaserPulseDat::getFW80 | ( | ) | const [inline] |
float LMFLaserPulseDat::getFWHM | ( | ) | const [inline] |
float LMFLaserPulseDat::getRise | ( | ) | const [inline] |
float LMFLaserPulseDat::getSliding | ( | ) | const [inline] |
std::string LMFLaserPulseDat::getTable | ( | ) | [inline, virtual] |
Implements IDataItem.
Definition at line 24 of file LMFLaserPulseDat.h.
References _color, iBlue, iGreen, iIRed, and iRed.
Referenced by fetchData(), and prepareWrite().
00025 { 00026 switch( _color ) 00027 { 00028 case iBlue: return "LMF_LASER_BLUE_PULSE_DAT"; 00029 case iGreen: return "LMF_LASER_GREEN_PULSE_DAT"; 00030 case iRed: return "LMF_LASER_RED_PULSE_DAT"; 00031 case iIRed: return "LMF_LASER_IRED_PULSE_DAT"; 00032 } 00033 // default 00034 return "LMF_LASER_BLUE_PULSE_DAT"; 00035 }
float LMFLaserPulseDat::getTime | ( | void | ) | const [inline] |
void LMFLaserPulseDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 44 of file LMFLaserPulseDat.cc.
References IDBObject::checkConnection(), e, getTable(), IDBObject::m_conn, and IDataItem::m_writeStmt.
00046 { 00047 this->checkConnection(); 00048 00049 // GHM 00050 std::string command_ = "INSERT INTO XXXXXX (lmf_iov_id, logic_id, fit_method, mtq_ampl, mtq_time, mtq_rise, mtq_fwhm, mtq_fw20, mtq_fw80, mtq_sliding ) VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10 )"; 00051 command_.replace( command_.find("XXXXXX",0), 6, getTable() ); 00052 00053 try { 00054 m_writeStmt = m_conn->createStatement(); 00055 m_writeStmt->setSQL( command_.c_str() ); // GHM 00056 } catch (SQLException &e) { 00057 throw(runtime_error("LMFLaserPulseDat::prepareWrite(): "+e.getMessage())); 00058 } 00059 }
void LMFLaserPulseDat::setAmplitude | ( | float | x | ) | [inline] |
Definition at line 53 of file LMFLaserPulseDat.h.
References m_fit_method.
Referenced by fetchData().
00053 { m_fit_method = x; }
void LMFLaserPulseDat::setFW20 | ( | float | x | ) | [inline] |
void LMFLaserPulseDat::setFW80 | ( | float | x | ) | [inline] |
void LMFLaserPulseDat::setFWHM | ( | float | x | ) | [inline] |
void LMFLaserPulseDat::setRise | ( | float | x | ) | [inline] |
void LMFLaserPulseDat::setSliding | ( | float | x | ) | [inline] |
void LMFLaserPulseDat::setTime | ( | float | x | ) | [inline] |
void LMFLaserPulseDat::writeDB | ( | const EcalLogicID * | ecid, | |
const LMFLaserPulseDat * | item, | |||
LMFRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 63 of file LMFLaserPulseDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00065 { 00066 this->checkConnection(); 00067 this->checkPrepare(); 00068 00069 int iovID = iov->fetchID(); 00070 if (!iovID) { throw(runtime_error("LMFLaserPulseDat::writeDB: IOV not in DB")); } 00071 00072 int logicID = ecid->getLogicID(); 00073 if (!logicID) { throw(runtime_error("LMFLaserPulseDat::writeDB: Bad EcalLogicID")); } 00074 00075 try { 00076 m_writeStmt->setInt(1, iovID); 00077 m_writeStmt->setInt(2, logicID); 00078 00079 // m_writeStmt->setString(3, item->getFitMethod() ); 00080 m_writeStmt->setInt(3, item->getFitMethod() ); 00081 m_writeStmt->setFloat(4, item->getAmplitude() ); 00082 m_writeStmt->setFloat(5, item->getTime() ); 00083 m_writeStmt->setFloat(6, item->getRise() ); 00084 m_writeStmt->setFloat(7, item->getFWHM() ); 00085 m_writeStmt->setFloat(8, item->getFW20() ); 00086 m_writeStmt->setFloat(9, item->getFW80() ); 00087 m_writeStmt->setFloat(10, item->getSliding() ); 00088 00089 m_writeStmt->executeUpdate(); 00090 } catch (SQLException &e) { 00091 throw(runtime_error("LMFLaserPulseDat::writeDB(): "+e.getMessage())); 00092 } 00093 }
friend class EcalCondDBInterface [friend] |
int LMFLaserPulseDat::_color = LMFLaserPulseDat::iBlue [static, private] |
Definition at line 60 of file LMFLaserPulseDat.h.
Referenced by getTable(), LMFLaserPulseDat(), and setColor().
float LMFLaserPulseDat::m_ampl [private] |
Definition at line 74 of file LMFLaserPulseDat.h.
Referenced by getAmplitude(), LMFLaserPulseDat(), and setAmplitude().
int LMFLaserPulseDat::m_fit_method [private] |
Definition at line 73 of file LMFLaserPulseDat.h.
Referenced by getFitMethod(), LMFLaserPulseDat(), and setFitMethod().
float LMFLaserPulseDat::m_fw20 [private] |
Definition at line 78 of file LMFLaserPulseDat.h.
Referenced by getFW20(), LMFLaserPulseDat(), and setFW20().
float LMFLaserPulseDat::m_fw80 [private] |
Definition at line 79 of file LMFLaserPulseDat.h.
Referenced by getFW80(), LMFLaserPulseDat(), and setFW80().
float LMFLaserPulseDat::m_fwhm [private] |
Definition at line 77 of file LMFLaserPulseDat.h.
Referenced by getFWHM(), LMFLaserPulseDat(), and setFWHM().
float LMFLaserPulseDat::m_rise [private] |
Definition at line 76 of file LMFLaserPulseDat.h.
Referenced by getRise(), LMFLaserPulseDat(), and setRise().
float LMFLaserPulseDat::m_sliding [private] |
Definition at line 80 of file LMFLaserPulseDat.h.
Referenced by getSliding(), LMFLaserPulseDat(), and setSliding().
float LMFLaserPulseDat::m_time [private] |
Definition at line 75 of file LMFLaserPulseDat.h.
Referenced by getTime(), LMFLaserPulseDat(), and setTime().