CMS 3D CMS Logo

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

#include <RunCrystalErrorsDat.h>

Inheritance diagram for RunCrystalErrorsDat:
IDataItem IDBObject

Public Member Functions

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

Constructor & Destructor Documentation

RunCrystalErrorsDat::RunCrystalErrorsDat ( )

Definition at line 12 of file RunCrystalErrorsDat.cc.

13 {
14  m_env = nullptr;
15  m_conn = nullptr;
16  m_writeStmt = nullptr;
17  m_errorBits = 0;
18 }
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
RunCrystalErrorsDat::~RunCrystalErrorsDat ( )
override

Definition at line 22 of file RunCrystalErrorsDat.cc.

23 {
24 }

Member Function Documentation

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

Definition at line 71 of file RunCrystalErrorsDat.cc.

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

Referenced by getErrorBits().

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

Definition at line 22 of file RunCrystalErrorsDat.h.

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

22 { return m_errorBits; }
std::string RunCrystalErrorsDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file RunCrystalErrorsDat.h.

19 { return "RUN_CRYSTAL_ERRORS_DAT"; }
void RunCrystalErrorsDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 28 of file RunCrystalErrorsDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getErrorBits().

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

Definition at line 21 of file RunCrystalErrorsDat.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 RunCrystalErrorsDat::writeDB ( const EcalLogicID ecid,
const RunCrystalErrorsDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 47 of file RunCrystalErrorsDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getErrorBits().

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

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file RunCrystalErrorsDat.h.

Member Data Documentation

uint64_t RunCrystalErrorsDat::m_errorBits
private

Definition at line 35 of file RunCrystalErrorsDat.h.

Referenced by getErrorBits(), and setErrorBits().