CMS 3D CMS Logo

LMFPNBluePrimDat Class Reference

#include <OnlineDB/EcalCondDB/interface/LMFPNBluePrimDat.h>

Inheritance diagram for LMFPNBluePrimDat:

IDataItem IDBObject

List of all members.

Public Member Functions

int getFlag () const
float getMean () const
float getPeak () const
float getPNAOverPNBMean () const
float getPNAOverPNBPeak () const
float getPNAOverPNBRMS () const
float getRMS () const
std::string getTable ()
 LMFPNBluePrimDat ()
void setFlag (int x)
void setMean (float mean)
void setPeak (float x)
void setPNAOverPNBMean (float mean)
void setPNAOverPNBPeak (float mean)
void setPNAOverPNBRMS (float mean)
void setRMS (float RMS)
 ~LMFPNBluePrimDat ()

Private Member Functions

void fetchData (std::map< EcalLogicID, LMFPNBluePrimDat > *fillVec, LMFRunIOV *iov) throw (std::runtime_error)
void prepareWrite () throw (std::runtime_error)
void writeArrayDB (const std::map< EcalLogicID, LMFPNBluePrimDat > *data, LMFRunIOV *iov) throw (runtime_error)
void writeDB (const EcalLogicID *ecid, const LMFPNBluePrimDat *item, LMFRunIOV *iov) throw (std::runtime_error)

Private Attributes

int m_Flag
float m_Mean
float m_Peak
float m_PNAOverPNBMean
float m_PNAOverPNBPeak
float m_PNAOverPNBRMS
float m_RMS

Friends

class EcalCondDBInterface


Detailed Description

Definition at line 12 of file LMFPNBluePrimDat.h.


Constructor & Destructor Documentation

LMFPNBluePrimDat::LMFPNBluePrimDat (  ) 

Definition at line 13 of file LMFPNBluePrimDat.cc.

References IDBObject::m_conn, IDBObject::m_env, m_Flag, m_Mean, m_Peak, m_PNAOverPNBMean, m_PNAOverPNBPeak, m_PNAOverPNBRMS, IDataItem::m_readStmt, m_RMS, IDataItem::m_writeStmt, and NULL.

00014 {
00015   m_env = NULL;
00016   m_conn = NULL;
00017   m_writeStmt = NULL;
00018   m_readStmt = NULL;
00019 
00020 
00021    m_Mean=0;
00022    m_RMS=0;
00023    m_Peak=0;
00024    m_Flag=0;
00025    m_PNAOverPNBMean=0;
00026    m_PNAOverPNBRMS=0;
00027    m_PNAOverPNBPeak=0;
00028 
00029 }

LMFPNBluePrimDat::~LMFPNBluePrimDat (  ) 

Definition at line 33 of file LMFPNBluePrimDat.cc.

00034 {
00035 }


Member Function Documentation

void LMFPNBluePrimDat::fetchData ( std::map< EcalLogicID, LMFPNBluePrimDat > *  fillVec,
LMFRunIOV iov 
) throw (std::runtime_error) [private]

Definition at line 201 of file LMFPNBluePrimDat.cc.

References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setFlag(), setMean(), setPeak(), setPNAOverPNBMean(), setPNAOverPNBPeak(), setPNAOverPNBRMS(), and setRMS().

00203 {
00204   this->checkConnection();
00205   fillMap->clear();
00206 
00207   iov->setConnection(m_env, m_conn);
00208   int iovID = iov->fetchID();
00209   if (!iovID) { 
00210     //  throw(runtime_error("LMFPNBluePrimDat::writeDB:  IOV not in DB")); 
00211     return;
00212   }
00213 
00214   try {
00215   
00216     m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
00217                  "d.flag, d.mean, d.rms, d.peak, d.pna_over_pnb_mean, d.pna_over_pnb_rms, d.pna_over_pnB_peak "
00218                  "FROM channelview cv JOIN lmf_laser_blue_PN_PRIM_dat d "
00219                  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
00220                  "WHERE d.lmf_iov_id = :iov_id");
00221  
00222     m_readStmt->setInt(1, iovID);
00223     
00224     ResultSet* rset = m_readStmt->executeQuery();
00225      
00226     std::pair< EcalLogicID, LMFPNBluePrimDat > p;
00227     LMFPNBluePrimDat dat;
00228     while(rset->next()) {
00229       p.first = EcalLogicID( rset->getString(1),     // name
00230                              rset->getInt(2),        // logic_id
00231                              rset->getInt(3),        // id1
00232                              rset->getInt(4),        // id2
00233                              rset->getInt(5),        // id3
00234                              rset->getString(6));    // maps_to
00235 
00236       dat.setFlag( rset->getInt(7) );
00237       dat.setMean( rset->getFloat(8) );
00238       dat.setRMS( rset->getFloat(9) );
00239       dat.setPeak( rset->getFloat(10) );
00240       dat.setPNAOverPNBMean( rset->getFloat(11) );
00241       dat.setPNAOverPNBRMS( rset->getFloat(12) );
00242       dat.setPNAOverPNBPeak( rset->getFloat(13) );
00243 
00244       p.second = dat;
00245       fillMap->insert(p);
00246     }
00247 
00248   } catch (SQLException &e) {
00249     throw(runtime_error("LMFPNBluePrimDat::fetchData():  "+e.getMessage()));
00250   }
00251 }

int LMFPNBluePrimDat::getFlag (  )  const [inline]

Definition at line 31 of file LMFPNBluePrimDat.h.

References m_Flag.

Referenced by writeArrayDB().

00031 { return m_Flag; }

float LMFPNBluePrimDat::getMean (  )  const [inline]

Definition at line 22 of file LMFPNBluePrimDat.h.

References m_Mean.

Referenced by writeArrayDB().

00022 { return m_Mean; }

float LMFPNBluePrimDat::getPeak (  )  const [inline]

Definition at line 28 of file LMFPNBluePrimDat.h.

References m_Peak.

Referenced by writeArrayDB().

00028 { return m_Peak; }

float LMFPNBluePrimDat::getPNAOverPNBMean (  )  const [inline]

Definition at line 34 of file LMFPNBluePrimDat.h.

References m_PNAOverPNBMean.

Referenced by writeArrayDB().

00034 { return m_PNAOverPNBMean; }

float LMFPNBluePrimDat::getPNAOverPNBPeak (  )  const [inline]

Definition at line 38 of file LMFPNBluePrimDat.h.

References m_PNAOverPNBPeak.

Referenced by writeArrayDB().

00038 { return m_PNAOverPNBPeak; }

float LMFPNBluePrimDat::getPNAOverPNBRMS (  )  const [inline]

Definition at line 36 of file LMFPNBluePrimDat.h.

References m_PNAOverPNBRMS.

Referenced by writeArrayDB().

00036 { return m_PNAOverPNBRMS; }

float LMFPNBluePrimDat::getRMS ( void   )  const [inline]

Definition at line 25 of file LMFPNBluePrimDat.h.

References m_RMS.

Referenced by writeArrayDB().

00025 { return m_RMS; }

std::string LMFPNBluePrimDat::getTable (  )  [inline, virtual]

Implements IDataItem.

Definition at line 19 of file LMFPNBluePrimDat.h.

00019 { return "LMF_Laser_blue_PN_PRIM_DAT"; }

void LMFPNBluePrimDat::prepareWrite (  )  throw (std::runtime_error) [private, virtual]

Implements IDataItem.

Definition at line 39 of file LMFPNBluePrimDat.cc.

References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.

00041 {
00042   this->checkConnection();
00043 
00044   try {
00045     m_writeStmt = m_conn->createStatement();
00046     m_writeStmt->setSQL("INSERT INTO lmf_laser_blue_PN_prim_dat (lmf_iov_id, logic_id, "
00047                         "flag, mean, rms, peak,  pna_over_pnB_mean, pna_over_pnB_rms, pna_over_pnB_peak ) "
00048                         "VALUES (:1, :2, "
00049                         ":3, :4, :5, :6, :7, :8, :9 )");
00050   } catch (SQLException &e) {
00051     throw(runtime_error("LMFPNBluePrimDat::prepareWrite():  "+e.getMessage()));
00052   }
00053 }

void LMFPNBluePrimDat::setFlag ( int  x  )  [inline]

Definition at line 30 of file LMFPNBluePrimDat.h.

References m_Flag.

Referenced by fetchData().

00030 { m_Flag = x; }

void LMFPNBluePrimDat::setMean ( float  mean  )  [inline]

Definition at line 21 of file LMFPNBluePrimDat.h.

References m_Mean.

Referenced by fetchData().

00021 { m_Mean = mean; }

void LMFPNBluePrimDat::setPeak ( float  x  )  [inline]

Definition at line 27 of file LMFPNBluePrimDat.h.

References m_Peak.

Referenced by fetchData().

00027 { m_Peak = x; }

void LMFPNBluePrimDat::setPNAOverPNBMean ( float  mean  )  [inline]

Definition at line 33 of file LMFPNBluePrimDat.h.

References m_PNAOverPNBMean.

Referenced by fetchData().

00033 { m_PNAOverPNBMean = mean; }

void LMFPNBluePrimDat::setPNAOverPNBPeak ( float  mean  )  [inline]

Definition at line 37 of file LMFPNBluePrimDat.h.

References m_PNAOverPNBPeak.

Referenced by fetchData().

00037 { m_PNAOverPNBPeak = mean; }

void LMFPNBluePrimDat::setPNAOverPNBRMS ( float  mean  )  [inline]

Definition at line 35 of file LMFPNBluePrimDat.h.

References m_PNAOverPNBRMS.

Referenced by fetchData().

00035 { m_PNAOverPNBRMS = mean; }

void LMFPNBluePrimDat::setRMS ( float  RMS  )  [inline]

Definition at line 24 of file LMFPNBluePrimDat.h.

References m_RMS.

Referenced by fetchData().

00024 { m_RMS = RMS; }

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

Definition at line 88 of file LMFPNBluePrimDat.cc.

References a, aa, IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, e, getFlag(), EcalLogicID::getLogicID(), getMean(), getPeak(), getPNAOverPNBMean(), getPNAOverPNBPeak(), getPNAOverPNBRMS(), getRMS(), IDataItem::m_writeStmt, p, x, y, and z.

00090 {
00091   this->checkConnection();
00092   this->checkPrepare();
00093 
00094   int iovID = iov->fetchID();
00095   if (!iovID) { throw(runtime_error("LMFPNBluePrimDat::writeArrayDB:  IOV not in DB")); }
00096 
00097 
00098   int nrows=data->size(); 
00099   int* ids= new int[nrows];
00100   int* iovid_vec= new int[nrows];
00101   int* aa= new int[nrows];
00102   float* xx= new float[nrows];
00103   float* yy= new float[nrows];
00104   float* zz= new float[nrows];
00105   float* wwa= new float[nrows];
00106   float* uua= new float[nrows];
00107   float* tta= new float[nrows];
00108 
00109   ub2* ids_len= new ub2[nrows];
00110   ub2* iov_len= new ub2[nrows];
00111   ub2* a_len= new ub2[nrows];
00112   ub2* x_len= new ub2[nrows];
00113   ub2* y_len= new ub2[nrows];
00114   ub2* z_len= new ub2[nrows];
00115   ub2* wa_len= new ub2[nrows];
00116   ub2* ua_len= new ub2[nrows];
00117   ub2* ta_len= new ub2[nrows];
00118 
00119   const EcalLogicID* channel;
00120   const LMFPNBluePrimDat* dataitem;
00121   int count=0;
00122   typedef map< EcalLogicID, LMFPNBluePrimDat >::const_iterator CI;
00123   for (CI p = data->begin(); p != data->end(); ++p) {
00124         channel = &(p->first);
00125         int logicID = channel->getLogicID();
00126         if (!logicID) { throw(runtime_error("LMFPNBluePrimDat::writeArrayDB:  Bad EcalLogicID")); }
00127         ids[count]=logicID;
00128         iovid_vec[count]=iovID;
00129 
00130         dataitem = &(p->second);
00131         // dataIface.writeDB( channel, dataitem, iov);
00132         int a=dataitem->getFlag();
00133         float x=dataitem->getMean();
00134         float y=dataitem->getRMS();
00135         float z=dataitem->getPeak();
00136         float wa=dataitem->getPNAOverPNBMean();
00137         float ua=dataitem->getPNAOverPNBRMS();
00138         float ta=dataitem->getPNAOverPNBPeak();
00139 
00140         aa[count]=a;
00141         xx[count]=x;
00142         yy[count]=y;
00143         zz[count]=z;
00144         wwa[count]=wa;
00145         uua[count]=ua;
00146         tta[count]=ta;
00147 
00148         ids_len[count]=sizeof(ids[count]);
00149         iov_len[count]=sizeof(iovid_vec[count]);
00150         
00151         a_len[count]=sizeof(aa[count]);
00152         x_len[count]=sizeof(xx[count]);
00153         y_len[count]=sizeof(yy[count]);
00154         z_len[count]=sizeof(zz[count]);
00155         wa_len[count]=sizeof(wwa[count]);
00156         ua_len[count]=sizeof(uua[count]);
00157         ta_len[count]=sizeof(tta[count]);
00158 
00159         count++;
00160      }
00161 
00162 
00163   try {
00164     m_writeStmt->setDataBuffer(1,  (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len);
00165     m_writeStmt->setDataBuffer(2,  (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
00166     m_writeStmt->setDataBuffer(3,  (dvoid*)aa,  OCCIINT , sizeof(aa[0]), a_len );
00167     m_writeStmt->setDataBuffer(4,  (dvoid*)xx,  OCCIFLOAT , sizeof(xx[0]), x_len );
00168     m_writeStmt->setDataBuffer(5,  (dvoid*)yy,  OCCIFLOAT , sizeof(yy[0]), y_len );
00169     m_writeStmt->setDataBuffer(6,  (dvoid*)zz,  OCCIFLOAT , sizeof(zz[0]), z_len );
00170     m_writeStmt->setDataBuffer(7,  (dvoid*)wwa, OCCIFLOAT , sizeof(wwa[0]), wa_len );
00171     m_writeStmt->setDataBuffer(8,  (dvoid*)uua, OCCIFLOAT , sizeof(uua[0]), ua_len );
00172     m_writeStmt->setDataBuffer(9,  (dvoid*)tta, OCCIFLOAT , sizeof(tta[0]), ta_len );
00173 
00174     m_writeStmt->executeArrayUpdate(nrows);
00175 
00176     delete [] ids;
00177     delete [] iovid_vec;
00178     delete [] aa;
00179     delete [] xx;
00180     delete [] yy;
00181     delete [] zz;
00182     delete [] wwa;
00183     delete [] uua;
00184     delete [] tta;
00185 
00186     delete [] ids_len;
00187     delete [] iov_len;
00188     delete [] a_len;
00189     delete [] x_len;
00190     delete [] y_len;
00191     delete [] z_len;
00192     delete [] wa_len;
00193     delete [] ua_len;
00194     delete [] ta_len;
00195 
00196   } catch (SQLException &e) {
00197     throw(runtime_error("LMFPNBluePrimDat::writeArrayDB():  "+e.getMessage()));
00198   }
00199 }

void LMFPNBluePrimDat::writeDB ( const EcalLogicID ecid,
const LMFPNBluePrimDat item,
LMFRunIOV iov 
) throw (std::runtime_error) [private]

Definition at line 57 of file LMFPNBluePrimDat.cc.

References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.

00059 {
00060   this->checkConnection();
00061   this->checkPrepare();
00062 
00063   int iovID = iov->fetchID();
00064   if (!iovID) { throw(runtime_error("LMFPNBluePrimDat::writeDB:  IOV not in DB")); }
00065 
00066   int logicID = ecid->getLogicID();
00067   if (!logicID) { throw(runtime_error("LMFPNBluePrimDat::writeDB:  Bad EcalLogicID")); }
00068   
00069   try {
00070     m_writeStmt->setInt(1, iovID);
00071     m_writeStmt->setInt(2, logicID);
00072 
00073     m_writeStmt->setInt(3, item->getFlag() );
00074     m_writeStmt->setFloat(4, item->getMean() );
00075     m_writeStmt->setFloat(5, item->getRMS() );
00076     m_writeStmt->setFloat(6, item->getPeak() );
00077     m_writeStmt->setFloat(7, item->getPNAOverPNBMean() );
00078     m_writeStmt->setFloat(8, item->getPNAOverPNBRMS() );
00079     m_writeStmt->setFloat(9, item->getPNAOverPNBPeak() );
00080   
00081     m_writeStmt->executeUpdate();
00082   } catch (SQLException &e) {
00083     throw(runtime_error("LMFPNBluePrimDat::writeDB():  "+e.getMessage()));
00084   }
00085 }


Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 14 of file LMFPNBluePrimDat.h.


Member Data Documentation

int LMFPNBluePrimDat::m_Flag [private]

Definition at line 55 of file LMFPNBluePrimDat.h.

Referenced by getFlag(), LMFPNBluePrimDat(), and setFlag().

float LMFPNBluePrimDat::m_Mean [private]

Definition at line 57 of file LMFPNBluePrimDat.h.

Referenced by getMean(), LMFPNBluePrimDat(), and setMean().

float LMFPNBluePrimDat::m_Peak [private]

Definition at line 58 of file LMFPNBluePrimDat.h.

Referenced by getPeak(), LMFPNBluePrimDat(), and setPeak().

float LMFPNBluePrimDat::m_PNAOverPNBMean [private]

Definition at line 59 of file LMFPNBluePrimDat.h.

Referenced by getPNAOverPNBMean(), LMFPNBluePrimDat(), and setPNAOverPNBMean().

float LMFPNBluePrimDat::m_PNAOverPNBPeak [private]

Definition at line 61 of file LMFPNBluePrimDat.h.

Referenced by getPNAOverPNBPeak(), LMFPNBluePrimDat(), and setPNAOverPNBPeak().

float LMFPNBluePrimDat::m_PNAOverPNBRMS [private]

Definition at line 60 of file LMFPNBluePrimDat.h.

Referenced by getPNAOverPNBRMS(), LMFPNBluePrimDat(), and setPNAOverPNBRMS().

float LMFPNBluePrimDat::m_RMS [private]

Definition at line 56 of file LMFPNBluePrimDat.h.

Referenced by getRMS(), LMFPNBluePrimDat(), and setRMS().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:27:48 2009 for CMSSW by  doxygen 1.5.4