9 using namespace oracle::occi;
14 m_writeStmt =
nullptr;
30 fetchLastData(fillMap);
36 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
37 " d.value_number , '5' NOMINAL_VALUE , d.VALUE_TIMESTAMP "
40 ".FWWIENERMARATHONCHANNEL_LV d "
44 " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and "
45 "dpe_name='MEASUREMENTSENSEVOLTAGE' ";
47 m_readStmt->setSQL(query);
48 rset = m_readStmt->executeQuery();
49 }
catch (SQLException&
e) {
50 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
51 throw(std::runtime_error(
std::string(
"RunDCSLVDat::getBarrelRset(): ") + e.getMessage() +
" " +
query));
53 throw(std::runtime_error(
std::string(
"RunDCSLVDat::getBarrelRset(): error code ") +
54 std::to_string(e.getErrorCode()) +
" " + query));
63 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
64 " d.VALUE_NUMBER, '5' NOMINAL_VALUE , d.VALUE_TIMESTAMP "
67 ".FWWIENERMARATHONCHANNEL_LV d "
70 ".EE_LV_MAPPING h on "
71 " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and "
72 "dpe_name='MEASUREMENTSENSEVOLTAGE' ";
74 m_readStmt->setSQL(query);
75 rset = m_readStmt->executeQuery();
76 }
catch (SQLException&
e) {
77 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
78 throw(std::runtime_error(
std::string(
"RunDCSLVDat::getEndcapRset(): ") + e.getMessage() +
" " +
query));
80 throw(std::runtime_error(
std::string(
"RunDCSLVDat::getEndcapRset(): error code ") +
81 std::to_string(e.getErrorCode()) +
" " + query));
88 std::pair<EcalLogicID, RunDCSLVDat>
p;
93 while (rset->next()) {
101 dat.
setLV(rset->getFloat(7));
103 Date sinceDate = rset->getDate(9);
106 if (p.first.getName() ==
"EB_LV_channel") {
107 setStatusForBarrel(dat, sinceTm);
109 setStatusForEndcaps(dat, sinceTm);
114 }
catch (SQLException&
e) {
115 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
116 throw(std::runtime_error(
std::string(
"RunDCSLVDat::fetchData(): ") + e.getMessage()));
118 throw(std::runtime_error(
std::string(
"RunDCSLVDat::fetchData(): error code ") + std::to_string(e.getErrorCode())));
127 int t_now_gmt_micros = t_now_gmt.
microsTime();
128 return t_now_gmt_micros;
132 int t_now_gmt_micros = nowMicroseconds();
137 if (dat.
getLV() * 1000 < minLV) {
142 int d = ((int)t_now_gmt_micros - (
int)sinceTm.
microsTime());
143 if (d > maxDifference) {
144 result = -d / 1000000;
150 int t_now_gmt_micros = nowMicroseconds();
155 if (dat.
getLV() * 1000 < minLV) {
160 int d = ((int)t_now_gmt_micros - (
int)sinceTm.
microsTime());
161 if (d > maxDifference) {
162 result = -d / 1000000;
168 this->checkConnection();
173 std::pair<EcalLogicID, RunDCSLVDat>
p;
178 fillTheMap(rset, fillMap);
179 rset = getEndcapRset();
181 fillTheMap(rset, fillMap);
182 }
catch (SQLException&
e) {
183 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
184 throw(std::runtime_error(
std::string(
"RunDCSLVDat::fetchData(): ") + e.getMessage()));
186 throw(std::runtime_error(
std::string(
"RunDCSLVDat::fetchData(): error code ") + std::to_string(e.getErrorCode())));
void fetchData(std::map< EcalLogicID, RunDCSLVDat > *fillMap, RunIOV *iov) noexcept(false)
void setToCurrentGMTime()
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)
static std::vector< std::string > checklist dat
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 &)