CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
MonLaserStatusDat Class Reference

#include <MonLaserStatusDat.h>

Inheritance diagram for MonLaserStatusDat:
IDataItem IDBObject

Public Member Functions

float getLaserFanout () const
 
float getLaserFilter () const
 
float getLaserPower () const
 
float getLaserWavelength () const
 
std::string getTable ()
 
 MonLaserStatusDat ()
 
void setLaserFanout (float p)
 
void setLaserFilter (float p)
 
void setLaserPower (float p)
 
void setLaserWavelength (float p)
 
 ~MonLaserStatusDat ()
 
- 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, MonLaserStatusDat > *fillMap, MonRunIOV *iov) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, MonLaserStatusDat > *data, MonRunIOV *iov) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const MonLaserStatusDat *item, MonRunIOV *iov) throw (std::runtime_error)
 

Private Attributes

float m_laserFanout
 
float m_laserFilter
 
float m_laserPower
 
float m_laserWavelength
 

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 11 of file MonLaserStatusDat.h.

Constructor & Destructor Documentation

MonLaserStatusDat::MonLaserStatusDat ( )

Definition at line 10 of file MonLaserStatusDat.cc.

References NULL.

11 {
12  m_env = NULL;
13  m_conn = NULL;
14  m_writeStmt = NULL;
15  m_readStmt = NULL;
16 
17  m_laserPower = 0;
18  m_laserFilter = 0;
20  m_laserFanout = 0;
21 }
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
MonLaserStatusDat::~MonLaserStatusDat ( )

Definition at line 25 of file MonLaserStatusDat.cc.

26 {
27 }

Member Function Documentation

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

Definition at line 78 of file MonLaserStatusDat.cc.

References alignCSCRings::e, edm::pset::fillMap(), o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setLaserFanout(), setLaserFilter(), setLaserPower(), and setLaserWavelength().

80 {
81  this->checkConnection();
82  fillMap->clear();
83 
84  iov->setConnection(m_env, m_conn);
85  int iovID = iov->fetchID();
86  if (!iovID) {
87  // throw(std::runtime_error("MonLaserStatusDat::writeDB: IOV not in DB"));
88  return;
89  }
90 
91  try {
92 
93  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
94  "d.laser_power, d.laser_filter, d.laser_wavelength, d.laser_fanout "
95  "FROM channelview cv JOIN mon_laser_status_dat d "
96  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
97  "WHERE d.iov_id = :iov_id");
98  m_readStmt->setInt(1, iovID);
99  ResultSet* rset = m_readStmt->executeQuery();
100 
101  std::pair< EcalLogicID, MonLaserStatusDat > p;
102  MonLaserStatusDat dat;
103  while(rset->next()) {
104  p.first = EcalLogicID( rset->getString(1), // name
105  rset->getInt(2), // logic_id
106  rset->getInt(3), // id1
107  rset->getInt(4), // id2
108  rset->getInt(5), // id3
109  rset->getString(6)); // maps_to
110 
111  dat.setLaserPower( rset->getFloat(7) );
112  dat.setLaserFilter( rset->getFloat(8) );
113  dat.setLaserWavelength( rset->getFloat(9) );
114  dat.setLaserFanout( rset->getFloat(10) );
115 
116  p.second = dat;
117  fillMap->insert(p);
118  }
119  } catch (SQLException &e) {
120  throw(std::runtime_error("MonLaserStatusDat::fetchData(): "+e.getMessage()));
121  }
122 }
void setLaserFanout(float p)
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setLaserFilter(float p)
void setLaserPower(float p)
void setLaserWavelength(float p)
int fetchID()
Definition: MonRunIOV.cc:118
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
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void fillMap(Registry *reg, regmap_type &fillme)
Definition: Registry.cc:24
void checkConnection() const
Definition: IDBObject.h:41
float MonLaserStatusDat::getLaserFanout ( ) const
inline

Definition at line 29 of file MonLaserStatusDat.h.

References m_laserFanout.

29 { return m_laserFanout; }
float MonLaserStatusDat::getLaserFilter ( ) const
inline

Definition at line 23 of file MonLaserStatusDat.h.

References m_laserFilter.

23 { return m_laserFilter; }
float MonLaserStatusDat::getLaserPower ( ) const
inline

Definition at line 20 of file MonLaserStatusDat.h.

References m_laserPower.

20 { return m_laserPower; }
float MonLaserStatusDat::getLaserWavelength ( ) const
inline

Definition at line 26 of file MonLaserStatusDat.h.

References m_laserWavelength.

26 { return m_laserWavelength; }
std::string MonLaserStatusDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file MonLaserStatusDat.h.

18 { return "MON_LASER_STATUS_DAT"; }
void MonLaserStatusDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 31 of file MonLaserStatusDat.cc.

References alignCSCRings::e.

33 {
34  this->checkConnection();
35 
36  try {
37  m_writeStmt = m_conn->createStatement();
38  m_writeStmt->setSQL("INSERT INTO mon_laser_status_dat (iov_id, logic_id, "
39  "laser_power, laser_filter, laser_wavelength, laser_fanout) "
40  "VALUES (:iov_id, :logic_id, "
41  ":3, :4, :5, :6)");
42  } catch (SQLException &e) {
43  throw(std::runtime_error("MonLaserStatusDat::prepareWrite(): "+e.getMessage()));
44  }
45 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void checkConnection() const
Definition: IDBObject.h:41
void MonLaserStatusDat::setLaserFanout ( float  p)
inline
void MonLaserStatusDat::setLaserFilter ( float  p)
inline
void MonLaserStatusDat::setLaserPower ( float  p)
inline
void MonLaserStatusDat::setLaserWavelength ( float  p)
inline
void MonLaserStatusDat::writeArrayDB ( const std::map< EcalLogicID, MonLaserStatusDat > *  data,
MonRunIOV iov 
)
throw (std::runtime_error
)
private
void MonLaserStatusDat::writeDB ( const EcalLogicID ecid,
const MonLaserStatusDat item,
MonRunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 49 of file MonLaserStatusDat.cc.

References alignCSCRings::e, and o2o::iov.

51 {
52  this->checkConnection();
53  this->checkPrepare();
54 
55  int iovID = iov->fetchID();
56  if (!iovID) { throw(std::runtime_error("MonLaserStatusDat::writeDB: IOV not in DB")); }
57 
58  int logicID = ecid->getLogicID();
59  if (!logicID) { throw(std::runtime_error("MonLaserStatusDat::writeDB: Bad EcalLogicID")); }
60 
61  try {
62  m_writeStmt->setInt(1, iovID);
63  m_writeStmt->setInt(2, logicID);
64 
65  m_writeStmt->setFloat(3, item->getLaserPower() );
66  m_writeStmt->setFloat(4, item->getLaserFilter() );
67  m_writeStmt->setFloat(5, item->getLaserWavelength() );
68  m_writeStmt->setFloat(6, item->getLaserFanout() );
69 
70  m_writeStmt->executeUpdate();
71  } catch (SQLException &e) {
72  throw(std::runtime_error("MonLaserStatusDat::writeDB(): "+e.getMessage()));
73  }
74 }
float getLaserWavelength() const
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
float getLaserPower() const
int fetchID()
Definition: MonRunIOV.cc:118
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
float getLaserFilter() const
int getLogicID() const
Definition: EcalLogicID.cc:42
void checkPrepare()
Definition: IDataItem.h:27
float getLaserFanout() const
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file MonLaserStatusDat.h.

Member Data Documentation

float MonLaserStatusDat::m_laserFanout
private

Definition at line 48 of file MonLaserStatusDat.h.

Referenced by getLaserFanout(), and setLaserFanout().

float MonLaserStatusDat::m_laserFilter
private

Definition at line 46 of file MonLaserStatusDat.h.

Referenced by getLaserFilter(), and setLaserFilter().

float MonLaserStatusDat::m_laserPower
private

Definition at line 45 of file MonLaserStatusDat.h.

Referenced by getLaserPower(), and setLaserPower().

float MonLaserStatusDat::m_laserWavelength
private

Definition at line 47 of file MonLaserStatusDat.h.

Referenced by getLaserWavelength(), and setLaserWavelength().