CMS 3D CMS Logo

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

#include <RunConfigDat.h>

Inheritance diagram for RunConfigDat:
IDataItem IDBObject

Public Member Functions

std::string getConfigTag () const
 
int getConfigVersion () const
 
std::string getTable () override
 
 RunConfigDat ()
 
void setConfigTag (std::string tag)
 
void setConfigVersion (int ver)
 
 ~RunConfigDat () 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, RunConfigDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunConfigDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

std::string m_configTag
 
int m_configVer
 

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

Constructor & Destructor Documentation

◆ RunConfigDat()

RunConfigDat::RunConfigDat ( )

Definition at line 11 of file RunConfigDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_configTag = "none";
18  m_configVer = 0;
19 }

◆ ~RunConfigDat()

RunConfigDat::~RunConfigDat ( )
override

Definition at line 21 of file RunConfigDat.cc.

21 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 64 of file RunConfigDat.cc.

64  {
65  this->checkConnection();
66  fillMap->clear();
67 
68  iov->setConnection(m_env, m_conn);
69  int iovID = iov->fetchID();
70  if (!iovID) {
71  // throw(std::runtime_error("RunConfigDat::writeDB: IOV not in DB"));
72  return;
73  }
74 
75  try {
76  m_readStmt->setSQL(
77  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
78  "d.config_tag, d.config_ver "
79  "FROM channelview cv JOIN run_config_dat d "
80  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
81  "WHERE d.iov_id = :iov_id");
82  m_readStmt->setInt(1, iovID);
83  ResultSet* rset = m_readStmt->executeQuery();
84 
85  std::pair<EcalLogicID, RunConfigDat> p;
86  RunConfigDat dat;
87  while (rset->next()) {
88  p.first = EcalLogicID(rset->getString(1), // name
89  rset->getInt(2), // logic_id
90  rset->getInt(3), // id1
91  rset->getInt(4), // id2
92  rset->getInt(5), // id3
93  rset->getString(6)); // maps_to
94 
95  dat.setConfigTag(rset->getString(7));
96  dat.setConfigVersion(rset->getInt(8));
97 
98  p.second = dat;
99  fillMap->insert(p);
100  }
101  } catch (SQLException& e) {
102  throw(std::runtime_error("RunConfigDat::fetchData(): " + e.getMessage()));
103  }
104 }

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setConfigTag(), and setConfigVersion().

◆ getConfigTag()

std::string RunConfigDat::getConfigTag ( ) const
inline

Definition at line 20 of file RunConfigDat.h.

20 { return m_configTag; }

References m_configTag.

Referenced by popcon::EcalSRPHandler::getNewObjects().

◆ getConfigVersion()

int RunConfigDat::getConfigVersion ( ) const
inline

Definition at line 23 of file RunConfigDat.h.

23 { return m_configVer; }

References m_configVer.

Referenced by popcon::EcalSRPHandler::getNewObjects().

◆ getTable()

std::string RunConfigDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file RunConfigDat.h.

18 { return "RUN_CONFIG_DAT"; }

◆ prepareWrite()

void RunConfigDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 23 of file RunConfigDat.cc.

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

References MillePedeFileConverter_cfg::e.

◆ setConfigTag()

void RunConfigDat::setConfigTag ( std::string  tag)
inline

Definition at line 21 of file RunConfigDat.h.

21 { m_configTag = tag; }

References m_configTag, and makeGlobalPositionRcd_cfg::tag.

Referenced by fetchData().

◆ setConfigVersion()

void RunConfigDat::setConfigVersion ( int  ver)
inline

Definition at line 24 of file RunConfigDat.h.

24 { m_configVer = ver; }

References m_configVer.

Referenced by fetchData().

◆ writeDB()

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

Definition at line 38 of file RunConfigDat.cc.

38  {
39  this->checkConnection();
40  this->checkPrepare();
41 
42  int iovID = iov->fetchID();
43  if (!iovID) {
44  throw(std::runtime_error("RunConfigDat::writeDB: IOV not in DB"));
45  }
46 
47  int logicID = ecid->getLogicID();
48  if (!logicID) {
49  throw(std::runtime_error("RunConfigDat::writeDB: Bad EcalLogicID"));
50  }
51 
52  try {
53  m_writeStmt->setInt(1, iovID);
54  m_writeStmt->setInt(2, logicID);
55  m_writeStmt->setString(3, item->getConfigTag());
56  m_writeStmt->setInt(4, item->getConfigVersion());
57 
58  m_writeStmt->executeUpdate();
59  } catch (SQLException& e) {
60  throw(std::runtime_error("RunConfigDat::writeDB(): " + e.getMessage()));
61  }
62 }

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file RunConfigDat.h.

Member Data Documentation

◆ m_configTag

std::string RunConfigDat::m_configTag
private

Definition at line 34 of file RunConfigDat.h.

Referenced by getConfigTag(), and setConfigTag().

◆ m_configVer

int RunConfigDat::m_configVer
private

Definition at line 35 of file RunConfigDat.h.

Referenced by getConfigVersion(), and setConfigVersion().

IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
RunConfigDat
Definition: RunConfigDat.h:11
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
RunConfigDat::setConfigVersion
void setConfigVersion(int ver)
Definition: RunConfigDat.h:24
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
EcalLogicID
Definition: EcalLogicID.h:7
RunConfigDat::m_configTag
std::string m_configTag
Definition: RunConfigDat.h:34
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
RunConfigDat::m_configVer
int m_configVer
Definition: RunConfigDat.h:35
RunConfigDat::setConfigTag
void setConfigTag(std::string tag)
Definition: RunConfigDat.h:21
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