15 m_writeStmt =
nullptr;
51 fetchLastData(fillMap);
57 string query =
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 58 " d.value_number , '5' NOMINAL_VALUE , d.VALUE_TIMESTAMP " 59 "FROM "+ getEBAccount()+
".FWWIENERMARATHONCHANNEL_LV d " 60 " JOIN "+ getEBAccount()+
".LV_MAPPING h on " 61 " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and dpe_name='MEASUREMENTSENSEVOLTAGE' ";
63 m_readStmt->setSQL(query);
64 rset = m_readStmt->executeQuery();
66 catch (SQLException
e) {
67 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 68 throw(std::runtime_error(
"RunDCSLVDat::getBarrelRset(): " + e.getMessage() +
" " +
query));
70 throw(std::runtime_error(
"RunDCSLVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) +
" " + query));
78 string query =
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 79 " d.VALUE_NUMBER, '5' NOMINAL_VALUE , d.VALUE_TIMESTAMP " 80 "FROM "+ getEEAccount()+
".FWWIENERMARATHONCHANNEL_LV d " 81 " JOIN "+ getEEAccount()+
".EE_LV_MAPPING h on " 82 " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and dpe_name='MEASUREMENTSENSEVOLTAGE' ";
84 m_readStmt->setSQL(query);
85 rset = m_readStmt->executeQuery();
87 catch (SQLException
e) {
88 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 89 throw(std::runtime_error(
"RunDCSLVDat::getEndcapRset(): " + e.getMessage() +
" " +
query));
91 throw(std::runtime_error(
"RunDCSLVDat::getEndcapRset(): error code " + std::to_string(e.getErrorCode()) +
" " + query));
98 map< EcalLogicID, RunDCSLVDat >* fillMap) {
99 std::pair< EcalLogicID, RunDCSLVDat >
p;
104 while(rset->next()) {
112 dat.
setLV( rset->getFloat(7) );
114 Date sinceDate = rset->getDate(9);
117 if (p.first.getName() ==
"EB_LV_channel") {
118 setStatusForBarrel(dat, sinceTm);
120 setStatusForEndcaps(dat, sinceTm);
126 catch (SQLException &
e) {
127 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 128 throw(std::runtime_error(
"RunDCSLVDat::fetchData(): "+e.getMessage()));
130 throw(std::runtime_error(
"RunDCSLVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
139 int t_now_gmt_micros = t_now_gmt.
microsTime();
140 return t_now_gmt_micros;
145 int t_now_gmt_micros = nowMicroseconds();
150 if (dat.
getLV()*1000 < minLV) {
156 if (d> maxDifference) {
165 int t_now_gmt_micros = nowMicroseconds();
170 if (dat.
getLV()*1000 < minLV) {
176 if (d> maxDifference) {
187 this->checkConnection();
192 std::pair< EcalLogicID, RunDCSLVDat >
p;
197 fillTheMap(rset, fillMap);
198 rset = getEndcapRset();
200 fillTheMap(rset, fillMap);
202 catch (SQLException &
e) {
203 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 204 throw(std::runtime_error(
"RunDCSLVDat::fetchData(): "+e.getMessage()));
206 throw(std::runtime_error(
"RunDCSLVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
void fetchData(std::map< EcalLogicID, RunDCSLVDat > *fillMap, RunIOV *iov) noexcept(false)
void setToCurrentGMTime()
def query(query_str, verbose=False)
uint64_t microsTime() const
float getLVNominal() const
oracle::occi::ResultSet ResultSet
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSLVDat > *)
void setStatusForEndcaps(RunDCSLVDat &, const Tm &)
void writeDB(const EcalLogicID *ecid, const RunDCSLVDat *item, RunIOV *iov) noexcept(false)
ResultSet * getBarrelRset()
ResultSet * getEndcapRset()
void prepareWrite() noexcept(false) override
void fetchLastData(std::map< EcalLogicID, RunDCSLVDat > *fillMap) noexcept(false)
void setLVNominal(float t)
Tm dateToTm(oracle::occi::Date &date) const
void setTimeStatus(int t)
void setStatusForBarrel(RunDCSLVDat &, const Tm &)