CMS 3D CMS Logo

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

FEConfigFgrEETowerDat Class Reference

#include <FEConfigFgrEETowerDat.h>

Inheritance diagram for FEConfigFgrEETowerDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigFgrEETowerDat ()
int getLUTValue () const
int getLutValue () const
std::string getTable ()
void setLUTValue (int mean)
void setLutValue (int mean)
 ~FEConfigFgrEETowerDat ()

Private Member Functions

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

Private Attributes

int m_lut

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigFgrEETowerDat.h.


Constructor & Destructor Documentation

FEConfigFgrEETowerDat::FEConfigFgrEETowerDat ( )

Definition at line 11 of file FEConfigFgrEETowerDat.cc.

References NULL.

FEConfigFgrEETowerDat::~FEConfigFgrEETowerDat ( )

Definition at line 24 of file FEConfigFgrEETowerDat.cc.

{
}

Member Function Documentation

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

Definition at line 21 of file FEConfigFgrEETowerDat.h.

References m_lut.

Referenced by popcon::EcalTPGFineGrainTowerEEHandler::getNewObjects().

{ return m_lut; }
int FEConfigFgrEETowerDat::getLutValue ( ) const [inline]

Definition at line 23 of file FEConfigFgrEETowerDat.h.

References m_lut.

Referenced by writeArrayDB().

{ return m_lut; }
std::string FEConfigFgrEETowerDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigFgrEETowerDat.h.

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

Implements IDataItem.

Definition at line 30 of file FEConfigFgrEETowerDat.cc.

References alignCSCRings::e.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO "+getTable()+" (fgr_conf_id, logic_id, "
                      "lut_value ) "
                      "VALUES (:fgr_conf_id, :logic_id, "
                      ":lut_value )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigFgrEETowerDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigFgrEETowerDat::setLUTValue ( int  mean) [inline]

Definition at line 20 of file FEConfigFgrEETowerDat.h.

References m_lut, and timingPdfMaker::mean.

{ m_lut = mean; }
void FEConfigFgrEETowerDat::setLutValue ( int  mean) [inline]

Definition at line 22 of file FEConfigFgrEETowerDat.h.

References m_lut, and timingPdfMaker::mean.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 116 of file FEConfigFgrEETowerDat.cc.

References prof2calltree::count, AlCaHLTBitMon_QueryRunRegistry::data, EcalLogicID::getLogicID(), getLutValue(), AlCaHLTBitMon_ParallelJobs::p, and x.

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

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

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

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

Definition at line 48 of file FEConfigFgrEETowerDat.cc.

References alignCSCRings::e.

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

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

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigFgrEETowerDat.h.


Member Data Documentation

Definition at line 42 of file FEConfigFgrEETowerDat.h.

Referenced by getLUTValue(), getLutValue(), setLUTValue(), and setLutValue().