CMS 3D CMS Logo

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

FEConfigLinParamDat Class Reference

#include <FEConfigLinParamDat.h>

Inheritance diagram for FEConfigLinParamDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigLinParamDat ()
float getETSat () const
std::string getTable ()
void setETSat (float x)
 ~FEConfigLinParamDat ()

Private Member Functions

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

Private Attributes

float m_etsat

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigLinParamDat.h.


Constructor & Destructor Documentation

FEConfigLinParamDat::FEConfigLinParamDat ( )

Definition at line 11 of file FEConfigLinParamDat.cc.

References NULL.

FEConfigLinParamDat::~FEConfigLinParamDat ( )

Definition at line 23 of file FEConfigLinParamDat.cc.

{
}

Member Function Documentation

void FEConfigLinParamDat::fetchData ( std::map< EcalLogicID, FEConfigLinParamDat > *  fillMap,
FEConfigLinInfo iconf 
) throw (std::runtime_error) [private]
float FEConfigLinParamDat::getETSat ( ) const [inline]

Definition at line 23 of file FEConfigLinParamDat.h.

References m_etsat.

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

{ return m_etsat; }
std::string FEConfigLinParamDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigLinParamDat.h.

{ return "FE_CONFIG_LINPARAM_DAT"; }
void FEConfigLinParamDat::prepareWrite ( ) throw (std::runtime_error) [private, virtual]

Implements IDataItem.

Definition at line 29 of file FEConfigLinParamDat.cc.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO "+getTable()+" (lin_conf_id, logic_id, "
                      " etsat ) "
                      "VALUES (:lin_conf_id, :logic_id, "
                      ":etsat )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigLinParamDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigLinParamDat::setETSat ( float  x) [inline]

Definition at line 21 of file FEConfigLinParamDat.h.

References m_etsat, and x.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 117 of file FEConfigLinParamDat.cc.

References prof2calltree::count, AlCaHLTBitMon_QueryRunRegistry::data, getETSat(), EcalLogicID::getLogicID(), AlCaHLTBitMon_ParallelJobs::p, and x.

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

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


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


  ub2* ids_len= new ub2[nrows];
  ub2* iov_len= new ub2[nrows];
  ub2* x_len= new ub2[nrows];

  const EcalLogicID* channel;
  const FEConfigLinParamDat* dataitem;
  int count=0;
  typedef map< EcalLogicID, FEConfigLinParamDat >::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("FEConfigLinParamDat::writeArrayDB:  Bad EcalLogicID")); }
        ids[count]=logicID;
        iov_vec[count]=iconfID;

        dataitem = &(p->second);
        float x=dataitem->getETSat();

        xx[count]=x;

        ids_len[count]=sizeof(ids[count]);
        iov_len[count]=sizeof(iov_vec[count]);
        x_len[count]=sizeof(xx[count]);

        count++;
     }


  try {
    m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT, sizeof(iov_vec[0]),iov_len);
    m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
    m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );

    m_writeStmt->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iov_vec;
    delete [] xx;

    delete [] ids_len;
    delete [] iov_len;
    delete [] x_len;

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

Definition at line 47 of file FEConfigLinParamDat.cc.

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

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

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigLinParamDat.h.


Member Data Documentation

Definition at line 41 of file FEConfigLinParamDat.h.

Referenced by getETSat(), and setETSat().