15 m_writeStmt =
nullptr;
39 this->checkConnection();
42 m_writeStmt = m_conn->createStatement();
43 m_writeStmt->setSQL(
"INSERT INTO fe_config_param_dat (lin_conf_id, logic_id, " 44 " etsat, ttthreshlow, ttthreshhigh, fg_lowthresh, fg_highthresh, fg_lowratio, fg_highratio ) " 45 "VALUES (:lin_conf_id, :logic_id, " 46 ":etsat, :ttthreshlow, :ttthreshhigh, :fg_lowthresh, :fg_highthresh, :fg_lowratio, :fg_highratio )" );
47 }
catch (SQLException &
e) {
48 throw(std::runtime_error(
std::string(
"FEConfigParamDat::prepareWrite(): ")+getOraMessage(&e)));
57 this->checkConnection();
60 int iconfID = iconf->fetchID();
61 if (!iconfID) {
throw(std::runtime_error(
"FEConfigParamDat::writeDB: ICONF not in DB")); }
63 int logicID = ecid->getLogicID();
64 if (!logicID) {
throw(std::runtime_error(
"FEConfigParamDat::writeDB: Bad EcalLogicID")); }
67 m_writeStmt->setInt(1, iconfID);
68 m_writeStmt->setInt(2, logicID);
69 m_writeStmt->setFloat(3, item->getETSat());
70 m_writeStmt->setFloat(4, item->getTTThreshlow());
71 m_writeStmt->setFloat(5, item->getTTThreshhigh());
72 m_writeStmt->setFloat(6, item->getFGlowthresh());
73 m_writeStmt->setFloat(7, item->getFGhighthresh());
74 m_writeStmt->setFloat(8, item->getFGlowratio());
75 m_writeStmt->setFloat(9, item->getFGhighratio());
77 m_writeStmt->executeUpdate();
78 }
catch (SQLException &
e) {
79 throw(std::runtime_error(
std::string(
"FEConfigParamDat::writeDB(): ")+getOraMessage(&e)));
88 this->checkConnection();
91 iconf->setConnection(m_env, m_conn);
92 int iconfID = iconf->fetchID();
100 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 101 " d.etsat, d.ttthreshlow, d.ttthreshhigh, d.fg_lowthresh, d.fg_highthresh, d.fg_lowratio, d.fg_highratio " 102 "FROM channelview cv JOIN fe_config_param_dat d " 103 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 104 "WHERE lin_conf_id = :lin_conf_id");
105 m_readStmt->setInt(1, iconfID);
106 ResultSet* rset = m_readStmt->executeQuery();
108 std::pair< EcalLogicID, FEConfigParamDat >
p;
110 while(rset->next()) {
116 getOraString(rset,6));
131 }
catch (SQLException &
e) {
132 throw(std::runtime_error(
std::string(
"FEConfigParamDat::fetchData: ")+getOraMessage(&e)));
139 this->checkConnection();
140 this->checkPrepare();
142 int iconfID = iconf->fetchID();
143 if (!iconfID) {
throw(std::runtime_error(
"FEConfigParamDat::writeArrayDB: ICONF not in DB")); }
146 int nrows=
data->size();
147 int*
ids=
new int[nrows];
148 int* iov_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 float* st=
new float[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, FEConfigParamDat >::const_iterator CI;
171 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
172 channel = &(
p->first);
174 if (!logicID) {
throw(std::runtime_error(
"FEConfigParamDat::writeArrayDB: Bad EcalLogicID")); }
176 iov_vec[
count]=iconfID;
178 dataitem = &(
p->second);
213 m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT,
sizeof(iov_vec[0]),iov_len);
214 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
215 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
216 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
217 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT ,
sizeof(zz[0]), z_len );
218 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT ,
sizeof(ww[0]), w_len );
219 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT ,
sizeof(uu[0]), u_len );
220 m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIFLOAT ,
sizeof(tt[0]), t_len );
221 m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIFLOAT ,
sizeof(st[0]), st_len );
224 m_writeStmt->executeArrayUpdate(nrows);
246 }
catch (SQLException &
e) {
247 throw(std::runtime_error(
std::string(
"FEConfigParamDat::writeArrayDB(): ")+getOraMessage(&e)));
float getTTThreshlow() const
void setTTThreshlow(float x)
void setFGlowratio(float x)
void writeDB(const EcalLogicID *ecid, const FEConfigParamDat *item, FEConfigLinInfo *iconf) noexcept(false)
void setFGlowthresh(float x)
void setFGhighthresh(float x)
void writeArrayDB(const std::map< EcalLogicID, FEConfigParamDat > *data, FEConfigLinInfo *iconf) noexcept(false)
float getFGhighthresh() const
float getFGlowratio() const
~FEConfigParamDat() override
float getFGlowthresh() const
float getTTThreshhigh() const
void fetchData(std::map< EcalLogicID, FEConfigParamDat > *fillMap, FEConfigLinInfo *iconf) noexcept(false)
char data[epos_bytes_allocation]
void setTTThreshhigh(float x)
float getFGhighratio() const
void prepareWrite() noexcept(false) override
void setFGhighratio(float x)