CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends
RunDCSHVDat Class Reference

#include <RunDCSHVDat.h>

Inheritance diagram for RunDCSHVDat:
IDataItem IDBObject

Public Types

typedef oracle::occi::ResultSet ResultSet
 

Public Member Functions

std::string getEBAccount ()
 
std::string getEEAccount ()
 
float getHV () const
 
float getHVNominal () const
 
int getStatus () const
 
std::string getTable () override
 
int getTimeStatus ()
 
 RunDCSHVDat ()
 
void setHV (float t)
 
void setHVNominal (float t)
 
void setStatus (int t)
 
void setTimeStatus (int t)
 
 ~RunDCSHVDat () override
 
- Public Member Functions inherited from IDataItem
 IDataItem ()
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Static Public Attributes

static const int HVNOTNOMINAL = 1
 
static const int HVOFF = 2
 
static const int maxDifference = 30 * 60 * 1000000
 
static const int maxHVDifferenceEB = 300
 
static const int maxHVDifferenceEE = 5000
 
static const int minHV = 10000
 
- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS = 1024
 

Private Member Functions

void fetchData (std::map< EcalLogicID, RunDCSHVDat > *fillMap, RunIOV *iov) noexcept(false)
 
void fetchHistoricalData (std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > > *fillMap, const Tm &timeStart) noexcept(false)
 
void fetchLastData (std::map< EcalLogicID, RunDCSHVDat > *fillMap) noexcept(false)
 
void fillTheMap (ResultSet *, std::map< EcalLogicID, RunDCSHVDat > *)
 
void fillTheMapByTime (ResultSet *rset, std::list< DataReducer< RunDCSHVDat >::MyData< RunDCSHVDat > > *my_data_list)
 
ResultSetgetBarrelRset ()
 
ResultSetgetBarrelRset (const Tm &timeStart)
 
ResultSetgetEndcapAnodeRset ()
 
ResultSetgetEndcapAnodeRset (const Tm &timestart)
 
ResultSetgetEndcapDynodeRset ()
 
ResultSetgetEndcapDynodeRset (const Tm &timestart)
 
int nowMicroseconds ()
 
void prepareWrite () noexcept(false) override
 
void setStatusForBarrel (RunDCSHVDat &, const Tm &)
 
void setStatusForEndcaps (RunDCSHVDat &, const Tm &)
 
void writeDB (const EcalLogicID *ecid, const RunDCSHVDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

float m_hv
 
float m_hvnom
 
int m_status
 
int m_tstatus
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Protected Member Functions inherited from IDataItem
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- Protected Attributes inherited from IDataItem
oracle::occi::Statement * m_readStmt
 
oracle::occi::Statement * m_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 15 of file RunDCSHVDat.h.

Member Typedef Documentation

typedef oracle::occi::ResultSet RunDCSHVDat::ResultSet

Definition at line 17 of file RunDCSHVDat.h.

Constructor & Destructor Documentation

RunDCSHVDat::RunDCSHVDat ( )

Definition at line 16 of file RunDCSHVDat.cc.

16  {
17  m_env = nullptr;
18  m_conn = nullptr;
19  m_writeStmt = nullptr;
20  m_readStmt = nullptr;
21 
22  m_hv = 0;
23  m_hvnom = 0;
24  m_status = 0;
25  m_tstatus = 0;
26 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
float m_hv
Definition: RunDCSHVDat.h:72
float m_hvnom
Definition: RunDCSHVDat.h:73
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
RunDCSHVDat::~RunDCSHVDat ( )
override

Definition at line 28 of file RunDCSHVDat.cc.

28 {}

Member Function Documentation

void RunDCSHVDat::fetchData ( std::map< EcalLogicID, RunDCSHVDat > *  fillMap,
RunIOV iov 
)
privatenoexcept

Definition at line 34 of file RunDCSHVDat.cc.

34  {
35  fetchLastData(fillMap);
36 }
void fetchLastData(std::map< EcalLogicID, RunDCSHVDat > *fillMap) noexcept(false)
Definition: RunDCSHVDat.cc:416
void RunDCSHVDat::fetchHistoricalData ( std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > > *  fillMap,
const Tm timeStart 
)
privatenoexcept

Definition at line 443 of file RunDCSHVDat.cc.

References dat, alignCSCRings::e, DataReducer< T >::getReducedDataList(), AlCaHLTBitMon_ParallelJobs::p, DataReducer< T >::setDataList(), and AlCaHLTBitMon_QueryRunRegistry::string.

444  {
445  this->checkConnection();
446 
447  fillMap->clear();
448 
449  std::list<DataReducer<RunDCSHVDat>::MyData<RunDCSHVDat> > my_data_list;
450 
451  try {
452  std::pair<EcalLogicID, RunDCSHVDat> p;
454 
455  ResultSet* rset1 = getBarrelRset(timeStart);
456  fillTheMapByTime(rset1, &my_data_list);
457 
458  ResultSet* rset2 = getEndcapAnodeRset(timeStart);
459  fillTheMapByTime(rset2, &my_data_list);
460 
461  ResultSet* rset3 = getEndcapDynodeRset(timeStart);
462  fillTheMapByTime(rset3, &my_data_list);
463 
465  my_dr.setDataList(my_data_list);
466  my_dr.getReducedDataList(fillMap);
467 
468  } catch (SQLException& e) {
469 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
470  throw(std::runtime_error(std::string("RunDCSHVDat::fetchData(): ") + e.getMessage()));
471 #else
472  throw(std::runtime_error(std::string("RunDCSHVDat::fetchData(): error code ") + std::to_string(e.getErrorCode())));
473 #endif
474  }
475 }
void setDataList(std::list< MyData< T > > _list)
Definition: DataReducer.h:49
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
ResultSet * getEndcapDynodeRset()
Definition: RunDCSHVDat.cc:213
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
ResultSet * getEndcapAnodeRset()
Definition: RunDCSHVDat.cc:186
ResultSet * getBarrelRset()
Definition: RunDCSHVDat.cc:159
void getReducedDataList(std::list< std::pair< Tm, DataMap > > *my_new_list)
Definition: DataReducer.h:54
static std::vector< std::string > checklist dat
void fillTheMapByTime(ResultSet *rset, std::list< DataReducer< RunDCSHVDat >::MyData< RunDCSHVDat > > *my_data_list)
Definition: RunDCSHVDat.cc:278
void RunDCSHVDat::fetchLastData ( std::map< EcalLogicID, RunDCSHVDat > *  fillMap)
privatenoexcept

Definition at line 416 of file RunDCSHVDat.cc.

References dat, alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

416  {
417  this->checkConnection();
418 
419  fillMap->clear();
420 
421  try {
422  std::pair<EcalLogicID, RunDCSHVDat> p;
424 
425  ResultSet* rset = getBarrelRset();
426 
427  fillTheMap(rset, fillMap);
428  rset = getEndcapAnodeRset();
429 
430  fillTheMap(rset, fillMap);
431  rset = getEndcapDynodeRset();
432 
433  fillTheMap(rset, fillMap);
434  } catch (SQLException& e) {
435 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
436  throw(std::runtime_error(std::string("RunDCSHVDat::fetchData(): ") + e.getMessage()));
437 #else
438  throw(std::runtime_error(std::string("RunDCSHVDat::fetchData(): error code ") + std::to_string(e.getErrorCode())));
439 #endif
440  }
441 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
ResultSet * getEndcapDynodeRset()
Definition: RunDCSHVDat.cc:213
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
ResultSet * getEndcapAnodeRset()
Definition: RunDCSHVDat.cc:186
ResultSet * getBarrelRset()
Definition: RunDCSHVDat.cc:159
static std::vector< std::string > checklist dat
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSHVDat > *)
Definition: RunDCSHVDat.cc:240
void RunDCSHVDat::fillTheMap ( ResultSet rset,
std::map< EcalLogicID, RunDCSHVDat > *  fillMap 
)
private

Definition at line 240 of file RunDCSHVDat.cc.

References dat, DateHandler::dateToTm(), cuy::dh, alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, setHV(), setHVNominal(), setStatus(), and AlCaHLTBitMon_QueryRunRegistry::string.

240  {
241  // method for last value queries
242 
243  std::pair<EcalLogicID, RunDCSHVDat> p;
246 
247  try {
248  while (rset->next()) {
249  p.first = EcalLogicID(rset->getString(1), // name
250  rset->getInt(2), // logic_id
251  rset->getInt(3), // id1
252  rset->getInt(4), // id2
253  rset->getInt(5), // id3
254  rset->getString(6)); // maps_to
255 
256  dat.setHV(rset->getFloat(7));
257  dat.setHVNominal(rset->getFloat(8));
258  Date sinceDate = rset->getDate(9);
259  Tm sinceTm = dh.dateToTm(sinceDate);
260  dat.setStatus(0);
261  if (p.first.getName() == "EB_HV_channel") {
262  setStatusForBarrel(dat, sinceTm);
263  } else {
264  setStatusForEndcaps(dat, sinceTm);
265  }
266  p.second = dat;
267  fillMap->insert(p);
268  }
269  } catch (SQLException& e) {
270 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
271  throw(std::runtime_error(std::string("RunDCSHVDat::fetchData(): ") + e.getMessage()));
272 #else
273  throw(std::runtime_error(std::string("RunDCSHVDat::fetchData(): error code ") + std::to_string(e.getErrorCode())));
274 #endif
275  }
276 }
void setStatusForEndcaps(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:398
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void setStatusForBarrel(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:377
void setStatus(int t)
Definition: RunDCSHVDat.h:36
void setHVNominal(float t)
Definition: RunDCSHVDat.h:37
static std::vector< std::string > checklist dat
void setHV(float t)
Definition: RunDCSHVDat.h:35
Definition: Tm.h:13
tuple dh
Definition: cuy.py:354
void RunDCSHVDat::fillTheMapByTime ( ResultSet rset,
std::list< DataReducer< RunDCSHVDat >::MyData< RunDCSHVDat > > *  my_data_list 
)
privatenoexcept

Definition at line 278 of file RunDCSHVDat.cc.

References submitPVResolutionJobs::count, gather_cfg::cout, ztail::d, dat, util.getRunInfo::day(), cuy::dh, alignCSCRings::e, getHV(), EcalLogicID::getID1(), EcalLogicID::getID2(), EcalLogicID::getName(), AlCaHLTBitMon_ParallelJobs::p, createTree::pp, edm::second(), setHV(), setHVNominal(), setStatus(), Tm::setToString(), Tm::str(), AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::tt.

279  {
280  // std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > >* fillMap) {
281 
282  // method for historic queries
283 
286 
287  try {
288  int count = -1;
289  while (rset->next()) {
290  EcalLogicID ec = EcalLogicID(rset->getString(1), // name
291  rset->getInt(2), // logic_id
292  rset->getInt(3), // id1
293  rset->getInt(4), // id2
294  rset->getInt(5), // id3
295  rset->getString(6)); // maps_to
296 
297  dat.setHV(rset->getFloat(7));
298  dat.setHVNominal(rset->getFloat(8));
299  // Date sinceDate = rset->getDate(9);
300  // Tm sinceTm = dh.dateToTm( sinceDate );
301  // Date sinceDate = rset->getDate(9);
302  Timestamp ora_timestamp = rset->getTimestamp(9);
303  Tm sinceTm; // YYYY-MM-DD HH:MM:SS
304 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
305  sinceTm.setToString(ora_timestamp.toText("yyyy-mm-dd hh24:mi:ss", 0));
306 #else
307  int year = 0;
308  unsigned int month = 0;
309  unsigned int day = 0;
310  unsigned int hour = 0;
311  unsigned int minute = 0;
312  unsigned int second = 0;
313  unsigned int fs = 0;
314  ora_timestamp.getDate(year, month, day);
315  ora_timestamp.getTime(hour, minute, second, fs);
316  const std::tm tt = {.tm_sec = static_cast<int>(second),
317  .tm_min = static_cast<int>(minute),
318  .tm_hour = static_cast<int>(hour),
319  .tm_mday = static_cast<int>(day),
320  .tm_mon = static_cast<int>(month),
321  .tm_year = year - 1900,
322  .tm_wday = 0,
323  .tm_yday = 0,
324  .tm_isdst = 0,
325  .tm_gmtoff = 0,
326  .tm_zone = nullptr};
327  char tt_str[30] = {0};
328  if (std::strftime(tt_str, sizeof(tt_str), "%F %T", &tt)) {
329  sinceTm.setToString(std::string(tt_str));
330  } else {
331  throw std::runtime_error("RunDCSHVDat::fillTheMapByTime: failed to generate the date string");
332  }
333 #endif
334 
335  dat.setStatus(0);
336  if (ec.getName() == "EB_HV_channel") {
337  setStatusForBarrel(dat, sinceTm);
338  } else {
339  setStatusForEndcaps(dat, sinceTm);
340  }
341 
342  std::pair<EcalLogicID, RunDCSHVDat> d;
343  d.first = ec;
344  d.second = dat;
345  std::pair<Tm, std::pair<EcalLogicID, RunDCSHVDat> > p;
346  p.first = sinceTm;
347  p.second = d;
348 
350  pp.m_iData = p;
351 
352  my_data_list->push_back(pp);
353  count++;
354  if (count < 100)
355  std::cout << "DCS DB : size:" << my_data_list->size() << " Tm " << sinceTm.str() << " " << ec.getID1() << " "
356  << ec.getID2() << " " << dat.getHV() << std::endl;
357  }
358  std::cout << "DCS DB : size:" << my_data_list->size() << std::endl;
359 
360  } catch (SQLException& e) {
361 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
362  throw(std::runtime_error(std::string("RunDCSHVDat::fetchData(): ") + e.getMessage()));
363 #else
364  throw(std::runtime_error(std::string("RunDCSHVDat::fetchData(): error code ") + std::to_string(e.getErrorCode())));
365 #endif
366  }
367 }
void setStatusForEndcaps(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:398
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
tuple pp
Definition: createTree.py:17
void setStatusForBarrel(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:377
int getID2() const
Definition: EcalLogicID.cc:32
U second(std::pair< T, U > const &p)
tuple d
Definition: ztail.py:151
std::string getName() const
Definition: EcalLogicID.cc:26
int getID1() const
Definition: EcalLogicID.cc:30
void setToString(const std::string s) noexcept(false)
Definition: Tm.cc:150
void setStatus(int t)
Definition: RunDCSHVDat.h:36
void setHVNominal(float t)
Definition: RunDCSHVDat.h:37
static std::vector< std::string > checklist dat
std::string str() const
Definition: Tm.cc:66
tuple cout
Definition: gather_cfg.py:144
void setHV(float t)
Definition: RunDCSHVDat.h:35
Definition: Tm.h:13
float getHV() const
Definition: RunDCSHVDat.h:38
tuple dh
Definition: cuy.py:354
ResultSet * RunDCSHVDat::getBarrelRset ( )
private

Definition at line 159 of file RunDCSHVDat.cc.

References alignCSCRings::e, contentValuesFiles::query, and AlCaHLTBitMon_QueryRunRegistry::string.

159  {
160  ResultSet* rset = nullptr;
161  string query =
162  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
163  " d.VALUE_NUMBER, h.nominal_value , d.CHANGE_DATE "
164  "FROM " +
165  getEBAccount() +
166  ".FWCAENCHANNEL_LV d "
167  " JOIN " +
168  getEBAccount() +
169  ".HV_MAPPING h on "
170  " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and "
171  "DPE_NAME='ACTUAL_VMON' ";
172  try {
173  m_readStmt->setSQL(query);
174  rset = m_readStmt->executeQuery();
175  } catch (SQLException& e) {
176 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
177  throw(std::runtime_error(std::string("RunDCSHVDat::getBarrelRset(): ") + e.getMessage() + " " + query));
178 #else
179  throw(std::runtime_error(std::string("RunDCSHVDat::getBarrelRset(): error code ") +
180  std::to_string(e.getErrorCode()) + " " + query));
181 #endif
182  }
183  return rset;
184 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
std::string getEBAccount()
Definition: RunDCSHVDat.h:33
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
ResultSet * RunDCSHVDat::getBarrelRset ( const Tm timeStart)
private

Definition at line 38 of file RunDCSHVDat.cc.

References cuy::dh, alignCSCRings::e, contentValuesFiles::query, AlCaHLTBitMon_QueryRunRegistry::string, and DateHandler::tmToDate().

38  {
40 
41  ResultSet* rset = nullptr;
42  string query =
43  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
44  " d.actual_vmon, h.nominal_value , d.change_date "
45  " FROM " +
46  getEBAccount() +
47  ".FWCAENCHANNEL d "
48  " JOIN " +
49  getEBAccount() +
50  ".HV_MAPPING h on h.DPID = d.DPID "
51  " join " +
52  getEBAccount() +
53  ".CHANNELVIEW cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name "
54  " AND d.change_date> :1 AND d.actual_vmon is not null order by change_date ";
55  try {
56  m_readStmt->setSQL(query);
57 
58  m_readStmt->setDate(1, dh.tmToDate(timeStart));
59 
60  rset = m_readStmt->executeQuery();
61  } catch (SQLException& e) {
62 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
63  throw(std::runtime_error(std::string("RunDCSHVDat::getBarrelRset(): ") + e.getMessage() + " " + query));
64 #else
65  throw(std::runtime_error(std::string("RunDCSHVDat::getBarrelRset(): error code ") +
66  std::to_string(e.getErrorCode()) + " " + query));
67 #endif
68  }
69  return rset;
70 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
std::string getEBAccount()
Definition: RunDCSHVDat.h:33
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
tuple dh
Definition: cuy.py:354
std::string RunDCSHVDat::getEBAccount ( )
inline

Definition at line 33 of file RunDCSHVDat.h.

33 { return "CMS_ECAL_HV_PVSS_COND"; }
std::string RunDCSHVDat::getEEAccount ( )
inline

Definition at line 34 of file RunDCSHVDat.h.

34 { return "CMS_EE_HV_PVSS_COND"; }
ResultSet * RunDCSHVDat::getEndcapAnodeRset ( )
private

Definition at line 186 of file RunDCSHVDat.cc.

References alignCSCRings::e, contentValuesFiles::query, and AlCaHLTBitMon_QueryRunRegistry::string.

186  {
187  ResultSet* rset = nullptr;
188  string query =
189  "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 " +
192  getEEAccount() +
193  ".FWCAENCHANNEL_LV d "
194  " JOIN " +
195  getEEAccount() +
196  ".EE_HVA_MAPPING h on "
197  " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and "
198  "dpe_name='ACTUAL_VMON' ";
199  try {
200  m_readStmt->setSQL(query);
201  rset = m_readStmt->executeQuery();
202  } catch (SQLException& e) {
203 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
204  throw(std::runtime_error(std::string("RunDCSHVDat::getEndcapAnodeRset(): ") + e.getMessage() + " " + query));
205 #else
206  throw(std::runtime_error(std::string("RunDCSHVDat::getEndcapAnodeRset(): error code ") +
207  std::to_string(e.getErrorCode()) + " " + query));
208 #endif
209  }
210  return rset;
211 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
ResultSet * RunDCSHVDat::getEndcapAnodeRset ( const Tm timestart)
private

Definition at line 72 of file RunDCSHVDat.cc.

References cuy::dh, alignCSCRings::e, contentValuesFiles::query, AlCaHLTBitMon_QueryRunRegistry::string, and DateHandler::tmToDate().

72  {
74 
75  ResultSet* rset = nullptr;
76  string query =
77  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
78  " d.actual_vmon, '800' nominal_value , d.change_date "
79  " FROM " +
80  getEEAccount() +
81  ".FWCAENCHANNEL d "
82  " JOIN " +
83  getEEAccount() +
84  ".EE_HVA_MAPPING h on h.DPID = d.DPID "
85  " join " +
86  getEEAccount() +
87  ".CHANNELVIEW cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name "
88  " AND d.change_date> :1 AND d.actual_vmon is not null order by change_date ";
89  try {
90  m_readStmt->setSQL(query);
91 
92  m_readStmt->setDate(1, dh.tmToDate(timeStart));
93 
94  rset = m_readStmt->executeQuery();
95  } catch (SQLException& e) {
96 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
97  throw(std::runtime_error(std::string("RunDCSHVDat::getBarrelRset(): ") + e.getMessage() + " " + query));
98 #else
99  throw(std::runtime_error(std::string("RunDCSHVDat::getBarrelRset(): error code ") +
100  std::to_string(e.getErrorCode()) + " " + query));
101 #endif
102  }
103  return rset;
104 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
tuple dh
Definition: cuy.py:354
ResultSet * RunDCSHVDat::getEndcapDynodeRset ( )
private

Definition at line 213 of file RunDCSHVDat.cc.

References alignCSCRings::e, contentValuesFiles::query, and AlCaHLTBitMon_QueryRunRegistry::string.

213  {
214  ResultSet* rset = nullptr;
215  string query =
216  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
217  " d.value_number, '600' NOMINAL_VALUE , d.CHANGE_DATE "
218  "FROM " +
219  getEEAccount() +
220  ".FWCAENCHANNEL_LV d "
221  " JOIN " +
222  getEEAccount() +
223  ".EE_HVD_MAPPING h on "
224  " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and "
225  "dpe_name='ACTUAL_VMON' ";
226  try {
227  m_readStmt->setSQL(query);
228  rset = m_readStmt->executeQuery();
229  } catch (SQLException& e) {
230 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
231  throw(std::runtime_error(std::string("RunDCSHVDat::getEndcapDynodeRset(): ") + e.getMessage() + " " + query));
232 #else
233  throw(std::runtime_error(std::string("RunDCSHVDat::getEndcapDynodeRset(): error code ") +
234  std::to_string(e.getErrorCode()) + " " + query));
235 #endif
236  }
237  return rset;
238 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
ResultSet * RunDCSHVDat::getEndcapDynodeRset ( const Tm timestart)
private

Definition at line 106 of file RunDCSHVDat.cc.

References cuy::dh, alignCSCRings::e, contentValuesFiles::query, AlCaHLTBitMon_QueryRunRegistry::string, and DateHandler::tmToDate().

106  {
108 
109  ResultSet* rset = nullptr;
110  string query =
111  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
112  " d.actual_vmon, '600' nominal_value , d.change_date "
113  " FROM " +
114  getEEAccount() +
115  ".FWCAENCHANNEL d "
116  " JOIN " +
117  getEEAccount() +
118  ".EE_HVD_MAPPING h on h.DPID = d.DPID "
119  " join " +
120  getEEAccount() +
121  ".CHANNELVIEW cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name "
122  " AND d.change_date> :1 AND d.actual_vmon is not null order by change_date ";
123  try {
124  m_readStmt->setSQL(query);
125 
126  m_readStmt->setDate(1, dh.tmToDate(timeStart));
127 
128  rset = m_readStmt->executeQuery();
129  } catch (SQLException& e) {
130 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
131  throw(std::runtime_error(std::string("RunDCSHVDat::getBarrelRset(): ") + e.getMessage() + " " + query));
132 #else
133  throw(std::runtime_error(std::string("RunDCSHVDat::getBarrelRset(): error code ") +
134  std::to_string(e.getErrorCode()) + " " + query));
135 #endif
136  }
137  return rset;
138 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
tuple dh
Definition: cuy.py:354
float RunDCSHVDat::getHV ( ) const
inline
float RunDCSHVDat::getHVNominal ( ) const
inline
int RunDCSHVDat::getStatus ( ) const
inline

Definition at line 40 of file RunDCSHVDat.h.

References m_status.

Referenced by popcon::EcalDCSHandler::printHVDataSet(), and popcon::EcalDCSHandler::updateHV().

40 { return m_status; }
std::string RunDCSHVDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 32 of file RunDCSHVDat.h.

32 { return ""; }
int RunDCSHVDat::getTimeStatus ( )
inline

Definition at line 41 of file RunDCSHVDat.h.

References m_tstatus.

41 { return m_tstatus; }
int RunDCSHVDat::nowMicroseconds ( )
private

Definition at line 369 of file RunDCSHVDat.cc.

References Tm::microsTime(), and Tm::setToCurrentGMTime().

369  {
370  Tm t_now_gmt;
371 
372  t_now_gmt.setToCurrentGMTime();
373  int t_now_gmt_micros = t_now_gmt.microsTime();
374  return t_now_gmt_micros;
375 }
void setToCurrentGMTime()
Definition: Tm.cc:141
uint64_t microsTime() const
Definition: Tm.cc:96
Definition: Tm.h:13
void RunDCSHVDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 30 of file RunDCSHVDat.cc.

30 {}
void RunDCSHVDat::setHV ( float  t)
inline

Definition at line 35 of file RunDCSHVDat.h.

References m_hv, and submitPVValidationJobs::t.

Referenced by fillTheMap(), and fillTheMapByTime().

void RunDCSHVDat::setHVNominal ( float  t)
inline

Definition at line 37 of file RunDCSHVDat.h.

References m_hvnom, and submitPVValidationJobs::t.

Referenced by fillTheMap(), and fillTheMapByTime().

void RunDCSHVDat::setStatus ( int  t)
inline
void RunDCSHVDat::setStatusForBarrel ( RunDCSHVDat dat,
const Tm sinceTm 
)
private

Definition at line 377 of file RunDCSHVDat.cc.

References ztail::d, getHV(), getHVNominal(), Tm::microsTime(), mps_fire::result, setStatus(), and setTimeStatus().

377  {
378  int t_now_gmt_micros = nowMicroseconds();
379 
380  float hv_diff = dat.getHV() - dat.getHVNominal();
381  if (hv_diff < 0)
382  hv_diff = -hv_diff;
383  if (hv_diff * 1000 > maxHVDifferenceEB) {
384  dat.setStatus(HVNOTNOMINAL);
385  }
386  if (dat.getHV() * 1000 < minHV) {
387  dat.setStatus(HVOFF);
388  }
389 
390  int result = 0;
391  long long d = (t_now_gmt_micros - sinceTm.microsTime());
392  if (d > maxDifference) {
393  result = -d / 1000000;
394  }
395  dat.setTimeStatus(result);
396 }
static const int maxHVDifferenceEB
Definition: RunDCSHVDat.h:20
float getHVNominal() const
Definition: RunDCSHVDat.h:39
static const int HVNOTNOMINAL
Definition: RunDCSHVDat.h:24
tuple result
Definition: mps_fire.py:311
uint64_t microsTime() const
Definition: Tm.cc:96
tuple d
Definition: ztail.py:151
static const int minHV
Definition: RunDCSHVDat.h:22
void setTimeStatus(int t)
Definition: RunDCSHVDat.h:42
void setStatus(int t)
Definition: RunDCSHVDat.h:36
static const int HVOFF
Definition: RunDCSHVDat.h:25
int nowMicroseconds()
Definition: RunDCSHVDat.cc:369
float getHV() const
Definition: RunDCSHVDat.h:38
static const int maxDifference
Definition: RunDCSHVDat.h:19
void RunDCSHVDat::setStatusForEndcaps ( RunDCSHVDat dat,
const Tm sinceTm 
)
private

Definition at line 398 of file RunDCSHVDat.cc.

References ztail::d, getHV(), getHVNominal(), Tm::microsTime(), mps_fire::result, setStatus(), and setTimeStatus().

398  {
399  int t_now_gmt_micros = nowMicroseconds();
400 
401  if (fabs(dat.getHV() - dat.getHVNominal()) * 1000 > maxHVDifferenceEE) {
402  dat.setStatus(HVNOTNOMINAL);
403  }
404  if (dat.getHV() * 1000 < minHV) {
405  dat.setStatus(HVOFF);
406  }
407 
408  int result = 0;
409  long long d = (t_now_gmt_micros - sinceTm.microsTime());
410  if (d > maxDifference) {
411  result = -d / 1000000;
412  }
413  dat.setTimeStatus(result);
414 }
float getHVNominal() const
Definition: RunDCSHVDat.h:39
static const int HVNOTNOMINAL
Definition: RunDCSHVDat.h:24
tuple result
Definition: mps_fire.py:311
uint64_t microsTime() const
Definition: Tm.cc:96
tuple d
Definition: ztail.py:151
static const int minHV
Definition: RunDCSHVDat.h:22
static const int maxHVDifferenceEE
Definition: RunDCSHVDat.h:21
void setTimeStatus(int t)
Definition: RunDCSHVDat.h:42
void setStatus(int t)
Definition: RunDCSHVDat.h:36
static const int HVOFF
Definition: RunDCSHVDat.h:25
int nowMicroseconds()
Definition: RunDCSHVDat.cc:369
float getHV() const
Definition: RunDCSHVDat.h:38
static const int maxDifference
Definition: RunDCSHVDat.h:19
void RunDCSHVDat::setTimeStatus ( int  t)
inline

Definition at line 42 of file RunDCSHVDat.h.

References m_tstatus, and submitPVValidationJobs::t.

Referenced by setStatusForBarrel(), and setStatusForEndcaps().

void RunDCSHVDat::writeDB ( const EcalLogicID ecid,
const RunDCSHVDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 32 of file RunDCSHVDat.cc.

32 {}

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 27 of file RunDCSHVDat.h.

Member Data Documentation

const int RunDCSHVDat::HVNOTNOMINAL = 1
static

Definition at line 24 of file RunDCSHVDat.h.

Referenced by popcon::EcalDCSHandler::updateHV().

const int RunDCSHVDat::HVOFF = 2
static

Definition at line 25 of file RunDCSHVDat.h.

Referenced by popcon::EcalDCSHandler::updateHV().

float RunDCSHVDat::m_hv
private

Definition at line 72 of file RunDCSHVDat.h.

Referenced by getHV(), and setHV().

float RunDCSHVDat::m_hvnom
private

Definition at line 73 of file RunDCSHVDat.h.

Referenced by getHVNominal(), and setHVNominal().

int RunDCSHVDat::m_status
private

Definition at line 74 of file RunDCSHVDat.h.

Referenced by getStatus(), and setStatus().

int RunDCSHVDat::m_tstatus
private

Definition at line 75 of file RunDCSHVDat.h.

Referenced by getTimeStatus(), and setTimeStatus().

const int RunDCSHVDat::maxDifference = 30 * 60 * 1000000
static

Definition at line 19 of file RunDCSHVDat.h.

const int RunDCSHVDat::maxHVDifferenceEB = 300
static

Definition at line 20 of file RunDCSHVDat.h.

const int RunDCSHVDat::maxHVDifferenceEE = 5000
static

Definition at line 21 of file RunDCSHVDat.h.

const int RunDCSHVDat::minHV = 10000
static

Definition at line 22 of file RunDCSHVDat.h.