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

Definition at line 11 of file RunLaserRunDat.cc.

12 {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_laserSeqType = "";
17  m_laserSeqCond = "";
18 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string m_laserSeqCond
std::string m_laserSeqType
RunLaserRunDat::~RunLaserRunDat ( )
override

Definition at line 22 of file RunLaserRunDat.cc.

23 {
24 }

Member Function Documentation

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

Definition at line 72 of file RunLaserRunDat.cc.

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

Referenced by getLaserSequenceCond().

74 {
75  this->checkConnection();
76  fillMap->clear();
77 
78  iov->setConnection(m_env, m_conn);
79  int iovID = iov->fetchID();
80  if (!iovID) {
81  // throw(std::runtime_error("RunLaserRunDat::writeDB: IOV not in DB"));
82  return;
83  }
84 
85  try {
86  Statement* stmt = m_conn->createStatement();
87  stmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
88  "d.laser_sequence_type, d.laser_sequence_cond "
89  "FROM channelview cv JOIN run_laserrun_config_dat d "
90  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
91  "WHERE d.iov_id = :iov_id");
92  stmt->setInt(1, iovID);
93  ResultSet* rset = stmt->executeQuery();
94 
95  std::pair< EcalLogicID, RunLaserRunDat > p;
96  RunLaserRunDat dat;
97  while(rset->next()) {
98  p.first = EcalLogicID( getOraString(rset,1), // name
99  rset->getInt(2), // logic_id
100  rset->getInt(3), // id1
101  rset->getInt(4), // id2
102  rset->getInt(5), // id3
103  getOraString(rset,6)); // maps_to
104 
105  dat.setLaserSequenceType( getOraString(rset,7)); // maps_to
106  dat.setLaserSequenceCond( getOraString(rset,8)); // maps_to
107 
108  p.second = dat;
109  fillMap->insert(p);
110  }
111  m_conn->terminateStatement(stmt);
112  } catch (SQLException &e) {
113  throw(std::runtime_error(std::string("RunLaserRunDat::fetchData(): ")+getOraMessage(&e)));
114  }
115 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
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:103
std::string RunLaserRunDat::getLaserSequenceCond ( ) const
inline

Definition at line 24 of file RunLaserRunDat.h.

References fetchData(), m_laserSeqCond, noexcept, prepareWrite(), and writeDB().

24 { return m_laserSeqCond; }
std::string m_laserSeqCond
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
std::string RunLaserRunDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file RunLaserRunDat.h.

18 { return "RUN_LASERRUN_CONFIG_DAT"; }
void RunLaserRunDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 28 of file RunLaserRunDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getLaserSequenceCond().

30 {
31  this->checkConnection();
32 
33  try {
34  m_writeStmt = m_conn->createStatement();
35  m_writeStmt->setSQL("INSERT INTO run_laserrun_config_dat (iov_id, logic_id, "
36  "laser_sequence_type, laser_sequence_cond) "
37  "VALUES (:1, :2, "
38  ":3, :4 )");
39  } catch (SQLException &e) {
40  throw(std::runtime_error(std::string("RunLaserRunDat::prepareWrite(): ")+getOraMessage(&e)));
41  }
42 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
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
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
void RunLaserRunDat::writeDB ( const EcalLogicID ecid,
const RunLaserRunDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 46 of file RunLaserRunDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getLaserSequenceCond().

48 {
49  this->checkConnection();
50  this->checkPrepare();
51 
52  int iovID = iov->fetchID();
53  if (!iovID) { throw(std::runtime_error("RunLaserRunDat::writeDB: IOV not in DB")); }
54 
55  int logicID = ecid->getLogicID();
56  if (!logicID) { throw(std::runtime_error("RunLaserRunDat::writeDB: Bad EcalLogicID")); }
57 
58  try {
59  m_writeStmt->setInt(1, iovID);
60  m_writeStmt->setInt(2, logicID);
61  m_writeStmt->setString(3, item->getLaserSequenceType());
62  m_writeStmt->setString(4, item->getLaserSequenceCond());
63 
64  m_writeStmt->executeUpdate();
65  } catch (SQLException &e) {
66  throw(std::runtime_error(std::string("RunLaserRunDat::writeDB(): ")+getOraMessage(&e)));
67  }
68 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
std::string getLaserSequenceCond() const
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
std::string getLaserSequenceType() const
int getLogicID() const
Definition: EcalLogicID.cc:41
int fetchID() noexcept(false) override
Definition: RunIOV.cc:103

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file RunLaserRunDat.h.

Member Data Documentation

std::string RunLaserRunDat::m_laserSeqCond
private

Definition at line 38 of file RunLaserRunDat.h.

Referenced by getLaserSequenceCond(), and setLaserSequenceCond().

std::string RunLaserRunDat::m_laserSeqType
private

Definition at line 37 of file RunLaserRunDat.h.

Referenced by getLaserSequenceType(), and setLaserSequenceType().