CMS 3D CMS Logo

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

MonPedestalsDat Class Reference

#include <MonPedestalsDat.h>

Inheritance diagram for MonPedestalsDat:
IDataItem IDBObject

List of all members.

Public Member Functions

float getPedMeanG1 () const
float getPedMeanG12 () const
float getPedMeanG6 () const
float getPedRMSG1 () const
float getPedRMSG12 () const
float getPedRMSG6 () const
std::string getTable ()
bool getTaskStatus () const
 MonPedestalsDat ()
void setPedMeanG1 (float mean)
void setPedMeanG12 (float mean)
void setPedMeanG6 (float mean)
void setPedRMSG1 (float rms)
void setPedRMSG12 (float rms)
void setPedRMSG6 (float rms)
void setTaskStatus (bool status)
 ~MonPedestalsDat ()

Private Member Functions

void fetchData (std::map< EcalLogicID, MonPedestalsDat > *fillMap, MonRunIOV *iov) throw (std::runtime_error)
void prepareWrite () throw (std::runtime_error)
void writeArrayDB (const std::map< EcalLogicID, MonPedestalsDat > *data, MonRunIOV *iov) throw (std::runtime_error)
void writeDB (const EcalLogicID *ecid, const MonPedestalsDat *item, MonRunIOV *iov) throw (std::runtime_error)

Private Attributes

float m_pedMeanG1
float m_pedMeanG12
float m_pedMeanG6
float m_pedRMSG1
float m_pedRMSG12
float m_pedRMSG6
bool m_taskStatus

Friends

class EcalCondDBInterface

Detailed Description

Definition at line 11 of file MonPedestalsDat.h.


Constructor & Destructor Documentation

MonPedestalsDat::MonPedestalsDat ( )

Definition at line 11 of file MonPedestalsDat.cc.

References NULL.

MonPedestalsDat::~MonPedestalsDat ( )

Definition at line 29 of file MonPedestalsDat.cc.

{
}

Member Function Documentation

void MonPedestalsDat::fetchData ( std::map< EcalLogicID, MonPedestalsDat > *  fillMap,
MonRunIOV iov 
) throw (std::runtime_error) [private]
float MonPedestalsDat::getPedMeanG1 ( ) const [inline]
float MonPedestalsDat::getPedMeanG12 ( ) const [inline]
float MonPedestalsDat::getPedMeanG6 ( ) const [inline]
float MonPedestalsDat::getPedRMSG1 ( ) const [inline]
float MonPedestalsDat::getPedRMSG12 ( ) const [inline]
float MonPedestalsDat::getPedRMSG6 ( ) const [inline]
std::string MonPedestalsDat::getTable ( ) [inline, virtual]

Implements IDataItem.

Definition at line 18 of file MonPedestalsDat.h.

{ return "MON_PEDESTALS_DAT"; }
bool MonPedestalsDat::getTaskStatus ( ) const [inline]

Definition at line 39 of file MonPedestalsDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

{ return m_taskStatus; }
void MonPedestalsDat::prepareWrite ( ) throw (std::runtime_error) [private, virtual]

Implements IDataItem.

Definition at line 35 of file MonPedestalsDat.cc.

{
  this->checkConnection();

  try {
    m_writeStmt = m_conn->createStatement();
    m_writeStmt->setSQL("INSERT INTO mon_pedestals_dat (iov_id, logic_id, "
                      "ped_mean_g1, ped_mean_g6, ped_mean_g12, "
                      "ped_rms_g1, ped_rms_g6, ped_rms_g12, task_status) "
                      "VALUES (:iov_id, :logic_id, "
                      ":ped_mean_g1, :ped_mean_g6, :ped_mean_g12, "
                      ":ped_rms_g1, :ped_rms_g6, :ped_rms_g12, :task_status)");
  } catch (SQLException &e) {
    throw(std::runtime_error("MonPedestalsDat::prepareWrite():  "+e.getMessage()));
  }
}
void MonPedestalsDat::setPedMeanG1 ( float  mean) [inline]

Definition at line 20 of file MonPedestalsDat.h.

References m_pedMeanG1, and timingPdfMaker::mean.

void MonPedestalsDat::setPedMeanG12 ( float  mean) [inline]

Definition at line 26 of file MonPedestalsDat.h.

References m_pedMeanG12, and timingPdfMaker::mean.

void MonPedestalsDat::setPedMeanG6 ( float  mean) [inline]

Definition at line 23 of file MonPedestalsDat.h.

References m_pedMeanG6, and timingPdfMaker::mean.

void MonPedestalsDat::setPedRMSG1 ( float  rms) [inline]

Definition at line 29 of file MonPedestalsDat.h.

References m_pedRMSG1, and plotscripts::rms().

{ m_pedRMSG1 = rms; }
void MonPedestalsDat::setPedRMSG12 ( float  rms) [inline]

Definition at line 35 of file MonPedestalsDat.h.

References m_pedRMSG12, and plotscripts::rms().

void MonPedestalsDat::setPedRMSG6 ( float  rms) [inline]

Definition at line 32 of file MonPedestalsDat.h.

References m_pedRMSG6, and plotscripts::rms().

{ m_pedRMSG6 = rms; }
void MonPedestalsDat::setTaskStatus ( bool  status) [inline]

Definition at line 38 of file MonPedestalsDat.h.

References m_taskStatus, and ntuplemaker::status.

void MonPedestalsDat::writeArrayDB ( const std::map< EcalLogicID, MonPedestalsDat > *  data,
MonRunIOV iov 
) throw (std::runtime_error) [private]

Definition at line 136 of file MonPedestalsDat.cc.

References prof2calltree::count, AlCaHLTBitMon_QueryRunRegistry::data, EcalLogicID::getLogicID(), getPedMeanG1(), getPedMeanG12(), getPedMeanG6(), getPedRMSG1(), getPedRMSG12(), getPedRMSG6(), getTaskStatus(), o2o::iov, AlCaHLTBitMon_ParallelJobs::p, matplotRender::t, x, detailsBasic3DVector::y, and z.

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

  int iovID = iov->fetchID();
  if (!iovID) { throw(std::runtime_error("MonPedestalsDat::writeArrayDB:  IOV not in DB")); }


  int nrows=data->size(); 
  int* ids= new int[nrows];
  int* iovid_vec= new int[nrows];
  float* xx= new float[nrows];
  float* yy= new float[nrows];
  float* zz= new float[nrows];
  float* ww= new float[nrows];
  float* uu= new float[nrows];
  float* tt= new float[nrows];
  int* st= new int[nrows];

  ub2* ids_len= new ub2[nrows];
  ub2* iov_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* u_len= new ub2[nrows];
  ub2* t_len= new ub2[nrows];
  ub2* st_len= new ub2[nrows];

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

        dataitem = &(p->second);
        // dataIface.writeDB( channel, dataitem, iov);
        float x=dataitem->getPedMeanG1();
        float y=dataitem->getPedMeanG6();
        float z=dataitem->getPedMeanG12();
        float w=dataitem->getPedRMSG1();
        float u=dataitem->getPedRMSG6();
        float t=dataitem->getPedRMSG12();
        int statu=dataitem->getTaskStatus();



        xx[count]=x;
        yy[count]=y;
        zz[count]=z;
        ww[count]=w;
        uu[count]=u;
        tt[count]=t;
        st[count]=statu;


        ids_len[count]=sizeof(ids[count]);
        iov_len[count]=sizeof(iovid_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]);
        u_len[count]=sizeof(uu[count]);
        t_len[count]=sizeof(tt[count]);
        st_len[count]=sizeof(st[count]);

        count++;
     }


  try {
    m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_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->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
    m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
    m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT , sizeof(ww[0]), w_len );
    m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT , sizeof(uu[0]), u_len );
    m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIFLOAT , sizeof(tt[0]), t_len );
    m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len );
   

    m_writeStmt->executeArrayUpdate(nrows);

    delete [] ids;
    delete [] iovid_vec;
    delete [] xx;
    delete [] yy;
    delete [] zz;
    delete [] ww;
    delete [] uu;
    delete [] tt;
    delete [] st;

    delete [] ids_len;
    delete [] iov_len;
    delete [] x_len;
    delete [] y_len;
    delete [] z_len;
    delete [] w_len;
    delete [] u_len;
    delete [] t_len;
    delete [] st_len;



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

Definition at line 55 of file MonPedestalsDat.cc.

References o2o::iov.

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

  int iovID = iov->fetchID();
  if (!iovID) { throw(std::runtime_error("MonPedestalsDat::writeDB:  IOV not in DB")); }

  int logicID = ecid->getLogicID();
  if (!logicID) { throw(std::runtime_error("MonPedestalsDat::writeDB:  Bad EcalLogicID")); }
 
  try {
    m_writeStmt->setInt(1, iovID);
    m_writeStmt->setInt(2, logicID);
    m_writeStmt->setFloat(3, item->getPedMeanG1());
    m_writeStmt->setFloat(4, item->getPedMeanG6());
    m_writeStmt->setFloat(5, item->getPedMeanG12());
    m_writeStmt->setFloat(6, item->getPedRMSG1());
    m_writeStmt->setFloat(7, item->getPedRMSG6());
    m_writeStmt->setFloat(8, item->getPedRMSG12());
    m_writeStmt->setInt(9, item->getTaskStatus());

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

Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file MonPedestalsDat.h.


Member Data Documentation

Definition at line 57 of file MonPedestalsDat.h.

Referenced by getPedMeanG1(), and setPedMeanG1().

Definition at line 59 of file MonPedestalsDat.h.

Referenced by getPedMeanG12(), and setPedMeanG12().

Definition at line 58 of file MonPedestalsDat.h.

Referenced by getPedMeanG6(), and setPedMeanG6().

float MonPedestalsDat::m_pedRMSG1 [private]

Definition at line 60 of file MonPedestalsDat.h.

Referenced by getPedRMSG1(), and setPedRMSG1().

Definition at line 62 of file MonPedestalsDat.h.

Referenced by getPedRMSG12(), and setPedRMSG12().

float MonPedestalsDat::m_pedRMSG6 [private]

Definition at line 61 of file MonPedestalsDat.h.

Referenced by getPedRMSG6(), and setPedRMSG6().

Definition at line 63 of file MonPedestalsDat.h.

Referenced by getTaskStatus(), and setTaskStatus().