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 | 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 ()
 
Tm getTime () const
 
 RunDCSMagnetDat ()
 
void setMagnetCurrent (float t)
 
void setTime (Tm start)
 
 ~RunDCSMagnetDat ()
 
- 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) throw (std::runtime_error)
 
void fetchLastData (std::map< EcalLogicID, RunDCSMagnetDat > *fillMap) throw (std::runtime_error)
 
void fillTheMap (ResultSet *, std::map< EcalLogicID, RunDCSMagnetDat > *)
 
ResultSetgetMagnetRset ()
 
int nowMicroseconds ()
 
void prepareWrite () throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const RunDCSMagnetDat *item, RunIOV *iov) throw (std::runtime_error)
 

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 () 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 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.

References NULL.

16 {
17  m_env = NULL;
18  m_conn = NULL;
19  m_writeStmt = NULL;
20  m_readStmt = NULL;
21 
22  m_current = 0;
23  m_time=Tm();
24 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:25
Definition: Tm.h:14
RunDCSMagnetDat::~RunDCSMagnetDat ( )

Definition at line 28 of file RunDCSMagnetDat.cc.

29 {
30 }

Member Function Documentation

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

Definition at line 62 of file RunDCSMagnetDat.cc.

References gather_cfg::cout, and edm::pset::fillMap().

64 {
65 
66  std::cout<<"going to call fetchLastData"<<std::endl;
68  std::cout<<"returned from fetchLastData"<<std::endl;
69 
70 }
void fetchLastData(std::map< EcalLogicID, RunDCSMagnetDat > *fillMap)
tuple cout
Definition: gather_cfg.py:41
void fillMap(Registry *reg, regmap_type &fillme)
Definition: Registry.cc:24
void RunDCSMagnetDat::fetchLastData ( std::map< EcalLogicID, RunDCSMagnetDat > *  fillMap)
throw (std::runtime_error
)
private

Definition at line 145 of file RunDCSMagnetDat.cc.

References gather_cfg::cout, edm::pset::fillMap(), and L1TEmulatorMonitor_cff::p.

147 {
148  this->checkConnection();
149 
150  std::cout<<"fetchLastData>>1"<<std::endl;
151 
152  fillMap->clear();
153 
154  std::cout<<"fetchLastData>>2"<<std::endl;
155 
156 
157  try {
158  std::pair< EcalLogicID, RunDCSMagnetDat > p;
159  RunDCSMagnetDat dat;
160  std::cout<<"fetchLastData>>3"<<std::endl;
161 
162  ResultSet* rset = getMagnetRset();
163 
164  std::cout<<"fetchLastData>>4"<<std::endl;
165 
166  fillTheMap(rset, fillMap);
167  std::cout<<"fetchLastData>>5"<<std::endl;
168 
169 
170  }
171  catch (SQLException &e) {
172  throw(std::runtime_error("RunDCSMagnetDat::fetchData(): "+e.getMessage()));
173  }
174 }
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSMagnetDat > *)
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
ResultSet * getMagnetRset()
tuple cout
Definition: gather_cfg.py:41
void fillMap(Registry *reg, regmap_type &fillme)
Definition: Registry.cc:24
void checkConnection() const
Definition: IDBObject.h:41
void RunDCSMagnetDat::fillTheMap ( ResultSet rset,
std::map< EcalLogicID, RunDCSMagnetDat > *  fillMap 
)
private

Definition at line 95 of file RunDCSMagnetDat.cc.

References gather_cfg::cout, DateHandler::dateToTm(), L1TEmulatorMonitor_cff::p, setMagnetCurrent(), and setTime().

96  {
97 
98  // method for last value queries
99 
100  std::pair< EcalLogicID, RunDCSMagnetDat > p;
101  RunDCSMagnetDat dat;
102  DateHandler dh(m_env, m_conn);
103 
104  try {
105  while(rset->next()) {
106  p.first = EcalLogicID( rset->getString(1), // name
107  rset->getInt(2), // logic_id
108  rset->getInt(3), // id1
109  rset->getInt(4), // id2
110  rset->getInt(5), // id3
111  rset->getString(6)); // maps_to
112 
113  std::cout<<"done the logic id"<<std::endl;
114  dat.setMagnetCurrent( rset->getFloat(7) );
115  std::cout<<"done the magnet current"<<std::endl;
116 
117  Date sinceDate = rset->getDate(8);
118  std::cout<<"done the date"<<std::endl;
119 
120  Tm sinceTm = dh.dateToTm( sinceDate );
121  dat.setTime(sinceTm);
122 
123  p.second = dat;
124  fillMap->insert(p);
125  }
126  }
127  catch (SQLException &e) {
128  throw(std::runtime_error("RunDCSMagnetDat::fetchData(): "+e.getMessage()));
129  }
130 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void setTime(Tm start)
void setMagnetCurrent(float t)
tuple cout
Definition: gather_cfg.py:41
void fillMap(Registry *reg, regmap_type &fillme)
Definition: Registry.cc:24
Definition: Tm.h:14
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::EcalIntercalibHandler::getNewObjects().

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

Definition at line 73 of file RunDCSMagnetDat.cc.

References gather_cfg::cout, NULL, and o2o::query.

73  {
74 
76 
77  ResultSet* rset = NULL;
78  string query="SELECT c.name, c.logic_id, c.id1, c.id2, c.id3, c.maps_to , v.value_number, v.change_date from "+ getMagnetAccount()+
79  ".CMSFWMAGNET_LV v, channelview c where v.dpe_name= 'CURRENT' and c.name=maps_to and c.name='EB' " ;
80  try {
81 
82  std::cout<<"query:"<<query<<std::endl;
83 
84  m_readStmt->setSQL(query);
85  rset = m_readStmt->executeQuery();
86  }
87  catch (SQLException e) {
88  throw(std::runtime_error("RunDCSMagnetDat::getBarrelRset(): " + e.getMessage() + " " + query));
89  }
90  return rset;
91 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string getMagnetAccount()
#define NULL
Definition: scimark2.h:8
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:25
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
tuple query
Definition: o2o.py:269
tuple cout
Definition: gather_cfg.py:41
std::string RunDCSMagnetDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 24 of file RunDCSMagnetDat.h.

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

Definition at line 37 of file RunDCSMagnetDat.cc.

38 {
39  return m_time;
40 }
int RunDCSMagnetDat::nowMicroseconds ( )
private

Definition at line 135 of file RunDCSMagnetDat.cc.

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

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:156
uint64_t microsTime() const
Definition: Tm.cc:109
Definition: Tm.h:14
void RunDCSMagnetDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 46 of file RunDCSMagnetDat.cc.

48 {
49 
50 
51 }
void RunDCSMagnetDat::setMagnetCurrent ( float  t)
inline

Definition at line 26 of file RunDCSMagnetDat.h.

References m_current, and matplotRender::t.

Referenced by fillTheMap().

26 { m_current = t; }
void RunDCSMagnetDat::setTime ( Tm  start)

Definition at line 32 of file RunDCSMagnetDat.cc.

Referenced by fillTheMap().

33 {
34  m_time = start;
35 }
void RunDCSMagnetDat::writeDB ( const EcalLogicID ecid,
const RunDCSMagnetDat item,
RunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 55 of file RunDCSMagnetDat.cc.

57 {
58 }

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 53 of file RunDCSMagnetDat.h.

Referenced by getMagnetCurrent(), and setMagnetCurrent().

Tm RunDCSMagnetDat::m_time
private

Definition at line 54 of file RunDCSMagnetDat.h.