CMS 3D CMS Logo

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

FEConfigFgrDat Class Reference

#include <FEConfigFgrDat.h>

Inheritance diagram for FEConfigFgrDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigFgrDat ()
int getFgrGroupId () const
std::string getTable ()
void setFgrGroupId (int x)
 ~FEConfigFgrDat ()

Private Member Functions

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

Private Attributes

int m_group_id

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigFgrDat.h.


Constructor & Destructor Documentation

FEConfigFgrDat::FEConfigFgrDat ( )

Definition at line 11 of file FEConfigFgrDat.cc.

References NULL.

FEConfigFgrDat::~FEConfigFgrDat ( )

Definition at line 24 of file FEConfigFgrDat.cc.

{
}

Member Function Documentation

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

Definition at line 21 of file FEConfigFgrDat.h.

References m_group_id.

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

{ return m_group_id; }
std::string FEConfigFgrDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigFgrDat.h.

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

Implements IDataItem.

Definition at line 30 of file FEConfigFgrDat.cc.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO fe_config_fgr_dat (fgr_conf_id, logic_id, "
                      "group_id ) "
                      "VALUES (:fgr_conf_id, :logic_id, "
                      ":group_id )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigFgrDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigFgrDat::setFgrGroupId ( int  x) [inline]

Definition at line 20 of file FEConfigFgrDat.h.

References m_group_id, and x.

Referenced by EcalTPGParamBuilder::analyze(), and RunTTErrorsDat::fetchData().

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

Definition at line 115 of file FEConfigFgrDat.cc.

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

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

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

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


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

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

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

Definition at line 47 of file FEConfigFgrDat.cc.

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

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

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigFgrDat.h.


Member Data Documentation

Definition at line 39 of file FEConfigFgrDat.h.

Referenced by getFgrGroupId(), and setFgrGroupId().