CMS 3D CMS Logo

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

MonLaserStatusDat Class Reference

#include <MonLaserStatusDat.h>

Inheritance diagram for MonLaserStatusDat:
IDataItem IDBObject

List of all members.

Public Member Functions

float getLaserFanout () const
float getLaserFilter () const
float getLaserPower () const
float getLaserWavelength () const
std::string getTable ()
 MonLaserStatusDat ()
void setLaserFanout (float p)
void setLaserFilter (float p)
void setLaserPower (float p)
void setLaserWavelength (float p)
 ~MonLaserStatusDat ()

Private Member Functions

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

Private Attributes

float m_laserFanout
float m_laserFilter
float m_laserPower
float m_laserWavelength

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file MonLaserStatusDat.h.


Constructor & Destructor Documentation

MonLaserStatusDat::MonLaserStatusDat ( )

Definition at line 10 of file MonLaserStatusDat.cc.

References NULL.

MonLaserStatusDat::~MonLaserStatusDat ( )

Definition at line 25 of file MonLaserStatusDat.cc.

{
}

Member Function Documentation

void MonLaserStatusDat::fetchData ( std::map< EcalLogicID, MonLaserStatusDat > *  fillMap,
MonRunIOV iov 
) throw (std::runtime_error) [private]

Definition at line 78 of file MonLaserStatusDat.cc.

References ExpressReco_HICollisions_FallBack::e, edm::pset::fillMap(), o2o::iov, L1TEmulatorMonitor_cff::p, setLaserFanout(), setLaserFilter(), setLaserPower(), and setLaserWavelength().

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

  iov->setConnection(m_env, m_conn);
  int iovID = iov->fetchID();
  if (!iovID) { 
    //  throw(std::runtime_error("MonLaserStatusDat::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.laser_power, d.laser_filter, d.laser_wavelength, d.laser_fanout "
                 "FROM channelview cv JOIN mon_laser_status_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, MonLaserStatusDat > p;
    MonLaserStatusDat 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.setLaserPower( rset->getFloat(7) );
      dat.setLaserFilter( rset->getFloat(8) );
      dat.setLaserWavelength( rset->getFloat(9) );
      dat.setLaserFanout( rset->getFloat(10) );

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

Definition at line 29 of file MonLaserStatusDat.h.

References m_laserFanout.

{ return m_laserFanout; }
float MonLaserStatusDat::getLaserFilter ( ) const [inline]

Definition at line 23 of file MonLaserStatusDat.h.

References m_laserFilter.

{ return m_laserFilter; }
float MonLaserStatusDat::getLaserPower ( ) const [inline]

Definition at line 20 of file MonLaserStatusDat.h.

References m_laserPower.

{ return m_laserPower; }
float MonLaserStatusDat::getLaserWavelength ( ) const [inline]

Definition at line 26 of file MonLaserStatusDat.h.

References m_laserWavelength.

{ return m_laserWavelength; }
std::string MonLaserStatusDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file MonLaserStatusDat.h.

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

Implements IDataItem.

Definition at line 31 of file MonLaserStatusDat.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO mon_laser_status_dat (iov_id, logic_id, "
                        "laser_power, laser_filter, laser_wavelength, laser_fanout) "
                        "VALUES (:iov_id, :logic_id, "
                        ":3, :4, :5, :6)");
  } catch (SQLException &e) {
    throw(std::runtime_error("MonLaserStatusDat::prepareWrite():  "+e.getMessage()));
  }
}
void MonLaserStatusDat::setLaserFanout ( float  p) [inline]

Definition at line 28 of file MonLaserStatusDat.h.

References m_laserFanout, and L1TEmulatorMonitor_cff::p.

Referenced by fetchData().

void MonLaserStatusDat::setLaserFilter ( float  p) [inline]

Definition at line 22 of file MonLaserStatusDat.h.

References m_laserFilter, and L1TEmulatorMonitor_cff::p.

Referenced by fetchData().

void MonLaserStatusDat::setLaserPower ( float  p) [inline]

Definition at line 19 of file MonLaserStatusDat.h.

References m_laserPower, and L1TEmulatorMonitor_cff::p.

Referenced by fetchData().

{ m_laserPower = p; }
void MonLaserStatusDat::setLaserWavelength ( float  p) [inline]

Definition at line 25 of file MonLaserStatusDat.h.

References m_laserWavelength, and L1TEmulatorMonitor_cff::p.

Referenced by fetchData().

void MonLaserStatusDat::writeArrayDB ( const std::map< EcalLogicID, MonLaserStatusDat > *  data,
MonRunIOV iov 
) throw (std::runtime_error) [private]
void MonLaserStatusDat::writeDB ( const EcalLogicID ecid,
const MonLaserStatusDat item,
MonRunIOV iov 
) throw (std::runtime_error) [private]

Definition at line 49 of file MonLaserStatusDat.cc.

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

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

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

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

    m_writeStmt->setFloat(3, item->getLaserPower() );
    m_writeStmt->setFloat(4, item->getLaserFilter() );
    m_writeStmt->setFloat(5, item->getLaserWavelength() );
    m_writeStmt->setFloat(6, item->getLaserFanout() );

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file MonLaserStatusDat.h.


Member Data Documentation

Definition at line 48 of file MonLaserStatusDat.h.

Referenced by getLaserFanout(), and setLaserFanout().

Definition at line 46 of file MonLaserStatusDat.h.

Referenced by getLaserFilter(), and setLaserFilter().

Definition at line 45 of file MonLaserStatusDat.h.

Referenced by getLaserPower(), and setLaserPower().

Definition at line 47 of file MonLaserStatusDat.h.

Referenced by getLaserWavelength(), and setLaserWavelength().