15 m_writeStmt =
nullptr;
28 this->checkConnection();
31 m_writeStmt = m_conn->createStatement();
33 "INSERT INTO mon_pn_ped_dat (iov_id, logic_id, " 34 "ped_mean_g1, ped_rms_g1, ped_mean_g16, ped_rms_g16, task_status) " 35 "VALUES (:iov_id, :logic_id, " 36 ":3, :4, :5, :6, :7)");
37 }
catch (SQLException&
e) {
38 throw(std::runtime_error(
"MonPNPedDat::prepareWrite(): " +
e.getMessage()));
43 this->checkConnection();
46 int iovID = iov->fetchID();
48 throw(std::runtime_error(
"MonPNPedDat::writeDB: IOV not in DB"));
51 int logicID = ecid->getLogicID();
53 throw(std::runtime_error(
"MonPNPedDat::writeDB: Bad EcalLogicID"));
57 m_writeStmt->setInt(1, iovID);
58 m_writeStmt->setInt(2, logicID);
60 m_writeStmt->setFloat(3,
item->getPedMeanG1());
61 m_writeStmt->setFloat(4,
item->getPedRMSG1());
62 m_writeStmt->setFloat(5,
item->getPedMeanG16());
63 m_writeStmt->setFloat(6,
item->getPedRMSG16());
64 m_writeStmt->setInt(7,
item->getTaskStatus());
66 m_writeStmt->executeUpdate();
67 }
catch (SQLException&
e) {
68 throw(std::runtime_error(
"MonPNPedDat::writeDB(): " +
e.getMessage()));
73 this->checkConnection();
76 iov->setConnection(m_env, m_conn);
77 int iovID = iov->fetchID();
85 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 86 "d.ped_mean_g1,d.ped_rms_g1, d.ped_mean_g16, d.ped_rms_g16, d.task_status " 87 "FROM channelview cv JOIN mon_pn_ped_dat d " 88 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 89 "WHERE d.iov_id = :iov_id");
90 m_readStmt->setInt(1, iovID);
91 ResultSet* rset = m_readStmt->executeQuery();
93 std::pair<EcalLogicID, MonPNPedDat>
p;
95 while (rset->next()) {
111 }
catch (SQLException&
e) {
112 throw(std::runtime_error(
"MonPNPedDat::fetchData(): " +
e.getMessage()));
117 this->checkConnection();
118 this->checkPrepare();
120 int iovID = iov->fetchID();
122 throw(std::runtime_error(
"MonPNPedDat::writeArrayDB: IOV not in DB"));
125 int nrows =
data->size();
126 int* ids =
new int[nrows];
127 int* iovid_vec =
new int[nrows];
128 float*
xx =
new float[nrows];
129 float*
yy =
new float[nrows];
130 float*
zz =
new float[nrows];
131 float* ww =
new float[nrows];
132 int* st =
new int[nrows];
134 ub2* ids_len =
new ub2[nrows];
135 ub2* iov_len =
new ub2[nrows];
136 ub2* x_len =
new ub2[nrows];
137 ub2* y_len =
new ub2[nrows];
138 ub2* z_len =
new ub2[nrows];
139 ub2* w_len =
new ub2[nrows];
141 ub2* st_len =
new ub2[nrows];
146 typedef map<EcalLogicID, MonPNPedDat>::const_iterator CI;
147 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
148 channel = &(
p->first);
151 throw(std::runtime_error(
"MonPNPedDat::writeArrayDB: Bad EcalLogicID"));
153 ids[
count] = logicID;
154 iovid_vec[
count] = iovID;
156 dataitem = &(
p->second);
185 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
186 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
187 m_writeStmt->setDataBuffer(3, (dvoid*)
xx, OCCIFLOAT,
sizeof(
xx[0]), x_len);
188 m_writeStmt->setDataBuffer(4, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
189 m_writeStmt->setDataBuffer(5, (dvoid*)
zz, OCCIFLOAT,
sizeof(
zz[0]), z_len);
190 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT,
sizeof(ww[0]), w_len);
191 m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT,
sizeof(st[0]), st_len);
193 m_writeStmt->executeArrayUpdate(nrows);
213 }
catch (SQLException&
e) {
214 throw(std::runtime_error(
"MonPNPedDat::writeArrayDB(): " +
e.getMessage()));
void setPedRMSG16(float mean)
void writeDB(const EcalLogicID *ecid, const MonPNPedDat *item, MonRunIOV *iov) noexcept(false)
float getPedMeanG16() const
void fetchData(std::map< EcalLogicID, MonPNPedDat > *fillVec, MonRunIOV *iov) noexcept(false)
void setPedRMSG1(float mean)
void setPedMeanG1(float mean)
void prepareWrite() noexcept(false) override
void setPedMeanG16(float mean)
bool getTaskStatus() const
void writeArrayDB(const std::map< EcalLogicID, MonPNPedDat > *data, MonRunIOV *iov) noexcept(false)
float getPedRMSG1() const
float getPedMeanG1() const
float getPedRMSG16() const
char data[epos_bytes_allocation]
void setTaskStatus(bool status)