CMS 3D CMS Logo

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

RunDat Class Reference

#include <RunDat.h>

Inheritance diagram for RunDat:
IDataItem IDBObject

List of all members.

Public Member Functions

int getNumEvents () const
std::string getTable ()
 RunDat ()
void setNumEvents (int num)
 ~RunDat ()

Private Member Functions

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

Private Attributes

int m_numEvents

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file RunDat.h.


Constructor & Destructor Documentation

RunDat::RunDat ( )

Definition at line 11 of file RunDat.cc.

References NULL.

RunDat::~RunDat ( )

Definition at line 21 of file RunDat.cc.

{
}

Member Function Documentation

void RunDat::fetchData ( std::map< EcalLogicID, RunDat > *  fillMap,
RunIOV iov 
) throw (std::runtime_error) [private]
int RunDat::getNumEvents ( ) const [inline]

Definition at line 21 of file RunDat.h.

References m_numEvents.

{ return m_numEvents; }
std::string RunDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file RunDat.h.

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

Implements IDataItem.

Definition at line 27 of file RunDat.cc.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO run_dat (iov_id, logic_id, "
                        "num_events) "
                        "VALUES (:iov_id, :logic_id, "
                        ":num_events)");
  } catch (SQLException &e) {
    throw(std::runtime_error("RunDat::prepareWrite():  "+e.getMessage()));
  }
}
void RunDat::setNumEvents ( int  num) [inline]

Definition at line 20 of file RunDat.h.

References m_numEvents.

Referenced by EcalBarrelMonitorClient::endRunDb(), and EcalEndcapMonitorClient::endRunDb().

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

Definition at line 45 of file RunDat.cc.

References o2o::iov.

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

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

  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("RunDat::writeDB:  Bad EcalLogicID")); }
  
  try {
    m_writeStmt->setInt(1, iovID);
    m_writeStmt->setInt(2, logicID);
    m_writeStmt->setInt(3, item->getNumEvents());

    m_writeStmt->executeUpdate();
  } catch (SQLException &e) {
    throw(std::runtime_error("RunDat::writeDB():  "+e.getMessage()));
  }
}

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file RunDat.h.


Member Data Documentation

int RunDat::m_numEvents [private]

Definition at line 34 of file RunDat.h.

Referenced by getNumEvents(), and setNumEvents().