CMS 3D CMS Logo

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

FEConfigTimingDat Class Reference

#include <FEConfigTimingDat.h>

Inheritance diagram for FEConfigTimingDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigTimingDat ()
std::string getTable ()
int getTimingPar1 () const
int getTimingPar2 () const
void setTimingPar1 (int x)
void setTimingPar2 (int x)
 ~FEConfigTimingDat ()

Private Member Functions

void fetchData (std::map< EcalLogicID, FEConfigTimingDat > *fillMap, FEConfigTimingInfo *iconf) throw (std::runtime_error)
void prepareWrite () throw (std::runtime_error)
void writeArrayDB (const std::map< EcalLogicID, FEConfigTimingDat > *data, FEConfigTimingInfo *iconf) throw (std::runtime_error)
void writeDB (const EcalLogicID *ecid, const FEConfigTimingDat *item, FEConfigTimingInfo *iconf) throw (std::runtime_error)

Private Attributes

int m_par1
int m_par2

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigTimingDat.h.


Constructor & Destructor Documentation

FEConfigTimingDat::FEConfigTimingDat ( )

Definition at line 11 of file FEConfigTimingDat.cc.

References NULL.

FEConfigTimingDat::~FEConfigTimingDat ( )

Definition at line 25 of file FEConfigTimingDat.cc.

{
}

Member Function Documentation

void FEConfigTimingDat::fetchData ( std::map< EcalLogicID, FEConfigTimingDat > *  fillMap,
FEConfigTimingInfo iconf 
) throw (std::runtime_error) [private]
std::string FEConfigTimingDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigTimingDat.h.

{ return "FE_CONFIG_Time_DAT"; }
int FEConfigTimingDat::getTimingPar1 ( ) const [inline]

Definition at line 21 of file FEConfigTimingDat.h.

References m_par1.

Referenced by writeArrayDB().

{ return m_par1; }
int FEConfigTimingDat::getTimingPar2 ( ) const [inline]

Definition at line 23 of file FEConfigTimingDat.h.

References m_par2.

Referenced by writeArrayDB().

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

Implements IDataItem.

Definition at line 31 of file FEConfigTimingDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO "+getTable()+" (tim_conf_id, logic_id, "
                      "time_par1, time_par2 ) VALUES (:tim_conf_id, :logic_id, :time_par1, :time_par2 )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigTimingDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigTimingDat::setTimingPar1 ( int  x) [inline]

Definition at line 20 of file FEConfigTimingDat.h.

References m_par1, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_par1 = x; }
void FEConfigTimingDat::setTimingPar2 ( int  x) [inline]

Definition at line 22 of file FEConfigTimingDat.h.

References m_par2, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_par2 = x; }
void FEConfigTimingDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigTimingDat > *  data,
FEConfigTimingInfo iconf 
) throw (std::runtime_error) [private]

Definition at line 114 of file FEConfigTimingDat.cc.

References prof2calltree::count, data, EcalLogicID::getLogicID(), getTimingPar1(), getTimingPar2(), AlCaHLTBitMon_ParallelJobs::p, x, and detailsBasic3DVector::y.

{
  this->checkConnection();
  this->checkPrepare();

  int iconfID = iconf->fetchID();
  if (!iconfID) { throw(std::runtime_error("FEConfigTimingDat::writeArrayDB:  tim_conf_id not in DB")); }


  int nrows=data->size(); 
  int* ids= new int[nrows];
  int* iconfid_vec= new int[nrows];
  int* xx= new int[nrows];
  int* yy= new int[nrows];

  ub2* ids_len= new ub2[nrows];
  ub2* iconf_len= new ub2[nrows];
  ub2* x_len= new ub2[nrows];
  ub2* y_len= new ub2[nrows];

  const EcalLogicID* channel;
  const FEConfigTimingDat* dataitem;
  int count=0;
  typedef map< EcalLogicID, FEConfigTimingDat >::const_iterator CI;
  for (CI p = data->begin(); p != data->end(); ++p) {
        channel = &(p->first);
        int logicID = channel->getLogicID();
        if (!logicID) { throw(std::runtime_error("FEConfigTimingDat::writeArrayDB:  Bad EcalLogicID")); }
        ids[count]=logicID;
        iconfid_vec[count]=iconfID;

        dataitem = &(p->second);
        // dataIface.writeDB( channel, dataitem, iconf);
        int x=dataitem->getTimingPar1();
        int y=dataitem->getTimingPar2();

        xx[count]=x;
        yy[count]=y;

        ids_len[count]=sizeof(ids[count]);
        iconf_len[count]=sizeof(iconfid_vec[count]);
        
        x_len[count]=sizeof(xx[count]);
        y_len[count]=sizeof(yy[count]);

        count++;
     }


  try {
    m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len);
    m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
    m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len );
    m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len );

    m_writeStmt->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iconfid_vec;
    delete [] xx;
    delete [] yy;

    delete [] ids_len;
    delete [] iconf_len;
    delete [] x_len;
    delete [] y_len;

  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigTimingDat::writeArrayDB():  "+e.getMessage()));
  }
}
void FEConfigTimingDat::writeDB ( const EcalLogicID ecid,
const FEConfigTimingDat item,
FEConfigTimingInfo iconf 
) throw (std::runtime_error) [private]

Definition at line 46 of file FEConfigTimingDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();
  this->checkPrepare();

  int iconfID = iconf->fetchID();
  if (!iconfID) { throw(std::runtime_error("FEConfigTimingDat::writeDB:  ICONF not in DB")); }

  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("FEConfigTimingDat::writeDB:  Bad EcalLogicID")); }
 
  try {
    m_writeStmt->setInt(1, iconfID);
    m_writeStmt->setInt(2, logicID);
    m_writeStmt->setInt(3, item->getTimingPar1());
    m_writeStmt->setInt(4, item->getTimingPar2());

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigTimingDat.h.


Member Data Documentation

Definition at line 39 of file FEConfigTimingDat.h.

Referenced by getTimingPar1(), and setTimingPar1().

Definition at line 40 of file FEConfigTimingDat.h.

Referenced by getTimingPar2(), and setTimingPar2().