15 m_writeStmt =
nullptr;
30 this->checkConnection();
33 m_writeStmt = m_conn->createStatement();
35 "INSERT INTO mon_test_pulse_dat (iov_id, logic_id, " 36 "adc_mean_g1, adc_rms_g1, adc_mean_g6, adc_rms_g6, adc_mean_g12, adc_rms_g12, task_status) " 37 "VALUES (:iov_id, :logic_id, " 38 ":adc_mean_g1, :adc_rms_g1, :adc_rms_g6, :adc_rms_g6, :adc_mean_g12, :adc_rms_g12, :task_status)");
39 }
catch (SQLException&
e) {
40 throw(std::runtime_error(
"MonTestPulseDat::prepareWrite(): " + e.getMessage()));
45 this->checkConnection();
48 int iovID = iov->fetchID();
50 throw(std::runtime_error(
"MonTestPulseDat::writeDB: IOV not in DB"));
53 int logicID = ecid->getLogicID();
55 throw(std::runtime_error(
"MonTestPulseDat::writeDB: Bad EcalLogicID"));
59 m_writeStmt->setInt(1, iovID);
60 m_writeStmt->setInt(2, logicID);
61 m_writeStmt->setFloat(3,
item->getADCMeanG1());
62 m_writeStmt->setFloat(4,
item->getADCRMSG1());
63 m_writeStmt->setFloat(5,
item->getADCMeanG6());
64 m_writeStmt->setFloat(6,
item->getADCRMSG6());
65 m_writeStmt->setFloat(7,
item->getADCMeanG12());
66 m_writeStmt->setFloat(8,
item->getADCRMSG12());
67 m_writeStmt->setInt(9,
item->getTaskStatus());
69 m_writeStmt->executeUpdate();
70 }
catch (SQLException&
e) {
71 throw(std::runtime_error(
"MonTestPulseDat::writeDB(): " + e.getMessage()));
76 this->checkConnection();
79 iov->setConnection(m_env, m_conn);
80 int iovID = iov->fetchID();
88 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 89 "d.adc_mean_g1, d.adc_rms_g1, d.adc_mean_g6, d.adc_rms_g6, d.adc_mean_g12, d.adc_rms_g12, d.task_status " 90 "FROM channelview cv JOIN mon_test_pulse_dat d " 91 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 92 "WHERE d.iov_id = :iov_id");
93 m_readStmt->setInt(1, iovID);
94 ResultSet* rset = m_readStmt->executeQuery();
96 std::pair<EcalLogicID, MonTestPulseDat>
p;
98 while (rset->next()) {
117 }
catch (SQLException&
e) {
118 throw(std::runtime_error(
"MonTestPulseDat::fetchData(): " + e.getMessage()));
123 this->checkConnection();
124 this->checkPrepare();
126 int iovID = iov->fetchID();
128 throw(std::runtime_error(
"MonTestPulseDat::writeArrayDB: IOV not in DB"));
131 int nrows =
data->size();
132 int*
ids =
new int[nrows];
133 int* iovid_vec =
new int[nrows];
134 float*
xx =
new float[nrows];
135 float*
yy =
new float[nrows];
136 float*
zz =
new float[nrows];
137 float* ww =
new float[nrows];
138 float* uu =
new float[nrows];
139 float*
tt =
new float[nrows];
140 int* st =
new int[nrows];
142 ub2* ids_len =
new ub2[nrows];
143 ub2* iov_len =
new ub2[nrows];
144 ub2* x_len =
new ub2[nrows];
145 ub2* y_len =
new ub2[nrows];
146 ub2* z_len =
new ub2[nrows];
147 ub2* w_len =
new ub2[nrows];
148 ub2* u_len =
new ub2[nrows];
149 ub2* t_len =
new ub2[nrows];
150 ub2* st_len =
new ub2[nrows];
155 typedef map<EcalLogicID, MonTestPulseDat>::const_iterator CI;
156 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
157 channel = &(
p->first);
160 throw(std::runtime_error(
"MonTestPulseDat::writeArrayDB: Bad EcalLogicID"));
162 ids[
count] = logicID;
163 iovid_vec[
count] = iovID;
165 dataitem = &(
p->second);
198 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
199 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
200 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT,
sizeof(xx[0]), x_len);
201 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT,
sizeof(yy[0]), y_len);
202 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT,
sizeof(zz[0]), z_len);
203 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT,
sizeof(ww[0]), w_len);
204 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT,
sizeof(uu[0]), u_len);
205 m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIFLOAT,
sizeof(tt[0]), t_len);
206 m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIINT,
sizeof(st[0]), st_len);
208 m_writeStmt->executeArrayUpdate(nrows);
230 }
catch (SQLException&
e) {
231 throw(std::runtime_error(
"MonTestPulseDat::writeArrayDB(): " + e.getMessage()));
void setADCRMSG1(float rms)
void writeDB(const EcalLogicID *ecid, const MonTestPulseDat *item, MonRunIOV *iov) noexcept(false)
float getADCMeanG6() const
void setADCMeanG1(float mean)
float getADCRMSG12() const
void setADCMeanG6(float mean)
void setADCMeanG12(float mean)
void fetchData(std::map< EcalLogicID, MonTestPulseDat > *fillMap, MonRunIOV *iov) noexcept(false)
void setTaskStatus(bool status)
float getADCRMSG1() const
void setADCRMSG12(float rms)
void prepareWrite() noexcept(false) override
float getADCMeanG12() const
bool getTaskStatus() const
void setADCRMSG6(float rms)
char data[epos_bytes_allocation]
float getADCRMSG6() const
~MonTestPulseDat() override
float getADCMeanG1() const
void writeArrayDB(const std::map< EcalLogicID, MonTestPulseDat > *data, MonRunIOV *iov) noexcept(false)