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 const int 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 }

◆ ~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.

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 }

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

◆ getLaserSequenceCond()

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

Definition at line 24 of file RunLaserRunDat.h.

24 { return m_laserSeqCond; }

References m_laserSeqCond.

◆ getLaserSequenceType()

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

Definition at line 21 of file RunLaserRunDat.h.

21 { return m_laserSeqType; }

References 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.

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 }

References MillePedeFileConverter_cfg::e.

◆ setLaserSequenceCond()

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

Definition at line 23 of file RunLaserRunDat.h.

23 { m_laserSeqCond = x; }

References m_laserSeqCond, and x.

Referenced by fetchData().

◆ setLaserSequenceType()

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

Definition at line 20 of file RunLaserRunDat.h.

20 { m_laserSeqType = x; }

References m_laserSeqType, and x.

Referenced by fetchData().

◆ writeDB()

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

Definition at line 36 of file RunLaserRunDat.cc.

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 }

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

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

RunLaserRunDat::m_laserSeqCond
std::string m_laserSeqCond
Definition: RunLaserRunDat.h:35
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
RunLaserRunDat
Definition: RunLaserRunDat.h:11
EcalLogicID
Definition: EcalLogicID.h:7
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
RunIOV::fetchID
int fetchID() noexcept(false) override
Definition: RunIOV.cc:60
RunLaserRunDat::setLaserSequenceType
void setLaserSequenceType(std::string x)
Definition: RunLaserRunDat.h:20
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
RunLaserRunDat::m_laserSeqType
std::string m_laserSeqType
Definition: RunLaserRunDat.h:34
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
RunLaserRunDat::setLaserSequenceCond
void setLaserSequenceCond(std::string x)
Definition: RunLaserRunDat.h:23