CMS 3D CMS Logo

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

FEConfigFgrGroupDat Class Reference

#include <FEConfigFgrGroupDat.h>

Inheritance diagram for FEConfigFgrGroupDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigFgrGroupDat ()
int getFgrGroupId () const
int getLUTValue () const
float getRatioHigh () const
float getRatioLow () const
std::string getTable ()
float getThreshHigh () const
float getThreshLow () const
void setFgrGroupId (int x)
void setLUTValue (int x)
void setRatioHigh (float x)
void setRatioLow (float x)
void setThreshHigh (float x)
void setThreshLow (float x)
 ~FEConfigFgrGroupDat ()

Private Member Functions

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

Private Attributes

int m_group_id
int m_lut
float m_ratio_high
float m_ratio_low
float m_thresh_high
float m_thresh_low

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigFgrGroupDat.h.


Constructor & Destructor Documentation

FEConfigFgrGroupDat::FEConfigFgrGroupDat ( )

Definition at line 11 of file FEConfigFgrGroupDat.cc.

References NULL.

FEConfigFgrGroupDat::~FEConfigFgrGroupDat ( )

Definition at line 29 of file FEConfigFgrGroupDat.cc.

{
}

Member Function Documentation

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

Definition at line 21 of file FEConfigFgrGroupDat.h.

References m_group_id.

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

{ return m_group_id; }
int FEConfigFgrGroupDat::getLUTValue ( ) const [inline]

Definition at line 32 of file FEConfigFgrGroupDat.h.

References m_lut.

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

{ return m_lut; }
float FEConfigFgrGroupDat::getRatioHigh ( ) const [inline]

Definition at line 30 of file FEConfigFgrGroupDat.h.

References m_ratio_high.

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

{ return m_ratio_high; }
float FEConfigFgrGroupDat::getRatioLow ( ) const [inline]

Definition at line 28 of file FEConfigFgrGroupDat.h.

References m_ratio_low.

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

{ return m_ratio_low; }
std::string FEConfigFgrGroupDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigFgrGroupDat.h.

{ return "FE_CONFIG_FGR_PER_GROUP_DAT"; }
float FEConfigFgrGroupDat::getThreshHigh ( ) const [inline]

Definition at line 26 of file FEConfigFgrGroupDat.h.

References m_thresh_high.

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

{ return m_thresh_high; }
float FEConfigFgrGroupDat::getThreshLow ( ) const [inline]

Definition at line 24 of file FEConfigFgrGroupDat.h.

References m_thresh_low.

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

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

Implements IDataItem.

Definition at line 35 of file FEConfigFgrGroupDat.cc.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO fe_fgr_per_group_dat (fgr_conf_id, group_id, "
                      " threshold_low, threshold_high, ratio_low, ratio_high, lut_value ) "
                      "VALUES (:fgr_conf_id, :group_id, "
                      ":3, :4, :5, :6, :7 )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigFgrGroupDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigFgrGroupDat::setFgrGroupId ( int  x) [inline]

Definition at line 20 of file FEConfigFgrGroupDat.h.

References m_group_id, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_group_id = x; }
void FEConfigFgrGroupDat::setLUTValue ( int  x) [inline]

Definition at line 31 of file FEConfigFgrGroupDat.h.

References m_lut, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_lut = x; }
void FEConfigFgrGroupDat::setRatioHigh ( float  x) [inline]

Definition at line 29 of file FEConfigFgrGroupDat.h.

References m_ratio_high, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_ratio_high = x; }
void FEConfigFgrGroupDat::setRatioLow ( float  x) [inline]

Definition at line 27 of file FEConfigFgrGroupDat.h.

References m_ratio_low, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_ratio_low = x; }
void FEConfigFgrGroupDat::setThreshHigh ( float  x) [inline]

Definition at line 25 of file FEConfigFgrGroupDat.h.

References m_thresh_high, and x.

Referenced by EcalTPGParamBuilder::analyze().

void FEConfigFgrGroupDat::setThreshLow ( float  x) [inline]

Definition at line 23 of file FEConfigFgrGroupDat.h.

References m_thresh_low, and x.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 128 of file FEConfigFgrGroupDat.cc.

References prof2calltree::count, runTheMatrix::data, getFgrGroupId(), getLUTValue(), getRatioHigh(), getRatioLow(), getThreshHigh(), getThreshLow(), L1TEmulatorMonitor_cff::p, csvReporter::r, asciidump::s, matplotRender::t, x, detailsBasic3DVector::y, and z.

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

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


  int nrows=data->size(); 
  int* ids= new int[nrows];
  int* iconfid_vec= new int[nrows];
  int* xx= new int[nrows];
  float* yy= new float[nrows];
  float* zz= new float[nrows];
  float* rr= new float[nrows];
  float* ss= new float[nrows];
  int* tt= new 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];
  ub2* z_len= new ub2[nrows];
  ub2* r_len= new ub2[nrows];
  ub2* s_len= new ub2[nrows];
  ub2* t_len= new ub2[nrows];


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

        dataitem = &(p->second);
        // dataIface.writeDB( channel, dataitem, iconf);
        int x=dataitem->getFgrGroupId();
        float y=dataitem->getThreshLow();
        float z=dataitem->getThreshHigh();
        float r=dataitem->getRatioLow();
        float s=dataitem->getRatioHigh();
        int t=dataitem->getLUTValue();

        xx[count]=x;
        yy[count]=y;
        zz[count]=z;
        rr[count]=r;
        ss[count]=s;
        tt[count]=t;

        //      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]);
        z_len[count]=sizeof(zz[count]);
        r_len[count]=sizeof(rr[count]);
        s_len[count]=sizeof(ss[count]);
        t_len[count]=sizeof(tt[count]);

        count++;
     }


  try {
    m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len);
    m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len );
    m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
    m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
    m_writeStmt->setDataBuffer(5, (dvoid*)rr, OCCIFLOAT , sizeof(rr[0]), r_len );
    m_writeStmt->setDataBuffer(6, (dvoid*)ss, OCCIFLOAT , sizeof(ss[0]), s_len );
    m_writeStmt->setDataBuffer(7, (dvoid*)tt, OCCIINT , sizeof(tt[0]), t_len );

    m_writeStmt->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iconfid_vec;
    delete [] xx;
    delete [] yy;
    delete [] zz;
    delete [] rr;
    delete [] ss;
    delete [] tt;

    delete [] ids_len;
    delete [] iconf_len;
    delete [] x_len;
    delete [] y_len;
    delete [] z_len;
    delete [] r_len;
    delete [] s_len;
    delete [] t_len;

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

Definition at line 53 of file FEConfigFgrGroupDat.cc.

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

  int iconfID = iconf->fetchID();
  if (!iconfID) { throw(std::runtime_error("FEConfigFgrGroupDat::writeDB:  ICONF not in DB")); }
  /* no need for the logic id in this table 
     int logicID = ecid->getLogicID();
     if (!logicID) { throw(std::runtime_error("FEConfigFgrGroupDat::writeDB:  Bad EcalLogicID")); }
  */

  try {
    m_writeStmt->setInt(1, iconfID);

    m_writeStmt->setInt(2, item->getFgrGroupId());
    m_writeStmt->setFloat(3, item->getThreshLow());
    m_writeStmt->setFloat(4, item->getThreshHigh());
    m_writeStmt->setFloat(5, item->getRatioLow());
    m_writeStmt->setFloat(6, item->getRatioHigh());
    m_writeStmt->setInt(7, item->getLUTValue());

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigFgrGroupDat.h.


Member Data Documentation

Definition at line 50 of file FEConfigFgrGroupDat.h.

Referenced by getFgrGroupId(), and setFgrGroupId().

Definition at line 55 of file FEConfigFgrGroupDat.h.

Referenced by getLUTValue(), and setLUTValue().

Definition at line 54 of file FEConfigFgrGroupDat.h.

Referenced by getRatioHigh(), and setRatioHigh().

Definition at line 53 of file FEConfigFgrGroupDat.h.

Referenced by getRatioLow(), and setRatioLow().

Definition at line 52 of file FEConfigFgrGroupDat.h.

Referenced by getThreshHigh(), and setThreshHigh().

Definition at line 51 of file FEConfigFgrGroupDat.h.

Referenced by getThreshLow(), and setThreshLow().