CMS 3D CMS Logo

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

FEConfigPedDat Class Reference

#include <FEConfigPedDat.h>

Inheritance diagram for FEConfigPedDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigPedDat ()
int getId () const
float getPedMeanG1 () const
float getPedMeanG12 () const
float getPedMeanG6 () const
std::string getTable ()
void setId (int x)
void setPedMeanG1 (float mean)
void setPedMeanG12 (float mean)
void setPedMeanG6 (float mean)
 ~FEConfigPedDat ()

Private Member Functions

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

Private Attributes

int m_ID
float m_pedMeanG1
float m_pedMeanG12
float m_pedMeanG6

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigPedDat.h.


Constructor & Destructor Documentation

FEConfigPedDat::FEConfigPedDat ( )

Definition at line 11 of file FEConfigPedDat.cc.

References NULL.

FEConfigPedDat::~FEConfigPedDat ( )

Definition at line 26 of file FEConfigPedDat.cc.

{
}

Member Function Documentation

void FEConfigPedDat::fetchData ( std::map< EcalLogicID, FEConfigPedDat > *  fillMap,
FEConfigPedInfo iconf 
) throw (std::runtime_error) [private]
int FEConfigPedDat::getId ( ) const [inline]

Definition at line 21 of file FEConfigPedDat.h.

References m_ID.

{ return m_ID; }
float FEConfigPedDat::getPedMeanG1 ( ) const [inline]
float FEConfigPedDat::getPedMeanG12 ( ) const [inline]
float FEConfigPedDat::getPedMeanG6 ( ) const [inline]
std::string FEConfigPedDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigPedDat.h.

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

Implements IDataItem.

Definition at line 31 of file FEConfigPedDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();

    m_writeStmt->setSQL("INSERT INTO "+getTable()+" (ped_conf_id, logic_id, "
                      "mean_12, mean_6, mean_1 ) "
                      "VALUES (:ped_conf_id, :logic_id, "
                      ":ped_mean_g12, :ped_mean_g6, :ped_mean_g1 )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigPedDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigPedDat::setId ( int  x) [inline]

Definition at line 20 of file FEConfigPedDat.h.

References m_ID, and x.

{ m_ID = x; }
void FEConfigPedDat::setPedMeanG1 ( float  mean) [inline]

Definition at line 23 of file FEConfigPedDat.h.

References m_pedMeanG1, and timingPdfMaker::mean.

Referenced by EcalTPGParamBuilder::analyze().

void FEConfigPedDat::setPedMeanG12 ( float  mean) [inline]

Definition at line 29 of file FEConfigPedDat.h.

References m_pedMeanG12, and timingPdfMaker::mean.

Referenced by EcalTPGParamBuilder::analyze().

void FEConfigPedDat::setPedMeanG6 ( float  mean) [inline]

Definition at line 26 of file FEConfigPedDat.h.

References m_pedMeanG6, and timingPdfMaker::mean.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 120 of file FEConfigPedDat.cc.

References prof2calltree::count, AlCaHLTBitMon_QueryRunRegistry::data, EcalLogicID::getLogicID(), getPedMeanG1(), getPedMeanG12(), getPedMeanG6(), AlCaHLTBitMon_ParallelJobs::p, x, detailsBasic3DVector::y, and z.

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

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


  int nrows=data->size(); 
  int* ids= new int[nrows];
  int* iconfid_vec= new int[nrows];
  float* xx= new float[nrows];
  float* yy= new float[nrows];
  float* zz= 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];


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

        dataitem = &(p->second);
        // dataIface.writeDB( channel, dataitem, iconf);
        float x=dataitem->getPedMeanG12();
        float y=dataitem->getPedMeanG6();
        float z=dataitem->getPedMeanG1();

        xx[count]=x;
        yy[count]=y;
        zz[count]=z;

        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]);

        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, 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->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iconfid_vec;
    delete [] xx;
    delete [] yy;
    delete [] zz;

    delete [] ids_len;
    delete [] iconf_len;
    delete [] x_len;
    delete [] y_len;
    delete [] z_len;

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

Definition at line 50 of file FEConfigPedDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();

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

  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("FEConfigPedDat::writeDB:  Bad EcalLogicID")); }
 
  try {
    m_writeStmt->setInt(1, iconfID);
    m_writeStmt->setInt(2, logicID);
    m_writeStmt->setFloat(3, item->getPedMeanG12());
    m_writeStmt->setFloat(4, item->getPedMeanG6());
    m_writeStmt->setFloat(5, item->getPedMeanG1());

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigPedDat.h.


Member Data Documentation

int FEConfigPedDat::m_ID [private]

Definition at line 50 of file FEConfigPedDat.h.

Referenced by getId(), and setId().

float FEConfigPedDat::m_pedMeanG1 [private]

Definition at line 47 of file FEConfigPedDat.h.

Referenced by getPedMeanG1(), and setPedMeanG1().

Definition at line 49 of file FEConfigPedDat.h.

Referenced by getPedMeanG12(), and setPedMeanG12().

float FEConfigPedDat::m_pedMeanG6 [private]

Definition at line 48 of file FEConfigPedDat.h.

Referenced by getPedMeanG6(), and setPedMeanG6().