CMS 3D CMS Logo

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

FEConfigParamDat Class Reference

#include <FEConfigParamDat.h>

Inheritance diagram for FEConfigParamDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigParamDat ()
float getETSat () const
float getFGhighratio () const
float getFGhighthresh () const
float getFGlowratio () const
float getFGlowthresh () const
std::string getTable ()
float getTTThreshhigh () const
float getTTThreshlow () const
void setETSat (float x)
void setFGhighratio (float x)
void setFGhighthresh (float x)
void setFGlowratio (float x)
void setFGlowthresh (float x)
void setTTThreshhigh (float x)
void setTTThreshlow (float x)
 ~FEConfigParamDat ()

Private Member Functions

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

Private Attributes

float m_etsat
float m_fghighthresh
float m_fglowthresh
float m_highratio
float m_lowratio
float m_tthreshhigh
float m_tthreshlow

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigParamDat.h.


Constructor & Destructor Documentation

FEConfigParamDat::FEConfigParamDat ( )

Definition at line 11 of file FEConfigParamDat.cc.

References NULL.

FEConfigParamDat::~FEConfigParamDat ( )

Definition at line 30 of file FEConfigParamDat.cc.

{
}

Member Function Documentation

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

Definition at line 29 of file FEConfigParamDat.h.

References m_etsat.

Referenced by writeArrayDB().

{ return m_etsat; }
float FEConfigParamDat::getFGhighratio ( ) const [inline]

Definition at line 35 of file FEConfigParamDat.h.

References m_highratio.

Referenced by writeArrayDB().

{ return m_highratio; }
float FEConfigParamDat::getFGhighthresh ( ) const [inline]

Definition at line 33 of file FEConfigParamDat.h.

References m_fghighthresh.

Referenced by writeArrayDB().

{ return m_fghighthresh; }
float FEConfigParamDat::getFGlowratio ( ) const [inline]

Definition at line 34 of file FEConfigParamDat.h.

References m_lowratio.

Referenced by writeArrayDB().

{ return m_lowratio ; }
float FEConfigParamDat::getFGlowthresh ( ) const [inline]

Definition at line 32 of file FEConfigParamDat.h.

References m_fglowthresh.

Referenced by writeArrayDB().

{ return m_fglowthresh; }
std::string FEConfigParamDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigParamDat.h.

{ return "FE_CONFIG_PARAM_DAT"; }
float FEConfigParamDat::getTTThreshhigh ( ) const [inline]

Definition at line 31 of file FEConfigParamDat.h.

References m_tthreshhigh.

Referenced by writeArrayDB().

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

Definition at line 30 of file FEConfigParamDat.h.

References m_tthreshlow.

Referenced by writeArrayDB().

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

Implements IDataItem.

Definition at line 36 of file FEConfigParamDat.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();

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

Definition at line 21 of file FEConfigParamDat.h.

References m_etsat, and ExpressReco_HICollisions_FallBack::x.

{ m_etsat = x; }
void FEConfigParamDat::setFGhighratio ( float  x) [inline]

Definition at line 27 of file FEConfigParamDat.h.

References m_highratio, and ExpressReco_HICollisions_FallBack::x.

{ m_highratio = x; }
void FEConfigParamDat::setFGhighthresh ( float  x) [inline]

Definition at line 25 of file FEConfigParamDat.h.

References m_fghighthresh, and ExpressReco_HICollisions_FallBack::x.

void FEConfigParamDat::setFGlowratio ( float  x) [inline]

Definition at line 26 of file FEConfigParamDat.h.

References m_lowratio, and ExpressReco_HICollisions_FallBack::x.

{ m_lowratio = x; }
void FEConfigParamDat::setFGlowthresh ( float  x) [inline]

Definition at line 24 of file FEConfigParamDat.h.

References m_fglowthresh, and ExpressReco_HICollisions_FallBack::x.

void FEConfigParamDat::setTTThreshhigh ( float  x) [inline]

Definition at line 23 of file FEConfigParamDat.h.

References m_tthreshhigh, and ExpressReco_HICollisions_FallBack::x.

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

Definition at line 22 of file FEConfigParamDat.h.

References m_tthreshlow, and ExpressReco_HICollisions_FallBack::x.

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

Definition at line 136 of file FEConfigParamDat.cc.

References prof2calltree::count, runTheMatrix::data, getETSat(), getFGhighratio(), getFGhighthresh(), getFGlowratio(), getFGlowthresh(), EcalLogicID::getLogicID(), getTTThreshhigh(), getTTThreshlow(), L1TEmulatorMonitor_cff::p, csvReporter::r, matplotRender::t, ExpressReco_HICollisions_FallBack::x, ExpressReco_HICollisions_FallBack::y, and z.

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

  int iconfID = iconf->fetchID();
  if (!iconfID) { throw(std::runtime_error("FEConfigParamDat::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];
  float* ww= new float[nrows];
  float* uu= new float[nrows];
  float* tt= new float[nrows];
  float* st= 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];
  ub2* w_len= new ub2[nrows];
  ub2* u_len= new ub2[nrows];
  ub2* t_len= new ub2[nrows];
  ub2* st_len= new ub2[nrows];

  const EcalLogicID* channel;
  const FEConfigParamDat* dataitem;
  int count=0;
  typedef map< EcalLogicID, FEConfigParamDat >::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("FEConfigParamDat::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();
        float w=dataitem->getFGlowthresh();
        float u=dataitem->getFGhighthresh();
        float t=dataitem->getFGlowratio();
        float r=dataitem->getFGhighratio();

        xx[count]=x;
        yy[count]=y;
        zz[count]=z;
        ww[count]=w;
        uu[count]=u;
        tt[count]=t;
        st[count]=r;


        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]);
        w_len[count]=sizeof(ww[count]);
        u_len[count]=sizeof(uu[count]);
        t_len[count]=sizeof(tt[count]);
        st_len[count]=sizeof(st[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->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT , sizeof(ww[0]), w_len );
    m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT , sizeof(uu[0]), u_len );
    m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIFLOAT , sizeof(tt[0]), t_len );
    m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIFLOAT , sizeof(st[0]), st_len );
   

    m_writeStmt->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iov_vec;
    delete [] xx;
    delete [] yy;
    delete [] zz;
    delete [] ww;
    delete [] uu;
    delete [] tt;
    delete [] st;

    delete [] ids_len;
    delete [] iov_len;
    delete [] x_len;
    delete [] y_len;
    delete [] z_len;
    delete [] w_len;
    delete [] u_len;
    delete [] t_len;
    delete [] st_len;

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

Definition at line 54 of file FEConfigParamDat.cc.

References ExpressReco_HICollisions_FallBack::e.

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

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

  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("FEConfigParamDat::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->setFloat(6, item->getFGlowthresh());
    m_writeStmt->setFloat(7, item->getFGhighthresh());
    m_writeStmt->setFloat(8, item->getFGlowratio());
    m_writeStmt->setFloat(9, item->getFGhighratio());

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigParamDat.h.


Member Data Documentation

float FEConfigParamDat::m_etsat [private]

Definition at line 53 of file FEConfigParamDat.h.

Referenced by getETSat(), and setETSat().

Definition at line 57 of file FEConfigParamDat.h.

Referenced by getFGhighthresh(), and setFGhighthresh().

Definition at line 56 of file FEConfigParamDat.h.

Referenced by getFGlowthresh(), and setFGlowthresh().

Definition at line 59 of file FEConfigParamDat.h.

Referenced by getFGhighratio(), and setFGhighratio().

Definition at line 58 of file FEConfigParamDat.h.

Referenced by getFGlowratio(), and setFGlowratio().

Definition at line 55 of file FEConfigParamDat.h.

Referenced by getTTThreshhigh(), and setTTThreshhigh().

Definition at line 54 of file FEConfigParamDat.h.

Referenced by getTTThreshlow(), and setTTThreshlow().