CMS 3D CMS Logo

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

FEConfigLinDat Class Reference

#include <FEConfigLinDat.h>

Inheritance diagram for FEConfigLinDat:
IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigLinDat ()
int getMultX1 () const
int getMultX12 () const
int getMultX6 () const
int getShift1 () const
int getShift12 () const
int getShift6 () const
std::string getTable ()
void setMultX1 (int x)
void setMultX12 (int x)
void setMultX6 (int x)
void setShift1 (int x)
void setShift12 (int x)
void setShift6 (int x)
 ~FEConfigLinDat ()

Private Member Functions

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

Private Attributes

int m_multx1
int m_multx12
int m_multx6
int m_shift1
int m_shift12
int m_shift6

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file FEConfigLinDat.h.


Constructor & Destructor Documentation

FEConfigLinDat::FEConfigLinDat ( )

Definition at line 11 of file FEConfigLinDat.cc.

References NULL.

FEConfigLinDat::~FEConfigLinDat ( )

Definition at line 30 of file FEConfigLinDat.cc.

{
}

Member Function Documentation

void FEConfigLinDat::fetchData ( std::map< EcalLogicID, FEConfigLinDat > *  fillMap,
FEConfigLinInfo iconf 
) throw (std::runtime_error) [private]
int FEConfigLinDat::getMultX1 ( ) const [inline]

Definition at line 30 of file FEConfigLinDat.h.

References m_multx1.

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

{ return m_multx1; }
int FEConfigLinDat::getMultX12 ( ) const [inline]

Definition at line 28 of file FEConfigLinDat.h.

References m_multx12.

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

{ return m_multx12; }
int FEConfigLinDat::getMultX6 ( ) const [inline]

Definition at line 29 of file FEConfigLinDat.h.

References m_multx6.

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

{ return m_multx6; }
int FEConfigLinDat::getShift1 ( ) const [inline]

Definition at line 33 of file FEConfigLinDat.h.

References m_shift1.

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

{ return m_shift1; }
int FEConfigLinDat::getShift12 ( ) const [inline]

Definition at line 31 of file FEConfigLinDat.h.

References m_shift12.

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

{ return m_shift12; }
int FEConfigLinDat::getShift6 ( ) const [inline]

Definition at line 32 of file FEConfigLinDat.h.

References m_shift6.

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

{ return m_shift6; }
std::string FEConfigLinDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file FEConfigLinDat.h.

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

Implements IDataItem.

Definition at line 36 of file FEConfigLinDat.cc.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO fe_config_lin_dat (lin_conf_id, logic_id, "
                      " multx12, multx6, multx1, shift12, shift6, shift1 ) "
                      "VALUES (:lin_conf_id, :logic_id, "
                      ":multx12, :multx6, :multx1, :shift12, :shift6, :shift1 )" );
  } catch (SQLException &e) {
    throw(std::runtime_error("FEConfigLinDat::prepareWrite():  "+e.getMessage()));
  }
}
void FEConfigLinDat::setMultX1 ( int  x) [inline]

Definition at line 22 of file FEConfigLinDat.h.

References m_multx1, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_multx1 = x; }
void FEConfigLinDat::setMultX12 ( int  x) [inline]

Definition at line 20 of file FEConfigLinDat.h.

References m_multx12, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_multx12 = x; }
void FEConfigLinDat::setMultX6 ( int  x) [inline]

Definition at line 21 of file FEConfigLinDat.h.

References m_multx6, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_multx6 = x; }
void FEConfigLinDat::setShift1 ( int  x) [inline]

Definition at line 25 of file FEConfigLinDat.h.

References m_shift1, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_shift1 = x; }
void FEConfigLinDat::setShift12 ( int  x) [inline]

Definition at line 23 of file FEConfigLinDat.h.

References m_shift12, and x.

Referenced by EcalTPGParamBuilder::analyze().

{ m_shift12 = x; }
void FEConfigLinDat::setShift6 ( int  x) [inline]

Definition at line 24 of file FEConfigLinDat.h.

References m_shift6, and x.

Referenced by EcalTPGParamBuilder::analyze().

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

Definition at line 132 of file FEConfigLinDat.cc.

References prof2calltree::count, runTheMatrix::data, EcalLogicID::getLogicID(), getMultX1(), getMultX12(), getMultX6(), getShift1(), getShift12(), getShift6(), L1TEmulatorMonitor_cff::p, csvReporter::r, asciidump::s, x, detailsBasic3DVector::y, and z.

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

  int iconfID = iconf->fetchID();
  if (!iconfID) { throw(std::runtime_error("FEConfigLinDat::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];
  int* yy= new int[nrows];
  int* zz= new int[nrows];
  int* ww= new int[nrows];
  int* rr= new int[nrows];
  int* ss= new int[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];
  ub2* w_len= new ub2[nrows];
  ub2* r_len= new ub2[nrows];
  ub2* s_len= new ub2[nrows];


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

        dataitem = &(p->second);
        // dataIface.writeDB( channel, dataitem, iconf);
        int x=dataitem->getMultX12();
        int y=dataitem->getMultX6();
        int z=dataitem->getMultX1();
        int w=dataitem->getShift12();
        int r=dataitem->getShift6();
        int s=dataitem->getShift1();

        xx[count]=x;
        yy[count]=y;
        zz[count]=z;
        ww[count]=w;
        rr[count]=r;
        ss[count]=s;

        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]);
        w_len[count]=sizeof(ww[count]);
        r_len[count]=sizeof(rr[count]);
        s_len[count]=sizeof(ss[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->setDataBuffer(4, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len );
    m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len );
    m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT , sizeof(ww[0]), w_len );
    m_writeStmt->setDataBuffer(7, (dvoid*)rr, OCCIINT , sizeof(rr[0]), r_len );
    m_writeStmt->setDataBuffer(8, (dvoid*)ss, OCCIINT , sizeof(ss[0]), s_len );

    m_writeStmt->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iconfid_vec;
    delete [] xx;
    delete [] yy;
    delete [] zz;
    delete [] ww;
    delete [] rr;
    delete [] ss;

    delete [] ids_len;
    delete [] iconf_len;
    delete [] x_len;
    delete [] y_len;
    delete [] z_len;
    delete [] w_len;
    delete [] r_len;
    delete [] s_len;

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

Definition at line 54 of file FEConfigLinDat.cc.

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

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

  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("FEConfigLinDat::writeDB:  Bad EcalLogicID")); }
 
  try {
    m_writeStmt->setInt(1, iconfID);
    m_writeStmt->setInt(2, logicID);
    m_writeStmt->setInt(3, item->getMultX12());
    m_writeStmt->setInt(4, item->getMultX6());
    m_writeStmt->setInt(5, item->getMultX1());
    m_writeStmt->setInt(6, item->getShift12());
    m_writeStmt->setInt(7, item->getShift6());
    m_writeStmt->setInt(8, item->getShift1());

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigLinDat.h.


Member Data Documentation

int FEConfigLinDat::m_multx1 [private]

Definition at line 53 of file FEConfigLinDat.h.

Referenced by getMultX1(), and setMultX1().

Definition at line 51 of file FEConfigLinDat.h.

Referenced by getMultX12(), and setMultX12().

int FEConfigLinDat::m_multx6 [private]

Definition at line 52 of file FEConfigLinDat.h.

Referenced by getMultX6(), and setMultX6().

int FEConfigLinDat::m_shift1 [private]

Definition at line 56 of file FEConfigLinDat.h.

Referenced by getShift1(), and setShift1().

Definition at line 54 of file FEConfigLinDat.h.

Referenced by getShift12(), and setShift12().

int FEConfigLinDat::m_shift6 [private]

Definition at line 55 of file FEConfigLinDat.h.

Referenced by getShift6(), and setShift6().