CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const RunMemChErrorsDat *item, RunIOV *iov) throw (std::runtime_error)
 

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 () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- 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 
)
throw (std::runtime_error
)
private

Definition at line 72 of file RunMemChErrorsDat.cc.

References alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, and setErrorBits().

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
int fetchID()
Definition: RunIOV.cc:103
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setErrorBits(uint64_t bits)
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
void checkConnection() const
Definition: IDBObject.h:41
uint64_t RunMemChErrorsDat::getErrorBits ( ) const
inline

Definition at line 22 of file RunMemChErrorsDat.h.

References m_errorBits.

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 ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 29 of file RunMemChErrorsDat.cc.

References alignCSCRings::e.

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
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 
)
throw (std::runtime_error
)
private

Definition at line 48 of file RunMemChErrorsDat.cc.

References alignCSCRings::e, and o2o::iov.

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
int fetchID()
Definition: RunIOV.cc:103
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
uint64_t getErrorBits() const
int getLogicID() const
Definition: EcalLogicID.cc:41
void checkPrepare()
Definition: IDataItem.h:31
void checkConnection() const
Definition: IDBObject.h:41

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().