CMS 3D CMS Logo

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

FEConfigFgrParamDat Class Reference

#include <FEConfigFgrParamDat.h>

Inheritance diagram for FEConfigFgrParamDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigFgrParamDat ()
float getFGhighratio () const
float getFGhighthresh () const
float getFGlowratio () const
float getFGlowthresh () const
std::string getTable ()
void setFGhighratio (float x)
void setFGhighthresh (float x)
void setFGlowratio (float x)
void setFGlowthresh (float x)
 ~FEConfigFgrParamDat ()

Private Member Functions

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

Private Attributes

float m_fghighthresh
float m_fglowthresh
float m_highratio
float m_lowratio

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigFgrParamDat.h.


Constructor & Destructor Documentation

FEConfigFgrParamDat::FEConfigFgrParamDat ( )

Definition at line 11 of file FEConfigFgrParamDat.cc.

References NULL.

FEConfigFgrParamDat::~FEConfigFgrParamDat ( )

Definition at line 27 of file FEConfigFgrParamDat.cc.

{
}

Member Function Documentation

void FEConfigFgrParamDat::fetchData ( std::map< EcalLogicID, FEConfigFgrParamDat > *  fillMap,
FEConfigFgrInfo iconf 
) throw (std::runtime_error) [private]
float FEConfigFgrParamDat::getFGhighratio ( ) const [inline]

Definition at line 29 of file FEConfigFgrParamDat.h.

References m_highratio.

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

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

Definition at line 27 of file FEConfigFgrParamDat.h.

References m_fghighthresh.

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

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

Definition at line 28 of file FEConfigFgrParamDat.h.

References m_lowratio.

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

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

Definition at line 26 of file FEConfigFgrParamDat.h.

References m_fglowthresh.

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

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

Implements IDataItem.

Definition at line 18 of file FEConfigFgrParamDat.h.

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

Implements IDataItem.

Definition at line 33 of file FEConfigFgrParamDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO "+ getTable()+" (fgr_conf_id, logic_id, "
                      " fg_lowthresh, fg_highthresh, fg_lowratio, fg_highratio ) "
                      "VALUES (:fgr_conf_id, :logic_id, "
                      " :fg_lowthresh, :fg_highthresh, :fg_lowratio, :fg_highratio )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigFgrParamDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigFgrParamDat::setFGhighratio ( float  x) [inline]

Definition at line 24 of file FEConfigFgrParamDat.h.

References m_highratio, and x.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 22 of file FEConfigFgrParamDat.h.

References m_fghighthresh, and x.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 23 of file FEConfigFgrParamDat.h.

References m_lowratio, and x.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 21 of file FEConfigFgrParamDat.h.

References m_fglowthresh, and x.

Referenced by EcalTPGParamBuilder::analyze().

void FEConfigFgrParamDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigFgrParamDat > *  data,
FEConfigFgrInfo iconf 
) throw (std::runtime_error) [private]

Definition at line 125 of file FEConfigFgrParamDat.cc.

References prof2calltree::count, data, getFGhighratio(), getFGhighthresh(), getFGlowratio(), getFGlowthresh(), EcalLogicID::getLogicID(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, lumiQTWidget::t, groupFilesInBlocks::tt, and w().

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

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


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

        dataitem = &(p->second);
        // dataIface.writeDB( channel, dataitem, conf);
        float w=dataitem->getFGlowthresh();
        float u=dataitem->getFGhighthresh();
        float t=dataitem->getFGlowratio();
        float r=dataitem->getFGhighratio();

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

    m_writeStmt->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iov_vec;
    delete [] ww;
    delete [] uu;
    delete [] tt;
    delete [] st;

    delete [] ids_len;
    delete [] iov_len;
    delete [] w_len;
    delete [] u_len;
    delete [] t_len;
    delete [] st_len;

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

Definition at line 51 of file FEConfigFgrParamDat.cc.

References alignCSCRings::e.

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

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

  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("FEConfigFgrParamDat::writeDB:  Bad EcalLogicID")); }
 
  try {
    m_writeStmt->setInt(1, iconfID);
    m_writeStmt->setInt(2, logicID);
    m_writeStmt->setFloat(3, item->getFGlowthresh());
    m_writeStmt->setFloat(4, item->getFGhighthresh());
    m_writeStmt->setFloat(5, item->getFGlowratio());
    m_writeStmt->setFloat(6, item->getFGhighratio());

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigFgrParamDat.h.


Member Data Documentation

Definition at line 48 of file FEConfigFgrParamDat.h.

Referenced by getFGhighthresh(), and setFGhighthresh().

Definition at line 47 of file FEConfigFgrParamDat.h.

Referenced by getFGlowthresh(), and setFGlowthresh().

Definition at line 50 of file FEConfigFgrParamDat.h.

Referenced by getFGhighratio(), and setFGhighratio().

Definition at line 49 of file FEConfigFgrParamDat.h.

Referenced by getFGlowratio(), and setFGlowratio().