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 | Private Member Functions | Private Attributes | Friends
RunDCSMagnetDat Class Reference

#include <RunDCSMagnetDat.h>

Inheritance diagram for RunDCSMagnetDat:
IDataItem IDBObject

Public Types

typedef oracle::occi::ResultSet ResultSet
 

Public Member Functions

std::string getMagnetAccount ()
 
float getMagnetCurrent () const
 
std::string getTable () override
 
Tm getTime () const
 
 RunDCSMagnetDat ()
 
void setMagnetCurrent (float t)
 
void setTime (const Tm &start)
 
 ~RunDCSMagnetDat () 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 ()
 

Private Member Functions

void fetchData (std::map< EcalLogicID, RunDCSMagnetDat > *fillMap, RunIOV *iov) noexcept(false)
 
void fetchLastData (std::map< EcalLogicID, RunDCSMagnetDat > *fillMap) noexcept(false)
 
void fillTheMap (ResultSet *, std::map< EcalLogicID, RunDCSMagnetDat > *)
 
ResultSetgetMagnetRset ()
 
int nowMicroseconds ()
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunDCSMagnetDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

float m_current
 
Tm m_time
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS = 1024
 
- 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 RunDCSMagnetDat.h.

Member Typedef Documentation

typedef oracle::occi::ResultSet RunDCSMagnetDat::ResultSet

Definition at line 17 of file RunDCSMagnetDat.h.

Constructor & Destructor Documentation

RunDCSMagnetDat::RunDCSMagnetDat ( )

Definition at line 15 of file RunDCSMagnetDat.cc.

15  {
16  m_env = nullptr;
17  m_conn = nullptr;
18  m_writeStmt = nullptr;
19  m_readStmt = nullptr;
20 
21  m_current = 0;
22  m_time = Tm();
23 }
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
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
Definition: Tm.h:13
RunDCSMagnetDat::~RunDCSMagnetDat ( )
override

Definition at line 25 of file RunDCSMagnetDat.cc.

25 {}

Member Function Documentation

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

Definition at line 35 of file RunDCSMagnetDat.cc.

References gather_cfg::cout.

35  {
36  std::cout << "going to call fetchLastData" << std::endl;
37  fetchLastData(fillMap);
38  std::cout << "returned from fetchLastData" << std::endl;
39 }
void fetchLastData(std::map< EcalLogicID, RunDCSMagnetDat > *fillMap) noexcept(false)
tuple cout
Definition: gather_cfg.py:144
void RunDCSMagnetDat::fetchLastData ( std::map< EcalLogicID, RunDCSMagnetDat > *  fillMap)
privatenoexcept

Definition at line 111 of file RunDCSMagnetDat.cc.

References gather_cfg::cout, dat, alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

111  {
112  this->checkConnection();
113 
114  std::cout << "fetchLastData>>1" << std::endl;
115 
116  fillMap->clear();
117 
118  std::cout << "fetchLastData>>2" << std::endl;
119 
120  try {
121  std::pair<EcalLogicID, RunDCSMagnetDat> p;
123  std::cout << "fetchLastData>>3" << std::endl;
124 
125  ResultSet* rset = getMagnetRset();
126 
127  std::cout << "fetchLastData>>4" << std::endl;
128 
129  fillTheMap(rset, fillMap);
130  std::cout << "fetchLastData>>5" << std::endl;
131 
132  } catch (SQLException& e) {
133 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
134  throw(std::runtime_error(std::string("RunDCSMagnetDat::fetchData(): ") + e.getMessage()));
135 #else
136  throw(std::runtime_error(std::string("RunDCSMagnetDat::fetchData(): error code ") +
137  std::to_string(e.getErrorCode())));
138 #endif
139  }
140 }
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
std::string to_string(const V &value)
Definition: OMSAccess.h:71
oracle::occi::ResultSet ResultSet
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSMagnetDat > *)
static std::vector< std::string > checklist dat
ResultSet * getMagnetRset()
tuple cout
Definition: gather_cfg.py:144
void RunDCSMagnetDat::fillTheMap ( ResultSet rset,
std::map< EcalLogicID, RunDCSMagnetDat > *  fillMap 
)
private

Definition at line 64 of file RunDCSMagnetDat.cc.

References gather_cfg::cout, dat, DateHandler::dateToTm(), cuy::dh, alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, setMagnetCurrent(), setTime(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

64  {
65  // method for last value queries
66 
67  std::pair<EcalLogicID, RunDCSMagnetDat> p;
70 
71  try {
72  while (rset->next()) {
73  p.first = EcalLogicID(rset->getString(1), // name
74  rset->getInt(2), // logic_id
75  rset->getInt(3), // id1
76  rset->getInt(4), // id2
77  rset->getInt(5), // id3
78  rset->getString(6)); // maps_to
79 
80  std::cout << "done the logic id" << std::endl;
81  dat.setMagnetCurrent(rset->getFloat(7));
82  std::cout << "done the magnet current" << std::endl;
83 
84  Date sinceDate = rset->getDate(8);
85  std::cout << "done the date" << std::endl;
86 
87  Tm sinceTm = dh.dateToTm(sinceDate);
88  dat.setTime(sinceTm);
89 
90  p.second = dat;
91  fillMap->insert(p);
92  }
93  } catch (SQLException& e) {
94 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
95  throw(std::runtime_error(std::string("RunDCSMagnetDat::fetchData(): ") + e.getMessage()));
96 #else
97  throw(std::runtime_error(std::string("RunDCSMagnetDat::fetchData(): error code ") +
98  std::to_string(e.getErrorCode())));
99 #endif
100  }
101 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
std::string to_string(const V &value)
Definition: OMSAccess.h:71
void setMagnetCurrent(float t)
static std::vector< std::string > checklist dat
void setTime(const Tm &start)
tuple cout
Definition: gather_cfg.py:144
Definition: Tm.h:13
tuple dh
Definition: cuy.py:354
std::string RunDCSMagnetDat::getMagnetAccount ( )
inline

Definition at line 25 of file RunDCSMagnetDat.h.

25 { return "CMS_DCS_ENV_PVSS_COND"; }
float RunDCSMagnetDat::getMagnetCurrent ( ) const
inline

Definition at line 27 of file RunDCSMagnetDat.h.

References m_current.

Referenced by popcon::EcalADCToGeVHandler::getNewObjects().

27 { return m_current; }
ResultSet * RunDCSMagnetDat::getMagnetRset ( )
private

Definition at line 41 of file RunDCSMagnetDat.cc.

References gather_cfg::cout, cuy::dh, alignCSCRings::e, contentValuesFiles::query, AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

41  {
43 
44  ResultSet* rset = nullptr;
45  string query = "SELECT c.name, c.logic_id, c.id1, c.id2, c.id3, c.maps_to , v.value_number, v.change_date from " +
47  ".CMSFWMAGNET_LV v, channelview c where v.dpe_name= 'CURRENT' and c.name=maps_to and c.name='EB' ";
48  try {
49  std::cout << "query:" << query << std::endl;
50 
51  m_readStmt->setSQL(query);
52  rset = m_readStmt->executeQuery();
53  } catch (SQLException& e) {
54 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0)
55  throw(std::runtime_error(std::string("RunDCSMagnetDat::getBarrelRset(): ") + e.getMessage() + " " + query));
56 #else
57  throw(std::runtime_error(std::string("RunDCSMagnetDat::getBarrelRset(): error code ") +
58  std::to_string(e.getErrorCode()) + " " + query));
59 #endif
60  }
61  return rset;
62 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
std::string getMagnetAccount()
std::string to_string(const V &value)
Definition: OMSAccess.h:71
oracle::occi::ResultSet ResultSet
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
tuple cout
Definition: gather_cfg.py:144
tuple dh
Definition: cuy.py:354
std::string RunDCSMagnetDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 24 of file RunDCSMagnetDat.h.

24 { return "CMSFWMAGNET_LV"; }
Tm RunDCSMagnetDat::getTime ( void  ) const

Definition at line 29 of file RunDCSMagnetDat.cc.

29 { return m_time; }
int RunDCSMagnetDat::nowMicroseconds ( )
private

Definition at line 103 of file RunDCSMagnetDat.cc.

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

103  {
104  Tm t_now_gmt;
105 
106  t_now_gmt.setToCurrentGMTime();
107  int t_now_gmt_micros = t_now_gmt.microsTime();
108  return t_now_gmt_micros;
109 }
void setToCurrentGMTime()
Definition: Tm.cc:141
uint64_t microsTime() const
Definition: Tm.cc:96
Definition: Tm.h:13
void RunDCSMagnetDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 31 of file RunDCSMagnetDat.cc.

31 {}
void RunDCSMagnetDat::setMagnetCurrent ( float  t)
inline

Definition at line 26 of file RunDCSMagnetDat.h.

References m_current, and submitPVValidationJobs::t.

Referenced by fillTheMap().

void RunDCSMagnetDat::setTime ( const Tm start)

Definition at line 27 of file RunDCSMagnetDat.cc.

References command_line::start.

Referenced by fillTheMap().

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

Definition at line 33 of file RunDCSMagnetDat.cc.

33 {}

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 19 of file RunDCSMagnetDat.h.

Member Data Documentation

float RunDCSMagnetDat::m_current
private

Definition at line 48 of file RunDCSMagnetDat.h.

Referenced by getMagnetCurrent(), and setMagnetCurrent().

Tm RunDCSMagnetDat::m_time
private

Definition at line 49 of file RunDCSMagnetDat.h.