CMS 3D CMS Logo

LMFPNConfigDat Class Reference

#include <OnlineDB/EcalCondDB/interface/LMFPNConfigDat.h>

Inheritance diagram for LMFPNConfigDat:

IDataItem IDBObject

List of all members.

Public Member Functions

int getPNAID () const
bool getPNAValidity () const
int getPNBID () const
bool getPNBValidity () const
bool getPNMeanValidity () const
std::string getTable ()
 LMFPNConfigDat ()
void setPNAID (int logic_id)
void setPNAValidity (bool valid)
void setPNBID (int logic_id)
void setPNBValidity (bool valid)
void setPNMeanValidity (bool valid)
 ~LMFPNConfigDat ()

Private Member Functions

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

Private Attributes

int m_pnAID
bool m_pnAValidity
int m_pnBID
bool m_pnBValidity
bool m_pnMeanValidity

Friends

class EcalCondDBInterface


Detailed Description

Definition at line 12 of file LMFPNConfigDat.h.


Constructor & Destructor Documentation

LMFPNConfigDat::LMFPNConfigDat (  ) 

Definition at line 12 of file LMFPNConfigDat.cc.

References IDBObject::m_conn, IDBObject::m_env, m_pnAID, m_pnAValidity, m_pnBID, m_pnBValidity, m_pnMeanValidity, IDataItem::m_readStmt, IDataItem::m_writeStmt, and NULL.

00013 {
00014   m_env = NULL;
00015   m_conn = NULL;
00016   m_writeStmt = NULL;
00017   m_readStmt = NULL;
00018 
00019   m_pnAID = 0;
00020   m_pnBID = 0;
00021   m_pnAValidity = 0;
00022   m_pnBValidity = 0;
00023   m_pnMeanValidity = 0;
00024 }

LMFPNConfigDat::~LMFPNConfigDat (  ) 

Definition at line 28 of file LMFPNConfigDat.cc.

00029 {
00030 }


Member Function Documentation

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

Definition at line 82 of file LMFPNConfigDat.cc.

References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setPNAID(), setPNAValidity(), setPNBID(), setPNBValidity(), and setPNMeanValidity().

00084 {
00085   this->checkConnection();
00086   fillMap->clear();
00087 
00088   iov->setConnection(m_env, m_conn);
00089   int iovID = iov->fetchID();
00090   if (!iovID) { 
00091     //  throw(runtime_error("LMFPNConfigDat::writeDB:  IOV not in DB")); 
00092     return;
00093   }
00094 
00095   try {
00096 
00097     m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
00098                  "d.pna_id, d.pnb_id, d.pna_validity, d.pnb_validity, d.pnmean_validity "
00099                  "FROM channelview cv JOIN lmf_pn_config_dat d "
00100                  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
00101                  "WHERE d.iov_id = :iov_id");
00102     m_readStmt->setInt(1, iovID);
00103     ResultSet* rset = m_readStmt->executeQuery();
00104     
00105     std::pair< EcalLogicID, LMFPNConfigDat > p;
00106     LMFPNConfigDat dat;
00107     while(rset->next()) {
00108       p.first = EcalLogicID( rset->getString(1),     // name
00109                              rset->getInt(2),        // logic_id
00110                              rset->getInt(3),        // id1
00111                              rset->getInt(4),        // id2
00112                              rset->getInt(5),        // id3
00113                              rset->getString(6));    // maps_to
00114 
00115       dat.setPNAID( rset->getInt(7) );
00116       dat.setPNBID( rset->getInt(8) );
00117       dat.setPNAValidity( rset->getInt(9) );
00118       dat.setPNBValidity( rset->getInt(10) );
00119       dat.setPNMeanValidity( rset->getInt(11) );
00120 
00121       p.second = dat;
00122       fillMap->insert(p);
00123     }
00124 
00125   } catch (SQLException &e) {
00126     throw(runtime_error("LMFPNConfigDat::fetchData():  "+e.getMessage()));
00127   }
00128 }

int LMFPNConfigDat::getPNAID (  )  const [inline]

Definition at line 22 of file LMFPNConfigDat.h.

References m_pnAID.

00022 { return m_pnAID; }

bool LMFPNConfigDat::getPNAValidity (  )  const [inline]

Definition at line 28 of file LMFPNConfigDat.h.

References m_pnAValidity.

00028 { return m_pnAValidity; }

int LMFPNConfigDat::getPNBID (  )  const [inline]

Definition at line 25 of file LMFPNConfigDat.h.

References m_pnBID.

00025 { return m_pnBID; }

bool LMFPNConfigDat::getPNBValidity (  )  const [inline]

Definition at line 31 of file LMFPNConfigDat.h.

References m_pnBValidity.

00031 { return m_pnBValidity; }

bool LMFPNConfigDat::getPNMeanValidity (  )  const [inline]

Definition at line 34 of file LMFPNConfigDat.h.

References m_pnMeanValidity.

00034 { return m_pnMeanValidity; }

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

Implements IDataItem.

Definition at line 19 of file LMFPNConfigDat.h.

00019 { return "LMF_PN_CONFIG_DAT"; }

void LMFPNConfigDat::prepareWrite (  )  throw (std::runtime_error) [private, virtual]

Implements IDataItem.

Definition at line 34 of file LMFPNConfigDat.cc.

References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.

00036 {
00037   this->checkConnection();
00038 
00039   try {
00040     m_writeStmt = m_conn->createStatement();
00041     m_writeStmt->setSQL("INSERT INTO lmf_pn_config_dat (iov_id, logic_id, "
00042                         "pna_id, pnb_id, pna_validity, pnb_validity, pnmean_validity) "
00043                         "VALUES (:iov_id, :logic_id, "
00044                         ":3, :4, :5, :6, :7)");
00045   } catch (SQLException &e) {
00046     throw(runtime_error("LMFPNConfigDat::prepareWrite():  "+e.getMessage()));
00047   }
00048 }

void LMFPNConfigDat::setPNAID ( int  logic_id  )  [inline]

Definition at line 21 of file LMFPNConfigDat.h.

References m_pnAID.

Referenced by fetchData().

00021 { m_pnAID = logic_id; }

void LMFPNConfigDat::setPNAValidity ( bool  valid  )  [inline]

Definition at line 27 of file LMFPNConfigDat.h.

References m_pnAValidity.

Referenced by fetchData().

00027 { m_pnAValidity = valid; }

void LMFPNConfigDat::setPNBID ( int  logic_id  )  [inline]

Definition at line 24 of file LMFPNConfigDat.h.

References m_pnBID.

Referenced by fetchData().

00024 { m_pnBID = logic_id; }

void LMFPNConfigDat::setPNBValidity ( bool  valid  )  [inline]

Definition at line 30 of file LMFPNConfigDat.h.

References m_pnBValidity.

Referenced by fetchData().

00030 { m_pnBValidity = valid; }

void LMFPNConfigDat::setPNMeanValidity ( bool  valid  )  [inline]

Definition at line 33 of file LMFPNConfigDat.h.

References m_pnMeanValidity.

Referenced by fetchData().

00033 { m_pnMeanValidity = valid; }

void LMFPNConfigDat::writeDB ( const EcalLogicID ecid,
const LMFPNConfigDat item,
LMFRunIOV iov 
) throw (std::runtime_error) [private]

Definition at line 52 of file LMFPNConfigDat.cc.

References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.

00054 {
00055   this->checkConnection();
00056   this->checkPrepare();
00057 
00058   int iovID = iov->fetchID();
00059   if (!iovID) { throw(runtime_error("LMFPNConfigDat::writeDB:  IOV not in DB")); }
00060 
00061   int logicID = ecid->getLogicID();
00062   if (!logicID) { throw(runtime_error("LMFPNConfigDat::writeDB:  Bad EcalLogicID")); }
00063   
00064   try {
00065     m_writeStmt->setInt(1, iovID);
00066     m_writeStmt->setInt(2, logicID);
00067 
00068     m_writeStmt->setInt(3, item->getPNAID() );
00069     m_writeStmt->setInt(4, item->getPNBID() );
00070     m_writeStmt->setInt(5, item->getPNAValidity() );
00071     m_writeStmt->setInt(6, item->getPNBValidity() );
00072     m_writeStmt->setInt(7, item->getPNMeanValidity() );
00073 
00074     m_writeStmt->executeUpdate();
00075   } catch (SQLException &e) {
00076     throw(runtime_error("LMFPNConfigDat::writeDB():  "+e.getMessage()));
00077   }
00078 }


Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 14 of file LMFPNConfigDat.h.


Member Data Documentation

int LMFPNConfigDat::m_pnAID [private]

Definition at line 47 of file LMFPNConfigDat.h.

Referenced by getPNAID(), LMFPNConfigDat(), and setPNAID().

bool LMFPNConfigDat::m_pnAValidity [private]

Definition at line 49 of file LMFPNConfigDat.h.

Referenced by getPNAValidity(), LMFPNConfigDat(), and setPNAValidity().

int LMFPNConfigDat::m_pnBID [private]

Definition at line 48 of file LMFPNConfigDat.h.

Referenced by getPNBID(), LMFPNConfigDat(), and setPNBID().

bool LMFPNConfigDat::m_pnBValidity [private]

Definition at line 50 of file LMFPNConfigDat.h.

Referenced by getPNBValidity(), LMFPNConfigDat(), and setPNBValidity().

bool LMFPNConfigDat::m_pnMeanValidity [private]

Definition at line 51 of file LMFPNConfigDat.h.

Referenced by getPNMeanValidity(), LMFPNConfigDat(), and setPNMeanValidity().


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