CMS 3D CMS Logo

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

FEConfigFgrEEStripDat Class Reference

#include <FEConfigFgrEEStripDat.h>

Inheritance diagram for FEConfigFgrEEStripDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigFgrEEStripDat ()
unsigned int getLutFg () const
unsigned int getLUTFgr () const
unsigned int getLutFgr () const
std::string getTable ()
unsigned int getThreshold () const
void setLutFg (unsigned int mean)
void setLutFgr (unsigned int mean)
void setLUTFgr (unsigned int mean)
void setThreshold (unsigned int mean)
 ~FEConfigFgrEEStripDat ()

Private Member Functions

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

Private Attributes

unsigned int m_lut_fg
unsigned int m_thresh

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigFgrEEStripDat.h.


Constructor & Destructor Documentation

FEConfigFgrEEStripDat::FEConfigFgrEEStripDat ( )

Definition at line 11 of file FEConfigFgrEEStripDat.cc.

References NULL.

FEConfigFgrEEStripDat::~FEConfigFgrEEStripDat ( )

Definition at line 25 of file FEConfigFgrEEStripDat.cc.

{
}

Member Function Documentation

void FEConfigFgrEEStripDat::fetchData ( std::map< EcalLogicID, FEConfigFgrEEStripDat > *  fillMap,
FEConfigFgrInfo iconf 
) throw (std::runtime_error) [private]
unsigned int FEConfigFgrEEStripDat::getLutFg ( ) const [inline]

Definition at line 23 of file FEConfigFgrEEStripDat.h.

References m_lut_fg.

Referenced by writeArrayDB().

{ return m_lut_fg; }
unsigned int FEConfigFgrEEStripDat::getLutFgr ( ) const [inline]

Definition at line 27 of file FEConfigFgrEEStripDat.h.

References m_lut_fg.

{ return m_lut_fg; }
unsigned int FEConfigFgrEEStripDat::getLUTFgr ( ) const [inline]

Definition at line 25 of file FEConfigFgrEEStripDat.h.

References m_lut_fg.

Referenced by popcon::EcalTPGFineGrainStripEEHandler::getNewObjects().

{ return m_lut_fg; }
std::string FEConfigFgrEEStripDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigFgrEEStripDat.h.

{ return "FE_CONFIG_FGREEST_DAT"; }
unsigned int FEConfigFgrEEStripDat::getThreshold ( ) const [inline]

Definition at line 21 of file FEConfigFgrEEStripDat.h.

References m_thresh.

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

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

Implements IDataItem.

Definition at line 31 of file FEConfigFgrEEStripDat.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO "+getTable()+" (fgr_conf_id, logic_id, "
                      "threshold, lut_fg ) "
                      "VALUES (:fgr_conf_id, :logic_id, "
                      ":threshold, :lut_fg )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigFgrEEStripDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigFgrEEStripDat::setLutFg ( unsigned int  mean) [inline]

Definition at line 22 of file FEConfigFgrEEStripDat.h.

References m_lut_fg, and plotscripts::mean().

{ m_lut_fg = mean; }
void FEConfigFgrEEStripDat::setLutFgr ( unsigned int  mean) [inline]

Definition at line 26 of file FEConfigFgrEEStripDat.h.

References m_lut_fg, and plotscripts::mean().

Referenced by EcalTPGParamBuilder::analyze().

{ m_lut_fg = mean; }
void FEConfigFgrEEStripDat::setLUTFgr ( unsigned int  mean) [inline]

Definition at line 24 of file FEConfigFgrEEStripDat.h.

References m_lut_fg, and plotscripts::mean().

{ m_lut_fg = mean; }
void FEConfigFgrEEStripDat::setThreshold ( unsigned int  mean) [inline]

Definition at line 20 of file FEConfigFgrEEStripDat.h.

References m_thresh, and plotscripts::mean().

Referenced by EcalTPGParamBuilder::analyze().

{ m_thresh = mean; }
void FEConfigFgrEEStripDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigFgrEEStripDat > *  data,
FEConfigFgrInfo iconf 
) throw (std::runtime_error) [private]

Definition at line 119 of file FEConfigFgrEEStripDat.cc.

References prof2calltree::count, runTheMatrix::data, EcalLogicID::getLogicID(), getLutFg(), getThreshold(), L1TEmulatorMonitor_cff::p, ExpressReco_HICollisions_FallBack::x, and ExpressReco_HICollisions_FallBack::y.

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

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


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

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

        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, OCCIUNSIGNED_INT , sizeof(xx[0]), x_len );
    m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIUNSIGNED_INT , 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("FEConfigFgrEEStripDat::writeArrayDB():  "+e.getMessage()));
  }
}
void FEConfigFgrEEStripDat::writeDB ( const EcalLogicID ecid,
const FEConfigFgrEEStripDat item,
FEConfigFgrInfo iconf 
) throw (std::runtime_error) [private]

Definition at line 49 of file FEConfigFgrEEStripDat.cc.

References ExpressReco_HICollisions_FallBack::e.

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

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

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigFgrEEStripDat.h.


Member Data Documentation

unsigned int FEConfigFgrEEStripDat::m_lut_fg [private]

Definition at line 46 of file FEConfigFgrEEStripDat.h.

Referenced by getLutFg(), getLUTFgr(), getLutFgr(), setLutFg(), setLUTFgr(), and setLutFgr().

unsigned int FEConfigFgrEEStripDat::m_thresh [private]

Definition at line 45 of file FEConfigFgrEEStripDat.h.

Referenced by getThreshold(), and setThreshold().