15 m_writeStmt =
nullptr;
32 this->checkConnection();
35 m_writeStmt = m_conn->createStatement();
37 "INSERT INTO mon_pn_ired_dat (iov_id, logic_id, " 38 "adc_mean_g1, adc_rms_g1, adc_mean_g16, adc_rms_g16, ped_mean_g1, ped_rms_g1, ped_mean_g16, ped_rms_g16, " 40 "VALUES (:iov_id, :logic_id, " 41 ":3, :4, :5, :6, :7, :8, :9, :10, :11)");
42 }
catch (SQLException&
e) {
43 throw(std::runtime_error(
"MonPNIRedDat::prepareWrite(): " +
e.getMessage()));
48 this->checkConnection();
51 int iovID = iov->fetchID();
53 throw(std::runtime_error(
"MonPNIRedDat::writeDB: IOV not in DB"));
56 int logicID = ecid->getLogicID();
58 throw(std::runtime_error(
"MonPNIRedDat::writeDB: Bad EcalLogicID"));
62 m_writeStmt->setInt(1, iovID);
63 m_writeStmt->setInt(2, logicID);
65 m_writeStmt->setFloat(3,
item->getADCMeanG1());
66 m_writeStmt->setFloat(4,
item->getADCRMSG1());
67 m_writeStmt->setFloat(5,
item->getADCMeanG16());
68 m_writeStmt->setFloat(6,
item->getADCRMSG16());
69 m_writeStmt->setFloat(7,
item->getPedMeanG1());
70 m_writeStmt->setFloat(8,
item->getPedRMSG1());
71 m_writeStmt->setFloat(9,
item->getPedMeanG16());
72 m_writeStmt->setFloat(10,
item->getPedRMSG16());
73 m_writeStmt->setInt(11,
item->getTaskStatus());
75 m_writeStmt->executeUpdate();
76 }
catch (SQLException&
e) {
77 throw(std::runtime_error(
"MonPNIRedDat::writeDB(): " +
e.getMessage()));
82 this->checkConnection();
85 iov->setConnection(m_env, m_conn);
86 int iovID = iov->fetchID();
94 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 95 "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, " 96 "d.ped_rms_g16, d.task_status " 97 "FROM channelview cv JOIN mon_pn_ired_dat d " 98 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 99 "WHERE d.iov_id = :iov_id");
100 m_readStmt->setInt(1, iovID);
101 ResultSet* rset = m_readStmt->executeQuery();
103 std::pair<EcalLogicID, MonPNIRedDat>
p;
105 while (rset->next()) {
125 }
catch (SQLException&
e) {
126 throw(std::runtime_error(
"MonPNIRedDat::fetchData(): " +
e.getMessage()));
130 this->checkConnection();
131 this->checkPrepare();
133 int iovID = iov->fetchID();
135 throw(std::runtime_error(
"MonPNIRedDat::writeArrayDB: IOV not in DB"));
138 int nrows =
data->size();
139 int* ids =
new int[nrows];
140 int* iovid_vec =
new int[nrows];
141 float*
xx =
new float[nrows];
142 float*
yy =
new float[nrows];
143 float*
zz =
new float[nrows];
144 float*
ww =
new float[nrows];
145 float* uu =
new float[nrows];
146 float*
tt =
new float[nrows];
147 float*
rr =
new float[nrows];
148 float*
pp =
new float[nrows];
149 int* st =
new int[nrows];
151 ub2* ids_len =
new ub2[nrows];
152 ub2* iov_len =
new ub2[nrows];
153 ub2* x_len =
new ub2[nrows];
154 ub2* y_len =
new ub2[nrows];
155 ub2* z_len =
new ub2[nrows];
156 ub2* w_len =
new ub2[nrows];
157 ub2* u_len =
new ub2[nrows];
158 ub2* t_len =
new ub2[nrows];
159 ub2* r_len =
new ub2[nrows];
160 ub2* p_len =
new ub2[nrows];
161 ub2* st_len =
new ub2[nrows];
166 typedef map<EcalLogicID, MonPNIRedDat>::const_iterator CI;
167 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
168 channel = &(
p->first);
171 throw(std::runtime_error(
"MonPNIRedDat::writeArrayDB: Bad EcalLogicID"));
173 ids[
count] = logicID;
174 iovid_vec[
count] = iovID;
176 dataitem = &(
p->second);
215 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
216 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
217 m_writeStmt->setDataBuffer(3, (dvoid*)
xx, OCCIFLOAT,
sizeof(
xx[0]), x_len);
218 m_writeStmt->setDataBuffer(4, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
219 m_writeStmt->setDataBuffer(5, (dvoid*)
zz, OCCIFLOAT,
sizeof(
zz[0]), z_len);
220 m_writeStmt->setDataBuffer(6, (dvoid*)
ww, OCCIFLOAT,
sizeof(
ww[0]), w_len);
221 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT,
sizeof(uu[0]), u_len);
222 m_writeStmt->setDataBuffer(8, (dvoid*)
tt, OCCIFLOAT,
sizeof(
tt[0]), t_len);
223 m_writeStmt->setDataBuffer(9, (dvoid*)
rr, OCCIFLOAT,
sizeof(
rr[0]), r_len);
224 m_writeStmt->setDataBuffer(10, (dvoid*)
pp, OCCIFLOAT,
sizeof(
pp[0]), p_len);
225 m_writeStmt->setDataBuffer(11, (dvoid*)st, OCCIINT,
sizeof(st[0]), st_len);
227 m_writeStmt->executeArrayUpdate(nrows);
253 }
catch (SQLException&
e) {
254 throw(std::runtime_error(
"MonPNIRedDat::writeArrayDB(): " +
e.getMessage()));
float getADCMeanG16() const
void setADCRMSG16(float mean)
void setPedRMSG16(float mean)
float getADCRMSG1() const
float getPedRMSG16() const
void writeArrayDB(const std::map< EcalLogicID, MonPNIRedDat > *data, MonRunIOV *iov) noexcept(false)
void setADCMeanG16(float mean)
float getPedMeanG1() const
float getPedMeanG16() const
void setADCMeanG1(float mean)
void setADCRMSG1(float mean)
void setPedRMSG1(float mean)
float getPedRMSG1() const
bool getTaskStatus() const
void writeDB(const EcalLogicID *ecid, const MonPNIRedDat *item, MonRunIOV *iov) noexcept(false)
char data[epos_bytes_allocation]
void setPedMeanG1(float mean)
void prepareWrite() noexcept(false) override
void fetchData(std::map< EcalLogicID, MonPNIRedDat > *fillVec, MonRunIOV *iov) noexcept(false)
float getADCMeanG1() const
void setPedMeanG16(float mean)
void setTaskStatus(bool status)
float getADCRMSG16() const