CMS 3D CMS Logo

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

FEConfigBadXTDat Class Reference

#include <FEConfigBadXTDat.h>

Inheritance diagram for FEConfigBadXTDat:
IODConfig IDBObject

List of all members.

Public Member Functions

 FEConfigBadXTDat ()
int getFedId () const
int getId () const
int getStatus () const
std::string getTable ()
int getTCCId () const
int getTTId () const
int getXTId () const
void setFedId (int dac)
void setId (int dac)
void setStatus (int dac)
void setTCCId (int dac)
void setTTId (int dac)
void setXTId (int dac)
 ~FEConfigBadXTDat ()

Private Member Functions

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

Private Attributes

int m_fed
int m_ID
int m_t1
int m_tcc
int m_tt
int m_xt

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 10 of file FEConfigBadXTDat.h.


Constructor & Destructor Documentation

FEConfigBadXTDat::FEConfigBadXTDat ( )

Definition at line 10 of file FEConfigBadXTDat.cc.

References NULL.

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

  m_tcc = 0;
  m_fed = 0;
  m_tt = 0;
  m_xt = 0;
  m_t1 = 0;

}
FEConfigBadXTDat::~FEConfigBadXTDat ( )

Definition at line 27 of file FEConfigBadXTDat.cc.

{
}

Member Function Documentation

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

Definition at line 70 of file FEConfigBadXTDat.cc.

References ExpressReco_HICollisions_FallBack::e, o2o::iov, L1TEmulatorMonitor_cff::p, setFedId(), setStatus(), setTCCId(), setTTId(), and setXTId().

{
  this->checkConnection();

  iov->setConnection(m_env, m_conn);
  int iovID = iov->fetchID();
  if (!iovID) { 
    //  throw(std::runtime_error("FEConfigBadXTDat::writeDB:  IOV not in DB")); 
    return;
  }

  try {
    m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by tcc_id, fed_id, tt_id , cry_id ");
    m_readStmt->setInt(1, iovID);
    ResultSet* rset = m_readStmt->executeQuery();
    
    //    std::vector< FEConfigBadXTDat > p;
    FEConfigBadXTDat dat;
    while(rset->next()) {
      // dat.setId( rset->getInt(1) );
      dat.setTCCId( rset->getInt(2) );
      dat.setFedId( rset->getInt(3) );
      dat.setTTId( rset->getInt(4) );
      dat.setXTId( rset->getInt(5) );
      dat.setStatus( rset->getInt(6) );

      p->push_back( dat);

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

Definition at line 23 of file FEConfigBadXTDat.h.

References m_fed.

Referenced by popcon::EcalTPGBadXTHandler::getNewObjects(), and writeArrayDB().

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

Definition at line 20 of file FEConfigBadXTDat.h.

References m_ID.

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

Definition at line 36 of file FEConfigBadXTDat.h.

References m_t1.

Referenced by popcon::EcalTPGBadXTHandler::getNewObjects(), and writeArrayDB().

{ return m_t1; }
std::string FEConfigBadXTDat::getTable ( ) [inline, virtual]

Implements IODConfig.

Definition at line 17 of file FEConfigBadXTDat.h.

{ return "FE_CONFIG_BadCRYSTALS_DAT"; }
int FEConfigBadXTDat::getTCCId ( ) const [inline]

Definition at line 26 of file FEConfigBadXTDat.h.

References m_tcc.

Referenced by writeArrayDB().

{ return m_tcc; }
int FEConfigBadXTDat::getTTId ( ) const [inline]

Definition at line 29 of file FEConfigBadXTDat.h.

References m_tt.

Referenced by popcon::EcalTPGBadXTHandler::getNewObjects(), and writeArrayDB().

{ return m_tt; }
int FEConfigBadXTDat::getXTId ( ) const [inline]

Definition at line 32 of file FEConfigBadXTDat.h.

References m_xt.

Referenced by popcon::EcalTPGBadXTHandler::getNewObjects(), and writeArrayDB().

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

Implements IODConfig.

Definition at line 33 of file FEConfigBadXTDat.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();

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

Definition at line 22 of file FEConfigBadXTDat.h.

References m_fed.

Referenced by fetchData().

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

Definition at line 19 of file FEConfigBadXTDat.h.

References m_ID.

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

Definition at line 35 of file FEConfigBadXTDat.h.

References m_t1.

Referenced by fetchData().

{ m_t1 = dac; }
void FEConfigBadXTDat::setTCCId ( int  dac) [inline]

Definition at line 25 of file FEConfigBadXTDat.h.

References m_tcc.

Referenced by fetchData().

{ m_tcc = dac; }
void FEConfigBadXTDat::setTTId ( int  dac) [inline]

Definition at line 28 of file FEConfigBadXTDat.h.

References m_tt.

Referenced by fetchData().

{ m_tt = dac; }
void FEConfigBadXTDat::setXTId ( int  dac) [inline]

Definition at line 31 of file FEConfigBadXTDat.h.

References m_xt.

Referenced by fetchData().

{ m_xt = dac; }
void FEConfigBadXTDat::writeArrayDB ( const std::vector< FEConfigBadXTDat data,
FEConfigBadXTInfo iov 
) throw (std::runtime_error) [private]

Definition at line 107 of file FEConfigBadXTDat.cc.

References prof2calltree::count, runTheMatrix::data, ExpressReco_HICollisions_FallBack::e, getFedId(), getStatus(), getTCCId(), getTTId(), getXTId(), and o2o::iov.

{
  this->checkConnection();

  int iovID = iov->fetchID();
  if (!iovID) { throw(std::runtime_error("FEConfigDelays::writeArrayDB:  FEConfigBadXTInfo 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* z1= 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* z1_len= new ub2[nrows];
  ub2* st_len= new ub2[nrows];


  FEConfigBadXTDat dataitem;
  

  for (size_t count = 0; count != data.size(); count++) {
    dataitem=data[count];
    ids[count]=iovID;
    xx[count]=dataitem.getTCCId();
    yy[count]=dataitem.getFedId();
    zz[count]=dataitem.getTTId();
    z1[count]=dataitem.getXTId();
    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]);
        z1_len[count]=sizeof(z1[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*)z1, OCCIINT , sizeof(z1[0]), z1_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 [] z1;
    delete [] st;

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

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

Definition at line 49 of file FEConfigBadXTDat.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 12 of file FEConfigBadXTDat.h.


Member Data Documentation

int FEConfigBadXTDat::m_fed [private]

Definition at line 54 of file FEConfigBadXTDat.h.

Referenced by getFedId(), and setFedId().

int FEConfigBadXTDat::m_ID [private]

Definition at line 58 of file FEConfigBadXTDat.h.

Referenced by getId(), and setId().

int FEConfigBadXTDat::m_t1 [private]

Definition at line 57 of file FEConfigBadXTDat.h.

Referenced by getStatus(), and setStatus().

int FEConfigBadXTDat::m_tcc [private]

Definition at line 53 of file FEConfigBadXTDat.h.

Referenced by getTCCId(), and setTCCId().

int FEConfigBadXTDat::m_tt [private]

Definition at line 55 of file FEConfigBadXTDat.h.

Referenced by getTTId(), and setTTId().

int FEConfigBadXTDat::m_xt [private]

Definition at line 56 of file FEConfigBadXTDat.h.

Referenced by getXTId(), and setXTId().