CMS 3D CMS Logo

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

DCULVRTempsDat Class Reference

#include <DCULVRTempsDat.h>

Inheritance diagram for DCULVRTempsDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 DCULVRTempsDat ()
float getT1 () const
float getT2 () const
float getT3 () const
std::string getTable ()
void setT1 (float temp)
void setT2 (float temp)
void setT3 (float temp)
 ~DCULVRTempsDat ()

Private Member Functions

void fetchData (std::map< EcalLogicID, DCULVRTempsDat > *fillVec, DCUIOV *iov) throw (std::runtime_error)
void prepareWrite () throw (std::runtime_error)
void writeArrayDB (const std::map< EcalLogicID, DCULVRTempsDat > *data, DCUIOV *iov) throw (std::runtime_error)
void writeDB (const EcalLogicID *ecid, const DCULVRTempsDat *item, DCUIOV *iov) throw (std::runtime_error)

Private Attributes

float m_t1
float m_t2
float m_t3

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 12 of file DCULVRTempsDat.h.


Constructor & Destructor Documentation

DCULVRTempsDat::DCULVRTempsDat ( )

Definition at line 12 of file DCULVRTempsDat.cc.

References NULL.

{
  m_env = NULL;
  m_conn = NULL;
  m_writeStmt = NULL;
  m_readStmt = NULL;

  m_t1 = 0;
  m_t2 = 0;
  m_t3 = 0;
}
DCULVRTempsDat::~DCULVRTempsDat ( )

Definition at line 26 of file DCULVRTempsDat.cc.

{
}

Member Function Documentation

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

Definition at line 78 of file DCULVRTempsDat.cc.

References alignCSCRings::e, edm::pset::fillMap(), o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setT1(), setT2(), and setT3().

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

  iov->setConnection(m_env, m_conn);
  int iovID = iov->fetchID();
  if (!iovID) { 
    //  throw(std::runtime_error("DCULVRTempsDat::writeDB:  IOV not in DB")); 
    return;
  }

  try {

    m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
                 "d.t1, d.t2, d.t3 "
                 "FROM channelview cv JOIN dcu_lvr_temps_dat d "
                 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
                 "WHERE d.iov_id = :iov_id");
    m_readStmt->setInt(1, iovID);
    ResultSet* rset = m_readStmt->executeQuery();
    
    std::pair< EcalLogicID, DCULVRTempsDat > p;
    DCULVRTempsDat 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.setT1( rset->getFloat(7) );
      dat.setT2( rset->getFloat(8) );
      dat.setT3( rset->getFloat(9) );

      p.second = dat;
      fillMap->insert(p);
    }
  } catch (SQLException &e) {
    throw(std::runtime_error("DCULVRTempsDat::fetchData():  "+e.getMessage()));
  }
}
float DCULVRTempsDat::getT1 ( ) const [inline]

Definition at line 22 of file DCULVRTempsDat.h.

References m_t1.

{ return m_t1; }
float DCULVRTempsDat::getT2 ( ) const [inline]

Definition at line 25 of file DCULVRTempsDat.h.

References m_t2.

{ return m_t2; }
float DCULVRTempsDat::getT3 ( ) const [inline]

Definition at line 28 of file DCULVRTempsDat.h.

References m_t3.

{ return m_t3; }
std::string DCULVRTempsDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 19 of file DCULVRTempsDat.h.

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

Implements IDataItem.

Definition at line 32 of file DCULVRTempsDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO dcu_lvr_temps_dat (iov_id, logic_id, "
                        "t1, t2, t3) "
                        "VALUES (:iov_id, :logic_id, "
                        ":3, :4, :5)");
  } catch (SQLException &e) {
    throw(std::runtime_error("DCULVRTempsDat::prepareWrite():  "+e.getMessage()));
  }
}
void DCULVRTempsDat::setT1 ( float  temp) [inline]

Definition at line 21 of file DCULVRTempsDat.h.

References m_t1, and groupFilesInBlocks::temp.

Referenced by fetchData().

{ m_t1 = temp; }
void DCULVRTempsDat::setT2 ( float  temp) [inline]

Definition at line 24 of file DCULVRTempsDat.h.

References m_t2, and groupFilesInBlocks::temp.

Referenced by fetchData().

{ m_t2 = temp; }
void DCULVRTempsDat::setT3 ( float  temp) [inline]

Definition at line 27 of file DCULVRTempsDat.h.

References m_t3, and groupFilesInBlocks::temp.

Referenced by fetchData().

{ m_t3 = temp; }
void DCULVRTempsDat::writeArrayDB ( const std::map< EcalLogicID, DCULVRTempsDat > *  data,
DCUIOV iov 
) throw (std::runtime_error) [private]
void DCULVRTempsDat::writeDB ( const EcalLogicID ecid,
const DCULVRTempsDat item,
DCUIOV iov 
) throw (std::runtime_error) [private]

Definition at line 50 of file DCULVRTempsDat.cc.

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

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

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

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

    m_writeStmt->setFloat(3, item->getT1() );
    m_writeStmt->setFloat(4, item->getT2() );
    m_writeStmt->setFloat(5, item->getT3() );

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 14 of file DCULVRTempsDat.h.


Member Data Documentation

float DCULVRTempsDat::m_t1 [private]

Definition at line 45 of file DCULVRTempsDat.h.

Referenced by getT1(), and setT1().

float DCULVRTempsDat::m_t2 [private]

Definition at line 46 of file DCULVRTempsDat.h.

Referenced by getT2(), and setT2().

float DCULVRTempsDat::m_t3 [private]

Definition at line 47 of file DCULVRTempsDat.h.

Referenced by getT3(), and setT3().