CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
RunLaserRunDat Class Reference

#include <RunLaserRunDat.h>

Inheritance diagram for RunLaserRunDat:
IDataItem IDBObject

Public Member Functions

std::string getLaserSequenceCond () const
 
std::string getLaserSequenceType () const
 
std::string getTable () override
 
 RunLaserRunDat ()
 
void setLaserSequenceCond (std::string x)
 
void setLaserSequenceType (std::string x)
 
 ~RunLaserRunDat () 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, RunLaserRunDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunLaserRunDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

std::string m_laserSeqCond
 
std::string m_laserSeqType
 

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 RunLaserRunDat.h.

Constructor & Destructor Documentation

◆ RunLaserRunDat()

RunLaserRunDat::RunLaserRunDat ( )

Definition at line 11 of file RunLaserRunDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_laserSeqType = "";
16  m_laserSeqCond = "";
17 }
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
std::string m_laserSeqCond
std::string m_laserSeqType

◆ ~RunLaserRunDat()

RunLaserRunDat::~RunLaserRunDat ( )
override

Definition at line 19 of file RunLaserRunDat.cc.

19 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 62 of file RunLaserRunDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setLaserSequenceCond(), and setLaserSequenceType().

62  {
63  this->checkConnection();
64  fillMap->clear();
65 
66  iov->setConnection(m_env, m_conn);
67  int iovID = iov->fetchID();
68  if (!iovID) {
69  // throw(std::runtime_error("RunLaserRunDat::writeDB: IOV not in DB"));
70  return;
71  }
72 
73  try {
74  Statement* stmt = m_conn->createStatement();
75  stmt->setSQL(
76  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
77  "d.laser_sequence_type, d.laser_sequence_cond "
78  "FROM channelview cv JOIN run_laserrun_config_dat d "
79  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
80  "WHERE d.iov_id = :iov_id");
81  stmt->setInt(1, iovID);
82  ResultSet* rset = stmt->executeQuery();
83 
84  std::pair<EcalLogicID, RunLaserRunDat> p;
85  RunLaserRunDat dat;
86  while (rset->next()) {
87  p.first = EcalLogicID(rset->getString(1), // name
88  rset->getInt(2), // logic_id
89  rset->getInt(3), // id1
90  rset->getInt(4), // id2
91  rset->getInt(5), // id3
92  rset->getString(6)); // maps_to
93 
94  dat.setLaserSequenceType(rset->getString(7)); // maps_to
95  dat.setLaserSequenceCond(rset->getString(8)); // maps_to
96 
97  p.second = dat;
98  fillMap->insert(p);
99  }
100  m_conn->terminateStatement(stmt);
101  } catch (SQLException& e) {
102  throw(std::runtime_error("RunLaserRunDat::fetchData(): " + e.getMessage()));
103  }
104 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void setLaserSequenceCond(std::string x)
void setLaserSequenceType(std::string x)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int fetchID() noexcept(false) override
Definition: RunIOV.cc:60

◆ getLaserSequenceCond()

std::string RunLaserRunDat::getLaserSequenceCond ( ) const
inline

Definition at line 24 of file RunLaserRunDat.h.

References m_laserSeqCond.

24 { return m_laserSeqCond; }
std::string m_laserSeqCond

◆ getLaserSequenceType()

std::string RunLaserRunDat::getLaserSequenceType ( ) const
inline

Definition at line 21 of file RunLaserRunDat.h.

References m_laserSeqType.

21 { return m_laserSeqType; }
std::string m_laserSeqType

◆ getTable()

std::string RunLaserRunDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file RunLaserRunDat.h.

18 { return "RUN_LASERRUN_CONFIG_DAT"; }

◆ prepareWrite()

void RunLaserRunDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 21 of file RunLaserRunDat.cc.

References MillePedeFileConverter_cfg::e.

21  {
22  this->checkConnection();
23 
24  try {
25  m_writeStmt = m_conn->createStatement();
26  m_writeStmt->setSQL(
27  "INSERT INTO run_laserrun_config_dat (iov_id, logic_id, "
28  "laser_sequence_type, laser_sequence_cond) "
29  "VALUES (:1, :2, "
30  ":3, :4 )");
31  } catch (SQLException& e) {
32  throw(std::runtime_error("RunLaserRunDat::prepareWrite(): " + e.getMessage()));
33  }
34 }
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

◆ setLaserSequenceCond()

void RunLaserRunDat::setLaserSequenceCond ( std::string  x)
inline

Definition at line 23 of file RunLaserRunDat.h.

References m_laserSeqCond, and x.

Referenced by fetchData().

23 { m_laserSeqCond = x; }
std::string m_laserSeqCond

◆ setLaserSequenceType()

void RunLaserRunDat::setLaserSequenceType ( std::string  x)
inline

Definition at line 20 of file RunLaserRunDat.h.

References m_laserSeqType, and x.

Referenced by fetchData().

20 { m_laserSeqType = x; }
std::string m_laserSeqType

◆ writeDB()

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

Definition at line 36 of file RunLaserRunDat.cc.

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

36  {
37  this->checkConnection();
38  this->checkPrepare();
39 
40  int iovID = iov->fetchID();
41  if (!iovID) {
42  throw(std::runtime_error("RunLaserRunDat::writeDB: IOV not in DB"));
43  }
44 
45  int logicID = ecid->getLogicID();
46  if (!logicID) {
47  throw(std::runtime_error("RunLaserRunDat::writeDB: Bad EcalLogicID"));
48  }
49 
50  try {
51  m_writeStmt->setInt(1, iovID);
52  m_writeStmt->setInt(2, logicID);
53  m_writeStmt->setString(3, item->getLaserSequenceType());
54  m_writeStmt->setString(4, item->getLaserSequenceCond());
55 
56  m_writeStmt->executeUpdate();
57  } catch (SQLException& e) {
58  throw(std::runtime_error("RunLaserRunDat::writeDB(): " + e.getMessage()));
59  }
60 }
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 getLogicID() const
Definition: EcalLogicID.cc:28
int fetchID() noexcept(false) override
Definition: RunIOV.cc:60

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file RunLaserRunDat.h.

Member Data Documentation

◆ m_laserSeqCond

std::string RunLaserRunDat::m_laserSeqCond
private

Definition at line 35 of file RunLaserRunDat.h.

Referenced by getLaserSequenceCond(), and setLaserSequenceCond().

◆ m_laserSeqType

std::string RunLaserRunDat::m_laserSeqType
private

Definition at line 34 of file RunLaserRunDat.h.

Referenced by getLaserSequenceType(), and setLaserSequenceType().