CMS 3D CMS Logo

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

MonRunDat Class Reference

#include <MonRunDat.h>

Inheritance diagram for MonRunDat:
IDataItem IDBObject

List of all members.

Public Member Functions

MonRunOutcomeDef getMonRunOutcomeDef () const
int getNumEvents () const
std::string getRootfileName () const
std::string getTable ()
int getTaskList () const
int getTaskOutcome () const
 MonRunDat ()
void setMonRunOutcomeDef (MonRunOutcomeDef outcomeDef)
void setNumEvents (int num)
void setRootfileName (std::string name)
void setTaskList (int list)
void setTaskOutcome (int outcome)
 ~MonRunDat ()

Private Member Functions

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

Private Attributes

int m_numEvents
MonRunOutcomeDef m_outcomeDef
std::string m_rootfileName
int m_taskList
int m_taskOutcome

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 12 of file MonRunDat.h.


Constructor & Destructor Documentation

MonRunDat::MonRunDat ( )

Definition at line 12 of file MonRunDat.cc.

References NULL.

MonRunDat::~MonRunDat ( )

Definition at line 28 of file MonRunDat.cc.

{
}

Member Function Documentation

void MonRunDat::fetchData ( std::map< EcalLogicID, MonRunDat > *  fillMap,
MonRunIOV iov 
) throw (std::runtime_error) [private]
MonRunOutcomeDef MonRunDat::getMonRunOutcomeDef ( ) const [inline]

Definition at line 25 of file MonRunDat.h.

References m_outcomeDef.

{ return m_outcomeDef; }
int MonRunDat::getNumEvents ( ) const [inline]

Definition at line 22 of file MonRunDat.h.

References m_numEvents.

{ return m_numEvents; }
std::string MonRunDat::getRootfileName ( ) const [inline]

Definition at line 28 of file MonRunDat.h.

References m_rootfileName.

{ return m_rootfileName; }
std::string MonRunDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 19 of file MonRunDat.h.

{ return "MON_RUN_DAT"; }
int MonRunDat::getTaskList ( ) const [inline]

Definition at line 31 of file MonRunDat.h.

References m_taskList.

{ return m_taskList; }
int MonRunDat::getTaskOutcome ( ) const [inline]

Definition at line 34 of file MonRunDat.h.

References m_taskOutcome.

{ return m_taskOutcome; }
void MonRunDat::prepareWrite ( ) throw (std::runtime_error) [private, virtual]

Implements IDataItem.

Definition at line 34 of file MonRunDat.cc.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO mon_run_dat (iov_id, logic_id, "
                        "num_events, run_outcome_id, rootfile_name, task_list, task_outcome) "
                        "VALUES (:iov_id, :logic_id, "
                        ":num_events, :run_outcome_id, :rootfile_name, :task_list, :task_outcome) ");
  } catch (SQLException &e) {
    throw(std::runtime_error("MonRunDat::prepareWrite():  "+e.getMessage()));
  }
}
void MonRunDat::setMonRunOutcomeDef ( MonRunOutcomeDef  outcomeDef) [inline]

Definition at line 24 of file MonRunDat.h.

References m_outcomeDef.

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

{ m_outcomeDef = outcomeDef; }
void MonRunDat::setNumEvents ( int  num) [inline]

Definition at line 21 of file MonRunDat.h.

References m_numEvents.

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

void MonRunDat::setRootfileName ( std::string  name) [inline]

Definition at line 27 of file MonRunDat.h.

References m_rootfileName, and mergeVDriftHistosByStation::name.

void MonRunDat::setTaskList ( int  list) [inline]

Definition at line 30 of file MonRunDat.h.

References list(), and m_taskList.

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

void MonRunDat::setTaskOutcome ( int  outcome) [inline]

Definition at line 33 of file MonRunDat.h.

References m_taskOutcome.

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

{ m_taskOutcome = outcome; }
void MonRunDat::writeDB ( const EcalLogicID ecid,
const MonRunDat item,
MonRunIOV iov 
) throw (std::runtime_error) [private]

Definition at line 52 of file MonRunDat.cc.

References MonRunOutcomeDef::fetchID(), o2o::iov, and IDBObject::setConnection().

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

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

  MonRunOutcomeDef monRunOutcomeDef = item->getMonRunOutcomeDef(); // XXX object copy every row!
  monRunOutcomeDef.setConnection(m_env, m_conn);
  int outcomeID = monRunOutcomeDef.fetchID();
  if (!outcomeID) { throw(std::runtime_error("MonRunDat::writeDB:  Outcome Definition not in DB")); }

  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("MonRunDat::writeDB:  Bad EcalLogicID")); }
  
  try {
    m_writeStmt->setInt(1, iovID);
    m_writeStmt->setInt(2, logicID);
    m_writeStmt->setInt(3, item->getNumEvents());
    m_writeStmt->setInt(4, outcomeID);
    m_writeStmt->setString(5, item->getRootfileName());
    m_writeStmt->setInt(6, item->getTaskList());
    m_writeStmt->setInt(7, item->getTaskOutcome());

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 14 of file MonRunDat.h.


Member Data Documentation

int MonRunDat::m_numEvents [private]

Definition at line 47 of file MonRunDat.h.

Referenced by getNumEvents(), and setNumEvents().

Definition at line 48 of file MonRunDat.h.

Referenced by getMonRunOutcomeDef(), and setMonRunOutcomeDef().

std::string MonRunDat::m_rootfileName [private]

Definition at line 49 of file MonRunDat.h.

Referenced by getRootfileName(), and setRootfileName().

int MonRunDat::m_taskList [private]

Definition at line 50 of file MonRunDat.h.

Referenced by getTaskList(), and setTaskList().

int MonRunDat::m_taskOutcome [private]

Definition at line 51 of file MonRunDat.h.

Referenced by getTaskOutcome(), and setTaskOutcome().