CMS 3D CMS Logo

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

FEConfigSlidingDat Class Reference

#include <FEConfigSlidingDat.h>

Inheritance diagram for FEConfigSlidingDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigSlidingDat ()
float getSliding () const
std::string getTable ()
void setSliding (float mean)
 ~FEConfigSlidingDat ()

Private Member Functions

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

Private Attributes

float m_sliding

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigSlidingDat.h.


Constructor & Destructor Documentation

FEConfigSlidingDat::FEConfigSlidingDat ( )

Definition at line 11 of file FEConfigSlidingDat.cc.

References NULL.

FEConfigSlidingDat::~FEConfigSlidingDat ( )

Definition at line 24 of file FEConfigSlidingDat.cc.

{
}

Member Function Documentation

void FEConfigSlidingDat::fetchData ( std::map< EcalLogicID, FEConfigSlidingDat > *  fillMap,
FEConfigSlidingInfo iconf 
) throw (std::runtime_error) [private]
float FEConfigSlidingDat::getSliding ( ) const [inline]

Definition at line 21 of file FEConfigSlidingDat.h.

References m_sliding.

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

{ return m_sliding; }
std::string FEConfigSlidingDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigSlidingDat.h.

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

Implements IDataItem.

Definition at line 30 of file FEConfigSlidingDat.cc.

References ExpressReco_HICollisions_FallBack::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO fe_config_sliding_dat (sli_conf_id, logic_id, "
                      "sliding ) "
                      "VALUES (:sli_conf_id, :logic_id, "
                      ":sliding )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigSlidingDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigSlidingDat::setSliding ( float  mean) [inline]

Definition at line 20 of file FEConfigSlidingDat.h.

References m_sliding, and plotscripts::mean().

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 116 of file FEConfigSlidingDat.cc.

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

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

  int iconfID = iconf->fetchID();
  if (!iconfID) { throw(std::runtime_error("FEConfigSlidingDat::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];


  ub2* ids_len= new ub2[nrows];
  ub2* iconf_len= new ub2[nrows];
  ub2* x_len= new ub2[nrows];


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

        dataitem = &(p->second);
        // dataIface.writeDB( channel, dataitem, iconf);
        float x=dataitem->getSliding();

        xx[count]=x;


        ids_len[count]=sizeof(ids[count]);
        iconf_len[count]=sizeof(iconfid_vec[count]);
        
        x_len[count]=sizeof(xx[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->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iconfid_vec;
    delete [] xx;

    delete [] ids_len;
    delete [] iconf_len;
    delete [] x_len;

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

Definition at line 48 of file FEConfigSlidingDat.cc.

References ExpressReco_HICollisions_FallBack::e.

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

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

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigSlidingDat.h.


Member Data Documentation

Definition at line 39 of file FEConfigSlidingDat.h.

Referenced by getSliding(), and setSliding().