CMS 3D CMS Logo

MonLaserStatusDat Class Reference

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

00011 {
00012   m_env = NULL;
00013   m_conn = NULL;
00014   m_writeStmt = NULL;
00015   m_readStmt = NULL;
00016 
00017   m_laserPower = 0;
00018   m_laserFilter = 0;
00019   m_laserWavelength = 0;
00020   m_laserFanout = 0;
00021 }

MonLaserStatusDat::~MonLaserStatusDat (  ) 

Definition at line 25 of file MonLaserStatusDat.cc.

00026 {
00027 }


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 IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setLaserFanout(), setLaserFilter(), setLaserPower(), and setLaserWavelength().

00080 {
00081   this->checkConnection();
00082   fillMap->clear();
00083 
00084   iov->setConnection(m_env, m_conn);
00085   int iovID = iov->fetchID();
00086   if (!iovID) { 
00087     //  throw(runtime_error("MonLaserStatusDat::writeDB:  IOV not in DB")); 
00088     return;
00089   }
00090 
00091   try {
00092 
00093     m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
00094                  "d.laser_power, d.laser_filter, d.laser_wavelength, d.laser_fanout "
00095                  "FROM channelview cv JOIN mon_laser_status_dat d "
00096                  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
00097                  "WHERE d.iov_id = :iov_id");
00098     m_readStmt->setInt(1, iovID);
00099     ResultSet* rset = m_readStmt->executeQuery();
00100     
00101     std::pair< EcalLogicID, MonLaserStatusDat > p;
00102     MonLaserStatusDat dat;
00103     while(rset->next()) {
00104       p.first = EcalLogicID( rset->getString(1),     // name
00105                              rset->getInt(2),        // logic_id
00106                              rset->getInt(3),        // id1
00107                              rset->getInt(4),        // id2
00108                              rset->getInt(5),        // id3
00109                              rset->getString(6));    // maps_to
00110 
00111       dat.setLaserPower( rset->getFloat(7) );
00112       dat.setLaserFilter( rset->getFloat(8) );
00113       dat.setLaserWavelength( rset->getFloat(9) );
00114       dat.setLaserFanout( rset->getFloat(10) );
00115 
00116       p.second = dat;
00117       fillMap->insert(p);
00118     }
00119   } catch (SQLException &e) {
00120     throw(runtime_error("MonLaserStatusDat::fetchData():  "+e.getMessage()));
00121   }
00122 }

float MonLaserStatusDat::getLaserFanout (  )  const [inline]

Definition at line 29 of file MonLaserStatusDat.h.

References m_laserFanout.

00029 { return m_laserFanout; }

float MonLaserStatusDat::getLaserFilter (  )  const [inline]

Definition at line 23 of file MonLaserStatusDat.h.

References m_laserFilter.

00023 { return m_laserFilter; }

float MonLaserStatusDat::getLaserPower (  )  const [inline]

Definition at line 20 of file MonLaserStatusDat.h.

References m_laserPower.

00020 { return m_laserPower; }

float MonLaserStatusDat::getLaserWavelength (  )  const [inline]

Definition at line 26 of file MonLaserStatusDat.h.

References m_laserWavelength.

00026 { return m_laserWavelength; }

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

Implements IDataItem.

Definition at line 18 of file MonLaserStatusDat.h.

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

00033 {
00034   this->checkConnection();
00035 
00036   try {
00037     m_writeStmt = m_conn->createStatement();
00038     m_writeStmt->setSQL("INSERT INTO mon_laser_status_dat (iov_id, logic_id, "
00039                         "laser_power, laser_filter, laser_wavelength, laser_fanout) "
00040                         "VALUES (:iov_id, :logic_id, "
00041                         ":3, :4, :5, :6)");
00042   } catch (SQLException &e) {
00043     throw(runtime_error("MonLaserStatusDat::prepareWrite():  "+e.getMessage()));
00044   }
00045 }

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

Definition at line 28 of file MonLaserStatusDat.h.

References m_laserFanout.

Referenced by fetchData().

00028 { m_laserFanout = p; }

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

Definition at line 22 of file MonLaserStatusDat.h.

References m_laserFilter.

Referenced by fetchData().

00022 { m_laserFilter = p; }

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

Definition at line 19 of file MonLaserStatusDat.h.

References m_laserPower.

Referenced by fetchData().

00019 { m_laserPower = p; }

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

Definition at line 25 of file MonLaserStatusDat.h.

References m_laserWavelength.

Referenced by fetchData().

00025 { m_laserWavelength = p; }

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

00051 {
00052   this->checkConnection();
00053   this->checkPrepare();
00054 
00055   int iovID = iov->fetchID();
00056   if (!iovID) { throw(runtime_error("MonLaserStatusDat::writeDB:  IOV not in DB")); }
00057 
00058   int logicID = ecid->getLogicID();
00059   if (!logicID) { throw(runtime_error("MonLaserStatusDat::writeDB:  Bad EcalLogicID")); }
00060   
00061   try {
00062     m_writeStmt->setInt(1, iovID);
00063     m_writeStmt->setInt(2, logicID);
00064 
00065     m_writeStmt->setFloat(3, item->getLaserPower() );
00066     m_writeStmt->setFloat(4, item->getLaserFilter() );
00067     m_writeStmt->setFloat(5, item->getLaserWavelength() );
00068     m_writeStmt->setFloat(6, item->getLaserFanout() );
00069 
00070     m_writeStmt->executeUpdate();
00071   } catch (SQLException &e) {
00072     throw(runtime_error("MonLaserStatusDat::writeDB():  "+e.getMessage()));
00073   }
00074 }


Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file MonLaserStatusDat.h.


Member Data Documentation

float MonLaserStatusDat::m_laserFanout [private]

Definition at line 48 of file MonLaserStatusDat.h.

Referenced by getLaserFanout(), MonLaserStatusDat(), and setLaserFanout().

float MonLaserStatusDat::m_laserFilter [private]

Definition at line 46 of file MonLaserStatusDat.h.

Referenced by getLaserFilter(), MonLaserStatusDat(), and setLaserFilter().

float MonLaserStatusDat::m_laserPower [private]

Definition at line 45 of file MonLaserStatusDat.h.

Referenced by getLaserPower(), MonLaserStatusDat(), and setLaserPower().

float MonLaserStatusDat::m_laserWavelength [private]

Definition at line 47 of file MonLaserStatusDat.h.

Referenced by getLaserWavelength(), MonLaserStatusDat(), and setLaserWavelength().


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