38 this->checkConnection();
41 m_writeStmt = m_conn->createStatement();
42 m_writeStmt->setSQL(
"INSERT INTO mon_pedestals_dat (iov_id, logic_id, " 43 "ped_mean_g1, ped_mean_g6, ped_mean_g12, " 44 "ped_rms_g1, ped_rms_g6, ped_rms_g12, task_status) " 45 "VALUES (:iov_id, :logic_id, " 46 ":ped_mean_g1, :ped_mean_g6, :ped_mean_g12, " 47 ":ped_rms_g1, :ped_rms_g6, :ped_rms_g12, :task_status)");
49 throw(std::runtime_error(
"MonPedestalsDat::prepareWrite(): "+e.getMessage()));
58 this->checkConnection();
61 int iovID = iov->fetchID();
62 if (!iovID) {
throw(std::runtime_error(
"MonPedestalsDat::writeDB: IOV not in DB")); }
64 int logicID = ecid->getLogicID();
65 if (!logicID) {
throw(std::runtime_error(
"MonPedestalsDat::writeDB: Bad EcalLogicID")); }
68 m_writeStmt->setInt(1, iovID);
69 m_writeStmt->setInt(2, logicID);
70 m_writeStmt->setFloat(3, item->getPedMeanG1());
71 m_writeStmt->setFloat(4, item->getPedMeanG6());
72 m_writeStmt->setFloat(5, item->getPedMeanG12());
73 m_writeStmt->setFloat(6, item->getPedRMSG1());
74 m_writeStmt->setFloat(7, item->getPedRMSG6());
75 m_writeStmt->setFloat(8, item->getPedRMSG12());
76 m_writeStmt->setInt(9, item->getTaskStatus());
78 m_writeStmt->executeUpdate();
80 throw(std::runtime_error(
"MonPedestalsDat::writeDB(): "+e.getMessage()));
89 this->checkConnection();
92 iov->setConnection(m_env, m_conn);
93 int iovID = iov->fetchID();
101 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 102 "d.ped_mean_g1, d.ped_mean_g6, d.ped_mean_g12, " 103 "d.ped_rms_g1, d.ped_rms_g6, d.ped_rms_g12, d.task_status " 104 "FROM channelview cv JOIN mon_pedestals_dat d " 105 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 106 "WHERE iov_id = :iov_id");
107 m_readStmt->setInt(1, iovID);
108 ResultSet* rset = m_readStmt->executeQuery();
110 std::pair< EcalLogicID, MonPedestalsDat >
p;
112 while(rset->next()) {
132 throw(std::runtime_error(
"MonPedestalsDat::fetchData: "+e.getMessage()));
139 this->checkConnection();
140 this->checkPrepare();
142 int iovID = iov->fetchID();
143 if (!iovID) {
throw(std::runtime_error(
"MonPedestalsDat::writeArrayDB: IOV not in DB")); }
146 int nrows=
data->size();
147 int* ids=
new int[nrows];
148 int* iovid_vec=
new int[nrows];
149 float*
xx=
new float[nrows];
150 float*
yy=
new float[nrows];
151 float*
zz=
new float[nrows];
152 float* ww=
new float[nrows];
153 float* uu=
new float[nrows];
154 float*
tt=
new float[nrows];
155 int* st=
new int[nrows];
157 ub2* ids_len=
new ub2[nrows];
158 ub2* iov_len=
new ub2[nrows];
159 ub2* x_len=
new ub2[nrows];
160 ub2* y_len=
new ub2[nrows];
161 ub2* z_len=
new ub2[nrows];
162 ub2* w_len=
new ub2[nrows];
163 ub2* u_len=
new ub2[nrows];
164 ub2* t_len=
new ub2[nrows];
165 ub2* st_len=
new ub2[nrows];
170 typedef map< EcalLogicID, MonPedestalsDat >::const_iterator CI;
171 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
172 channel = &(
p->first);
174 if (!logicID) {
throw(std::runtime_error(
"MonPedestalsDat::writeArrayDB: Bad EcalLogicID")); }
176 iovid_vec[
count]=iovID;
178 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*)st, OCCIINT ,
sizeof(st[0]), st_len );
226 m_writeStmt->executeArrayUpdate(nrows);
251 throw(std::runtime_error(
"MonPedestalsDat::writeArrayDB(): "+e.getMessage()));
void setPedMeanG1(float mean)
float getPedRMSG1() const
void setPedRMSG6(float rms)
oracle::occi::SQLException SQLException
void setTaskStatus(bool status)
float getPedMeanG12() const
float getPedRMSG12() const
void setPedMeanG6(float mean)
void prepareWrite() noexcept(false)
bool getTaskStatus() const
void setPedRMSG1(float rms)
void fetchData(std::map< EcalLogicID, MonPedestalsDat > *fillMap, MonRunIOV *iov) noexcept(false)
oracle::occi::ResultSet ResultSet
float getPedMeanG1() const
char data[epos_bytes_allocation]
float getPedMeanG6() const
void setPedMeanG12(float mean)
void writeDB(const EcalLogicID *ecid, const MonPedestalsDat *item, MonRunIOV *iov) noexcept(false)
void writeArrayDB(const std::map< EcalLogicID, MonPedestalsDat > *data, MonRunIOV *iov) noexcept(false)
float getPedRMSG6() const
void setPedRMSG12(float rms)