CMS 3D CMS Logo

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.

17 {
18  m_env = nullptr;
19  m_conn = nullptr;
20  m_writeStmt = nullptr;
21  m_readStmt = nullptr;
22 
23  m_hv = 0;
24  m_hvnom = 0;
25  m_status= 0;
26  m_tstatus= 0;
27 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
float m_hv
Definition: RunDCSHVDat.h:77
float m_hvnom
Definition: RunDCSHVDat.h:78
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
RunDCSHVDat::~RunDCSHVDat ( )
override

Definition at line 31 of file RunDCSHVDat.cc.

32 {
33 }

Member Function Documentation

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

Definition at line 53 of file RunDCSHVDat.cc.

Referenced by setTimeStatus().

55 {
56  fetchLastData(fillMap);
57 
58 }
void fetchLastData(std::map< EcalLogicID, RunDCSHVDat > *fillMap) noexcept(false)
Definition: RunDCSHVDat.cc:414
void RunDCSHVDat::fetchHistoricalData ( std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > > *  fillMap,
const Tm timeStart 
)
privatenoexcept

Definition at line 444 of file RunDCSHVDat.cc.

References MillePedeFileConverter_cfg::e, DataReducer< T >::getReducedDataList(), AlCaHLTBitMon_ParallelJobs::p, and DataReducer< T >::setDataList().

Referenced by setTimeStatus().

446 {
447  this->checkConnection();
448 
449  fillMap->clear();
450 
451  std::list< DataReducer<RunDCSHVDat>::MyData<RunDCSHVDat> > my_data_list;
452 
453 
454  try {
455 
456  std::pair< EcalLogicID, RunDCSHVDat > p;
457  RunDCSHVDat dat;
458 
459  ResultSet* rset1 = getBarrelRset(timeStart);
460  fillTheMapByTime(rset1, &my_data_list);
461 
462  ResultSet* rset2 = getEndcapAnodeRset(timeStart);
463  fillTheMapByTime(rset2, &my_data_list);
464 
465  ResultSet* rset3 = getEndcapDynodeRset(timeStart);
466  fillTheMapByTime(rset3, &my_data_list);
467 
468 
470  my_dr.setDataList(my_data_list);
471  my_dr.getReducedDataList(fillMap);
472 
473 
474  }
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()));
478 #else
479  throw(std::runtime_error("RunDCSHVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
480 #endif
481  }
482 }
void setDataList(std::list< MyData< T > > _list)
Definition: DataReducer.h:60
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
ResultSet * getEndcapDynodeRset()
Definition: RunDCSHVDat.cc:208
ResultSet * getEndcapAnodeRset()
Definition: RunDCSHVDat.cc:187
ResultSet * getBarrelRset()
Definition: RunDCSHVDat.cc:166
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void getReducedDataList(std::list< std::pair< Tm, DataMap > > *my_new_list)
Definition: DataReducer.h:67
void fillTheMapByTime(ResultSet *rset, std::list< DataReducer< RunDCSHVDat >::MyData< RunDCSHVDat > > *my_data_list)
Definition: RunDCSHVDat.cc:273
void RunDCSHVDat::fetchLastData ( std::map< EcalLogicID, RunDCSHVDat > *  fillMap)
privatenoexcept

Definition at line 414 of file RunDCSHVDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by setTimeStatus().

416 {
417  this->checkConnection();
418 
419  fillMap->clear();
420 
421  try {
422  std::pair< EcalLogicID, RunDCSHVDat > p;
423  RunDCSHVDat dat;
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  }
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()));
438 #else
439  throw(std::runtime_error("RunDCSHVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
440 #endif
441  }
442 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
ResultSet * getEndcapDynodeRset()
Definition: RunDCSHVDat.cc:208
ResultSet * getEndcapAnodeRset()
Definition: RunDCSHVDat.cc:187
ResultSet * getBarrelRset()
Definition: RunDCSHVDat.cc:166
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSHVDat > *)
Definition: RunDCSHVDat.cc:229
void RunDCSHVDat::fillTheMap ( ResultSet rset,
std::map< EcalLogicID, RunDCSHVDat > *  fillMap 
)
private

Definition at line 229 of file RunDCSHVDat.cc.

References DateHandler::dateToTm(), cuy::dh, MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setHV(), setHVNominal(), and setStatus().

Referenced by setTimeStatus().

230  {
231 
232  // method for last value queries
233 
234  std::pair< EcalLogicID, RunDCSHVDat > p;
235  RunDCSHVDat dat;
237 
238  try {
239  while(rset->next()) {
240  p.first = EcalLogicID( rset->getString(1), // name
241  rset->getInt(2), // logic_id
242  rset->getInt(3), // id1
243  rset->getInt(4), // id2
244  rset->getInt(5), // id3
245  rset->getString(6)); // maps_to
246 
247  dat.setHV( rset->getFloat(7) );
248  dat.setHVNominal( rset->getFloat(8) );
249  Date sinceDate = rset->getDate(9);
250  Tm sinceTm = dh.dateToTm( sinceDate );
251  dat.setStatus(0);
252  if (p.first.getName() == "EB_HV_channel") {
253  setStatusForBarrel(dat, sinceTm);
254  } else {
255  setStatusForEndcaps(dat, sinceTm);
256  }
257  p.second = dat;
258  fillMap->insert(p);
259  }
260  }
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()));
264 #else
265  throw(std::runtime_error("RunDCSHVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
266 #endif
267  }
268 }
void setStatusForEndcaps(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:396
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setStatusForBarrel(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:374
void setStatus(int t)
Definition: RunDCSHVDat.h:36
void setHVNominal(float t)
Definition: RunDCSHVDat.h:37
void setHV(float t)
Definition: RunDCSHVDat.h:35
dh
Definition: cuy.py:353
Definition: Tm.h:13
void RunDCSHVDat::fillTheMapByTime ( ResultSet rset,
std::list< DataReducer< RunDCSHVDat >::MyData< RunDCSHVDat > > *  my_data_list 
)
privatenoexcept

Definition at line 273 of file RunDCSHVDat.cc.

References KineDebug3::count(), gather_cfg::cout, edmIntegrityCheck::d, util.getRunInfo::day(), cuy::dh, MillePedeFileConverter_cfg::e, RecoEcal_EventContent_cff::ec, getHV(), EcalLogicID::getID1(), EcalLogicID::getID2(), EcalLogicID::getName(), AlCaHLTBitMon_ParallelJobs::p, createTree::pp, edm::second(), setHV(), setHVNominal(), setStatus(), Tm::setToString(), Tm::str(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::tt, and create_public_lumi_plots::year.

Referenced by setTimeStatus().

274  {
275 
276  // std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > >* fillMap) {
277 
278  // method for historic queries
279 
280  RunDCSHVDat dat;
282 
283 
284  try {
285  int count=-1;
286  while(rset->next()) {
287  EcalLogicID ec = EcalLogicID( rset->getString(1), // name
288  rset->getInt(2), // logic_id
289  rset->getInt(3), // id1
290  rset->getInt(4), // id2
291  rset->getInt(5), // id3
292  rset->getString(6)); // maps_to
293 
294 
295  dat.setHV( rset->getFloat(7) );
296  dat.setHVNominal( rset->getFloat(8) );
297  // Date sinceDate = rset->getDate(9);
298  // Tm sinceTm = dh.dateToTm( sinceDate );
299  // Date sinceDate = rset->getDate(9);
300  Timestamp ora_timestamp = rset->getTimestamp(9);
301  Tm sinceTm; // YYYY-MM-DD HH:MM:SS
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));
304 #else
305  int year = 0;
306  unsigned int month = 0;
307  unsigned int day = 0;
308  unsigned int hour = 0;
309  unsigned int minute = 0;
310  unsigned int second = 0;
311  unsigned int fs = 0;
312  ora_timestamp.getDate(year, month, day);
313  ora_timestamp.getTime(hour, minute, second, fs);
314  const std::tm tt = {
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
321  };
322  char tt_str[30] = { 0 };
323  if (std::strftime(tt_str, sizeof(tt_str), "%F %T", &tt)) {
324  sinceTm.setToString(std::string(tt_str));
325  } else {
326  throw std::runtime_error("RunDCSHVDat::fillTheMapByTime: failed to generate the date string");
327  }
328 #endif
329 
330  dat.setStatus(0);
331  if (ec.getName() == "EB_HV_channel") {
332  setStatusForBarrel(dat, sinceTm);
333  } else {
334  setStatusForEndcaps(dat, sinceTm);
335  }
336 
337  std::pair< EcalLogicID, RunDCSHVDat > d;
338  d.first=ec;
339  d.second=dat;
340  std::pair< Tm, std::pair< EcalLogicID, RunDCSHVDat > > p;
341  p.first=sinceTm;
342  p.second = d;
343 
345  pp.m_iData=p;
346 
347  my_data_list->push_back(pp);
348  count++;
349  if(count<100) std::cout<<"DCS DB : size:"<< my_data_list->size()<<" Tm " <<sinceTm.str()<<" "<<ec.getID1()<<" "<<ec.getID2()<<" "<<dat.getHV()<<std::endl;
350  }
351  std::cout<<"DCS DB : size:"<< my_data_list->size()<<std::endl;
352 
353 
354  }
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()));
358 #else
359  throw(std::runtime_error("RunDCSHVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
360 #endif
361  }
362 }
void setStatusForEndcaps(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:396
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setStatusForBarrel(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:374
int getID2() const
Definition: EcalLogicID.cc:51
U second(std::pair< T, U > const &p)
std::string getName() const
Definition: EcalLogicID.cc:36
int getID1() const
Definition: EcalLogicID.cc:46
void setToString(const std::string s) noexcept(false)
Definition: Tm.cc:193
void setStatus(int t)
Definition: RunDCSHVDat.h:36
void setHVNominal(float t)
Definition: RunDCSHVDat.h:37
std::string str() const
Definition: Tm.cc:89
def day(string)
Definition: getRunInfo.py:11
void setHV(float t)
Definition: RunDCSHVDat.h:35
dh
Definition: cuy.py:353
Definition: Tm.h:13
float getHV() const
Definition: RunDCSHVDat.h:38
ResultSet * RunDCSHVDat::getBarrelRset ( )
private

Definition at line 166 of file RunDCSHVDat.cc.

References MillePedeFileConverter_cfg::e, and das::query().

Referenced by setTimeStatus().

166  {
167  ResultSet* rset = nullptr;
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' ";
173  try {
174  m_readStmt->setSQL(query);
175  rset = m_readStmt->executeQuery();
176  }
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));
180 #else
181  throw(std::runtime_error("RunDCSHVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) + " " + query));
182 #endif
183  }
184  return rset;
185 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
def query(query_str, verbose=False)
Definition: das.py:5
std::string getEBAccount()
Definition: RunDCSHVDat.h:33
Definition: query.py:1
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
ResultSet * RunDCSHVDat::getBarrelRset ( const Tm timeStart)
private

Definition at line 62 of file RunDCSHVDat.cc.

References cuy::dh, MillePedeFileConverter_cfg::e, das::query(), and DateHandler::tmToDate().

62  {
63 
65 
66  ResultSet* rset = nullptr;
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 " ;
73  try {
74  m_readStmt->setSQL(query);
75 
76  m_readStmt->setDate(1, dh.tmToDate(timeStart));
77 
78  rset = m_readStmt->executeQuery();
79  }
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));
83 #else
84  throw(std::runtime_error("RunDCSHVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) + " " + query));
85 #endif
86  }
87  return rset;
88 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
def query(query_str, verbose=False)
Definition: das.py:5
std::string getEBAccount()
Definition: RunDCSHVDat.h:33
Definition: query.py:1
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
dh
Definition: cuy.py:353
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 187 of file RunDCSHVDat.cc.

References MillePedeFileConverter_cfg::e, and das::query().

Referenced by setTimeStatus().

187  {
188  ResultSet* rset = nullptr;
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' ";
194  try {
195  m_readStmt->setSQL(query);
196  rset = m_readStmt->executeQuery();
197  }
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));
201 #else
202  throw(std::runtime_error("RunDCSHVDat::getEndcapAnodeRset(): error code " + std::to_string(e.getErrorCode()) + " " + query));
203 #endif
204  }
205  return rset;
206 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
def query(query_str, verbose=False)
Definition: das.py:5
Definition: query.py:1
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
ResultSet * RunDCSHVDat::getEndcapAnodeRset ( const Tm timestart)
private

Definition at line 90 of file RunDCSHVDat.cc.

References cuy::dh, MillePedeFileConverter_cfg::e, das::query(), and DateHandler::tmToDate().

90  {
91 
93 
94  ResultSet* rset = nullptr;
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 " ;
101  try {
102  m_readStmt->setSQL(query);
103 
104  m_readStmt->setDate(1, dh.tmToDate(timeStart));
105 
106  rset = m_readStmt->executeQuery();
107  }
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));
111 #else
112  throw(std::runtime_error("RunDCSHVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) + " " + query));
113 #endif
114  }
115  return rset;
116 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
def query(query_str, verbose=False)
Definition: das.py:5
Definition: query.py:1
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
dh
Definition: cuy.py:353
ResultSet * RunDCSHVDat::getEndcapDynodeRset ( )
private

Definition at line 208 of file RunDCSHVDat.cc.

References MillePedeFileConverter_cfg::e, and das::query().

Referenced by setTimeStatus().

208  {
209  ResultSet* rset = nullptr;
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' ";
215  try {
216  m_readStmt->setSQL(query);
217  rset = m_readStmt->executeQuery();
218  }
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));
222 #else
223  throw(std::runtime_error("RunDCSHVDat::getEndcapDynodeRset(): error code " + std::to_string(e.getErrorCode()) + " " + query));
224 #endif
225  }
226  return rset;
227 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
def query(query_str, verbose=False)
Definition: das.py:5
Definition: query.py:1
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
ResultSet * RunDCSHVDat::getEndcapDynodeRset ( const Tm timestart)
private

Definition at line 118 of file RunDCSHVDat.cc.

References cuy::dh, MillePedeFileConverter_cfg::e, das::query(), and DateHandler::tmToDate().

118  {
119 
121 
122  ResultSet* rset = nullptr;
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 " ;
129  try {
130  m_readStmt->setSQL(query);
131 
132  m_readStmt->setDate(1, dh.tmToDate(timeStart));
133 
134  rset = m_readStmt->executeQuery();
135  }
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));
139 #else
140  throw(std::runtime_error("RunDCSHVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) + " " + query));
141 #endif
142  }
143  return rset;
144 }
oracle::occi::ResultSet ResultSet
Definition: RunDCSHVDat.h:17
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
def query(query_str, verbose=False)
Definition: das.py:5
Definition: query.py:1
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
dh
Definition: cuy.py:353
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 364 of file RunDCSHVDat.cc.

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

Referenced by setTimeStatus().

364  {
365  Tm t_now_gmt;
366 
367  t_now_gmt.setToCurrentGMTime();
368  int t_now_gmt_micros = t_now_gmt.microsTime();
369  return t_now_gmt_micros;
370 }
void setToCurrentGMTime()
Definition: Tm.cc:177
uint64_t microsTime() const
Definition: Tm.cc:126
Definition: Tm.h:13
void RunDCSHVDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 37 of file RunDCSHVDat.cc.

Referenced by setTimeStatus().

39 {
40 
41 
42 }
void RunDCSHVDat::setHV ( float  t)
inline

Definition at line 35 of file RunDCSHVDat.h.

References m_hv, and lumiQTWidget::t.

Referenced by fillTheMap(), and fillTheMapByTime().

35 { m_hv = t; }
float m_hv
Definition: RunDCSHVDat.h:77
void RunDCSHVDat::setHVNominal ( float  t)
inline

Definition at line 37 of file RunDCSHVDat.h.

References m_hvnom, and lumiQTWidget::t.

Referenced by fillTheMap(), and fillTheMapByTime().

37 { m_hvnom = t; }
float m_hvnom
Definition: RunDCSHVDat.h:78
void RunDCSHVDat::setStatus ( int  t)
inline

Definition at line 36 of file RunDCSHVDat.h.

References m_status, and lumiQTWidget::t.

Referenced by fillTheMap(), fillTheMapByTime(), setStatusForBarrel(), and setStatusForEndcaps().

36 { m_status = t; }
void RunDCSHVDat::setStatusForBarrel ( RunDCSHVDat dat,
const Tm sinceTm 
)
private

Definition at line 374 of file RunDCSHVDat.cc.

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

Referenced by setTimeStatus().

374  {
375  int t_now_gmt_micros = nowMicroseconds();
376 
377  float hv_diff=dat.getHV() - dat.getHVNominal();
378  if(hv_diff<0) hv_diff=-hv_diff;
379  if (hv_diff*1000 > maxHVDifferenceEB) {
380  dat.setStatus(HVNOTNOMINAL);
381  }
382  if (dat.getHV()*1000 < minHV) {
383  dat.setStatus(HVOFF);
384  }
385 
386  int result=0;
387  long long d= (t_now_gmt_micros - sinceTm.microsTime()) ;
388  if (d> maxDifference) {
389  result= -d/1000000 ;
390  }
391  dat.setTimeStatus(result);
392 
393 
394 }
static const int maxHVDifferenceEB
Definition: RunDCSHVDat.h:20
float getHVNominal() const
Definition: RunDCSHVDat.h:39
static const int HVNOTNOMINAL
Definition: RunDCSHVDat.h:24
uint64_t microsTime() const
Definition: Tm.cc:126
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:364
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 396 of file RunDCSHVDat.cc.

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

Referenced by setTimeStatus().

396  {
397  int t_now_gmt_micros = nowMicroseconds();
398 
399  if (fabs(dat.getHV() - dat.getHVNominal())*1000 > maxHVDifferenceEE) {
400  dat.setStatus(HVNOTNOMINAL);
401  }
402  if (dat.getHV()*1000 < minHV) {
403  dat.setStatus(HVOFF);
404  }
405 
406  int result=0;
407  long long d= (t_now_gmt_micros - sinceTm.microsTime()) ;
408  if (d> maxDifference) {
409  result= -d/1000000 ;
410  }
411  dat.setTimeStatus(result);
412 }
float getHVNominal() const
Definition: RunDCSHVDat.h:39
static const int HVNOTNOMINAL
Definition: RunDCSHVDat.h:24
uint64_t microsTime() const
Definition: Tm.cc:126
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:364
float getHV() const
Definition: RunDCSHVDat.h:38
static const int maxDifference
Definition: RunDCSHVDat.h:19
void RunDCSHVDat::setTimeStatus ( int  t)
inline
void RunDCSHVDat::writeDB ( const EcalLogicID ecid,
const RunDCSHVDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 46 of file RunDCSHVDat.cc.

Referenced by setTimeStatus().

48 {
49 }

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 77 of file RunDCSHVDat.h.

Referenced by getHV(), and setHV().

float RunDCSHVDat::m_hvnom
private

Definition at line 78 of file RunDCSHVDat.h.

Referenced by getHVNominal(), and setHVNominal().

int RunDCSHVDat::m_status
private

Definition at line 79 of file RunDCSHVDat.h.

Referenced by getStatus(), and setStatus().

int RunDCSHVDat::m_tstatus
private

Definition at line 80 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.