CMS 3D CMS Logo

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 () override
 
 MonLaserStatusDat ()
 
void setLaserFanout (float p)
 
void setLaserFilter (float p)
 
void setLaserPower (float p)
 
void setLaserWavelength (float p)
 
 ~MonLaserStatusDat () 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, MonLaserStatusDat > *fillMap, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonLaserStatusDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonLaserStatusDat *item, MonRunIOV *iov) noexcept(false)
 

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

Constructor & Destructor Documentation

◆ MonLaserStatusDat()

MonLaserStatusDat::MonLaserStatusDat ( )

Definition at line 10 of file MonLaserStatusDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
16  m_laserPower = 0;
17  m_laserFilter = 0;
19  m_laserFanout = 0;
20 }
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

◆ ~MonLaserStatusDat()

MonLaserStatusDat::~MonLaserStatusDat ( )
override

Definition at line 22 of file MonLaserStatusDat.cc.

22 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 70 of file MonLaserStatusDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setLaserFanout(), setLaserFilter(), setLaserPower(), and setLaserWavelength().

70  {
71  this->checkConnection();
72  fillMap->clear();
73 
74  iov->setConnection(m_env, m_conn);
75  int iovID = iov->fetchID();
76  if (!iovID) {
77  // throw(std::runtime_error("MonLaserStatusDat::writeDB: IOV not in DB"));
78  return;
79  }
80 
81  try {
82  m_readStmt->setSQL(
83  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
84  "d.laser_power, d.laser_filter, d.laser_wavelength, d.laser_fanout "
85  "FROM channelview cv JOIN mon_laser_status_dat d "
86  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
87  "WHERE d.iov_id = :iov_id");
88  m_readStmt->setInt(1, iovID);
89  ResultSet* rset = m_readStmt->executeQuery();
90 
91  std::pair<EcalLogicID, MonLaserStatusDat> p;
93  while (rset->next()) {
94  p.first = EcalLogicID(rset->getString(1), // name
95  rset->getInt(2), // logic_id
96  rset->getInt(3), // id1
97  rset->getInt(4), // id2
98  rset->getInt(5), // id3
99  rset->getString(6)); // maps_to
100 
101  dat.setLaserPower(rset->getFloat(7));
102  dat.setLaserFilter(rset->getFloat(8));
103  dat.setLaserWavelength(rset->getFloat(9));
104  dat.setLaserFanout(rset->getFloat(10));
105 
106  p.second = dat;
107  fillMap->insert(p);
108  }
109  } catch (SQLException& e) {
110  throw(std::runtime_error("MonLaserStatusDat::fetchData(): " + e.getMessage()));
111  }
112 }
void setLaserFanout(float p)
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void setLaserFilter(float p)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void setLaserPower(float p)
void setLaserWavelength(float p)
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23

◆ getLaserFanout()

float MonLaserStatusDat::getLaserFanout ( ) const
inline

Definition at line 29 of file MonLaserStatusDat.h.

References m_laserFanout.

29 { return m_laserFanout; }

◆ getLaserFilter()

float MonLaserStatusDat::getLaserFilter ( ) const
inline

Definition at line 23 of file MonLaserStatusDat.h.

References m_laserFilter.

23 { return m_laserFilter; }

◆ getLaserPower()

float MonLaserStatusDat::getLaserPower ( ) const
inline

Definition at line 20 of file MonLaserStatusDat.h.

References m_laserPower.

20 { return m_laserPower; }

◆ getLaserWavelength()

float MonLaserStatusDat::getLaserWavelength ( ) const
inline

Definition at line 26 of file MonLaserStatusDat.h.

References m_laserWavelength.

26 { return m_laserWavelength; }

◆ getTable()

std::string MonLaserStatusDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file MonLaserStatusDat.h.

18 { return "MON_LASER_STATUS_DAT"; }

◆ prepareWrite()

void MonLaserStatusDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 24 of file MonLaserStatusDat.cc.

References MillePedeFileConverter_cfg::e.

24  {
25  this->checkConnection();
26 
27  try {
28  m_writeStmt = m_conn->createStatement();
29  m_writeStmt->setSQL(
30  "INSERT INTO mon_laser_status_dat (iov_id, logic_id, "
31  "laser_power, laser_filter, laser_wavelength, laser_fanout) "
32  "VALUES (:iov_id, :logic_id, "
33  ":3, :4, :5, :6)");
34  } catch (SQLException& e) {
35  throw(std::runtime_error("MonLaserStatusDat::prepareWrite(): " + e.getMessage()));
36  }
37 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36

◆ setLaserFanout()

void MonLaserStatusDat::setLaserFanout ( float  p)
inline

◆ setLaserFilter()

void MonLaserStatusDat::setLaserFilter ( float  p)
inline

◆ setLaserPower()

void MonLaserStatusDat::setLaserPower ( float  p)
inline

◆ setLaserWavelength()

void MonLaserStatusDat::setLaserWavelength ( float  p)
inline

◆ writeArrayDB()

void MonLaserStatusDat::writeArrayDB ( const std::map< EcalLogicID, MonLaserStatusDat > *  data,
MonRunIOV iov 
)
privatenoexcept

◆ writeDB()

void MonLaserStatusDat::writeDB ( const EcalLogicID ecid,
const MonLaserStatusDat item,
MonRunIOV iov 
)
privatenoexcept

Definition at line 39 of file MonLaserStatusDat.cc.

References MillePedeFileConverter_cfg::e, and B2GTnPMonitor_cfi::item.

41  {
42  this->checkConnection();
43  this->checkPrepare();
44 
45  int iovID = iov->fetchID();
46  if (!iovID) {
47  throw(std::runtime_error("MonLaserStatusDat::writeDB: IOV not in DB"));
48  }
49 
50  int logicID = ecid->getLogicID();
51  if (!logicID) {
52  throw(std::runtime_error("MonLaserStatusDat::writeDB: Bad EcalLogicID"));
53  }
54 
55  try {
56  m_writeStmt->setInt(1, iovID);
57  m_writeStmt->setInt(2, logicID);
58 
59  m_writeStmt->setFloat(3, item->getLaserPower());
60  m_writeStmt->setFloat(4, item->getLaserFilter());
61  m_writeStmt->setFloat(5, item->getLaserWavelength());
62  m_writeStmt->setFloat(6, item->getLaserFanout());
63 
64  m_writeStmt->executeUpdate();
65  } catch (SQLException& e) {
66  throw(std::runtime_error("MonLaserStatusDat::writeDB(): " + e.getMessage()));
67  }
68 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
int getLogicID() const
Definition: EcalLogicID.cc:28

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file MonLaserStatusDat.h.

Member Data Documentation

◆ m_laserFanout

float MonLaserStatusDat::m_laserFanout
private

Definition at line 44 of file MonLaserStatusDat.h.

Referenced by getLaserFanout(), and setLaserFanout().

◆ m_laserFilter

float MonLaserStatusDat::m_laserFilter
private

Definition at line 42 of file MonLaserStatusDat.h.

Referenced by getLaserFilter(), and setLaserFilter().

◆ m_laserPower

float MonLaserStatusDat::m_laserPower
private

Definition at line 41 of file MonLaserStatusDat.h.

Referenced by getLaserPower(), and setLaserPower().

◆ m_laserWavelength

float MonLaserStatusDat::m_laserWavelength
private

Definition at line 43 of file MonLaserStatusDat.h.

Referenced by getLaserWavelength(), and setLaserWavelength().