CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends
RunDCSLVDat Class Reference

#include <RunDCSLVDat.h>

Inheritance diagram for RunDCSLVDat:
IDataItem IDBObject

Public Types

typedef oracle::occi::ResultSet ResultSet
 

Public Member Functions

std::string getEBAccount ()
 
std::string getEEAccount ()
 
float getLV () const
 
float getLVNominal () const
 
int getStatus () const
 
std::string getTable () override
 
int getTimeStatus ()
 
 RunDCSLVDat ()
 
void setLV (float t)
 
void setLVNominal (float t)
 
void setStatus (int t)
 
void setTimeStatus (int t)
 
 ~RunDCSLVDat () 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 LVNOTNOMINAL = 1
 
static const int LVOFF = 2
 
static const int maxDifference = 30 * 60 * 1000000
 
static const int maxLVDifferenceEB = 1000
 
static const int maxLVDifferenceEE = 1000
 
static const int minLV = 2000
 
- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS = 1024
 

Private Member Functions

void fetchData (std::map< EcalLogicID, RunDCSLVDat > *fillMap, RunIOV *iov) noexcept(false)
 
void fetchLastData (std::map< EcalLogicID, RunDCSLVDat > *fillMap) noexcept(false)
 
void fillTheMap (ResultSet *, std::map< EcalLogicID, RunDCSLVDat > *)
 
ResultSetgetBarrelRset ()
 
ResultSetgetEndcapRset ()
 
int nowMicroseconds ()
 
void prepareWrite () noexcept(false) override
 
void setStatusForBarrel (RunDCSLVDat &, const Tm &)
 
void setStatusForEndcaps (RunDCSLVDat &, const Tm &)
 
void writeDB (const EcalLogicID *ecid, const RunDCSLVDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

float m_lv
 
float m_lvnom
 
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 14 of file RunDCSLVDat.h.

Member Typedef Documentation

typedef oracle::occi::ResultSet RunDCSLVDat::ResultSet

Definition at line 16 of file RunDCSLVDat.h.

Constructor & Destructor Documentation

RunDCSLVDat::RunDCSLVDat ( )

Definition at line 11 of file RunDCSLVDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_lv = 0;
18  m_lvnom = 0;
19  m_status = 0;
20  m_tstatus = 0;
21 }
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_lvnom
Definition: RunDCSLVDat.h:60
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
float m_lv
Definition: RunDCSLVDat.h:59
RunDCSLVDat::~RunDCSLVDat ( )
override

Definition at line 23 of file RunDCSLVDat.cc.

23 {}

Member Function Documentation

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

Definition at line 29 of file RunDCSLVDat.cc.

Referenced by setTimeStatus().

29  {
30  fetchLastData(fillMap);
31 }
void fetchLastData(std::map< EcalLogicID, RunDCSLVDat > *fillMap) noexcept(false)
Definition: RunDCSLVDat.cc:167
void RunDCSLVDat::fetchLastData ( std::map< EcalLogicID, RunDCSLVDat > *  fillMap)
privatenoexcept

Definition at line 167 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

167  {
168  this->checkConnection();
169 
170  fillMap->clear();
171 
172  try {
173  std::pair<EcalLogicID, RunDCSLVDat> p;
174  RunDCSLVDat dat;
175 
176  ResultSet* rset = getBarrelRset();
177 
178  fillTheMap(rset, fillMap);
179  rset = getEndcapRset();
180 
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()));
185 #else
186  throw(std::runtime_error(std::string("RunDCSLVDat::fetchData(): error code ") + std::to_string(e.getErrorCode())));
187 #endif
188  }
189 }
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
oracle::occi::ResultSet ResultSet
Definition: RunDCSLVDat.h:16
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSLVDat > *)
Definition: RunDCSLVDat.cc:87
ResultSet * getBarrelRset()
Definition: RunDCSLVDat.cc:33
ResultSet * getEndcapRset()
Definition: RunDCSLVDat.cc:60
void RunDCSLVDat::fillTheMap ( ResultSet rset,
std::map< EcalLogicID, RunDCSLVDat > *  fillMap 
)
private

Definition at line 87 of file RunDCSLVDat.cc.

References DateHandler::dateToTm(), cuy::dh, MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setLV(), setLVNominal(), setStatus(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setTimeStatus().

87  {
88  std::pair<EcalLogicID, RunDCSLVDat> p;
89  RunDCSLVDat dat;
91 
92  try {
93  while (rset->next()) {
94  p.first = EcalLogicID(rset->getString(1), // name
95  rset->getInt(2), // logic_id
96  rset->getInt(3), // id1
97  rset->getInt(4), // id2
98  rset->getInt(5), // id3
99  rset->getString(6)); // maps_to
100 
101  dat.setLV(rset->getFloat(7));
102  dat.setLVNominal(rset->getFloat(8));
103  Date sinceDate = rset->getDate(9);
104  Tm sinceTm = dh.dateToTm(sinceDate);
105  dat.setStatus(0);
106  if (p.first.getName() == "EB_LV_channel") {
107  setStatusForBarrel(dat, sinceTm);
108  } else {
109  setStatusForEndcaps(dat, sinceTm);
110  }
111  p.second = dat;
112  fillMap->insert(p);
113  }
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()));
117 #else
118  throw(std::runtime_error(std::string("RunDCSLVDat::fetchData(): error code ") + std::to_string(e.getErrorCode())));
119 #endif
120  }
121 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void setLV(float t)
Definition: RunDCSLVDat.h:34
void setStatus(int t)
Definition: RunDCSLVDat.h:35
void setStatusForEndcaps(RunDCSLVDat &, const Tm &)
Definition: RunDCSLVDat.cc:149
void setLVNominal(float t)
Definition: RunDCSLVDat.h:36
dh
Definition: cuy.py:355
Definition: Tm.h:13
void setStatusForBarrel(RunDCSLVDat &, const Tm &)
Definition: RunDCSLVDat.cc:131
ResultSet * RunDCSLVDat::getBarrelRset ( )
private

Definition at line 33 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

33  {
34  ResultSet* rset = nullptr;
35  string query =
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 "
38  "FROM " +
39  getEBAccount() +
40  ".FWWIENERMARATHONCHANNEL_LV d "
41  " JOIN " +
42  getEBAccount() +
43  ".LV_MAPPING h on "
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' ";
46  try {
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));
52 #else
53  throw(std::runtime_error(std::string("RunDCSLVDat::getBarrelRset(): error code ") +
54  std::to_string(e.getErrorCode()) + " " + query));
55 #endif
56  }
57  return rset;
58 }
std::string getEBAccount()
Definition: RunDCSLVDat.h:32
Definition: query.py:1
oracle::occi::ResultSet ResultSet
Definition: RunDCSLVDat.h:16
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
std::string RunDCSLVDat::getEBAccount ( )
inline

Definition at line 32 of file RunDCSLVDat.h.

32 { return "CMS_ECAL_LV_PVSS_COND"; }
std::string RunDCSLVDat::getEEAccount ( )
inline

Definition at line 33 of file RunDCSLVDat.h.

33 { return "CMS_ECAL_LV_PVSS_COND"; }
ResultSet * RunDCSLVDat::getEndcapRset ( )
private

Definition at line 60 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

60  {
61  ResultSet* rset = nullptr;
62  string 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 "
65  "FROM " +
66  getEEAccount() +
67  ".FWWIENERMARATHONCHANNEL_LV d "
68  " JOIN " +
69  getEEAccount() +
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' ";
73  try {
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));
79 #else
80  throw(std::runtime_error(std::string("RunDCSLVDat::getEndcapRset(): error code ") +
81  std::to_string(e.getErrorCode()) + " " + query));
82 #endif
83  }
84  return rset;
85 }
std::string getEEAccount()
Definition: RunDCSLVDat.h:33
Definition: query.py:1
oracle::occi::ResultSet ResultSet
Definition: RunDCSLVDat.h:16
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
float RunDCSLVDat::getLV ( ) const
inline
float RunDCSLVDat::getLVNominal ( ) const
inline
int RunDCSLVDat::getStatus ( ) const
inline

Definition at line 39 of file RunDCSLVDat.h.

References m_status.

Referenced by popcon::EcalDCSHandler::printLVDataSet(), and popcon::EcalDCSHandler::updateLV().

39 { return m_status; }
std::string RunDCSLVDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 31 of file RunDCSLVDat.h.

31 { return ""; }
int RunDCSLVDat::getTimeStatus ( )
inline

Definition at line 40 of file RunDCSLVDat.h.

References m_tstatus.

40 { return m_tstatus; }
int RunDCSLVDat::nowMicroseconds ( )
private

Definition at line 123 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

123  {
124  Tm t_now_gmt;
125 
126  t_now_gmt.setToCurrentGMTime();
127  int t_now_gmt_micros = t_now_gmt.microsTime();
128  return t_now_gmt_micros;
129 }
void setToCurrentGMTime()
Definition: Tm.cc:141
uint64_t microsTime() const
Definition: Tm.cc:96
Definition: Tm.h:13
void RunDCSLVDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 25 of file RunDCSLVDat.cc.

Referenced by setTimeStatus().

25 {}
void RunDCSLVDat::setLV ( float  t)
inline

Definition at line 34 of file RunDCSLVDat.h.

References m_lv, and OrderedSet::t.

Referenced by fillTheMap().

34 { m_lv = t; }
float m_lv
Definition: RunDCSLVDat.h:59
void RunDCSLVDat::setLVNominal ( float  t)
inline

Definition at line 36 of file RunDCSLVDat.h.

References m_lvnom, and OrderedSet::t.

Referenced by fillTheMap().

36 { m_lvnom = t; }
float m_lvnom
Definition: RunDCSLVDat.h:60
void RunDCSLVDat::setStatus ( int  t)
inline

Definition at line 35 of file RunDCSLVDat.h.

References m_status, and OrderedSet::t.

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

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

Definition at line 131 of file RunDCSLVDat.cc.

References ztail::d, getLV(), getLVNominal(), createfilelist::int, Tm::microsTime(), mps_fire::result, setStatus(), and setTimeStatus().

Referenced by setTimeStatus().

131  {
132  int t_now_gmt_micros = nowMicroseconds();
133 
134  if (fabs(dat.getLV() - dat.getLVNominal()) * 1000 > maxLVDifferenceEB) {
135  dat.setStatus(LVNOTNOMINAL);
136  }
137  if (dat.getLV() * 1000 < minLV) {
138  dat.setStatus(LVOFF);
139  }
140 
141  int result = 0;
142  int d = ((int)t_now_gmt_micros - (int)sinceTm.microsTime());
143  if (d > maxDifference) {
144  result = -d / 1000000;
145  }
146  dat.setTimeStatus(result);
147 }
int nowMicroseconds()
Definition: RunDCSLVDat.cc:123
float getLV() const
Definition: RunDCSLVDat.h:37
uint64_t microsTime() const
Definition: Tm.cc:96
float getLVNominal() const
Definition: RunDCSLVDat.h:38
static const int maxLVDifferenceEB
Definition: RunDCSLVDat.h:19
d
Definition: ztail.py:151
static const int LVOFF
Definition: RunDCSLVDat.h:24
void setStatus(int t)
Definition: RunDCSLVDat.h:35
static const int maxDifference
Definition: RunDCSLVDat.h:18
static const int LVNOTNOMINAL
Definition: RunDCSLVDat.h:23
static const int minLV
Definition: RunDCSLVDat.h:21
void setTimeStatus(int t)
Definition: RunDCSLVDat.h:41
void RunDCSLVDat::setStatusForEndcaps ( RunDCSLVDat dat,
const Tm sinceTm 
)
private

Definition at line 149 of file RunDCSLVDat.cc.

References ztail::d, getLV(), getLVNominal(), createfilelist::int, Tm::microsTime(), mps_fire::result, setStatus(), and setTimeStatus().

Referenced by setTimeStatus().

149  {
150  int t_now_gmt_micros = nowMicroseconds();
151 
152  if (fabs(dat.getLV() - dat.getLVNominal()) * 1000 > maxLVDifferenceEE) {
153  dat.setStatus(LVNOTNOMINAL);
154  }
155  if (dat.getLV() * 1000 < minLV) {
156  dat.setStatus(LVOFF);
157  }
158 
159  int result = 0;
160  int d = ((int)t_now_gmt_micros - (int)sinceTm.microsTime());
161  if (d > maxDifference) {
162  result = -d / 1000000;
163  }
164  dat.setTimeStatus(result);
165 }
int nowMicroseconds()
Definition: RunDCSLVDat.cc:123
static const int maxLVDifferenceEE
Definition: RunDCSLVDat.h:20
float getLV() const
Definition: RunDCSLVDat.h:37
uint64_t microsTime() const
Definition: Tm.cc:96
float getLVNominal() const
Definition: RunDCSLVDat.h:38
d
Definition: ztail.py:151
static const int LVOFF
Definition: RunDCSLVDat.h:24
void setStatus(int t)
Definition: RunDCSLVDat.h:35
static const int maxDifference
Definition: RunDCSLVDat.h:18
static const int LVNOTNOMINAL
Definition: RunDCSLVDat.h:23
static const int minLV
Definition: RunDCSLVDat.h:21
void setTimeStatus(int t)
Definition: RunDCSLVDat.h:41
void RunDCSLVDat::setTimeStatus ( int  t)
inline
void RunDCSLVDat::writeDB ( const EcalLogicID ecid,
const RunDCSLVDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 27 of file RunDCSLVDat.cc.

Referenced by setTimeStatus().

27 {}

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 26 of file RunDCSLVDat.h.

Member Data Documentation

const int RunDCSLVDat::LVNOTNOMINAL = 1
static

Definition at line 23 of file RunDCSLVDat.h.

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

const int RunDCSLVDat::LVOFF = 2
static

Definition at line 24 of file RunDCSLVDat.h.

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

float RunDCSLVDat::m_lv
private

Definition at line 59 of file RunDCSLVDat.h.

Referenced by getLV(), and setLV().

float RunDCSLVDat::m_lvnom
private

Definition at line 60 of file RunDCSLVDat.h.

Referenced by getLVNominal(), and setLVNominal().

int RunDCSLVDat::m_status
private

Definition at line 61 of file RunDCSLVDat.h.

Referenced by getStatus(), and setStatus().

int RunDCSLVDat::m_tstatus
private

Definition at line 62 of file RunDCSLVDat.h.

Referenced by getTimeStatus(), and setTimeStatus().

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

Definition at line 18 of file RunDCSLVDat.h.

const int RunDCSLVDat::maxLVDifferenceEB = 1000
static

Definition at line 19 of file RunDCSLVDat.h.

const int RunDCSLVDat::maxLVDifferenceEE = 1000
static

Definition at line 20 of file RunDCSLVDat.h.

const int RunDCSLVDat::minLV = 2000
static

Definition at line 21 of file RunDCSLVDat.h.