CMS 3D CMS Logo

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

CaliHVScanRatioDat Class Reference

#include <CaliHVScanRatioDat.h>

Inheritance diagram for CaliHVScanRatioDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 CaliHVScanRatioDat ()
float getHVRatio () const
float getHVRatioRMS () const
std::string getTable ()
bool getTaskStatus () const
void setHVRatio (float c)
void setHVRatioRMS (float c)
void setTaskStatus (bool s)
 ~CaliHVScanRatioDat ()

Private Member Functions

void fetchData (std::map< EcalLogicID, CaliHVScanRatioDat > *fillVec, CaliIOV *iov) throw (std::runtime_error)
void prepareWrite () throw (std::runtime_error)
void writeDB (const EcalLogicID *ecid, const CaliHVScanRatioDat *item, CaliIOV *iov) throw (std::runtime_error)

Private Attributes

float m_hvratio
float m_hvratioRMS
bool m_taskStatus

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 12 of file CaliHVScanRatioDat.h.


Constructor & Destructor Documentation

CaliHVScanRatioDat::CaliHVScanRatioDat ( )

Definition at line 12 of file CaliHVScanRatioDat.cc.

References NULL.

CaliHVScanRatioDat::~CaliHVScanRatioDat ( )

Definition at line 25 of file CaliHVScanRatioDat.cc.

{
}

Member Function Documentation

void CaliHVScanRatioDat::fetchData ( std::map< EcalLogicID, CaliHVScanRatioDat > *  fillVec,
CaliIOV iov 
) throw (std::runtime_error) [private]

Definition at line 77 of file CaliHVScanRatioDat.cc.

References alignCSCRings::e, edm::pset::fillMap(), o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setHVRatio(), setHVRatioRMS(), and setTaskStatus().

{
  this->checkConnection();
  fillMap->clear();
  
  iov->setConnection(m_env, m_conn);
  int iovID = iov->fetchID();
  if (!iovID) { 
    //  throw(std::runtime_error("CaliHVScanRatioDat::writeDB:  IOV not in DB")); 
    return;
  }
  
  try {
    Statement* stmt = m_conn->createStatement();
    stmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
                 "d.hvratio, d.hvratio_rms, d.task_status "
                 "FROM channelview cv JOIN cali_hv_scan_ratio_dat d "
                 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
                 "WHERE d.iov_id = :iov_id");
    stmt->setInt(1, iovID);
    ResultSet* rset = stmt->executeQuery();
    
    std::pair< EcalLogicID, CaliHVScanRatioDat > p;
    CaliHVScanRatioDat 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.setHVRatio( rset->getFloat(7) );
      dat.setHVRatioRMS( rset->getFloat(8) );
      dat.setTaskStatus( rset->getInt(9) );
      
      p.second = dat;
      fillMap->insert(p);
    }
  } catch (SQLException &e) {
    throw(std::runtime_error("CaliHVScanRatioDat::fetchData():  "+e.getMessage()));
  }
}
float CaliHVScanRatioDat::getHVRatio ( ) const [inline]

Definition at line 22 of file CaliHVScanRatioDat.h.

References m_hvratio.

{ return m_hvratio; }
float CaliHVScanRatioDat::getHVRatioRMS ( ) const [inline]

Definition at line 25 of file CaliHVScanRatioDat.h.

References m_hvratioRMS.

{ return m_hvratioRMS; }
std::string CaliHVScanRatioDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 19 of file CaliHVScanRatioDat.h.

{ return "CALI_HV_SCAN_RATIO_DAT"; }
bool CaliHVScanRatioDat::getTaskStatus ( ) const [inline]

Definition at line 28 of file CaliHVScanRatioDat.h.

References m_taskStatus.

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

Implements IDataItem.

Definition at line 31 of file CaliHVScanRatioDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();
  
  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO cali_hv_scan_ratio_dat (iov_id, logic_id, "
                        "hvratio, hvratio_rms, task_status) "
                        "VALUES (:iov_id, :logic_id, "
                        ":3, :4, :5)");
  } catch (SQLException &e) {
    throw(std::runtime_error("CaliHVScanRatioDat::prepareWrite():  "+e.getMessage()));
  }
}
void CaliHVScanRatioDat::setHVRatio ( float  c) [inline]

Definition at line 21 of file CaliHVScanRatioDat.h.

References trackerHits::c, and m_hvratio.

Referenced by fetchData().

{ m_hvratio = c; }
void CaliHVScanRatioDat::setHVRatioRMS ( float  c) [inline]

Definition at line 24 of file CaliHVScanRatioDat.h.

References trackerHits::c, and m_hvratioRMS.

Referenced by fetchData().

{ m_hvratioRMS = c; }
void CaliHVScanRatioDat::setTaskStatus ( bool  s) [inline]

Definition at line 27 of file CaliHVScanRatioDat.h.

References m_taskStatus, and alignCSCRings::s.

Referenced by fetchData().

{ m_taskStatus = s; }
void CaliHVScanRatioDat::writeDB ( const EcalLogicID ecid,
const CaliHVScanRatioDat item,
CaliIOV iov 
) throw (std::runtime_error) [private]

Definition at line 49 of file CaliHVScanRatioDat.cc.

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

{
  this->checkConnection();
  this->checkPrepare();
  
  int iovID = iov->fetchID();
  if (!iovID) { throw(std::runtime_error("CaliHVScanRatioDat::writeDB:  IOV not in DB")); }
  
  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("CaliHVScanRatioDat::writeDB:  Bad EcalLogicID")); }
  
  try {
    m_writeStmt->setInt(1, iovID);
    m_writeStmt->setInt(2, logicID);
    
    m_writeStmt->setFloat(3, item->getHVRatio() );
    m_writeStmt->setFloat(4, item->getHVRatioRMS() );
    m_writeStmt->setInt(5, item->getTaskStatus() );
    
    m_writeStmt->executeUpdate();
  } catch (SQLException &e) {
    throw(std::runtime_error("CaliHVScanRatioDat::writeDB():  "+e.getMessage()));
  }
}

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 14 of file CaliHVScanRatioDat.h.


Member Data Documentation

Definition at line 41 of file CaliHVScanRatioDat.h.

Referenced by getHVRatio(), and setHVRatio().

Definition at line 42 of file CaliHVScanRatioDat.h.

Referenced by getHVRatioRMS(), and setHVRatioRMS().

Definition at line 43 of file CaliHVScanRatioDat.h.

Referenced by getTaskStatus(), and setTaskStatus().