CMS 3D CMS Logo

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

FEConfigWeightGroupDat Class Reference

#include <FEConfigWeightGroupDat.h>

Inheritance diagram for FEConfigWeightGroupDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigWeightGroupDat ()
std::string getTable ()
float getWeight0 () const
float getWeight1 () const
float getWeight2 () const
float getWeight3 () const
float getWeight4 () const
int getWeightGroupId () const
void setWeight0 (float x)
void setWeight1 (float x)
void setWeight2 (float x)
void setWeight3 (float x)
void setWeight4 (float x)
void setWeightGroupId (int x)
 ~FEConfigWeightGroupDat ()

Private Member Functions

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

Private Attributes

int m_group_id
float m_w0
float m_w1
float m_w2
float m_w3
float m_w4

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigWeightGroupDat.h.


Constructor & Destructor Documentation

FEConfigWeightGroupDat::FEConfigWeightGroupDat ( )

Definition at line 11 of file FEConfigWeightGroupDat.cc.

References NULL.

{
  m_env = NULL;
  m_conn = NULL;
  m_writeStmt = NULL;
  m_readStmt = NULL;

  m_group_id=0;
  m_w0 = 0;
  m_w1 = 0;
  m_w2 = 0;
  m_w3 = 0;
  m_w4 = 0;

}
FEConfigWeightGroupDat::~FEConfigWeightGroupDat ( )

Definition at line 29 of file FEConfigWeightGroupDat.cc.

{
}

Member Function Documentation

void FEConfigWeightGroupDat::fetchData ( std::map< EcalLogicID, FEConfigWeightGroupDat > *  fillMap,
FEConfigWeightInfo iconf 
) throw (std::runtime_error) [private]
std::string FEConfigWeightGroupDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigWeightGroupDat.h.

{ return "FE_CONFIG_WEIGHT_PER_GROUP_DAT"; }
float FEConfigWeightGroupDat::getWeight0 ( ) const [inline]

Definition at line 24 of file FEConfigWeightGroupDat.h.

References m_w0.

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

{ return m_w0; }
float FEConfigWeightGroupDat::getWeight1 ( ) const [inline]

Definition at line 26 of file FEConfigWeightGroupDat.h.

References m_w1.

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

{ return m_w1; }
float FEConfigWeightGroupDat::getWeight2 ( ) const [inline]

Definition at line 28 of file FEConfigWeightGroupDat.h.

References m_w2.

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

{ return m_w2; }
float FEConfigWeightGroupDat::getWeight3 ( ) const [inline]

Definition at line 30 of file FEConfigWeightGroupDat.h.

References m_w3.

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

{ return m_w3; }
float FEConfigWeightGroupDat::getWeight4 ( ) const [inline]

Definition at line 32 of file FEConfigWeightGroupDat.h.

References m_w4.

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

{ return m_w4; }
int FEConfigWeightGroupDat::getWeightGroupId ( ) const [inline]

Definition at line 21 of file FEConfigWeightGroupDat.h.

References m_group_id.

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

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

Implements IDataItem.

Definition at line 35 of file FEConfigWeightGroupDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO fe_weight_per_group_dat (wei_conf_id, group_id, "
                      " w0, w1, w2, w3, w4 ) "
                      "VALUES (:wei_conf_id, :group_id, "
                      ":w0, :w1, :w2, :w3, :w4 )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigWeightGroupDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigWeightGroupDat::setWeight0 ( float  x) [inline]

Definition at line 23 of file FEConfigWeightGroupDat.h.

References m_w0, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_w0 = x; }
void FEConfigWeightGroupDat::setWeight1 ( float  x) [inline]

Definition at line 25 of file FEConfigWeightGroupDat.h.

References m_w1, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_w1 = x; }
void FEConfigWeightGroupDat::setWeight2 ( float  x) [inline]

Definition at line 27 of file FEConfigWeightGroupDat.h.

References m_w2, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_w2 = x; }
void FEConfigWeightGroupDat::setWeight3 ( float  x) [inline]

Definition at line 29 of file FEConfigWeightGroupDat.h.

References m_w3, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_w3 = x; }
void FEConfigWeightGroupDat::setWeight4 ( float  x) [inline]

Definition at line 31 of file FEConfigWeightGroupDat.h.

References m_w4, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_w4 = x; }
void FEConfigWeightGroupDat::setWeightGroupId ( int  x) [inline]

Definition at line 20 of file FEConfigWeightGroupDat.h.

References m_group_id, and x.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 128 of file FEConfigWeightGroupDat.cc.

References prof2calltree::count, data, getWeight0(), getWeight1(), getWeight2(), getWeight3(), getWeight4(), getWeightGroupId(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, findQualityFiles::rr, alignCSCRings::s, lumiQTWidget::t, groupFilesInBlocks::tt, x, detailsBasic3DVector::y, and z.

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

  int iconfID = iconf->fetchID();
  if (!iconfID) { throw(std::runtime_error("FEConfigWeightGroupDat::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];
  float* tt= new float[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 FEConfigWeightGroupDat* dataitem;
  int count=0;
  typedef map< EcalLogicID, FEConfigWeightGroupDat >::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("FEConfigWeightGroupDat::writeArrayDB:  Bad EcalLogicID")); }
        //      ids[count]=logicID;
        iconfid_vec[count]=iconfID;

        dataitem = &(p->second);
        // dataIface.writeDB( channel, dataitem, iconf);
        int x=dataitem->getWeightGroupId();
        float y=dataitem->getWeight0();
        float z=dataitem->getWeight1();
        float r=dataitem->getWeight2();
        float s=dataitem->getWeight3();
        float t=dataitem->getWeight4();

        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, OCCIFLOAT , 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("FEConfigWeightGroupDat::writeArrayDB():  "+e.getMessage()));
  }
}
void FEConfigWeightGroupDat::writeDB ( const EcalLogicID ecid,
const FEConfigWeightGroupDat item,
FEConfigWeightInfo iconf 
) throw (std::runtime_error) [private]

Definition at line 53 of file FEConfigWeightGroupDat.cc.

References alignCSCRings::e.

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

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

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

    m_writeStmt->setInt(2, item->getWeightGroupId());
    m_writeStmt->setFloat(3, item->getWeight0());
    m_writeStmt->setFloat(4, item->getWeight1());
    m_writeStmt->setFloat(5, item->getWeight2());
    m_writeStmt->setFloat(6, item->getWeight3());
    m_writeStmt->setFloat(7, item->getWeight4());

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigWeightGroupDat.h.


Member Data Documentation

Definition at line 50 of file FEConfigWeightGroupDat.h.

Referenced by getWeightGroupId(), and setWeightGroupId().

Definition at line 51 of file FEConfigWeightGroupDat.h.

Referenced by getWeight0(), and setWeight0().

Definition at line 52 of file FEConfigWeightGroupDat.h.

Referenced by getWeight1(), and setWeight1().

Definition at line 53 of file FEConfigWeightGroupDat.h.

Referenced by getWeight2(), and setWeight2().

Definition at line 54 of file FEConfigWeightGroupDat.h.

Referenced by getWeight3(), and setWeight3().

Definition at line 55 of file FEConfigWeightGroupDat.h.

Referenced by getWeight4(), and setWeight4().