56 fetchLastData(fillMap);
67 string query=
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 68 " d.actual_vmon, h.nominal_value , d.change_date " 69 " FROM "+ getEBAccount()+
".FWCAENCHANNEL d " 70 " JOIN "+ getEBAccount()+
".HV_MAPPING h on h.DPID = d.DPID " 71 " join "+ getEBAccount()+
".CHANNELVIEW cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name " 72 " AND d.change_date> :1 AND d.actual_vmon is not null order by change_date " ;
74 m_readStmt->setSQL(query);
76 m_readStmt->setDate(1, dh.
tmToDate(timeStart));
78 rset = m_readStmt->executeQuery();
80 catch (SQLException
e) {
81 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 82 throw(std::runtime_error(
"RunDCSHVDat::getBarrelRset(): " + e.getMessage() +
" " +
query));
84 throw(std::runtime_error(
"RunDCSHVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) +
" " + query));
95 string query=
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 96 " d.actual_vmon, '800' nominal_value , d.change_date " 97 " FROM "+ getEEAccount()+
".FWCAENCHANNEL d " 98 " JOIN "+ getEEAccount()+
".EE_HVA_MAPPING h on h.DPID = d.DPID " 99 " join "+ getEEAccount()+
".CHANNELVIEW cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name " 100 " AND d.change_date> :1 AND d.actual_vmon is not null order by change_date " ;
102 m_readStmt->setSQL(query);
104 m_readStmt->setDate(1, dh.
tmToDate(timeStart));
106 rset = m_readStmt->executeQuery();
108 catch (SQLException
e) {
109 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 110 throw(std::runtime_error(
"RunDCSHVDat::getBarrelRset(): " + e.getMessage() +
" " +
query));
112 throw(std::runtime_error(
"RunDCSHVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) +
" " + query));
123 string query=
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 124 " d.actual_vmon, '600' nominal_value , d.change_date " 125 " FROM "+ getEEAccount()+
".FWCAENCHANNEL d " 126 " JOIN "+ getEEAccount()+
".EE_HVD_MAPPING h on h.DPID = d.DPID " 127 " join "+ getEEAccount()+
".CHANNELVIEW cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name " 128 " AND d.change_date> :1 AND d.actual_vmon is not null order by change_date " ;
130 m_readStmt->setSQL(query);
132 m_readStmt->setDate(1, dh.
tmToDate(timeStart));
134 rset = m_readStmt->executeQuery();
136 catch (SQLException
e) {
137 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 138 throw(std::runtime_error(
"RunDCSHVDat::getBarrelRset(): " + e.getMessage() +
" " +
query));
140 throw(std::runtime_error(
"RunDCSHVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) +
" " + query));
168 string query =
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 169 " d.VALUE_NUMBER, h.nominal_value , d.CHANGE_DATE " 170 "FROM "+ getEBAccount()+
".FWCAENCHANNEL_LV d " 171 " JOIN "+ getEBAccount()+
".HV_MAPPING h on " 172 " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and DPE_NAME='ACTUAL_VMON' ";
174 m_readStmt->setSQL(query);
175 rset = m_readStmt->executeQuery();
177 catch (SQLException
e) {
178 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 179 throw(std::runtime_error(
"RunDCSHVDat::getBarrelRset(): " + e.getMessage() +
" " +
query));
181 throw(std::runtime_error(
"RunDCSHVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) +
" " + query));
189 string query =
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 190 " d.value_number, '800' NOMINAL_VALUE , d.CHANGE_DATE " 191 "FROM "+ getEEAccount()+
".FWCAENCHANNEL_LV d " 192 " JOIN "+ getEEAccount()+
".EE_HVA_MAPPING h on " 193 " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and dpe_name='ACTUAL_VMON' ";
195 m_readStmt->setSQL(query);
196 rset = m_readStmt->executeQuery();
198 catch (SQLException
e) {
199 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 200 throw(std::runtime_error(
"RunDCSHVDat::getEndcapAnodeRset(): " + e.getMessage() +
" " +
query));
202 throw(std::runtime_error(
"RunDCSHVDat::getEndcapAnodeRset(): error code " + std::to_string(e.getErrorCode()) +
" " + query));
210 string query =
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 211 " d.value_number, '600' NOMINAL_VALUE , d.CHANGE_DATE " 212 "FROM "+ getEEAccount()+
".FWCAENCHANNEL_LV d " 213 " JOIN "+ getEEAccount()+
".EE_HVD_MAPPING h on " 214 " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and dpe_name='ACTUAL_VMON' ";
216 m_readStmt->setSQL(query);
217 rset = m_readStmt->executeQuery();
219 catch (SQLException
e) {
220 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 221 throw(std::runtime_error(
"RunDCSHVDat::getEndcapDynodeRset(): " + e.getMessage() +
" " +
query));
223 throw(std::runtime_error(
"RunDCSHVDat::getEndcapDynodeRset(): error code " + std::to_string(e.getErrorCode()) +
" " + query));
230 map< EcalLogicID, RunDCSHVDat >* fillMap) {
234 std::pair< EcalLogicID, RunDCSHVDat >
p;
239 while(rset->next()) {
247 dat.
setHV( rset->getFloat(7) );
249 Date sinceDate = rset->getDate(9);
252 if (p.first.getName() ==
"EB_HV_channel") {
253 setStatusForBarrel(dat, sinceTm);
255 setStatusForEndcaps(dat, sinceTm);
261 catch (SQLException &
e) {
262 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 263 throw(std::runtime_error(
"RunDCSHVDat::fetchData(): "+e.getMessage()));
265 throw(std::runtime_error(
"RunDCSHVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
286 while(rset->next()) {
295 dat.
setHV( rset->getFloat(7) );
300 Timestamp ora_timestamp = rset->getTimestamp(9);
302 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 303 sinceTm.
setToString(ora_timestamp.toText(
"yyyy-mm-dd hh24:mi:ss",0));
306 unsigned int month = 0;
307 unsigned int day = 0;
308 unsigned int hour = 0;
309 unsigned int minute = 0;
312 ora_timestamp.getDate(year, month, day);
313 ora_timestamp.getTime(hour, minute, second, fs);
315 .tm_sec =
static_cast<int>(
second),
316 .tm_min = static_cast<int>(minute),
317 .tm_hour =
static_cast<int>(hour),
318 .tm_mday = static_cast<int>(day),
319 .tm_mon =
static_cast<int>(month),
320 .tm_year = year - 1900
322 char tt_str[30] = { 0 };
323 if (std::strftime(tt_str,
sizeof(tt_str),
"%F %T", &
tt)) {
326 throw std::runtime_error(
"RunDCSHVDat::fillTheMapByTime: failed to generate the date string");
331 if (ec.
getName() ==
"EB_HV_channel") {
332 setStatusForBarrel(dat, sinceTm);
334 setStatusForEndcaps(dat, sinceTm);
337 std::pair< EcalLogicID, RunDCSHVDat >
d;
340 std::pair< Tm, std::pair< EcalLogicID, RunDCSHVDat > >
p;
347 my_data_list->push_back(pp);
349 if(count<100)
std::cout<<
"DCS DB : size:"<< my_data_list->size()<<
" Tm " <<sinceTm.
str()<<
" "<<ec.
getID1()<<
" "<<ec.
getID2()<<
" "<<dat.
getHV()<<std::endl;
351 std::cout<<
"DCS DB : size:"<< my_data_list->size()<<std::endl;
355 catch (SQLException &
e) {
356 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 357 throw(std::runtime_error(
"RunDCSHVDat::fetchData(): "+e.getMessage()));
359 throw(std::runtime_error(
"RunDCSHVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
368 int t_now_gmt_micros = t_now_gmt.
microsTime();
369 return t_now_gmt_micros;
375 int t_now_gmt_micros = nowMicroseconds();
378 if(hv_diff<0) hv_diff=-hv_diff;
379 if (hv_diff*1000 > maxHVDifferenceEB) {
382 if (dat.
getHV()*1000 < minHV) {
387 long long d= (t_now_gmt_micros - sinceTm.
microsTime()) ;
388 if (d> maxDifference) {
397 int t_now_gmt_micros = nowMicroseconds();
402 if (dat.
getHV()*1000 < minHV) {
407 long long d= (t_now_gmt_micros - sinceTm.
microsTime()) ;
408 if (d> maxDifference) {
417 this->checkConnection();
422 std::pair< EcalLogicID, RunDCSHVDat >
p;
427 fillTheMap(rset, fillMap);
428 rset = getEndcapAnodeRset();
430 fillTheMap(rset, fillMap);
431 rset = getEndcapDynodeRset();
433 fillTheMap(rset, fillMap);
435 catch (SQLException &
e) {
436 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 437 throw(std::runtime_error(
"RunDCSHVDat::fetchData(): "+e.getMessage()));
439 throw(std::runtime_error(
"RunDCSHVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
447 this->checkConnection();
451 std::list< DataReducer<RunDCSHVDat>::MyData<
RunDCSHVDat> > my_data_list;
456 std::pair< EcalLogicID, RunDCSHVDat >
p;
459 ResultSet* rset1 = getBarrelRset(timeStart);
460 fillTheMapByTime(rset1, &my_data_list);
462 ResultSet* rset2 = getEndcapAnodeRset(timeStart);
463 fillTheMapByTime(rset2, &my_data_list);
465 ResultSet* rset3 = getEndcapDynodeRset(timeStart);
466 fillTheMapByTime(rset3, &my_data_list);
475 catch (SQLException &
e) {
476 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 477 throw(std::runtime_error(
"RunDCSHVDat::fetchData(): "+e.getMessage()));
479 throw(std::runtime_error(
"RunDCSHVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
void setDataList(std::list< MyData< T > > _list)
oracle::occi::ResultSet ResultSet
float getHVNominal() const
void setStatusForEndcaps(RunDCSHVDat &, const Tm &)
ResultSet * getEndcapDynodeRset()
void writeDB(const EcalLogicID *ecid, const RunDCSHVDat *item, RunIOV *iov) noexcept(false)
ResultSet * getEndcapAnodeRset()
ResultSet * getBarrelRset()
void fetchHistoricalData(std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > > *fillMap, const Tm &timeStart) noexcept(false)
void setToCurrentGMTime()
void fetchData(std::map< EcalLogicID, RunDCSHVDat > *fillMap, RunIOV *iov) noexcept(false)
def query(query_str, verbose=False)
void setStatusForBarrel(RunDCSHVDat &, const Tm &)
uint64_t microsTime() const
U second(std::pair< T, U > const &p)
std::string getName() const
oracle::occi::Date tmToDate(const Tm &inTm) const
void getReducedDataList(std::list< std::pair< Tm, DataMap > > *my_new_list)
void fetchLastData(std::map< EcalLogicID, RunDCSHVDat > *fillMap) noexcept(false)
void setTimeStatus(int t)
void prepareWrite() noexcept(false)
void setToString(const std::string s) noexcept(false)
void setHVNominal(float t)
void fillTheMapByTime(ResultSet *rset, std::list< DataReducer< RunDCSHVDat >::MyData< RunDCSHVDat > > *my_data_list)
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSHVDat > *)
Tm dateToTm(oracle::occi::Date &date) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run