CMS 3D CMS Logo

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

#include <RunPNErrorsDat.h>

Inheritance diagram for RunPNErrorsDat:
IDataItem IDBObject

Public Member Functions

uint64_t getErrorBits () const
 
std::string getTable () override
 
 RunPNErrorsDat ()
 
void setErrorBits (uint64_t bits)
 
 ~RunPNErrorsDat () 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, RunPNErrorsDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunPNErrorsDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

uint64_t m_errorBits
 

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

Constructor & Destructor Documentation

◆ RunPNErrorsDat()

RunPNErrorsDat::RunPNErrorsDat ( )

Definition at line 12 of file RunPNErrorsDat.cc.

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

◆ ~RunPNErrorsDat()

RunPNErrorsDat::~RunPNErrorsDat ( )
override

Definition at line 21 of file RunPNErrorsDat.cc.

21 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 63 of file RunPNErrorsDat.cc.

63  {
64  this->checkConnection();
65  fillMap->clear();
66 
67  iov->setConnection(m_env, m_conn);
68  int iovID = iov->fetchID();
69  if (!iovID) {
70  // throw(std::runtime_error("RunPNErrorsDat::writeDB: IOV not in DB"));
71  return;
72  }
73 
74  try {
75  /* Using TO_CHAR because OCCI does not support 64-bit integers well */
76  m_readStmt->setSQL(
77  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
78  "to_char(d.error_bits) "
79  "FROM channelview cv JOIN run_pn_errors_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, RunPNErrorsDat> p;
86  RunPNErrorsDat 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.setErrorBits(boost::lexical_cast<uint64_t>(rset->getString(7)));
96 
97  p.second = dat;
98  fillMap->insert(p);
99  }
100 
101  } catch (SQLException& e) {
102  throw(std::runtime_error("RunPNErrorsDat::fetchData(): " + e.getMessage()));
103  }
104 }

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

◆ getErrorBits()

uint64_t RunPNErrorsDat::getErrorBits ( ) const
inline

Definition at line 22 of file RunPNErrorsDat.h.

22 { return m_errorBits; }

References m_errorBits.

◆ getTable()

std::string RunPNErrorsDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file RunPNErrorsDat.h.

19 { return "RUN_PN_ERRORS_DAT"; }

◆ prepareWrite()

void RunPNErrorsDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 23 of file RunPNErrorsDat.cc.

23  {
24  this->checkConnection();
25 
26  try {
27  m_writeStmt = m_conn->createStatement();
28  /* Using TO_NUMBER because OCCI does not support 64-bit integers well */
29  m_writeStmt->setSQL(
30  "INSERT INTO run_pn_errors_dat (iov_id, logic_id, "
31  "error_bits) "
32  "VALUES (:iov_id, :logic_id, "
33  "to_number(:error_bits))");
34  } catch (SQLException& e) {
35  throw(std::runtime_error("RunPNErrorsDat::prepareWrite(): " + e.getMessage()));
36  }
37 }

References MillePedeFileConverter_cfg::e.

◆ setErrorBits()

void RunPNErrorsDat::setErrorBits ( uint64_t  bits)
inline

Definition at line 21 of file RunPNErrorsDat.h.

21 { m_errorBits = bits; }

References bits, and m_errorBits.

Referenced by fetchData().

◆ writeDB()

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

Definition at line 39 of file RunPNErrorsDat.cc.

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

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file RunPNErrorsDat.h.

Member Data Documentation

◆ m_errorBits

uint64_t RunPNErrorsDat::m_errorBits
private

Definition at line 32 of file RunPNErrorsDat.h.

Referenced by getErrorBits(), and setErrorBits().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
RunPNErrorsDat::setErrorBits
void setErrorBits(uint64_t bits)
Definition: RunPNErrorsDat.h:21
RunPNErrorsDat
Definition: RunPNErrorsDat.h:12
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
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
bits
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
Definition: EventSelector-behavior.doc:35
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
RunPNErrorsDat::m_errorBits
uint64_t m_errorBits
Definition: RunPNErrorsDat.h:32
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37