CMS 3D CMS Logo

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

FEConfigLUTDat Class Reference

#include <FEConfigLUTDat.h>

Inheritance diagram for FEConfigLUTDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigLUTDat ()
int getLUTGroupId () const
std::string getTable ()
void setLUTGroupId (int x)
 ~FEConfigLUTDat ()

Private Member Functions

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

Private Attributes

int m_group_id

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigLUTDat.h.


Constructor & Destructor Documentation

FEConfigLUTDat::FEConfigLUTDat ( )

Definition at line 11 of file FEConfigLUTDat.cc.

References NULL.

FEConfigLUTDat::~FEConfigLUTDat ( )

Definition at line 24 of file FEConfigLUTDat.cc.

{
}

Member Function Documentation

void FEConfigLUTDat::fetchData ( std::map< EcalLogicID, FEConfigLUTDat > *  fillMap,
FEConfigLUTInfo iconf 
) throw (std::runtime_error) [private]
int FEConfigLUTDat::getLUTGroupId ( ) const [inline]

Definition at line 21 of file FEConfigLUTDat.h.

References m_group_id.

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

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

Implements IDataItem.

Definition at line 18 of file FEConfigLUTDat.h.

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

Implements IDataItem.

Definition at line 30 of file FEConfigLUTDat.cc.

{
  this->checkConnection();

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

Definition at line 20 of file FEConfigLUTDat.h.

References m_group_id, and x.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 115 of file FEConfigLUTDat.cc.

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

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

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

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

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

Definition at line 47 of file FEConfigLUTDat.cc.

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

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

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigLUTDat.h.


Member Data Documentation

Definition at line 39 of file FEConfigLUTDat.h.

Referenced by getLUTGroupId(), and setLUTGroupId().