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 ()
 
int getTimeStatus ()
 
 RunDCSLVDat ()
 
void setLV (float t)
 
void setLVNominal (float t)
 
void setStatus (int t)
 
void setTimeStatus (int t)
 
 ~RunDCSLVDat ()
 
- 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)
 
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.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_lv = 0;
19  m_lvnom = 0;
20  m_status= 0;
21  m_tstatus= 0;
22 }
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
#define NULL
Definition: scimark2.h:8
float m_lvnom
Definition: RunDCSLVDat.h:64
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
float m_lv
Definition: RunDCSLVDat.h:63
RunDCSLVDat::~RunDCSLVDat ( )

Definition at line 26 of file RunDCSLVDat.cc.

27 {
28 }

Member Function Documentation

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

Definition at line 48 of file RunDCSLVDat.cc.

Referenced by setTimeStatus().

50 {
51  fetchLastData(fillMap);
52 
53 }
void fetchLastData(std::map< EcalLogicID, RunDCSLVDat > *fillMap) noexcept(false)
Definition: RunDCSLVDat.cc:184
void RunDCSLVDat::fetchLastData ( std::map< EcalLogicID, RunDCSLVDat > *  fillMap)
privatenoexcept

Definition at line 184 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

186 {
187  this->checkConnection();
188 
189  fillMap->clear();
190 
191  try {
192  std::pair< EcalLogicID, RunDCSLVDat > p;
193  RunDCSLVDat dat;
194 
195  ResultSet* rset = getBarrelRset();
196 
197  fillTheMap(rset, fillMap);
198  rset = getEndcapRset();
199 
200  fillTheMap(rset, fillMap);
201  }
202  catch (SQLException &e) {
203 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
204  throw(std::runtime_error("RunDCSLVDat::fetchData(): "+e.getMessage()));
205 #else
206  throw(std::runtime_error("RunDCSLVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
207 #endif
208  }
209 }
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
oracle::occi::ResultSet ResultSet
Definition: RunDCSLVDat.h:16
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSLVDat > *)
Definition: RunDCSLVDat.cc:97
ResultSet * getBarrelRset()
Definition: RunDCSLVDat.cc:55
ResultSet * getEndcapRset()
Definition: RunDCSLVDat.cc:76
void RunDCSLVDat::fillTheMap ( ResultSet rset,
std::map< EcalLogicID, RunDCSLVDat > *  fillMap 
)
private

Definition at line 97 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

98  {
99  std::pair< EcalLogicID, RunDCSLVDat > p;
100  RunDCSLVDat dat;
102 
103  try {
104  while(rset->next()) {
105  p.first = EcalLogicID( rset->getString(1), // name
106  rset->getInt(2), // logic_id
107  rset->getInt(3), // id1
108  rset->getInt(4), // id2
109  rset->getInt(5), // id3
110  rset->getString(6)); // maps_to
111 
112  dat.setLV( rset->getFloat(7) );
113  dat.setLVNominal( rset->getFloat(8) );
114  Date sinceDate = rset->getDate(9);
115  Tm sinceTm = dh.dateToTm( sinceDate );
116  dat.setStatus(0);
117  if (p.first.getName() == "EB_LV_channel") {
118  setStatusForBarrel(dat, sinceTm);
119  } else {
120  setStatusForEndcaps(dat, sinceTm);
121  }
122  p.second = dat;
123  fillMap->insert(p);
124  }
125  }
126  catch (SQLException &e) {
127 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
128  throw(std::runtime_error("RunDCSLVDat::fetchData(): "+e.getMessage()));
129 #else
130  throw(std::runtime_error("RunDCSLVDat::fetchData(): error code " + std::to_string(e.getErrorCode())));
131 #endif
132  }
133 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setLV(float t)
Definition: RunDCSLVDat.h:34
void setStatus(int t)
Definition: RunDCSLVDat.h:35
void setStatusForEndcaps(RunDCSLVDat &, const Tm &)
Definition: RunDCSLVDat.cc:164
void setLVNominal(float t)
Definition: RunDCSLVDat.h:36
dh
Definition: cuy.py:353
Definition: Tm.h:13
void setStatusForBarrel(RunDCSLVDat &, const Tm &)
Definition: RunDCSLVDat.cc:144
ResultSet * RunDCSLVDat::getBarrelRset ( )
private

Definition at line 55 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

55  {
56  ResultSet* rset = NULL;
57  string query = "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
58  " d.value_number , '5' NOMINAL_VALUE , d.VALUE_TIMESTAMP "
59  "FROM "+ getEBAccount()+".FWWIENERMARATHONCHANNEL_LV d "
60  " JOIN "+ getEBAccount()+".LV_MAPPING h on "
61  " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and dpe_name='MEASUREMENTSENSEVOLTAGE' ";
62  try {
63  m_readStmt->setSQL(query);
64  rset = m_readStmt->executeQuery();
65  }
66  catch (SQLException e) {
67 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
68  throw(std::runtime_error("RunDCSLVDat::getBarrelRset(): " + e.getMessage() + " " + query));
69 #else
70  throw(std::runtime_error("RunDCSLVDat::getBarrelRset(): error code " + std::to_string(e.getErrorCode()) + " " + query));
71 #endif
72  }
73  return rset;
74 }
std::string getEBAccount()
Definition: RunDCSLVDat.h:32
#define NULL
Definition: scimark2.h:8
def query(query_str, verbose=False)
Definition: das.py:5
Definition: query.py:1
oracle::occi::ResultSet ResultSet
Definition: RunDCSLVDat.h:16
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
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 76 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

76  {
77  ResultSet* rset = NULL;
78  string query = "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
79  " d.VALUE_NUMBER, '5' NOMINAL_VALUE , d.VALUE_TIMESTAMP "
80  "FROM "+ getEEAccount()+".FWWIENERMARATHONCHANNEL_LV d "
81  " JOIN "+ getEEAccount()+".EE_LV_MAPPING h on "
82  " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and dpe_name='MEASUREMENTSENSEVOLTAGE' ";
83  try {
84  m_readStmt->setSQL(query);
85  rset = m_readStmt->executeQuery();
86  }
87  catch (SQLException e) {
88 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
89  throw(std::runtime_error("RunDCSLVDat::getEndcapRset(): " + e.getMessage() + " " + query));
90 #else
91  throw(std::runtime_error("RunDCSLVDat::getEndcapRset(): error code " + std::to_string(e.getErrorCode()) + " " + query));
92 #endif
93  }
94  return rset;
95 }
std::string getEEAccount()
Definition: RunDCSLVDat.h:33
#define NULL
Definition: scimark2.h:8
def query(query_str, verbose=False)
Definition: das.py:5
Definition: query.py:1
oracle::occi::ResultSet ResultSet
Definition: RunDCSLVDat.h:16
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
float RunDCSLVDat::getLV ( ) const
inline
float RunDCSLVDat::getLVNominal ( ) const
inline
int RunDCSLVDat::getStatus ( void  ) 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 ( )
inlinevirtual

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 135 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

135  {
136  Tm t_now_gmt;
137 
138  t_now_gmt.setToCurrentGMTime();
139  int t_now_gmt_micros = t_now_gmt.microsTime();
140  return t_now_gmt_micros;
141 }
void setToCurrentGMTime()
Definition: Tm.cc:177
uint64_t microsTime() const
Definition: Tm.cc:126
Definition: Tm.h:13
void RunDCSLVDat::prepareWrite ( )
privatevirtualnoexcept

Implements IDataItem.

Definition at line 32 of file RunDCSLVDat.cc.

Referenced by setTimeStatus().

34 {
35 
36 
37 }
void RunDCSLVDat::setLV ( float  t)
inline

Definition at line 34 of file RunDCSLVDat.h.

References m_lv, and lumiQTWidget::t.

Referenced by fillTheMap().

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

Definition at line 36 of file RunDCSLVDat.h.

References m_lvnom, and lumiQTWidget::t.

Referenced by fillTheMap().

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

Definition at line 35 of file RunDCSLVDat.h.

References m_status, and lumiQTWidget::t.

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

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

Definition at line 144 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

144  {
145  int t_now_gmt_micros = nowMicroseconds();
146 
147  if (fabs(dat.getLV() - dat.getLVNominal())*1000 > maxLVDifferenceEB) {
148  dat.setStatus(LVNOTNOMINAL);
149  }
150  if (dat.getLV()*1000 < minLV) {
151  dat.setStatus(LVOFF);
152  }
153 
154  int result=0;
155  int d= ((int)t_now_gmt_micros - (int)sinceTm.microsTime()) ;
156  if (d> maxDifference) {
157  result= -d/1000000 ;
158  }
159  dat.setTimeStatus(result);
160 
161 
162 }
int nowMicroseconds()
Definition: RunDCSLVDat.cc:135
float getLV() const
Definition: RunDCSLVDat.h:37
uint64_t microsTime() const
Definition: Tm.cc:126
float getLVNominal() const
Definition: RunDCSLVDat.h:38
static const int maxLVDifferenceEB
Definition: RunDCSLVDat.h:19
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 164 of file RunDCSLVDat.cc.

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

Referenced by setTimeStatus().

164  {
165  int t_now_gmt_micros = nowMicroseconds();
166 
167  if (fabs(dat.getLV() - dat.getLVNominal())*1000 > maxLVDifferenceEE) {
168  dat.setStatus(LVNOTNOMINAL);
169  }
170  if (dat.getLV()*1000 < minLV) {
171  dat.setStatus(LVOFF);
172  }
173 
174  int result=0;
175  int d= ((int)t_now_gmt_micros - (int)sinceTm.microsTime()) ;
176  if (d> maxDifference) {
177  result= -d/1000000 ;
178  }
179  dat.setTimeStatus(result);
180 
181 
182 }
int nowMicroseconds()
Definition: RunDCSLVDat.cc:135
static const int maxLVDifferenceEE
Definition: RunDCSLVDat.h:20
float getLV() const
Definition: RunDCSLVDat.h:37
uint64_t microsTime() const
Definition: Tm.cc:126
float getLVNominal() const
Definition: RunDCSLVDat.h:38
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 41 of file RunDCSLVDat.cc.

Referenced by setTimeStatus().

43 {
44 }

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 63 of file RunDCSLVDat.h.

Referenced by getLV(), and setLV().

float RunDCSLVDat::m_lvnom
private

Definition at line 64 of file RunDCSLVDat.h.

Referenced by getLVNominal(), and setLVNominal().

int RunDCSLVDat::m_status
private

Definition at line 65 of file RunDCSLVDat.h.

Referenced by getStatus(), and setStatus().

int RunDCSLVDat::m_tstatus
private

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