#include <ODGolBiasCurrentDat.h>
Public Member Functions | |
int | getCurrent () const |
int | getFedId () const |
int | getGolId () const |
int | getId () const |
int | getPLLCurrent () const |
int | getStatus () const |
std::string | getTable () |
int | getTTId () const |
ODGolBiasCurrentDat () | |
void | setCurrent (int dac) |
void | setFedId (int dac) |
void | setGolId (int dac) |
void | setId (int dac) |
void | setPLLCurrent (int x) |
void | setStatus (int dac) |
void | setTTId (int dac) |
~ODGolBiasCurrentDat () | |
Private Member Functions | |
void | fetchData (std::vector< ODGolBiasCurrentDat > *fillMap, ODGolBiasCurrentInfo *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::vector< ODGolBiasCurrentDat > data, ODGolBiasCurrentInfo *iov) throw (std::runtime_error) |
void | writeDB (const ODGolBiasCurrentDat *item, ODGolBiasCurrentInfo *iov) throw (std::runtime_error) |
Private Attributes | |
int | m_cur |
int | m_fed |
int | m_gol |
int | m_ID |
int | m_pll_cur |
int | m_sta |
int | m_tt |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file ODGolBiasCurrentDat.h.
ODGolBiasCurrentDat::ODGolBiasCurrentDat | ( | ) |
ODGolBiasCurrentDat::~ODGolBiasCurrentDat | ( | ) |
Definition at line 28 of file ODGolBiasCurrentDat.cc.
{ }
void ODGolBiasCurrentDat::fetchData | ( | std::vector< ODGolBiasCurrentDat > * | fillMap, |
ODGolBiasCurrentInfo * | iov | ||
) | throw (std::runtime_error) [private] |
Definition at line 73 of file ODGolBiasCurrentDat.cc.
References gather_cfg::cout, o2o::iov, L1TEmulatorMonitor_cff::p, setCurrent(), setFedId(), setGolId(), setPLLCurrent(), setStatus(), and setTTId().
{ this->checkConnection(); iov->setConnection(m_env, m_conn); int iovID = iov->fetchID(); if (!iovID) { std::cout <<"ID not in the DB"<< endl; return; } try { m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by fed_id, tt_id, gol_id "); m_readStmt->setInt(1, iovID); ResultSet* rset = m_readStmt->executeQuery(); // std::vector< ODGolBiasCurrentDat > p; ODGolBiasCurrentDat dat; while(rset->next()) { // dat.setId( rset->getInt(1) ); dat.setFedId( rset->getInt(2) ); dat.setTTId( rset->getInt(3) ); dat.setGolId( rset->getInt(4) ); dat.setCurrent( rset->getInt(5) ); dat.setPLLCurrent( rset->getInt(6) ); dat.setStatus( rset->getInt(7) ); p->push_back( dat); } } catch (SQLException &e) { throw(std::runtime_error("ODGolBiasCurrentDat::fetchData(): "+e.getMessage())); } }
int ODGolBiasCurrentDat::getCurrent | ( | ) | const [inline] |
Definition at line 33 of file ODGolBiasCurrentDat.h.
References m_cur.
Referenced by writeArrayDB().
{ return m_cur; }
int ODGolBiasCurrentDat::getFedId | ( | ) | const [inline] |
Definition at line 27 of file ODGolBiasCurrentDat.h.
References m_fed.
Referenced by writeArrayDB().
{ return m_fed; }
int ODGolBiasCurrentDat::getGolId | ( | ) | const [inline] |
Definition at line 24 of file ODGolBiasCurrentDat.h.
References m_gol.
Referenced by writeArrayDB().
{ return m_gol; }
int ODGolBiasCurrentDat::getId | ( | ) | const [inline] |
int ODGolBiasCurrentDat::getPLLCurrent | ( | ) | const [inline] |
Definition at line 36 of file ODGolBiasCurrentDat.h.
References m_pll_cur.
Referenced by writeArrayDB().
{ return m_pll_cur; }
int ODGolBiasCurrentDat::getStatus | ( | void | ) | const [inline] |
Definition at line 39 of file ODGolBiasCurrentDat.h.
References m_sta.
Referenced by writeArrayDB().
{ return m_sta; }
std::string ODGolBiasCurrentDat::getTable | ( | ) | [inline, virtual] |
Implements IODConfig.
Definition at line 18 of file ODGolBiasCurrentDat.h.
{ return "GOL_BIAS_CURRENT_DAT"; }
int ODGolBiasCurrentDat::getTTId | ( | ) | const [inline] |
Definition at line 30 of file ODGolBiasCurrentDat.h.
References m_tt.
Referenced by writeArrayDB().
{ return m_tt; }
void ODGolBiasCurrentDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IODConfig.
Definition at line 34 of file ODGolBiasCurrentDat.cc.
{ this->checkConnection(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO "+getTable()+" (rec_id, fed_id, tt_id, gol_id, gol_current, pll_current, status ) " "VALUES (:1, :2, :3, :4, :5 , :6, :7)"); } catch (SQLException &e) { throw(std::runtime_error("ODGolBiasCurrentDat::prepareWrite(): "+e.getMessage())); } }
void ODGolBiasCurrentDat::setCurrent | ( | int | dac | ) | [inline] |
Definition at line 32 of file ODGolBiasCurrentDat.h.
References m_cur.
Referenced by fetchData().
{ m_cur = dac; }
void ODGolBiasCurrentDat::setFedId | ( | int | dac | ) | [inline] |
Definition at line 26 of file ODGolBiasCurrentDat.h.
References m_fed.
Referenced by fetchData().
{ m_fed = dac; }
void ODGolBiasCurrentDat::setGolId | ( | int | dac | ) | [inline] |
Definition at line 23 of file ODGolBiasCurrentDat.h.
References m_gol.
Referenced by fetchData().
{ m_gol = dac; }
void ODGolBiasCurrentDat::setId | ( | int | dac | ) | [inline] |
void ODGolBiasCurrentDat::setPLLCurrent | ( | int | x | ) | [inline] |
Definition at line 35 of file ODGolBiasCurrentDat.h.
Referenced by fetchData().
void ODGolBiasCurrentDat::setStatus | ( | int | dac | ) | [inline] |
Definition at line 38 of file ODGolBiasCurrentDat.h.
References m_sta.
Referenced by fetchData().
{ m_sta = dac; }
void ODGolBiasCurrentDat::setTTId | ( | int | dac | ) | [inline] |
Definition at line 29 of file ODGolBiasCurrentDat.h.
References m_tt.
Referenced by fetchData().
{ m_tt = dac; }
void ODGolBiasCurrentDat::writeArrayDB | ( | const std::vector< ODGolBiasCurrentDat > | data, |
ODGolBiasCurrentInfo * | iov | ||
) | throw (std::runtime_error) [private] |
Definition at line 113 of file ODGolBiasCurrentDat.cc.
References prof2calltree::count, runTheMatrix::data, getCurrent(), getFedId(), getGolId(), getPLLCurrent(), getStatus(), getTTId(), and o2o::iov.
{ this->checkConnection(); int iovID = iov->fetchID(); if (!iovID) { throw(std::runtime_error("ODDelays::writeArrayDB: ODFEDelaysInfo not in DB")); } int nrows=data.size(); int* ids= new int[nrows]; int* xx= new int[nrows]; int* yy= new int[nrows]; int* zz= new int[nrows]; int* ww= new int[nrows]; int* kk= new int[nrows]; int* st= new int[nrows]; ub2* ids_len= new ub2[nrows]; ub2* x_len= new ub2[nrows]; ub2* y_len= new ub2[nrows]; ub2* z_len= new ub2[nrows]; ub2* w_len= new ub2[nrows]; ub2* k_len= new ub2[nrows]; ub2* st_len= new ub2[nrows]; ODGolBiasCurrentDat dataitem; for (int count = 0; count != (int)data.size(); count++) { dataitem=data[count]; ids[count]=iovID; xx[count]=dataitem.getFedId(); yy[count]=dataitem.getTTId(); zz[count]=dataitem.getGolId(); ww[count]=dataitem.getCurrent(); kk[count]=dataitem.getPLLCurrent(); st[count]=dataitem.getStatus(); ids_len[count]=sizeof(ids[count]); x_len[count]=sizeof(xx[count]); y_len[count]=sizeof(yy[count]); z_len[count]=sizeof(zz[count]); w_len[count]=sizeof(ww[count]); k_len[count]=sizeof(kk[count]); st_len[count]=sizeof(st[count]); } try { m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]),ids_len); m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len ); m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len ); m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len ); m_writeStmt->setDataBuffer(5, (dvoid*)ww, OCCIINT , sizeof(ww[0]), w_len ); m_writeStmt->setDataBuffer(6, (dvoid*)kk, OCCIINT , sizeof(kk[0]), k_len ); m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len ); m_writeStmt->executeArrayUpdate(nrows); delete [] ids; delete [] xx; delete [] yy; delete [] zz; delete [] ww; delete [] kk; delete [] st; delete [] ids_len; delete [] x_len; delete [] y_len; delete [] z_len; delete [] w_len; delete [] k_len; delete [] st_len; } catch (SQLException &e) { throw(std::runtime_error("ODGolBiasCurrentDat::writeArrayDB(): "+e.getMessage())); } }
void ODGolBiasCurrentDat::writeDB | ( | const ODGolBiasCurrentDat * | item, |
ODGolBiasCurrentInfo * | iov | ||
) | throw (std::runtime_error) [private] |
Definition at line 50 of file ODGolBiasCurrentDat.cc.
{ this->checkConnection(); try { m_writeStmt->setInt(1, item->getId()); m_writeStmt->setInt(2, item->getFedId() ); m_writeStmt->setInt(3, item->getTTId() ); m_writeStmt->setInt(4, item->getGolId() ); m_writeStmt->setInt(5, item->getCurrent() ); m_writeStmt->setInt(6, item->getPLLCurrent() ); m_writeStmt->setInt(7, item->getStatus() ); m_writeStmt->executeUpdate(); } catch (SQLException &e) { throw(std::runtime_error("ODGolBiasCurrentDat::writeDB(): "+e.getMessage())); } }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 13 of file ODGolBiasCurrentDat.h.
int ODGolBiasCurrentDat::m_cur [private] |
Definition at line 60 of file ODGolBiasCurrentDat.h.
Referenced by getCurrent(), and setCurrent().
int ODGolBiasCurrentDat::m_fed [private] |
Definition at line 58 of file ODGolBiasCurrentDat.h.
Referenced by getFedId(), and setFedId().
int ODGolBiasCurrentDat::m_gol [private] |
Definition at line 57 of file ODGolBiasCurrentDat.h.
Referenced by getGolId(), and setGolId().
int ODGolBiasCurrentDat::m_ID [private] |
Definition at line 63 of file ODGolBiasCurrentDat.h.
int ODGolBiasCurrentDat::m_pll_cur [private] |
Definition at line 61 of file ODGolBiasCurrentDat.h.
Referenced by getPLLCurrent(), and setPLLCurrent().
int ODGolBiasCurrentDat::m_sta [private] |
Definition at line 62 of file ODGolBiasCurrentDat.h.
Referenced by getStatus(), and setStatus().
int ODGolBiasCurrentDat::m_tt [private] |
Definition at line 59 of file ODGolBiasCurrentDat.h.