#include <OnlineDB/EcalCondDB/interface/MonLaserGreenDat.h>
Public Member Functions | |
float | getAPDMean () const |
float | getAPDOverPNMean () const |
float | getAPDOverPNRMS () const |
float | getAPDRMS () const |
std::string | getTable () |
bool | getTaskStatus () const |
MonLaserGreenDat () | |
void | setAPDMean (float mean) |
void | setAPDOverPNMean (float mean) |
void | setAPDOverPNRMS (float rms) |
void | setAPDRMS (float rms) |
void | setTaskStatus (bool status) |
~MonLaserGreenDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, MonLaserGreenDat > *fillMap, MonRunIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::map< EcalLogicID, MonLaserGreenDat > *data, MonRunIOV *iov) throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const MonLaserGreenDat *item, MonRunIOV *iov) throw (std::runtime_error) |
Private Attributes | |
float | m_apdMean |
float | m_apdOverPNMean |
float | m_apdOverPNRMS |
float | m_apdRMS |
bool | m_taskStatus |
Friends | |
class | EcalCondDBInterface |
Definition at line 12 of file MonLaserGreenDat.h.
MonLaserGreenDat::MonLaserGreenDat | ( | ) |
Definition at line 10 of file MonLaserGreenDat.cc.
References m_apdMean, m_apdOverPNMean, m_apdOverPNRMS, m_apdRMS, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, m_taskStatus, 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_apdMean = 0; 00018 m_apdRMS = 0; 00019 m_apdOverPNMean = 0; 00020 m_apdOverPNRMS = 0; 00021 m_taskStatus = 0; 00022 00023 }
MonLaserGreenDat::~MonLaserGreenDat | ( | ) |
void MonLaserGreenDat::fetchData | ( | std::map< EcalLogicID, MonLaserGreenDat > * | fillMap, | |
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 81 of file MonLaserGreenDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setAPDMean(), setAPDOverPNMean(), setAPDOverPNRMS(), setAPDRMS(), and setTaskStatus().
00083 { 00084 this->checkConnection(); 00085 00086 fillMap->clear(); 00087 00088 iov->setConnection(m_env, m_conn); 00089 int iovID = iov->fetchID(); 00090 if (!iovID) { 00091 // throw(runtime_error("MonLaserGreenDat::writeDB: IOV not in DB")); 00092 return; 00093 } 00094 00095 try { 00096 00097 m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 00098 "d.apd_mean, d.apd_rms, d.apd_over_pn_mean, d.apd_over_pn_rms, d.task_status " 00099 "FROM channelview cv JOIN mon_laser_green_dat d " 00100 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 00101 "WHERE d.iov_id = :iov_id"); 00102 m_readStmt->setInt(1, iovID); 00103 ResultSet* rset = m_readStmt->executeQuery(); 00104 00105 std::pair< EcalLogicID, MonLaserGreenDat > p; 00106 MonLaserGreenDat dat; 00107 while(rset->next()) { 00108 p.first = EcalLogicID( rset->getString(1), // name 00109 rset->getInt(2), // logic_id 00110 rset->getInt(3), // id1 00111 rset->getInt(4), // id2 00112 rset->getInt(5), // id3 00113 rset->getString(6)); // maps_to 00114 00115 dat.setAPDMean( rset->getFloat(7) ); 00116 dat.setAPDRMS( rset->getFloat(8) ); 00117 dat.setAPDOverPNMean( rset->getFloat(9) ); 00118 dat.setAPDOverPNRMS( rset->getFloat(10) ); 00119 dat.setTaskStatus( rset->getInt(11) ); 00120 00121 00122 p.second = dat; 00123 fillMap->insert(p); 00124 } 00125 } catch (SQLException &e) { 00126 throw(runtime_error("MonLaserGreenDat::fetchData(): "+e.getMessage())); 00127 } 00128 }
float MonLaserGreenDat::getAPDMean | ( | ) | const [inline] |
Definition at line 22 of file MonLaserGreenDat.h.
References m_apdMean.
Referenced by writeArrayDB().
00022 { return m_apdMean; }
float MonLaserGreenDat::getAPDOverPNMean | ( | ) | const [inline] |
Definition at line 28 of file MonLaserGreenDat.h.
References m_apdOverPNMean.
Referenced by writeArrayDB().
00028 { return m_apdOverPNMean; }
float MonLaserGreenDat::getAPDOverPNRMS | ( | ) | const [inline] |
Definition at line 31 of file MonLaserGreenDat.h.
References m_apdOverPNRMS.
Referenced by writeArrayDB().
00031 { return m_apdOverPNRMS; }
float MonLaserGreenDat::getAPDRMS | ( | ) | const [inline] |
Definition at line 25 of file MonLaserGreenDat.h.
References m_apdRMS.
Referenced by writeArrayDB().
00025 { return m_apdRMS; }
std::string MonLaserGreenDat::getTable | ( | ) | [inline, virtual] |
bool MonLaserGreenDat::getTaskStatus | ( | ) | const [inline] |
Definition at line 34 of file MonLaserGreenDat.h.
References m_taskStatus.
Referenced by writeArrayDB().
00034 { return m_taskStatus; }
void MonLaserGreenDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 33 of file MonLaserGreenDat.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 mon_laser_green_dat (iov_id, logic_id, " 00041 "apd_mean, apd_rms, apd_over_pn_mean, apd_over_pn_rms, task_status) " 00042 "VALUES (:iov_id, :logic_id, " 00043 ":apd_mean, :apd_rms, :apd_over_pn_mean, :apd_over_pn_rms, :task_status)"); 00044 } catch (SQLException &e) { 00045 throw(runtime_error("MonLaserGreenDat::prepareWrite(): "+e.getMessage())); 00046 } 00047 }
void MonLaserGreenDat::setAPDMean | ( | float | mean | ) | [inline] |
Definition at line 21 of file MonLaserGreenDat.h.
References m_apdMean.
Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().
void MonLaserGreenDat::setAPDOverPNMean | ( | float | mean | ) | [inline] |
Definition at line 27 of file MonLaserGreenDat.h.
References m_apdOverPNMean.
Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().
00027 { m_apdOverPNMean = mean; }
void MonLaserGreenDat::setAPDOverPNRMS | ( | float | rms | ) | [inline] |
Definition at line 30 of file MonLaserGreenDat.h.
References m_apdOverPNRMS.
Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().
00030 { m_apdOverPNRMS = rms; }
void MonLaserGreenDat::setAPDRMS | ( | float | rms | ) | [inline] |
Definition at line 24 of file MonLaserGreenDat.h.
References m_apdRMS.
Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().
00024 { m_apdRMS = rms; }
Definition at line 33 of file MonLaserGreenDat.h.
References m_taskStatus.
Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().
00033 { m_taskStatus = status; }
void MonLaserGreenDat::writeArrayDB | ( | const std::map< EcalLogicID, MonLaserGreenDat > * | data, | |
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 130 of file MonLaserGreenDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, e, getAPDMean(), getAPDOverPNMean(), getAPDOverPNRMS(), getAPDRMS(), EcalLogicID::getLogicID(), getTaskStatus(), IDataItem::m_writeStmt, p, st, w, ww, x, y, and z.
00132 { 00133 this->checkConnection(); 00134 this->checkPrepare(); 00135 00136 int iovID = iov->fetchID(); 00137 if (!iovID) { throw(runtime_error("MonLaserGreenDat::writeArrayDB: IOV not in DB")); } 00138 00139 00140 int nrows=data->size(); 00141 int* ids= new int[nrows]; 00142 int* iovid_vec= new int[nrows]; 00143 float* xx= new float[nrows]; 00144 float* yy= new float[nrows]; 00145 float* zz= new float[nrows]; 00146 float* ww= new float[nrows]; 00147 int* st= new int[nrows]; 00148 00149 ub2* ids_len= new ub2[nrows]; 00150 ub2* iov_len= new ub2[nrows]; 00151 ub2* x_len= new ub2[nrows]; 00152 ub2* y_len= new ub2[nrows]; 00153 ub2* z_len= new ub2[nrows]; 00154 ub2* w_len= new ub2[nrows]; 00155 ub2* st_len= new ub2[nrows]; 00156 00157 const EcalLogicID* channel; 00158 const MonLaserGreenDat* dataitem; 00159 int count=0; 00160 typedef map< EcalLogicID, MonLaserGreenDat >::const_iterator CI; 00161 for (CI p = data->begin(); p != data->end(); ++p) { 00162 channel = &(p->first); 00163 int logicID = channel->getLogicID(); 00164 if (!logicID) { throw(runtime_error("MonLaserGreenDat::writeArrayDB: Bad EcalLogicID")); } 00165 ids[count]=logicID; 00166 iovid_vec[count]=iovID; 00167 00168 dataitem = &(p->second); 00169 // dataIface.writeDB( channel, dataitem, iov); 00170 float x=dataitem->getAPDMean(); 00171 float y=dataitem->getAPDRMS(); 00172 float z=dataitem->getAPDOverPNMean(); 00173 float w=dataitem->getAPDOverPNRMS(); 00174 int statu=dataitem->getTaskStatus(); 00175 00176 00177 00178 xx[count]=x; 00179 yy[count]=y; 00180 zz[count]=z; 00181 ww[count]=w; 00182 st[count]=statu; 00183 00184 00185 ids_len[count]=sizeof(ids[count]); 00186 iov_len[count]=sizeof(iovid_vec[count]); 00187 00188 x_len[count]=sizeof(xx[count]); 00189 y_len[count]=sizeof(yy[count]); 00190 z_len[count]=sizeof(zz[count]); 00191 w_len[count]=sizeof(ww[count]); 00192 st_len[count]=sizeof(st[count]); 00193 00194 count++; 00195 } 00196 00197 00198 try { 00199 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len); 00200 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len ); 00201 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len ); 00202 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len ); 00203 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len ); 00204 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT , sizeof(ww[0]), w_len ); 00205 m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len ); 00206 00207 00208 m_writeStmt->executeArrayUpdate(nrows); 00209 00210 delete [] ids; 00211 delete [] iovid_vec; 00212 delete [] xx; 00213 delete [] yy; 00214 delete [] zz; 00215 delete [] ww; 00216 delete [] st; 00217 00218 delete [] ids_len; 00219 delete [] iov_len; 00220 delete [] x_len; 00221 delete [] y_len; 00222 delete [] z_len; 00223 delete [] w_len; 00224 delete [] st_len; 00225 00226 00227 00228 } catch (SQLException &e) { 00229 throw(runtime_error("MonLaserGreenDat::writeArrayDB(): "+e.getMessage())); 00230 } 00231 }
void MonLaserGreenDat::writeDB | ( | const EcalLogicID * | ecid, | |
const MonLaserGreenDat * | item, | |||
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 51 of file MonLaserGreenDat.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("MonLaserGreenDat::writeDB: IOV not in DB")); } 00059 00060 int logicID = ecid->getLogicID(); 00061 if (!logicID) { throw(runtime_error("MonLaserGreenDat::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->getAPDMean() ); 00068 m_writeStmt->setFloat(4, item->getAPDRMS() ); 00069 m_writeStmt->setFloat(5, item->getAPDOverPNMean() ); 00070 m_writeStmt->setFloat(6, item->getAPDOverPNRMS() ); 00071 m_writeStmt->setInt(7, item->getTaskStatus() ); 00072 00073 m_writeStmt->executeUpdate(); 00074 } catch (SQLException &e) { 00075 throw(runtime_error("MonLaserGreenDat::writeDB(): "+e.getMessage())); 00076 } 00077 }
friend class EcalCondDBInterface [friend] |
float MonLaserGreenDat::m_apdMean [private] |
Definition at line 52 of file MonLaserGreenDat.h.
Referenced by getAPDMean(), MonLaserGreenDat(), and setAPDMean().
float MonLaserGreenDat::m_apdOverPNMean [private] |
Definition at line 54 of file MonLaserGreenDat.h.
Referenced by getAPDOverPNMean(), MonLaserGreenDat(), and setAPDOverPNMean().
float MonLaserGreenDat::m_apdOverPNRMS [private] |
Definition at line 55 of file MonLaserGreenDat.h.
Referenced by getAPDOverPNRMS(), MonLaserGreenDat(), and setAPDOverPNRMS().
float MonLaserGreenDat::m_apdRMS [private] |
Definition at line 53 of file MonLaserGreenDat.h.
Referenced by getAPDRMS(), MonLaserGreenDat(), and setAPDRMS().
bool MonLaserGreenDat::m_taskStatus [private] |
Definition at line 56 of file MonLaserGreenDat.h.
Referenced by getTaskStatus(), MonLaserGreenDat(), and setTaskStatus().