CMS 3D CMS Logo

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

ODTowersToByPassDat Class Reference

#include <ODTowersToByPassDat.h>

Inheritance diagram for ODTowersToByPassDat:
IODConfig IDBObject

List of all members.

Public Member Functions

int getFedId () const
int getId () const
int getStatus () const
std::string getTable ()
int getTimeCorr () const
int getTrId () const
int getTTId () const
 ODTowersToByPassDat ()
void setFedId (int dac)
void setId (int dac)
void setStatus (int dac)
void setTimeCorr (int dac)
void setTrId (int dac)
void setTTId (int dac)
 ~ODTowersToByPassDat ()

Private Member Functions

void fetchData (std::vector< ODTowersToByPassDat > *fillMap, ODTowersToByPassInfo *iov) throw (std::runtime_error)
void prepareWrite () throw (std::runtime_error)
void writeArrayDB (const std::vector< ODTowersToByPassDat > data, ODTowersToByPassInfo *iov) throw (std::runtime_error)
void writeDB (const ODTowersToByPassDat *item, ODTowersToByPassInfo *iov) throw (std::runtime_error)

Private Attributes

int m_fed
int m_ID
int m_sta
int m_time
int m_tr
int m_tt

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file ODTowersToByPassDat.h.


Constructor & Destructor Documentation

ODTowersToByPassDat::ODTowersToByPassDat ( )

Definition at line 10 of file ODTowersToByPassDat.cc.

References NULL.

{
  m_env = NULL;
  m_conn = NULL;
  m_writeStmt = NULL;
  m_readStmt = NULL;


  m_fed = 0;
  m_tt = 0;
  m_tr = 0;
  m_time = 0;
  m_sta = 0;

}
ODTowersToByPassDat::~ODTowersToByPassDat ( )

Definition at line 28 of file ODTowersToByPassDat.cc.

{
}

Member Function Documentation

void ODTowersToByPassDat::fetchData ( std::vector< ODTowersToByPassDat > *  fillMap,
ODTowersToByPassInfo iov 
) throw (std::runtime_error) [private]

Definition at line 71 of file ODTowersToByPassDat.cc.

References gather_cfg::cout, ExpressReco_HICollisions_FallBack::e, o2o::iov, L1TEmulatorMonitor_cff::p, setFedId(), setStatus(), setTimeCorr(), setTrId(), 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, tr_id, tt_id ");
    m_readStmt->setInt(1, iovID);
    ResultSet* rset = m_readStmt->executeQuery();
    
    //    std::vector< ODTowersToByPassDat > p;
    ODTowersToByPassDat dat;
    while(rset->next()) {
      // dat.setId( rset->getInt(1) );
      dat.setFedId(    rset->getInt(2) );
      dat.setTrId(     rset->getInt(3) );
      dat.setTTId(     rset->getInt(4) );
      dat.setTimeCorr( rset->getInt(5) );
      dat.setStatus(   rset->getInt(6) );

      p->push_back( dat);

    }


  } catch (SQLException &e) {
    throw(std::runtime_error("ODTowersToByPassDat::fetchData():  "+e.getMessage()));
  }
}
int ODTowersToByPassDat::getFedId ( ) const [inline]

Definition at line 27 of file ODTowersToByPassDat.h.

References m_fed.

Referenced by writeArrayDB().

{ return m_fed; }
int ODTowersToByPassDat::getId ( ) const [inline]

Definition at line 21 of file ODTowersToByPassDat.h.

References m_ID.

{ return m_ID; }
int ODTowersToByPassDat::getStatus ( void  ) const [inline]

Definition at line 36 of file ODTowersToByPassDat.h.

References m_sta.

Referenced by writeArrayDB().

{ return m_sta; }
std::string ODTowersToByPassDat::getTable ( ) [inline, virtual]

Implements IODConfig.

Definition at line 18 of file ODTowersToByPassDat.h.

{ return "TOWERS_TO_BYPASS_DAT"; }
int ODTowersToByPassDat::getTimeCorr ( ) const [inline]

Definition at line 33 of file ODTowersToByPassDat.h.

References m_time.

Referenced by writeArrayDB().

{ return m_time; }
int ODTowersToByPassDat::getTrId ( ) const [inline]

Definition at line 24 of file ODTowersToByPassDat.h.

References m_tr.

Referenced by writeArrayDB().

{ return m_tr; }
int ODTowersToByPassDat::getTTId ( ) const [inline]

Definition at line 30 of file ODTowersToByPassDat.h.

References m_tt.

Referenced by writeArrayDB().

{ return m_tt; }
void ODTowersToByPassDat::prepareWrite ( ) throw (std::runtime_error) [private, virtual]

Implements IODConfig.

Definition at line 34 of file ODTowersToByPassDat.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO "+getTable()+" (rec_id, fed_id, tr_id, tt_id, time_corr, STATUS ) "
                        "VALUES (:1, :2, :3, :4, :5 , :6 )");
  } catch (SQLException &e) {
    throw(std::runtime_error("ODTowersToByPassDat::prepareWrite():  "+e.getMessage()));
  }
}
void ODTowersToByPassDat::setFedId ( int  dac) [inline]

Definition at line 26 of file ODTowersToByPassDat.h.

References m_fed.

Referenced by fetchData().

{ m_fed = dac; }
void ODTowersToByPassDat::setId ( int  dac) [inline]

Definition at line 20 of file ODTowersToByPassDat.h.

References m_ID.

{ m_ID = dac; }
void ODTowersToByPassDat::setStatus ( int  dac) [inline]

Definition at line 35 of file ODTowersToByPassDat.h.

References m_sta.

Referenced by fetchData().

{ m_sta = dac; }
void ODTowersToByPassDat::setTimeCorr ( int  dac) [inline]

Definition at line 32 of file ODTowersToByPassDat.h.

References m_time.

Referenced by fetchData().

{ m_time = dac; }
void ODTowersToByPassDat::setTrId ( int  dac) [inline]

Definition at line 23 of file ODTowersToByPassDat.h.

References m_tr.

Referenced by fetchData().

{ m_tr = dac; }
void ODTowersToByPassDat::setTTId ( int  dac) [inline]

Definition at line 29 of file ODTowersToByPassDat.h.

References m_tt.

Referenced by fetchData().

{ m_tt = dac; }
void ODTowersToByPassDat::writeArrayDB ( const std::vector< ODTowersToByPassDat data,
ODTowersToByPassInfo iov 
) throw (std::runtime_error) [private]

Definition at line 110 of file ODTowersToByPassDat.cc.

References prof2calltree::count, runTheMatrix::data, ExpressReco_HICollisions_FallBack::e, getFedId(), getStatus(), getTimeCorr(), getTrId(), 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* 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* st_len= new ub2[nrows];

  ODTowersToByPassDat dataitem;
  

  for (int count = 0; count != (int) data.size(); count++) {
    dataitem=data[count];
    ids[count]=iovID;
    xx[count]=dataitem.getFedId();
    yy[count]=dataitem.getTrId();
    zz[count]=dataitem.getTTId();
    ww[count]=dataitem.getTimeCorr();
    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]);
        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*)st, OCCIINT , sizeof(st[0]), st_len );
   

    m_writeStmt->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] xx;
    delete [] yy;
    delete [] zz;
    delete [] ww;
    delete [] st;

    delete [] ids_len;
    delete [] x_len;
    delete [] y_len;
    delete [] z_len;
    delete [] w_len;
    delete [] st_len;


  } catch (SQLException &e) {
    throw(std::runtime_error("ODTowersToByPassDat::writeArrayDB():  "+e.getMessage()));
  }
}
void ODTowersToByPassDat::writeDB ( const ODTowersToByPassDat item,
ODTowersToByPassInfo iov 
) throw (std::runtime_error) [private]

Definition at line 50 of file ODTowersToByPassDat.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();

  try {
    m_writeStmt->setInt(1, item->getId());
    m_writeStmt->setInt(2, item->getFedId() );
    m_writeStmt->setInt(3, item->getTrId() );
    m_writeStmt->setInt(4, item->getTTId() );
    m_writeStmt->setInt(5, item->getTimeCorr() );
    m_writeStmt->setInt(6, item->getStatus() );

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file ODTowersToByPassDat.h.


Member Data Documentation

Definition at line 55 of file ODTowersToByPassDat.h.

Referenced by getFedId(), and setFedId().

Definition at line 59 of file ODTowersToByPassDat.h.

Referenced by getId(), and setId().

Definition at line 58 of file ODTowersToByPassDat.h.

Referenced by getStatus(), and setStatus().

Definition at line 57 of file ODTowersToByPassDat.h.

Referenced by getTimeCorr(), and setTimeCorr().

Definition at line 54 of file ODTowersToByPassDat.h.

Referenced by getTrId(), and setTrId().

Definition at line 56 of file ODTowersToByPassDat.h.

Referenced by getTTId(), and setTTId().