CMS 3D CMS Logo

RunDat Class Reference

#include <OnlineDB/EcalCondDB/interface/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 IDBObject::m_conn, IDBObject::m_env, m_numEvents, IDataItem::m_writeStmt, and NULL.

00012 {
00013   m_env = NULL;
00014   m_conn = NULL;
00015   m_writeStmt = NULL;
00016   m_numEvents = 0;
00017 }

RunDat::~RunDat (  ) 

Definition at line 21 of file RunDat.cc.

00022 {
00023 }


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.

00021 { return m_numEvents; }

std::string RunDat::getTable (  )  [inline, virtual]

Implements IDataItem.

Definition at line 18 of file RunDat.h.

00018 { return "RUN_DAT"; }

void RunDat::prepareWrite (  )  throw (std::runtime_error) [private, virtual]

Implements IDataItem.

Definition at line 27 of file RunDat.cc.

References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.

00029 {
00030   this->checkConnection();
00031 
00032   try {
00033     m_writeStmt = m_conn->createStatement();
00034     m_writeStmt->setSQL("INSERT INTO run_dat (iov_id, logic_id, "
00035                         "num_events) "
00036                         "VALUES (:iov_id, :logic_id, "
00037                         ":num_events)");
00038   } catch (SQLException &e) {
00039     throw(runtime_error("RunDat::prepareWrite():  "+e.getMessage()));
00040   }
00041 }

void RunDat::setNumEvents ( int  num  )  [inline]

Definition at line 20 of file RunDat.h.

References m_numEvents.

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

00020 { m_numEvents = num; }

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 IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.

00047 {
00048   this->checkConnection();
00049   this->checkPrepare();
00050 
00051   int iovID = iov->fetchID();
00052   if (!iovID) { throw(runtime_error("RunDat::writeDB:  IOV not in DB")); }
00053 
00054   int logicID = ecid->getLogicID();
00055   if (!logicID) { throw(runtime_error("RunDat::writeDB:  Bad EcalLogicID")); }
00056   
00057   try {
00058     m_writeStmt->setInt(1, iovID);
00059     m_writeStmt->setInt(2, logicID);
00060     m_writeStmt->setInt(3, item->getNumEvents());
00061 
00062     m_writeStmt->executeUpdate();
00063   } catch (SQLException &e) {
00064     throw(runtime_error("RunDat::writeDB():  "+e.getMessage()));
00065   }
00066 }


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(), RunDat(), and setNumEvents().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:13 2009 for CMSSW by  doxygen 1.5.4