![]() |
![]() |
#include <OnlineDB/EcalCondDB/interface/MonLaserPulseDat.h>
Public Member Functions | |
float | getPulseHeightMean () const |
float | getPulseHeightRMS () const |
float | getPulseWidthMean () const |
float | getPulseWidthRMS () const |
std::string | getTable () |
MonLaserPulseDat () | |
void | setPulseHeightMean (float p) |
void | setPulseHeightRMS (float p) |
void | setPulseWidthMean (float p) |
void | setPulseWidthRMS (float p) |
~MonLaserPulseDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, MonLaserPulseDat > *fillMap, MonRunIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::map< EcalLogicID, MonLaserPulseDat > *data, MonRunIOV *iov) throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const MonLaserPulseDat *item, MonRunIOV *iov) throw (std::runtime_error) |
Private Attributes | |
float | m_pulseHeightMean |
float | m_pulseHeightRMS |
float | m_pulseWidthMean |
float | m_pulseWidthRMS |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file MonLaserPulseDat.h.
MonLaserPulseDat::MonLaserPulseDat | ( | ) |
Definition at line 10 of file MonLaserPulseDat.cc.
References IDBObject::m_conn, IDBObject::m_env, m_pulseHeightMean, m_pulseHeightRMS, m_pulseWidthMean, m_pulseWidthRMS, IDataItem::m_readStmt, IDataItem::m_writeStmt, and NULL.
00011 { 00012 m_env = NULL; 00013 m_conn = NULL; 00014 m_writeStmt = NULL; 00015 m_readStmt = NULL; 00016 00017 m_pulseHeightMean = 0; 00018 m_pulseHeightRMS = 0; 00019 m_pulseWidthMean = 0; 00020 m_pulseWidthRMS = 0; 00021 }
MonLaserPulseDat::~MonLaserPulseDat | ( | ) |
void MonLaserPulseDat::fetchData | ( | std::map< EcalLogicID, MonLaserPulseDat > * | fillMap, | |
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 78 of file MonLaserPulseDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setPulseHeightMean(), setPulseHeightRMS(), setPulseWidthMean(), and setPulseWidthRMS().
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("MonLaserPulseDat::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.pulse_height_mean, d.pulse_height_rms, d.pulse_width_mean, d.pulse_width_rms " 00095 "FROM channelview cv JOIN mon_laser_pulse_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, MonLaserPulseDat > p; 00102 MonLaserPulseDat 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.setPulseHeightMean( rset->getFloat(7) ); 00112 dat.setPulseHeightRMS( rset->getFloat(8) ); 00113 dat.setPulseWidthMean( rset->getFloat(9) ); 00114 dat.setPulseWidthRMS( rset->getFloat(10) ); 00115 00116 p.second = dat; 00117 fillMap->insert(p); 00118 } 00119 } catch (SQLException &e) { 00120 throw(runtime_error("MonLaserPulseDat::fetchData(): "+e.getMessage())); 00121 } 00122 }
float MonLaserPulseDat::getPulseHeightMean | ( | ) | const [inline] |
Definition at line 21 of file MonLaserPulseDat.h.
References m_pulseHeightMean.
Referenced by writeArrayDB().
00021 { return m_pulseHeightMean; }
float MonLaserPulseDat::getPulseHeightRMS | ( | ) | const [inline] |
Definition at line 24 of file MonLaserPulseDat.h.
References m_pulseHeightRMS.
Referenced by writeArrayDB().
00024 { return m_pulseHeightRMS; }
float MonLaserPulseDat::getPulseWidthMean | ( | ) | const [inline] |
Definition at line 27 of file MonLaserPulseDat.h.
References m_pulseWidthMean.
Referenced by writeArrayDB().
00027 { return m_pulseWidthMean; }
float MonLaserPulseDat::getPulseWidthRMS | ( | ) | const [inline] |
Definition at line 30 of file MonLaserPulseDat.h.
References m_pulseWidthRMS.
Referenced by writeArrayDB().
00030 { return m_pulseWidthRMS; }
std::string MonLaserPulseDat::getTable | ( | ) | [inline, virtual] |
void MonLaserPulseDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 31 of file MonLaserPulseDat.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 mon_laser_pulse_dat (iov_id, logic_id, " 00039 "pulse_height_mean, pulse_height_rms, pulse_width_mean, pulse_width_rms) " 00040 "VALUES (:iov_id, :logic_id, " 00041 ":3, :4, :5, :6)"); 00042 } catch (SQLException &e) { 00043 throw(runtime_error("MonLaserPulseDat::prepareWrite(): "+e.getMessage())); 00044 } 00045 }
void MonLaserPulseDat::setPulseHeightMean | ( | float | p | ) | [inline] |
Definition at line 20 of file MonLaserPulseDat.h.
References m_pulseHeightMean.
Referenced by fetchData().
00020 { m_pulseHeightMean = p; }
void MonLaserPulseDat::setPulseHeightRMS | ( | float | p | ) | [inline] |
Definition at line 23 of file MonLaserPulseDat.h.
References m_pulseHeightRMS.
Referenced by fetchData().
00023 { m_pulseHeightRMS = p; }
void MonLaserPulseDat::setPulseWidthMean | ( | float | p | ) | [inline] |
Definition at line 26 of file MonLaserPulseDat.h.
References m_pulseWidthMean.
Referenced by fetchData().
00026 { m_pulseWidthMean = p; }
void MonLaserPulseDat::setPulseWidthRMS | ( | float | p | ) | [inline] |
Definition at line 29 of file MonLaserPulseDat.h.
References m_pulseWidthRMS.
Referenced by fetchData().
00029 { m_pulseWidthRMS = p; }
void MonLaserPulseDat::writeArrayDB | ( | const std::map< EcalLogicID, MonLaserPulseDat > * | data, | |
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 124 of file MonLaserPulseDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, e, EcalLogicID::getLogicID(), getPulseHeightMean(), getPulseHeightRMS(), getPulseWidthMean(), getPulseWidthRMS(), IDataItem::m_writeStmt, p, w, ww, x, y, and z.
00126 { 00127 this->checkConnection(); 00128 this->checkPrepare(); 00129 00130 int iovID = iov->fetchID(); 00131 if (!iovID) { throw(runtime_error("MonLaserPulseDat::writeArrayDB: IOV not in DB")); } 00132 00133 00134 int nrows=data->size(); 00135 int* ids= new int[nrows]; 00136 int* iovid_vec= new int[nrows]; 00137 float* xx= new float[nrows]; 00138 float* yy= new float[nrows]; 00139 float* zz= new float[nrows]; 00140 float* ww= new float[nrows]; 00141 00142 00143 ub2* ids_len= new ub2[nrows]; 00144 ub2* iov_len= new ub2[nrows]; 00145 ub2* x_len= new ub2[nrows]; 00146 ub2* y_len= new ub2[nrows]; 00147 ub2* z_len= new ub2[nrows]; 00148 ub2* w_len= new ub2[nrows]; 00149 00150 00151 const EcalLogicID* channel; 00152 const MonLaserPulseDat* dataitem; 00153 int count=0; 00154 typedef map< EcalLogicID, MonLaserPulseDat >::const_iterator CI; 00155 for (CI p = data->begin(); p != data->end(); ++p) { 00156 channel = &(p->first); 00157 int logicID = channel->getLogicID(); 00158 if (!logicID) { throw(runtime_error("MonLaserPulseDat::writeArrayDB: Bad EcalLogicID")); } 00159 ids[count]=logicID; 00160 iovid_vec[count]=iovID; 00161 00162 dataitem = &(p->second); 00163 // dataIface.writeDB( channel, dataitem, iov); 00164 float x=dataitem->getPulseHeightMean(); 00165 float y=dataitem->getPulseHeightRMS(); 00166 float z=dataitem->getPulseWidthMean(); 00167 float w=dataitem->getPulseWidthRMS(); 00168 00169 00170 xx[count]=x; 00171 yy[count]=y; 00172 zz[count]=z; 00173 ww[count]=w; 00174 00175 ids_len[count]=sizeof(ids[count]); 00176 iov_len[count]=sizeof(iovid_vec[count]); 00177 00178 x_len[count]=sizeof(xx[count]); 00179 y_len[count]=sizeof(yy[count]); 00180 z_len[count]=sizeof(zz[count]); 00181 w_len[count]=sizeof(ww[count]); 00182 00183 count++; 00184 } 00185 00186 00187 try { 00188 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len); 00189 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len ); 00190 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len ); 00191 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len ); 00192 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len ); 00193 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT , sizeof(ww[0]), w_len ); 00194 00195 00196 m_writeStmt->executeArrayUpdate(nrows); 00197 00198 delete [] ids; 00199 delete [] iovid_vec; 00200 delete [] xx; 00201 delete [] yy; 00202 delete [] zz; 00203 delete [] ww; 00204 00205 delete [] ids_len; 00206 delete [] iov_len; 00207 delete [] x_len; 00208 delete [] y_len; 00209 delete [] z_len; 00210 delete [] w_len; 00211 00212 00213 00214 } catch (SQLException &e) { 00215 throw(runtime_error("MonLaserPulseDat::writeArrayDB(): "+e.getMessage())); 00216 } 00217 }
void MonLaserPulseDat::writeDB | ( | const EcalLogicID * | ecid, | |
const MonLaserPulseDat * | item, | |||
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 49 of file MonLaserPulseDat.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("MonLaserPulseDat::writeDB: IOV not in DB")); } 00057 00058 int logicID = ecid->getLogicID(); 00059 if (!logicID) { throw(runtime_error("MonLaserPulseDat::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->getPulseHeightMean() ); 00066 m_writeStmt->setFloat(4, item->getPulseHeightRMS() ); 00067 m_writeStmt->setFloat(5, item->getPulseWidthMean() ); 00068 m_writeStmt->setFloat(6, item->getPulseWidthRMS() ); 00069 00070 m_writeStmt->executeUpdate(); 00071 } catch (SQLException &e) { 00072 throw(runtime_error("MonLaserPulseDat::writeDB(): "+e.getMessage())); 00073 } 00074 }
friend class EcalCondDBInterface [friend] |
float MonLaserPulseDat::m_pulseHeightMean [private] |
Definition at line 46 of file MonLaserPulseDat.h.
Referenced by getPulseHeightMean(), MonLaserPulseDat(), and setPulseHeightMean().
float MonLaserPulseDat::m_pulseHeightRMS [private] |
Definition at line 47 of file MonLaserPulseDat.h.
Referenced by getPulseHeightRMS(), MonLaserPulseDat(), and setPulseHeightRMS().
float MonLaserPulseDat::m_pulseWidthMean [private] |
Definition at line 48 of file MonLaserPulseDat.h.
Referenced by getPulseWidthMean(), MonLaserPulseDat(), and setPulseWidthMean().
float MonLaserPulseDat::m_pulseWidthRMS [private] |
Definition at line 49 of file MonLaserPulseDat.h.
Referenced by getPulseWidthRMS(), MonLaserPulseDat(), and setPulseWidthRMS().