CMS 3D CMS Logo

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

FEConfigLUTParamDat Class Reference

#include <FEConfigLUTParamDat.h>

Inheritance diagram for FEConfigLUTParamDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigLUTParamDat ()
float getETSat () const
std::string getTable ()
float getTTThreshhigh () const
float getTTThreshlow () const
void setETSat (float x)
void setTTThreshhigh (float x)
void setTTThreshlow (float x)
 ~FEConfigLUTParamDat ()

Private Member Functions

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

Private Attributes

float m_etsat
float m_tthreshhigh
float m_tthreshlow

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigLUTParamDat.h.


Constructor & Destructor Documentation

FEConfigLUTParamDat::FEConfigLUTParamDat ( )

Definition at line 11 of file FEConfigLUTParamDat.cc.

References NULL.

FEConfigLUTParamDat::~FEConfigLUTParamDat ( )

Definition at line 26 of file FEConfigLUTParamDat.cc.

{
}

Member Function Documentation

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

Definition at line 27 of file FEConfigLUTParamDat.h.

References m_etsat.

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

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

Implements IDataItem.

Definition at line 18 of file FEConfigLUTParamDat.h.

{ return "FE_CONFIG_LUTPARAM_DAT"; }
float FEConfigLUTParamDat::getTTThreshhigh ( ) const [inline]

Definition at line 29 of file FEConfigLUTParamDat.h.

References m_tthreshhigh.

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

{ return m_tthreshhigh; }
float FEConfigLUTParamDat::getTTThreshlow ( ) const [inline]

Definition at line 28 of file FEConfigLUTParamDat.h.

References m_tthreshlow.

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

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

Implements IDataItem.

Definition at line 32 of file FEConfigLUTParamDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();

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

Definition at line 21 of file FEConfigLUTParamDat.h.

References m_etsat, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_etsat = x; }
void FEConfigLUTParamDat::setTTThreshhigh ( float  x) [inline]

Definition at line 23 of file FEConfigLUTParamDat.h.

References m_tthreshhigh, and x.

Referenced by EcalTPGParamBuilder::analyze().

void FEConfigLUTParamDat::setTTThreshlow ( float  x) [inline]

Definition at line 22 of file FEConfigLUTParamDat.h.

References m_tthreshlow, and x.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 124 of file FEConfigLUTParamDat.cc.

References prof2calltree::count, AlCaHLTBitMon_QueryRunRegistry::data, getETSat(), EcalLogicID::getLogicID(), getTTThreshhigh(), getTTThreshlow(), AlCaHLTBitMon_ParallelJobs::p, x, detailsBasic3DVector::y, and z.

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

  int iconfID = iconf->fetchID();
  if (!iconfID) { throw(std::runtime_error("FEConfigLUTParamDat::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];
  float* yy= new float[nrows];
  float* zz= new float[nrows];


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


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

        dataitem = &(p->second);
        // dataIface.writeDB( channel, dataitem, conf);
        float x=dataitem->getETSat();
        float y=dataitem->getTTThreshlow();
        float z=dataitem->getTTThreshhigh();

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


        ids_len[count]=sizeof(ids[count]);
        iov_len[count]=sizeof(iov_vec[count]);
        
        x_len[count]=sizeof(xx[count]);
        y_len[count]=sizeof(yy[count]);
        z_len[count]=sizeof(zz[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->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
    m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );

    m_writeStmt->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iov_vec;
    delete [] xx;
    delete [] yy;
    delete [] zz;

    delete [] ids_len;
    delete [] iov_len;
    delete [] x_len;
    delete [] y_len;
    delete [] z_len;

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

Definition at line 50 of file FEConfigLUTParamDat.cc.

References alignCSCRings::e.

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

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

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigLUTParamDat.h.


Member Data Documentation

Definition at line 47 of file FEConfigLUTParamDat.h.

Referenced by getETSat(), and setETSat().

Definition at line 49 of file FEConfigLUTParamDat.h.

Referenced by getTTThreshhigh(), and setTTThreshhigh().

Definition at line 48 of file FEConfigLUTParamDat.h.

Referenced by getTTThreshlow(), and setTTThreshlow().