CMS 3D CMS Logo

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

#include <RunFEConfigDat.h>

Inheritance diagram for RunFEConfigDat:
IDataItem IDBObject

Public Member Functions

int getConfigId () const
 
std::list< ODDelaysDatgetDelays ()
 
std::string getTable () override
 
 RunFEConfigDat ()
 
void setConfigId (int x)
 
 ~RunFEConfigDat () 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, RunFEConfigDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunFEConfigDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

int m_config
 

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 12 of file RunFEConfigDat.h.

Constructor & Destructor Documentation

◆ RunFEConfigDat()

RunFEConfigDat::RunFEConfigDat ( )

Definition at line 11 of file RunFEConfigDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_config = 0;
18 }

◆ ~RunFEConfigDat()

RunFEConfigDat::~RunFEConfigDat ( )
override

Definition at line 20 of file RunFEConfigDat.cc.

20 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 62 of file RunFEConfigDat.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("RunFEConfigDat::writeDB: IOV not in DB"));
70  return;
71  }
72 
73  try {
74  // createReadStatement();
75  // m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
76  Statement* stmt = m_conn->createStatement();
77  stmt->setSQL(
78  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
79  "d.Config_id "
80  "FROM channelview cv JOIN run_FEConfig_dat d "
81  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
82  "WHERE d.iov_id = :iov_id");
83  stmt->setInt(1, iovID);
84  // m_readStmt->setInt(1, iovID);
85  // ResultSet* rset = m_readStmt->executeQuery();
86  ResultSet* rset = stmt->executeQuery();
87 
88  std::pair<EcalLogicID, RunFEConfigDat> p;
89  RunFEConfigDat dat;
90  while (rset->next()) {
91  p.first = EcalLogicID(rset->getString(1), // name
92  rset->getInt(2), // logic_id
93  rset->getInt(3), // id1
94  rset->getInt(4), // id2
95  rset->getInt(5), // id3
96  rset->getString(6)); // maps_to
97 
98  dat.setConfigId(rset->getInt(7));
99 
100  p.second = dat;
101  fillMap->insert(p);
102  }
103  // terminateReadStatement();
104  m_conn->terminateStatement(stmt);
105  } catch (SQLException& e) {
106  throw(std::runtime_error("RunFEConfigDat::fetchData(): " + e.getMessage()));
107  }
108 }

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, and setConfigId().

◆ getConfigId()

int RunFEConfigDat::getConfigId ( ) const
inline

◆ getDelays()

std::list<ODDelaysDat> RunFEConfigDat::getDelays ( )

◆ getTable()

std::string RunFEConfigDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file RunFEConfigDat.h.

19 { return "RUN_FECONFIG_DAT"; }

◆ prepareWrite()

void RunFEConfigDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 22 of file RunFEConfigDat.cc.

22  {
23  this->checkConnection();
24 
25  try {
26  m_writeStmt = m_conn->createStatement();
27  m_writeStmt->setSQL(
28  "INSERT INTO run_FEConfig_dat (iov_id, logic_id, "
29  "Config_id ) "
30  "VALUES (:iov_id, :logic_id, "
31  ":Config_id ) ");
32  } catch (SQLException& e) {
33  throw(std::runtime_error("RunFEConfigDat::prepareWrite(): " + e.getMessage()));
34  }
35 }

References MillePedeFileConverter_cfg::e.

◆ setConfigId()

void RunFEConfigDat::setConfigId ( int  x)
inline

Definition at line 22 of file RunFEConfigDat.h.

22 { m_config = x; }

References m_config, and x.

Referenced by fetchData().

◆ writeDB()

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

Definition at line 37 of file RunFEConfigDat.cc.

37  {
38  this->checkConnection();
39  this->checkPrepare();
40 
41  int iovID = iov->fetchID();
42  if (!iovID) {
43  throw(std::runtime_error("RunFEConfigDat::writeDB: IOV not in DB"));
44  }
45 
46  int logicID = ecid->getLogicID();
47  if (!logicID) {
48  throw(std::runtime_error("RunFEConfigDat::writeDB: Bad EcalLogicID"));
49  }
50 
51  try {
52  m_writeStmt->setInt(1, iovID);
53  m_writeStmt->setInt(2, logicID);
54  m_writeStmt->setInt(3, item->getConfigId());
55 
56  m_writeStmt->executeUpdate();
57  } catch (SQLException& e) {
58  throw(std::runtime_error("RunFEConfigDat::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 14 of file RunFEConfigDat.h.

Member Data Documentation

◆ m_config

int RunFEConfigDat::m_config
private

Definition at line 35 of file RunFEConfigDat.h.

Referenced by getConfigId(), and setConfigId().

IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
RunFEConfigDat::m_config
int m_config
Definition: RunFEConfigDat.h:35
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
RunFEConfigDat::setConfigId
void setConfigId(int x)
Definition: RunFEConfigDat.h:22
EcalLogicID
Definition: EcalLogicID.h:7
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RunFEConfigDat
Definition: RunFEConfigDat.h:12
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
RunIOV::fetchID
int fetchID() noexcept(false) override
Definition: RunIOV.cc:60
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
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37