#include <OnlineDB/EcalCondDB/interface/MonPedestalsOnlineDat.h>
Public Member Functions | |
float | getADCMeanG12 () const |
float | getADCRMSG12 () const |
std::string | getTable () |
bool | getTaskStatus () const |
MonPedestalsOnlineDat () | |
void | setADCMeanG12 (float mean) |
void | setADCRMSG12 (float rms) |
void | setTaskStatus (bool status) |
~MonPedestalsOnlineDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, MonPedestalsOnlineDat > *fillMap, MonRunIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::map< EcalLogicID, MonPedestalsOnlineDat > *data, MonRunIOV *iov) throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const MonPedestalsOnlineDat *item, MonRunIOV *iov) throw (std::runtime_error) |
Private Attributes | |
float | m_adcMeanG12 |
float | m_adcRMSG12 |
bool | m_taskStatus |
Friends | |
class | EcalCondDBInterface |
Definition at line 12 of file MonPedestalsOnlineDat.h.
MonPedestalsOnlineDat::MonPedestalsOnlineDat | ( | ) |
Definition at line 12 of file MonPedestalsOnlineDat.cc.
References m_adcMeanG12, m_adcRMSG12, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, m_taskStatus, 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_adcMeanG12 = 0; 00020 m_adcRMSG12 = 0; 00021 m_taskStatus = 0; 00022 }
MonPedestalsOnlineDat::~MonPedestalsOnlineDat | ( | ) |
void MonPedestalsOnlineDat::fetchData | ( | std::map< EcalLogicID, MonPedestalsOnlineDat > * | fillMap, | |
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 77 of file MonPedestalsOnlineDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setADCMeanG12(), setADCRMSG12(), and setTaskStatus().
00079 { 00080 this->checkConnection(); 00081 fillMap->clear(); 00082 00083 iov->setConnection(m_env, m_conn); 00084 int iovID = iov->fetchID(); 00085 if (!iovID) { 00086 // throw(runtime_error("MonPedestalsOnlineDat::writeDB: IOV not in DB")); 00087 return; 00088 } 00089 00090 try { 00091 00092 m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 00093 "d.adc_mean_g12, d.adc_rms_g12, d.task_status " 00094 "FROM channelview cv JOIN mon_pedestals_online_dat d " 00095 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 00096 "WHERE d.iov_id = :iov_id"); 00097 m_readStmt->setInt(1, iovID); 00098 ResultSet* rset = m_readStmt->executeQuery(); 00099 00100 std::pair< EcalLogicID, MonPedestalsOnlineDat > p; 00101 MonPedestalsOnlineDat dat; 00102 while(rset->next()) { 00103 p.first = EcalLogicID( rset->getString(1), // name 00104 rset->getInt(2), // logic_id 00105 rset->getInt(3), // id1 00106 rset->getInt(4), // id2 00107 rset->getInt(5), // id3 00108 rset->getString(6)); // maps_to 00109 00110 dat.setADCMeanG12( rset->getFloat(7) ); 00111 dat.setADCRMSG12( rset->getFloat(8) ); 00112 dat.setTaskStatus( rset->getInt(9) ); 00113 00114 p.second = dat; 00115 fillMap->insert(p); 00116 } 00117 } catch (SQLException &e) { 00118 throw(runtime_error("MonPedestalsOnlineDat::fetchData(): "+e.getMessage())); 00119 } 00120 }
float MonPedestalsOnlineDat::getADCMeanG12 | ( | ) | const [inline] |
Definition at line 22 of file MonPedestalsOnlineDat.h.
References m_adcMeanG12.
Referenced by writeArrayDB().
00022 { return m_adcMeanG12; }
float MonPedestalsOnlineDat::getADCRMSG12 | ( | ) | const [inline] |
Definition at line 25 of file MonPedestalsOnlineDat.h.
References m_adcRMSG12.
Referenced by writeArrayDB().
00025 { return m_adcRMSG12; }
std::string MonPedestalsOnlineDat::getTable | ( | ) | [inline, virtual] |
bool MonPedestalsOnlineDat::getTaskStatus | ( | ) | const [inline] |
Definition at line 28 of file MonPedestalsOnlineDat.h.
References m_taskStatus.
Referenced by writeArrayDB().
00028 { return m_taskStatus; }
void MonPedestalsOnlineDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 32 of file MonPedestalsOnlineDat.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 mon_pedestals_online_dat (iov_id, logic_id, " 00040 "adc_mean_g12, adc_rms_g12, task_status) " 00041 "VALUES (:iov_id, :logic_id, " 00042 ":adc_mean_g12, :adc_rms_g12, :task_status)"); 00043 } catch (SQLException &e) { 00044 throw(runtime_error("MonPedestalsOnlineDat::prepareWrite(): "+e.getMessage())); 00045 } 00046 }
void MonPedestalsOnlineDat::setADCMeanG12 | ( | float | mean | ) | [inline] |
Definition at line 21 of file MonPedestalsOnlineDat.h.
References m_adcMeanG12.
Referenced by fetchData(), EEPedestalOnlineClient::writeDb(), and EBPedestalOnlineClient::writeDb().
00021 { m_adcMeanG12 = mean; }
void MonPedestalsOnlineDat::setADCRMSG12 | ( | float | rms | ) | [inline] |
Definition at line 24 of file MonPedestalsOnlineDat.h.
References m_adcRMSG12.
Referenced by fetchData(), EEPedestalOnlineClient::writeDb(), and EBPedestalOnlineClient::writeDb().
00024 { m_adcRMSG12 = rms; }
Definition at line 27 of file MonPedestalsOnlineDat.h.
References m_taskStatus.
Referenced by fetchData(), EEPedestalOnlineClient::writeDb(), and EBPedestalOnlineClient::writeDb().
00027 { m_taskStatus = status; }
void MonPedestalsOnlineDat::writeArrayDB | ( | const std::map< EcalLogicID, MonPedestalsOnlineDat > * | data, | |
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 122 of file MonPedestalsOnlineDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, e, getADCMeanG12(), getADCRMSG12(), EcalLogicID::getLogicID(), getTaskStatus(), IDataItem::m_writeStmt, p, st, x, and y.
00124 { 00125 this->checkConnection(); 00126 this->checkPrepare(); 00127 00128 int iovID = iov->fetchID(); 00129 if (!iovID) { throw(runtime_error("MonPedestalsOnlineDat::writeArrayDB: IOV not in DB")); } 00130 00131 00132 int nrows=data->size(); 00133 int* ids= new int[nrows]; 00134 int* iovid_vec= new int[nrows]; 00135 float* xx= new float[nrows]; 00136 float* yy= new float[nrows]; 00137 int* st= new int[nrows]; 00138 00139 ub2* ids_len= new ub2[nrows]; 00140 ub2* iov_len= new ub2[nrows]; 00141 ub2* x_len= new ub2[nrows]; 00142 ub2* y_len= new ub2[nrows]; 00143 ub2* st_len= new ub2[nrows]; 00144 00145 const EcalLogicID* channel; 00146 const MonPedestalsOnlineDat* dataitem; 00147 int count=0; 00148 typedef map< EcalLogicID, MonPedestalsOnlineDat >::const_iterator CI; 00149 for (CI p = data->begin(); p != data->end(); ++p) { 00150 channel = &(p->first); 00151 int logicID = channel->getLogicID(); 00152 if (!logicID) { throw(runtime_error("MonPedestalsOnlineDat::writeArrayDB: Bad EcalLogicID")); } 00153 ids[count]=logicID; 00154 iovid_vec[count]=iovID; 00155 00156 dataitem = &(p->second); 00157 // dataIface.writeDB( channel, dataitem, iov); 00158 float x=dataitem->getADCMeanG12(); 00159 float y=dataitem->getADCRMSG12(); 00160 int statu=dataitem->getTaskStatus(); 00161 00162 00163 00164 xx[count]=x; 00165 yy[count]=y; 00166 st[count]=statu; 00167 00168 00169 ids_len[count]=sizeof(ids[count]); 00170 iov_len[count]=sizeof(iovid_vec[count]); 00171 00172 x_len[count]=sizeof(xx[count]); 00173 y_len[count]=sizeof(yy[count]); 00174 st_len[count]=sizeof(st[count]); 00175 00176 count++; 00177 } 00178 00179 00180 try { 00181 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len); 00182 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len ); 00183 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len ); 00184 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len ); 00185 m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len ); 00186 00187 00188 m_writeStmt->executeArrayUpdate(nrows); 00189 00190 delete [] ids; 00191 delete [] iovid_vec; 00192 delete [] xx; 00193 delete [] yy; 00194 delete [] st; 00195 00196 delete [] ids_len; 00197 delete [] iov_len; 00198 delete [] x_len; 00199 delete [] y_len; 00200 delete [] st_len; 00201 00202 00203 00204 } catch (SQLException &e) { 00205 throw(runtime_error("MonPedestalsDat::writeArrayDB(): "+e.getMessage())); 00206 } 00207 }
void MonPedestalsOnlineDat::writeDB | ( | const EcalLogicID * | ecid, | |
const MonPedestalsOnlineDat * | item, | |||
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 50 of file MonPedestalsOnlineDat.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("MonPedestalsOnlineDat::writeDB: IOV not in DB")); } 00058 00059 int logicID = ecid->getLogicID(); 00060 if (!logicID) { throw(runtime_error("MonPedestalsOnlineDat::writeDB: Bad EcalLogicID")); } 00061 00062 try { 00063 m_writeStmt->setInt(1, iovID); 00064 m_writeStmt->setInt(2, logicID); 00065 m_writeStmt->setFloat(3, item->getADCMeanG12() ); 00066 m_writeStmt->setFloat(4, item->getADCRMSG12() ); 00067 m_writeStmt->setInt(5, item->getTaskStatus() ); 00068 00069 m_writeStmt->executeUpdate(); 00070 } catch (SQLException &e) { 00071 throw(runtime_error("MonPedestalsOnlineDat::writeDB(): "+e.getMessage())); 00072 } 00073 }
friend class EcalCondDBInterface [friend] |
float MonPedestalsOnlineDat::m_adcMeanG12 [private] |
Definition at line 46 of file MonPedestalsOnlineDat.h.
Referenced by getADCMeanG12(), MonPedestalsOnlineDat(), and setADCMeanG12().
float MonPedestalsOnlineDat::m_adcRMSG12 [private] |
Definition at line 47 of file MonPedestalsOnlineDat.h.
Referenced by getADCRMSG12(), MonPedestalsOnlineDat(), and setADCRMSG12().
bool MonPedestalsOnlineDat::m_taskStatus [private] |
Definition at line 48 of file MonPedestalsOnlineDat.h.
Referenced by getTaskStatus(), MonPedestalsOnlineDat(), and setTaskStatus().