#include <ODPedestalOffsetsDat.h>
Public Member Functions | |
int | getCrystalId () const |
int | getFedId () const |
int | getHigh () const |
int | getId () const |
int | getLow () const |
int | getMid () const |
int | getSMId () const |
std::string | getTable () |
int | getTTId () const |
ODPedestalOffsetsDat () | |
void | setCrystalId (int dac) |
void | setFedId (int dac) |
void | setHigh (int dac) |
void | setId (int dac) |
void | setLow (int dac) |
void | setMid (int dac) |
void | setSMId (int dac) |
void | setTTId (int dac) |
~ODPedestalOffsetsDat () | |
Private Member Functions | |
void | fetchData (std::vector< ODPedestalOffsetsDat > *fillMap, ODFEPedestalOffsetInfo *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::vector< ODPedestalOffsetsDat > data, ODFEPedestalOffsetInfo *iov) throw (std::runtime_error) |
void | writeDB (const ODPedestalOffsetsDat *item, ODFEPedestalOffsetInfo *iov) throw (std::runtime_error) |
Private Attributes | |
int | m_fed |
int | m_high |
int | m_ID |
int | m_low |
int | m_mid |
int | m_sm |
int | m_tt |
int | m_xt |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file ODPedestalOffsetsDat.h.
ODPedestalOffsetsDat::ODPedestalOffsetsDat | ( | ) |
ODPedestalOffsetsDat::~ODPedestalOffsetsDat | ( | ) |
Definition at line 28 of file ODPedestalOffsetsDat.cc.
{ }
void ODPedestalOffsetsDat::fetchData | ( | std::vector< ODPedestalOffsetsDat > * | fillMap, |
ODFEPedestalOffsetInfo * | iov | ||
) | throw (std::runtime_error) [private] |
Definition at line 73 of file ODPedestalOffsetsDat.cc.
References gather_cfg::cout, o2o::iov, L1TEmulatorMonitor_cff::p, setCrystalId(), setFedId(), setHigh(), setLow(), setMid(), setSMId(), 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 sm_id, fed_id, tt_id, cry_id"); m_readStmt->setInt(1, iovID); ResultSet* rset = m_readStmt->executeQuery(); // std::vector< ODPedestalOffsetsDat > p; ODPedestalOffsetsDat dat; while(rset->next()) { // dat.setId( rset->getInt(1) ); dat.setSMId( rset->getInt(2) ); dat.setFedId( rset->getInt(3) ); dat.setTTId( rset->getInt(4) ); dat.setCrystalId( rset->getInt(5) ); dat.setLow( rset->getInt(6) ); dat.setMid( rset->getInt(7) ); dat.setHigh( rset->getInt(8) ); p->push_back( dat); } } catch (SQLException &e) { throw(std::runtime_error("ODPedestalOffsetsDat::fetchData(): "+e.getMessage())); } }
int ODPedestalOffsetsDat::getCrystalId | ( | ) | const [inline] |
Definition at line 33 of file ODPedestalOffsetsDat.h.
References m_xt.
Referenced by writeArrayDB().
{ return m_xt; }
int ODPedestalOffsetsDat::getFedId | ( | ) | const [inline] |
Definition at line 27 of file ODPedestalOffsetsDat.h.
References m_fed.
Referenced by writeArrayDB().
{ return m_fed; }
int ODPedestalOffsetsDat::getHigh | ( | ) | const [inline] |
Definition at line 42 of file ODPedestalOffsetsDat.h.
References m_high.
Referenced by writeArrayDB().
{ return m_high; }
int ODPedestalOffsetsDat::getId | ( | ) | const [inline] |
int ODPedestalOffsetsDat::getLow | ( | ) | const [inline] |
Definition at line 36 of file ODPedestalOffsetsDat.h.
References m_low.
Referenced by writeArrayDB().
{ return m_low; }
int ODPedestalOffsetsDat::getMid | ( | ) | const [inline] |
Definition at line 39 of file ODPedestalOffsetsDat.h.
References m_mid.
Referenced by writeArrayDB().
{ return m_mid; }
int ODPedestalOffsetsDat::getSMId | ( | ) | const [inline] |
Definition at line 24 of file ODPedestalOffsetsDat.h.
References m_sm.
Referenced by writeArrayDB().
{ return m_sm; }
std::string ODPedestalOffsetsDat::getTable | ( | ) | [inline, virtual] |
Implements IODConfig.
Definition at line 18 of file ODPedestalOffsetsDat.h.
{ return "PEDESTAL_OFFSETS_DAT"; }
int ODPedestalOffsetsDat::getTTId | ( | ) | const [inline] |
Definition at line 30 of file ODPedestalOffsetsDat.h.
References m_tt.
Referenced by writeArrayDB().
{ return m_tt; }
void ODPedestalOffsetsDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IODConfig.
Definition at line 34 of file ODPedestalOffsetsDat.cc.
{ this->checkConnection(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO "+getTable()+" (rec_id, sm_id, fed_id, tt_id, cry_id, low, mid, high) " "VALUES (:1, :2, :3, :4, :5, :6, :7, :8 )"); } catch (SQLException &e) { throw(std::runtime_error("ODPedestalOffsetsDat::prepareWrite(): "+e.getMessage())); } }
void ODPedestalOffsetsDat::setCrystalId | ( | int | dac | ) | [inline] |
Definition at line 32 of file ODPedestalOffsetsDat.h.
References m_xt.
Referenced by fetchData().
{ m_xt = dac; }
void ODPedestalOffsetsDat::setFedId | ( | int | dac | ) | [inline] |
Definition at line 26 of file ODPedestalOffsetsDat.h.
References m_fed.
Referenced by fetchData().
{ m_fed = dac; }
void ODPedestalOffsetsDat::setHigh | ( | int | dac | ) | [inline] |
Definition at line 41 of file ODPedestalOffsetsDat.h.
References m_high.
Referenced by fetchData().
{ m_high = dac; }
void ODPedestalOffsetsDat::setId | ( | int | dac | ) | [inline] |
void ODPedestalOffsetsDat::setLow | ( | int | dac | ) | [inline] |
Definition at line 35 of file ODPedestalOffsetsDat.h.
References m_low.
Referenced by fetchData().
{ m_low = dac; }
void ODPedestalOffsetsDat::setMid | ( | int | dac | ) | [inline] |
Definition at line 38 of file ODPedestalOffsetsDat.h.
References m_mid.
Referenced by fetchData().
{ m_mid = dac; }
void ODPedestalOffsetsDat::setSMId | ( | int | dac | ) | [inline] |
Definition at line 23 of file ODPedestalOffsetsDat.h.
References m_sm.
Referenced by fetchData().
{ m_sm = dac; }
void ODPedestalOffsetsDat::setTTId | ( | int | dac | ) | [inline] |
Definition at line 29 of file ODPedestalOffsetsDat.h.
References m_tt.
Referenced by fetchData().
{ m_tt = dac; }
void ODPedestalOffsetsDat::writeArrayDB | ( | const std::vector< ODPedestalOffsetsDat > | data, |
ODFEPedestalOffsetInfo * | iov | ||
) | throw (std::runtime_error) [private] |
Definition at line 114 of file ODPedestalOffsetsDat.cc.
References prof2calltree::count, runTheMatrix::data, getCrystalId(), getFedId(), getHigh(), getLow(), getMid(), getSMId(), 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* st= new int[nrows]; int* xx1= new int[nrows]; int* yy1= new int[nrows]; int* zz1= 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* st_len= new ub2[nrows]; ub2* x1_len= new ub2[nrows]; ub2* y1_len= new ub2[nrows]; ub2* z1_len= new ub2[nrows]; ODPedestalOffsetsDat dataitem; int n_data= (int) data.size(); for (int count = 0; count <n_data ; count++) { dataitem=data[count]; ids[count]=iovID; xx[count]=dataitem.getSMId(); yy[count]=dataitem.getFedId(); zz[count]=dataitem.getTTId(); st[count]=dataitem.getCrystalId(); xx1[count]=dataitem.getLow(); yy1[count]=dataitem.getMid(); zz1[count]=dataitem.getHigh(); ids_len[count]=sizeof(ids[count]); x_len[count]=sizeof(xx[count]); y_len[count]=sizeof(yy[count]); z_len[count]=sizeof(zz[count]); st_len[count]=sizeof(st[count]); x1_len[count]=sizeof(xx1[count]); y1_len[count]=sizeof(yy1[count]); z1_len[count]=sizeof(zz1[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*)st, OCCIINT , sizeof(st[0]), st_len ); m_writeStmt->setDataBuffer(6, (dvoid*)xx1, OCCIINT , sizeof(xx1[0]), x1_len ); m_writeStmt->setDataBuffer(7, (dvoid*)yy1, OCCIINT , sizeof(yy1[0]), y1_len ); m_writeStmt->setDataBuffer(8, (dvoid*)zz1, OCCIINT , sizeof(zz1[0]), z1_len ); m_writeStmt->executeArrayUpdate(nrows); delete [] ids; delete [] xx; delete [] yy; delete [] zz; delete [] st; delete [] xx1; delete [] yy1; delete [] zz1; delete [] ids_len; delete [] x_len; delete [] y_len; delete [] z_len; delete [] st_len; delete [] x1_len; delete [] y1_len; delete [] z1_len; } catch (SQLException &e) { throw(std::runtime_error("ODPedestalOffsetsDat::writeArrayDB(): "+e.getMessage())); } }
void ODPedestalOffsetsDat::writeDB | ( | const ODPedestalOffsetsDat * | item, |
ODFEPedestalOffsetInfo * | iov | ||
) | throw (std::runtime_error) [private] |
Definition at line 50 of file ODPedestalOffsetsDat.cc.
{ this->checkConnection(); try { m_writeStmt->setInt(1, item->getId()); m_writeStmt->setInt(2, item->getSMId()); m_writeStmt->setInt(3, item->getFedId() ); m_writeStmt->setInt(4, item->getTTId() ); m_writeStmt->setInt(5, item->getCrystalId() ); m_writeStmt->setInt(6, item->getLow() ); m_writeStmt->setInt(7, item->getMid() ); m_writeStmt->setInt(8, item->getHigh() ); m_writeStmt->executeUpdate(); } catch (SQLException &e) { throw(std::runtime_error("ODPedestalOffsetsDat::writeDB(): "+e.getMessage())); } }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 13 of file ODPedestalOffsetsDat.h.
int ODPedestalOffsetsDat::m_fed [private] |
Definition at line 61 of file ODPedestalOffsetsDat.h.
Referenced by getFedId(), and setFedId().
int ODPedestalOffsetsDat::m_high [private] |
Definition at line 66 of file ODPedestalOffsetsDat.h.
int ODPedestalOffsetsDat::m_ID [private] |
Definition at line 67 of file ODPedestalOffsetsDat.h.
int ODPedestalOffsetsDat::m_low [private] |
Definition at line 64 of file ODPedestalOffsetsDat.h.
int ODPedestalOffsetsDat::m_mid [private] |
Definition at line 65 of file ODPedestalOffsetsDat.h.
int ODPedestalOffsetsDat::m_sm [private] |
Definition at line 60 of file ODPedestalOffsetsDat.h.
int ODPedestalOffsetsDat::m_tt [private] |
Definition at line 62 of file ODPedestalOffsetsDat.h.
int ODPedestalOffsetsDat::m_xt [private] |
Definition at line 63 of file ODPedestalOffsetsDat.h.
Referenced by getCrystalId(), and setCrystalId().