CMS 3D CMS Logo

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

#include <RunMemChErrorsDat.h>

Inheritance diagram for RunMemChErrorsDat:
IDataItem IDBObject

Public Member Functions

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

Private Attributes

uint64_t m_errorBits
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const 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 RunMemChErrorsDat.h.

Constructor & Destructor Documentation

RunMemChErrorsDat::RunMemChErrorsDat ( )

Definition at line 12 of file RunMemChErrorsDat.cc.

References NULL.

13 {
14  m_env = NULL;
15  m_conn = NULL;
16  m_writeStmt = NULL;
17  m_readStmt = NULL;
18  m_errorBits = 0;
19 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
RunMemChErrorsDat::~RunMemChErrorsDat ( )

Definition at line 23 of file RunMemChErrorsDat.cc.

24 {
25 }

Member Function Documentation

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

Definition at line 72 of file RunMemChErrorsDat.cc.

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

Referenced by getErrorBits().

74 {
75  this->checkConnection();
76  fillMap->clear();
77 
78  iov->setConnection(m_env, m_conn);
79  int iovID = iov->fetchID();
80  if (!iovID) {
81  // throw(std::runtime_error("RunMemChErrorsDat::writeDB: IOV not in DB"));
82  return;
83  }
84 
85  try {
86 
87  /* Using TO_CHAR because OCCI does not support 64-bit integers well */
88  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
89  "to_char(d.error_bits) "
90  "FROM channelview cv JOIN run_mem_ch_errors_dat d "
91  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
92  "WHERE d.iov_id = :iov_id");
93  m_readStmt->setInt(1, iovID);
94  ResultSet* rset = m_readStmt->executeQuery();
95 
96  std::pair< EcalLogicID, RunMemChErrorsDat > p;
98  while(rset->next()) {
99  p.first = EcalLogicID( rset->getString(1), // name
100  rset->getInt(2), // logic_id
101  rset->getInt(3), // id1
102  rset->getInt(4), // id2
103  rset->getInt(5), // id3
104  rset->getString(6)); // maps_to
105 
106  dat.setErrorBits( boost::lexical_cast<uint64_t>(rset->getString(7)) );
107 
108  p.second = dat;
109  fillMap->insert(p);
110  }
111 
112 
113  } catch (SQLException &e) {
114  throw(std::runtime_error("RunMemChErrorsDat::fetchData(): "+e.getMessage()));
115  }
116 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void setErrorBits(uint64_t bits)
int fetchID() noexcept(false)
Definition: RunIOV.cc:103
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
uint64_t RunMemChErrorsDat::getErrorBits ( ) const
inline

Definition at line 22 of file RunMemChErrorsDat.h.

References fetchData(), m_errorBits, noexcept, prepareWrite(), and writeDB().

22 { return m_errorBits; }
std::string RunMemChErrorsDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 19 of file RunMemChErrorsDat.h.

19 { return "RUN_MEM_CH_ERRORS_DAT"; }
void RunMemChErrorsDat::prepareWrite ( )
privatevirtualnoexcept

Implements IDataItem.

Definition at line 29 of file RunMemChErrorsDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getErrorBits().

31 {
32  this->checkConnection();
33 
34  try {
35  m_writeStmt = m_conn->createStatement();
36  /* Using TO_NUMBER because OCCI does not support 64-bit integers well */
37  m_writeStmt->setSQL("INSERT INTO run_mem_ch_errors_dat (iov_id, logic_id, "
38  "error_bits) "
39  "VALUES (:iov_id, :logic_id, "
40  "to_number(:error_bits))");
41  } catch (SQLException &e) {
42  throw(std::runtime_error("RunMemChErrorsDat::prepareWrite(): "+e.getMessage()));
43  }
44 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void RunMemChErrorsDat::setErrorBits ( uint64_t  bits)
inline

Definition at line 21 of file RunMemChErrorsDat.h.

References bits, and m_errorBits.

Referenced by fetchData().

21 { m_errorBits = 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
void RunMemChErrorsDat::writeDB ( const EcalLogicID ecid,
const RunMemChErrorsDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 48 of file RunMemChErrorsDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getErrorBits().

50 {
51  this->checkConnection();
52  this->checkPrepare();
53 
54  int iovID = iov->fetchID();
55  if (!iovID) { throw(std::runtime_error("RunMemChErrorsDat::writeDB: IOV not in DB")); }
56 
57  int logicID = ecid->getLogicID();
58  if (!logicID) { throw(std::runtime_error("RunMemChErrorsDat::writeDB: Bad EcalLogicID")); }
59 
60  try {
61  m_writeStmt->setInt(1, iovID);
62  m_writeStmt->setInt(2, logicID);
63  m_writeStmt->setString(3, ( boost::lexical_cast<std::string>(item->getErrorBits()) ).c_str());
64  m_writeStmt->executeUpdate();
65  } catch (SQLException &e) {
66  throw(std::runtime_error("RunMemChErrorsDat::writeDB(): "+e.getMessage()));
67  }
68 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
uint64_t getErrorBits() const
int getLogicID() const
Definition: EcalLogicID.cc:41
int fetchID() noexcept(false)
Definition: RunIOV.cc:103

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file RunMemChErrorsDat.h.

Member Data Documentation

uint64_t RunMemChErrorsDat::m_errorBits
private

Definition at line 35 of file RunMemChErrorsDat.h.

Referenced by getErrorBits(), and setErrorBits().