16 m_writeStmt =
nullptr;
41 this->checkConnection();
44 m_writeStmt = m_conn->createStatement();
45 m_writeStmt->setSQL(
"INSERT INTO mon_pn_led1_dat (iov_id, logic_id, " 46 "adc_mean_g1, adc_rms_g1, adc_mean_g16, adc_rms_g16, ped_mean_g1, ped_rms_g1, ped_mean_g16, ped_rms_g16, task_status) " 47 "VALUES (:iov_id, :logic_id, " 48 ":3, :4, :5, :6, :7, :8, :9, :10, :11)");
49 }
catch (SQLException &
e) {
50 throw(std::runtime_error(
std::string(
"MonPNLed1Dat::prepareWrite(): ")+getOraMessage(&e)));
59 this->checkConnection();
62 int iovID = iov->fetchID();
63 if (!iovID) {
throw(std::runtime_error(
"MonPNLed1Dat::writeDB: IOV not in DB")); }
65 int logicID = ecid->getLogicID();
66 if (!logicID) {
throw(std::runtime_error(
"MonPNLed1Dat::writeDB: Bad EcalLogicID")); }
69 m_writeStmt->setInt(1, iovID);
70 m_writeStmt->setInt(2, logicID);
72 m_writeStmt->setFloat(3, item->getADCMeanG1() );
73 m_writeStmt->setFloat(4, item->getADCRMSG1() );
74 m_writeStmt->setFloat(5, item->getADCMeanG16() );
75 m_writeStmt->setFloat(6, item->getADCRMSG16() );
76 m_writeStmt->setFloat(7, item->getPedMeanG1() );
77 m_writeStmt->setFloat(8, item->getPedRMSG1() );
78 m_writeStmt->setFloat(9, item->getPedMeanG16() );
79 m_writeStmt->setFloat(10, item->getPedRMSG16() );
80 m_writeStmt->setInt(11, item->getTaskStatus() );
82 m_writeStmt->executeUpdate();
83 }
catch (SQLException &
e) {
84 throw(std::runtime_error(
std::string(
"MonPNLed1Dat::writeDB(): ")+getOraMessage(&e)));
93 this->checkConnection();
96 iov->setConnection(m_env, m_conn);
97 int iovID = iov->fetchID();
105 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 106 "d.adc_mean_g1, d.adc_rms_g1, d.adc_mean_g16, d.adc_rms_g16, d.ped_mean_g1,d.ped_rms_g1, d.ped_mean_g16, d.ped_rms_g16, d.task_status " 107 "FROM channelview cv JOIN mon_pn_led1_dat d " 108 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 109 "WHERE d.iov_id = :iov_id");
110 m_readStmt->setInt(1, iovID);
111 ResultSet* rset = m_readStmt->executeQuery();
113 std::pair< EcalLogicID, MonPNLed1Dat >
p;
115 while(rset->next()) {
121 getOraString(rset,6));
135 }
catch (SQLException &
e) {
136 throw(std::runtime_error(
std::string(
"MonPNLed1Dat::fetchData(): ")+getOraMessage(&e)));
143 this->checkConnection();
144 this->checkPrepare();
146 int iovID = iov->fetchID();
147 if (!iovID) {
throw(std::runtime_error(
"MonPNLed1Dat::writeArrayDB: IOV not in DB")); }
150 int nrows=
data->size();
151 int* ids=
new int[nrows];
152 int* iovid_vec=
new int[nrows];
153 float*
xx=
new float[nrows];
154 float*
yy=
new float[nrows];
155 float*
zz=
new float[nrows];
156 float* ww=
new float[nrows];
157 float* uu=
new float[nrows];
158 float*
tt=
new float[nrows];
159 float*
rr=
new float[nrows];
160 float*
pp=
new float[nrows];
161 int* st=
new int[nrows];
163 ub2* ids_len=
new ub2[nrows];
164 ub2* iov_len=
new ub2[nrows];
165 ub2* x_len=
new ub2[nrows];
166 ub2* y_len=
new ub2[nrows];
167 ub2* z_len=
new ub2[nrows];
168 ub2* w_len=
new ub2[nrows];
169 ub2* u_len=
new ub2[nrows];
170 ub2* t_len=
new ub2[nrows];
171 ub2* r_len=
new ub2[nrows];
172 ub2* p_len=
new ub2[nrows];
173 ub2* st_len=
new ub2[nrows];
178 typedef map< EcalLogicID, MonPNLed1Dat >::const_iterator CI;
179 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
180 channel = &(
p->first);
182 if (!logicID) {
throw(std::runtime_error(
"MonPNLed1Dat::writeArrayDB: Bad EcalLogicID")); }
184 iovid_vec[
count]=iovID;
186 dataitem = &(
p->second);
229 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
230 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
231 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
232 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
233 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT ,
sizeof(zz[0]), z_len );
234 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT ,
sizeof(ww[0]), w_len );
235 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT ,
sizeof(uu[0]), u_len );
236 m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIFLOAT ,
sizeof(tt[0]), t_len );
237 m_writeStmt->setDataBuffer(9, (dvoid*)rr, OCCIFLOAT ,
sizeof(rr[0]), r_len );
238 m_writeStmt->setDataBuffer(10, (dvoid*)pp, OCCIFLOAT ,
sizeof(pp[0]), p_len );
239 m_writeStmt->setDataBuffer(11, (dvoid*)st, OCCIINT ,
sizeof(st[0]), st_len );
242 m_writeStmt->executeArrayUpdate(nrows);
270 }
catch (SQLException &
e) {
271 throw(std::runtime_error(
std::string(
"MonPNLed1Dat::writeArrayDB(): ")+getOraMessage(&e)));
void setPedRMSG1(float mean)
float getADCMeanG16() const
float getPedRMSG16() const
void writeDB(const EcalLogicID *ecid, const MonPNLed1Dat *item, MonRunIOV *iov) noexcept(false)
float getADCRMSG1() const
void setPedMeanG1(float mean)
void fetchData(std::map< EcalLogicID, MonPNLed1Dat > *fillVec, MonRunIOV *iov) noexcept(false)
float getPedMeanG1() const
float getADCRMSG16() const
float getPedRMSG1() const
void setADCRMSG16(float mean)
void setADCMeanG16(float mean)
void prepareWrite() noexcept(false) override
void setTaskStatus(bool status)
float getPedMeanG16() const
void setADCRMSG1(float mean)
void setPedMeanG16(float mean)
bool getTaskStatus() const
void setPedRMSG16(float mean)
void setADCMeanG1(float mean)
void writeArrayDB(const std::map< EcalLogicID, MonPNLed1Dat > *data, MonRunIOV *iov) noexcept(false)
char data[epos_bytes_allocation]
float getADCMeanG1() const