13 m_writeStmt =
nullptr;
16 m_processedEvents = 0;
17 m_problematicEvents = 0;
19 m_problemsGainZero = 0;
20 m_problemsGainSwitch = 0;
27 this->checkConnection();
30 m_writeStmt = m_conn->createStatement();
32 "INSERT INTO mon_crystal_consistency_dat (iov_id, logic_id, " 33 "processed_events, problematic_events, problems_id, problems_gain_zero, problems_gain_switch, task_status) " 34 "VALUES (:iov_id, :logic_id, " 35 ":3, :4, :5, :6, :7, :8)");
36 }
catch (SQLException&
e) {
37 throw(std::runtime_error(
"MonCrystalConsistencyDat::prepareWrite(): " +
e.getMessage()));
44 this->checkConnection();
47 int iovID = iov->fetchID();
49 throw(std::runtime_error(
"MonCrystalConsistencyDat::writeDB: IOV not in DB"));
52 int logicID = ecid->getLogicID();
54 throw(std::runtime_error(
"MonCrystalConsistencyDat::writeDB: Bad EcalLogicID"));
58 m_writeStmt->setInt(1, iovID);
59 m_writeStmt->setInt(2, logicID);
61 m_writeStmt->setInt(3,
item->getProcessedEvents());
62 m_writeStmt->setInt(4,
item->getProblematicEvents());
63 m_writeStmt->setInt(5,
item->getProblemsID());
64 m_writeStmt->setInt(6,
item->getProblemsGainZero());
65 m_writeStmt->setInt(7,
item->getProblemsGainSwitch());
66 m_writeStmt->setInt(8,
item->getTaskStatus());
67 m_writeStmt->executeUpdate();
68 }
catch (SQLException&
e) {
69 throw(std::runtime_error(
"MonCrystalConsistencyDat::writeDB(): " +
e.getMessage()));
75 this->checkConnection();
78 iov->setConnection(m_env, m_conn);
79 int iovID = iov->fetchID();
87 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 88 "d.processed_events, d.problematic_events, d.problems_id, d.problems_gain_zero, d.problems_gain_switch, " 90 "FROM channelview cv JOIN mon_crystal_consistency_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, MonCrystalConsistencyDat>
p;
98 while (rset->next()) {
117 }
catch (SQLException&
e) {
118 throw(std::runtime_error(
"MonCrystalConsistencyDat::fetchData(): " +
e.getMessage()));
124 this->checkConnection();
125 this->checkPrepare();
127 int iovID = iov->fetchID();
129 throw(std::runtime_error(
"MonCrystalConsistencyDat::writeArrayDB: IOV not in DB"));
132 int nrows =
data->size();
133 int* ids =
new int[nrows];
134 int* iovid_vec =
new int[nrows];
135 int*
xx =
new int[nrows];
136 int*
yy =
new int[nrows];
137 int*
zz =
new int[nrows];
138 int*
ww =
new int[nrows];
139 int* uu =
new int[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* st_len =
new ub2[nrows];
154 typedef map<EcalLogicID, MonCrystalConsistencyDat>::const_iterator CI;
155 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
156 channel = &(
p->first);
159 throw(std::runtime_error(
"MonCrystalConsistencyDat::writeArrayDB: Bad EcalLogicID"));
161 ids[
count] = logicID;
162 iovid_vec[
count] = iovID;
164 dataitem = &(
p->second);
194 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
195 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
196 m_writeStmt->setDataBuffer(3, (dvoid*)
xx, OCCIINT,
sizeof(
xx[0]), x_len);
197 m_writeStmt->setDataBuffer(4, (dvoid*)
yy, OCCIINT,
sizeof(
yy[0]), y_len);
198 m_writeStmt->setDataBuffer(5, (dvoid*)
zz, OCCIINT,
sizeof(
zz[0]), z_len);
199 m_writeStmt->setDataBuffer(6, (dvoid*)
ww, OCCIINT,
sizeof(
ww[0]), w_len);
200 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIINT,
sizeof(uu[0]), u_len);
201 m_writeStmt->setDataBuffer(8, (dvoid*)st, OCCIINT,
sizeof(st[0]), st_len);
203 m_writeStmt->executeArrayUpdate(nrows);
223 }
catch (SQLException&
e) {
224 throw(std::runtime_error(
"MonCrystalConsistencyDat::writeArrayDB(): " +
e.getMessage()));
bool getTaskStatus() const
void setProblematicEvents(int prob)
int getProblemsGainZero() const
void writeArrayDB(const std::map< EcalLogicID, MonCrystalConsistencyDat > *data, MonRunIOV *iov) noexcept(false)
void writeDB(const EcalLogicID *ecid, const MonCrystalConsistencyDat *item, MonRunIOV *iov) noexcept(false)
int getProcessedEvents() const
MonCrystalConsistencyDat()
int getProblemsID() const
int getProblemsGainSwitch() const
void prepareWrite() noexcept(false) override
void setTaskStatus(bool status)
void setProblemsGainSwitch(int prob)
void setProblemsID(int id)
int getProblematicEvents() const
char data[epos_bytes_allocation]
void setProcessedEvents(int proc)
void setProblemsGainZero(int prob)
void fetchData(std::map< EcalLogicID, MonCrystalConsistencyDat > *fillVec, MonRunIOV *iov) noexcept(false)
~MonCrystalConsistencyDat() override