CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Friends

RunTTErrorsDat Class Reference

#include <RunTTErrorsDat.h>

Inheritance diagram for RunTTErrorsDat:
IDataItem IDBObject

List of all members.

Public Member Functions

uint64_t getErrorBits () const
std::string getTable ()
 RunTTErrorsDat ()
void setErrorBits (uint64_t bits)
 ~RunTTErrorsDat ()

Private Member Functions

void fetchData (std::map< EcalLogicID, RunTTErrorsDat > *fillMap, RunIOV *iov) throw (std::runtime_error)
void prepareWrite () throw (std::runtime_error)
void writeDB (const EcalLogicID *ecid, const RunTTErrorsDat *item, RunIOV *iov) throw (std::runtime_error)

Private Attributes

uint64_t m_errorBits

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 12 of file RunTTErrorsDat.h.


Constructor & Destructor Documentation

RunTTErrorsDat::RunTTErrorsDat ( )

Definition at line 12 of file RunTTErrorsDat.cc.

References NULL.

RunTTErrorsDat::~RunTTErrorsDat ( )

Definition at line 24 of file RunTTErrorsDat.cc.

{
}

Member Function Documentation

void RunTTErrorsDat::fetchData ( std::map< EcalLogicID, RunTTErrorsDat > *  fillMap,
RunIOV iov 
) throw (std::runtime_error) [private]

Definition at line 72 of file FEConfigFgrDat.cc.

References ExpressReco_HICollisions_FallBack::e, edm::pset::fillMap(), L1TEmulatorMonitor_cff::p, and FEConfigFgrDat::setFgrGroupId().

{
  this->checkConnection();
  fillMap->clear();

  iconf->setConnection(m_env, m_conn);
  int iconfID = iconf->fetchID();
  if (!iconfID) { 
    //  throw(std::runtime_error("FEConfigFgrDat::writeDB:  ICONF not in DB")); 
    return;
  }
  
  try {

    m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
                 "d.group_id  "
                 "FROM channelview cv JOIN fe_config_fgr_dat d "
                 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
                       "WHERE fgr_conf_id = :fgr_conf_id");
    m_readStmt->setInt(1, iconfID);
    ResultSet* rset = m_readStmt->executeQuery();
    
    std::pair< EcalLogicID, FEConfigFgrDat > p;
    FEConfigFgrDat dat;
    while(rset->next()) {
      p.first = EcalLogicID( rset->getString(1),     // name
                             rset->getInt(2),        // logic_id
                             rset->getInt(3),        // id1
                             rset->getInt(4),        // id2
                             rset->getInt(5),        // id3
                             rset->getString(6));    // maps_to

      dat.setFgrGroupId( rset->getInt(7) );  
       
      p.second = dat;
      fillMap->insert(p);
    }
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigFgrDat::fetchData:  "+e.getMessage()));
  }
}
uint64_t RunTTErrorsDat::getErrorBits ( ) const [inline]

Definition at line 22 of file RunTTErrorsDat.h.

References m_errorBits.

{ return m_errorBits; }
std::string RunTTErrorsDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 19 of file RunTTErrorsDat.h.

{ return "RUN_TT_ERRORS_DAT"; }
void RunTTErrorsDat::prepareWrite ( ) throw (std::runtime_error) [private, virtual]

Implements IDataItem.

Definition at line 30 of file RunTTErrorsDat.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    /* Using TO_NUMBER because OCCI does not support 64-bit integers well */
    m_writeStmt->setSQL("INSERT INTO run_tt_errors_dat (iov_id, logic_id, "
                        "error_bits) "
                        "VALUES (:iov_id, :logic_id, "
                        "to_number(:error_bits))");
  } catch (SQLException &e) {
    throw(std::runtime_error("RunTTErrorsDat::prepareWrite():  "+e.getMessage()));
  }
}
void RunTTErrorsDat::setErrorBits ( uint64_t  bits) [inline]

Definition at line 21 of file RunTTErrorsDat.h.

References bits, and m_errorBits.

void RunTTErrorsDat::writeDB ( const EcalLogicID ecid,
const RunTTErrorsDat item,
RunIOV iov 
) throw (std::runtime_error) [private]

Definition at line 49 of file RunTTErrorsDat.cc.

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

{
  this->checkConnection();
  this->checkPrepare();

  int iovID = iov->fetchID();
  if (!iovID) { throw(std::runtime_error("RunTTErrorsDat::writeDB:  IOV not in DB")); }

  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("RunTTErrorsDat::writeDB:  Bad EcalLogicID")); }
  
  try {
    m_writeStmt->setInt(1, iovID);
    m_writeStmt->setInt(2, logicID);
    m_writeStmt->setString(3, ( boost::lexical_cast<std::string>(item->getErrorBits()) ).c_str());
    m_writeStmt->executeUpdate();
  } catch (SQLException &e) {
    throw(std::runtime_error("RunTTErrorsDat::writeDB():  "+e.getMessage()));
  }
}

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 14 of file RunTTErrorsDat.h.


Member Data Documentation

uint64_t RunTTErrorsDat::m_errorBits [private]

Definition at line 35 of file RunTTErrorsDat.h.

Referenced by getErrorBits(), and setErrorBits().