CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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) throw (std::runtime_error)
 
void fetchLastData (std::map< EcalLogicID, RunDCSLVDat > *fillMap) throw (std::runtime_error)
 
void fillTheMap (ResultSet *, std::map< EcalLogicID, RunDCSLVDat > *)
 
ResultSetgetBarrelRset ()
 
ResultSetgetEndcapRset ()
 
int nowMicroseconds ()
 
void prepareWrite () throw (std::runtime_error)
 
void setStatusForBarrel (RunDCSLVDat &, const Tm &)
 
void setStatusForEndcaps (RunDCSLVDat &, const Tm &)
 
void writeDB (const EcalLogicID *ecid, const RunDCSLVDat *item, RunIOV *iov) throw (std::runtime_error)
 

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 () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- 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 
)
throw (std::runtime_error
)
private

Definition at line 48 of file RunDCSLVDat.cc.

50 {
51  fetchLastData(fillMap);
52 
53 }
void fetchLastData(std::map< EcalLogicID, RunDCSLVDat > *fillMap)
Definition: RunDCSLVDat.cc:172
void RunDCSLVDat::fetchLastData ( std::map< EcalLogicID, RunDCSLVDat > *  fillMap)
throw (std::runtime_error
)
private

Definition at line 172 of file RunDCSLVDat.cc.

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

174 {
175  this->checkConnection();
176 
177  fillMap->clear();
178 
179  try {
180  std::pair< EcalLogicID, RunDCSLVDat > p;
181  RunDCSLVDat dat;
182 
183  ResultSet* rset = getBarrelRset();
184 
185  fillTheMap(rset, fillMap);
186  rset = getEndcapRset();
187 
188  fillTheMap(rset, fillMap);
189  }
190  catch (SQLException &e) {
191  throw(std::runtime_error("RunDCSLVDat::fetchData(): "+e.getMessage()));
192  }
193 }
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSLVDat > *)
Definition: RunDCSLVDat.cc:89
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
ResultSet * getBarrelRset()
Definition: RunDCSLVDat.cc:55
ResultSet * getEndcapRset()
Definition: RunDCSLVDat.cc:72
void checkConnection() const
Definition: IDBObject.h:41
void RunDCSLVDat::fillTheMap ( ResultSet rset,
std::map< EcalLogicID, RunDCSLVDat > *  fillMap 
)
private

Definition at line 89 of file RunDCSLVDat.cc.

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

90  {
91  std::pair< EcalLogicID, RunDCSLVDat > p;
92  RunDCSLVDat dat;
94 
95  try {
96  while(rset->next()) {
97  p.first = EcalLogicID( rset->getString(1), // name
98  rset->getInt(2), // logic_id
99  rset->getInt(3), // id1
100  rset->getInt(4), // id2
101  rset->getInt(5), // id3
102  rset->getString(6)); // maps_to
103 
104  dat.setLV( rset->getFloat(7) );
105  dat.setLVNominal( rset->getFloat(8) );
106  Date sinceDate = rset->getDate(9);
107  Tm sinceTm = dh.dateToTm( sinceDate );
108  dat.setStatus(0);
109  if (p.first.getName() == "EB_LV_channel") {
110  setStatusForBarrel(dat, sinceTm);
111  } else {
112  setStatusForEndcaps(dat, sinceTm);
113  }
114  p.second = dat;
115  fillMap->insert(p);
116  }
117  }
118  catch (SQLException &e) {
119  throw(std::runtime_error("RunDCSLVDat::fetchData(): "+e.getMessage()));
120  }
121 }
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
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setStatus(int t)
Definition: RunDCSLVDat.h:35
void setStatusForEndcaps(RunDCSLVDat &, const Tm &)
Definition: RunDCSLVDat.cc:152
void setLVNominal(float t)
Definition: RunDCSLVDat.h:36
Definition: Tm.h:13
void setStatusForBarrel(RunDCSLVDat &, const Tm &)
Definition: RunDCSLVDat.cc:132
tuple dh
Definition: cuy.py:353
ResultSet * RunDCSLVDat::getBarrelRset ( )
private

Definition at line 55 of file RunDCSLVDat.cc.

References alignCSCRings::e, NULL, and o2o::query.

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  throw(std::runtime_error("RunDCSLVDat::getBarrelRset(): " + e.getMessage() + " " + query));
68  }
69  return rset;
70 }
std::string getEBAccount()
Definition: RunDCSLVDat.h:32
#define NULL
Definition: scimark2.h:8
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
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 72 of file RunDCSLVDat.cc.

References alignCSCRings::e, NULL, and o2o::query.

72  {
73  ResultSet* rset = NULL;
74  string query = "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
75  " d.VALUE_NUMBER, '5' NOMINAL_VALUE , d.VALUE_TIMESTAMP "
76  "FROM "+ getEEAccount()+".FWWIENERMARATHONCHANNEL_LV d "
77  " JOIN "+ getEEAccount()+".EE_LV_MAPPING h on "
78  " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and dpe_name='MEASUREMENTSENSEVOLTAGE' ";
79  try {
80  m_readStmt->setSQL(query);
81  rset = m_readStmt->executeQuery();
82  }
83  catch (SQLException e) {
84  throw(std::runtime_error("RunDCSLVDat::getEndcapRset(): " + e.getMessage() + " " + query));
85  }
86  return rset;
87 }
std::string getEEAccount()
Definition: RunDCSLVDat.h:33
#define NULL
Definition: scimark2.h:8
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
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 123 of file RunDCSLVDat.cc.

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

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:177
uint64_t microsTime() const
Definition: Tm.cc:126
Definition: Tm.h:13
void RunDCSLVDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 32 of file RunDCSLVDat.cc.

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

References getLV(), getLVNominal(), Tm::microsTime(), query::result, setStatus(), and setTimeStatus().

132  {
133  int t_now_gmt_micros = nowMicroseconds();
134 
135  if (fabs(dat.getLV() - dat.getLVNominal())*1000 > maxLVDifferenceEB) {
136  dat.setStatus(LVNOTNOMINAL);
137  }
138  if (dat.getLV()*1000 < minLV) {
139  dat.setStatus(LVOFF);
140  }
141 
142  int result=0;
143  int d= ((int)t_now_gmt_micros - (int)sinceTm.microsTime()) ;
144  if (d> maxDifference) {
145  result= -d/1000000 ;
146  }
147  dat.setTimeStatus(result);
148 
149 
150 }
int nowMicroseconds()
Definition: RunDCSLVDat.cc:123
float getLV() const
Definition: RunDCSLVDat.h:37
uint64_t microsTime() const
Definition: Tm.cc:126
float getLVNominal() const
Definition: RunDCSLVDat.h:38
tuple result
Definition: query.py:137
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 152 of file RunDCSLVDat.cc.

References getLV(), getLVNominal(), Tm::microsTime(), query::result, setStatus(), and setTimeStatus().

152  {
153  int t_now_gmt_micros = nowMicroseconds();
154 
155  if (fabs(dat.getLV() - dat.getLVNominal())*1000 > maxLVDifferenceEE) {
156  dat.setStatus(LVNOTNOMINAL);
157  }
158  if (dat.getLV()*1000 < minLV) {
159  dat.setStatus(LVOFF);
160  }
161 
162  int result=0;
163  int d= ((int)t_now_gmt_micros - (int)sinceTm.microsTime()) ;
164  if (d> maxDifference) {
165  result= -d/1000000 ;
166  }
167  dat.setTimeStatus(result);
168 
169 
170 }
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:126
float getLVNominal() const
Definition: RunDCSLVDat.h:38
tuple result
Definition: query.py:137
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

Definition at line 41 of file RunDCSLVDat.h.

References m_tstatus, and lumiQTWidget::t.

Referenced by setStatusForBarrel(), and setStatusForEndcaps().

41 {m_tstatus=t; }
void RunDCSLVDat::writeDB ( const EcalLogicID ecid,
const RunDCSLVDat item,
RunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 41 of file RunDCSLVDat.cc.

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.