CMS 3D CMS Logo

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

#include <RunTPGConfigDat.h>

Inheritance diagram for RunTPGConfigDat:
IDataItem IDBObject

Public Member Functions

std::string getConfigTag () const
 
std::string getTable () override
 
int getVersion () const
 
 RunTPGConfigDat ()
 
void setConfigTag (std::string x)
 
void setVersion (int x)
 
 ~RunTPGConfigDat () 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, RunTPGConfigDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunTPGConfigDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

std::string m_config
 
int m_version
 

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

Constructor & Destructor Documentation

◆ RunTPGConfigDat()

RunTPGConfigDat::RunTPGConfigDat ( )

Definition at line 11 of file RunTPGConfigDat.cc.

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

◆ ~RunTPGConfigDat()

RunTPGConfigDat::~RunTPGConfigDat ( )
override

Definition at line 21 of file RunTPGConfigDat.cc.

21 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 64 of file RunTPGConfigDat.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("RunTPGConfigDat::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.version "
79  "FROM channelview cv JOIN run_TPGConfig_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, RunTPGConfigDat> p;
86  RunTPGConfigDat 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.setVersion(rset->getInt(8));
97 
98  p.second = dat;
99  fillMap->insert(p);
100  }
101  } catch (SQLException& e) {
102  throw(std::runtime_error("RunTPGConfigDat::fetchData(): " + e.getMessage()));
103  }
104 }

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

◆ getConfigTag()

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

◆ getTable()

std::string RunTPGConfigDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file RunTPGConfigDat.h.

18 { return "RUN_TPGCONFIG_DAT"; }

◆ getVersion()

int RunTPGConfigDat::getVersion ( ) const
inline

◆ prepareWrite()

void RunTPGConfigDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 23 of file RunTPGConfigDat.cc.

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

References MillePedeFileConverter_cfg::e.

◆ setConfigTag()

void RunTPGConfigDat::setConfigTag ( std::string  x)
inline

Definition at line 21 of file RunTPGConfigDat.h.

21 { m_config = x; }

References m_config, and x.

Referenced by fetchData().

◆ setVersion()

void RunTPGConfigDat::setVersion ( int  x)
inline

Definition at line 23 of file RunTPGConfigDat.h.

23 { m_version = x; }

References m_version, and x.

Referenced by fetchData().

◆ writeDB()

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

Definition at line 38 of file RunTPGConfigDat.cc.

38  {
39  this->checkConnection();
40  this->checkPrepare();
41 
42  int iovID = iov->fetchID();
43  if (!iovID) {
44  throw(std::runtime_error("RunTPGConfigDat::writeDB: IOV not in DB"));
45  }
46 
47  int logicID = ecid->getLogicID();
48  if (!logicID) {
49  throw(std::runtime_error("RunTPGConfigDat::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->getVersion());
57 
58  m_writeStmt->executeUpdate();
59  } catch (SQLException& e) {
60  throw(std::runtime_error("RunTPGConfigDat::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 RunTPGConfigDat.h.

Member Data Documentation

◆ m_config

std::string RunTPGConfigDat::m_config
private

Definition at line 34 of file RunTPGConfigDat.h.

Referenced by getConfigTag(), and setConfigTag().

◆ m_version

int RunTPGConfigDat::m_version
private

Definition at line 33 of file RunTPGConfigDat.h.

Referenced by getVersion(), and setVersion().

RunTPGConfigDat::setConfigTag
void setConfigTag(std::string x)
Definition: RunTPGConfigDat.h:21
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_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.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
RunTPGConfigDat::setVersion
void setVersion(int x)
Definition: RunTPGConfigDat.h:23
EcalLogicID
Definition: EcalLogicID.h:7
RunTPGConfigDat
Definition: RunTPGConfigDat.h:11
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
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
RunTPGConfigDat::m_config
std::string m_config
Definition: RunTPGConfigDat.h:34
RunTPGConfigDat::m_version
int m_version
Definition: RunTPGConfigDat.h:33
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37