CMS 3D CMS Logo

MonPNIRedDat Class Reference

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

Inheritance diagram for MonPNIRedDat:

IDataItem IDBObject

List of all members.

Public Member Functions

float getADCMeanG1 () const
float getADCMeanG16 () const
float getADCRMSG1 () const
float getADCRMSG16 () const
float getPedMeanG1 () const
float getPedMeanG16 () const
float getPedRMSG1 () const
float getPedRMSG16 () const
std::string getTable ()
bool getTaskStatus () const
 MonPNIRedDat ()
void setADCMeanG1 (float mean)
void setADCMeanG16 (float mean)
void setADCRMSG1 (float mean)
void setADCRMSG16 (float mean)
void setPedMeanG1 (float mean)
void setPedMeanG16 (float mean)
void setPedRMSG1 (float mean)
void setPedRMSG16 (float mean)
void setTaskStatus (bool status)
 ~MonPNIRedDat ()

Private Member Functions

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

Private Attributes

float m_adcMeanG1
float m_adcMeanG16
float m_adcRMSG1
float m_adcRMSG16
float m_pedMeanG1
float m_pedMeanG16
float m_pedRMSG1
float m_pedRMSG16
bool m_taskStatus

Friends

class EcalCondDBInterface


Detailed Description

Definition at line 12 of file MonPNIRedDat.h.


Constructor & Destructor Documentation

MonPNIRedDat::MonPNIRedDat (  ) 

Definition at line 12 of file MonPNIRedDat.cc.

References m_adcMeanG1, m_adcMeanG16, m_adcRMSG1, m_adcRMSG16, IDBObject::m_conn, IDBObject::m_env, m_pedMeanG1, m_pedMeanG16, m_pedRMSG1, m_pedRMSG16, IDataItem::m_readStmt, m_taskStatus, IDataItem::m_writeStmt, and NULL.

00013 {
00014   m_env = NULL;
00015   m_conn = NULL;
00016   m_writeStmt = NULL;
00017   m_readStmt = NULL;
00018 
00019   m_adcMeanG1 =0;
00020   m_adcRMSG1 = 0;
00021   m_adcMeanG16 = 0;
00022   m_adcRMSG16 = 0;
00023   m_pedMeanG1 = 0;
00024   m_pedRMSG1 = 0;
00025   m_pedMeanG16 = 0;
00026   m_pedRMSG16 = 0;
00027   m_taskStatus = 0;
00028 }

MonPNIRedDat::~MonPNIRedDat (  ) 

Definition at line 32 of file MonPNIRedDat.cc.

00033 {
00034 }


Member Function Documentation

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

Definition at line 90 of file MonPNIRedDat.cc.

References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setADCMeanG1(), setADCMeanG16(), setADCRMSG1(), setADCRMSG16(), setPedMeanG1(), setPedMeanG16(), setPedRMSG1(), setPedRMSG16(), and setTaskStatus().

00092 {
00093   this->checkConnection();
00094   fillMap->clear();
00095 
00096   iov->setConnection(m_env, m_conn);
00097   int iovID = iov->fetchID();
00098   if (!iovID) { 
00099     //  throw(runtime_error("MonPNIRedDat::writeDB:  IOV not in DB")); 
00100     return;
00101   }
00102 
00103   try {
00104 
00105     m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
00106                  "d.adc_mean_g1, d.adc_rms_g1, d.adc_mean_g16, d.adc_rms_g16, d.ped_mean_g1,d.ped_rms_g1, d.ped_mean_g16, d.ped_rms_g16, d.task_status "
00107                  "FROM channelview cv JOIN mon_pn_ired_dat d "
00108                  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
00109                  "WHERE d.iov_id = :iov_id");
00110     m_readStmt->setInt(1, iovID);
00111     ResultSet* rset = m_readStmt->executeQuery();
00112     
00113     std::pair< EcalLogicID, MonPNIRedDat > p;
00114     MonPNIRedDat dat;
00115     while(rset->next()) {
00116       p.first = EcalLogicID( rset->getString(1),     // name
00117                              rset->getInt(2),        // logic_id
00118                              rset->getInt(3),        // id1
00119                              rset->getInt(4),        // id2
00120                              rset->getInt(5),        // id3
00121                              rset->getString(6));    // maps_to
00122 
00123       dat.setADCMeanG1( rset->getFloat(7) );
00124       dat.setADCRMSG1( rset->getFloat(8) );
00125       dat.setADCMeanG16( rset->getFloat(9) );
00126       dat.setADCRMSG16( rset->getFloat(10) );
00127       dat.setPedMeanG1( rset->getFloat(11) );
00128       dat.setPedRMSG1( rset->getFloat(12) );
00129       dat.setPedMeanG16( rset->getFloat(13) );
00130       dat.setPedRMSG16( rset->getFloat(14) );
00131       dat.setTaskStatus( rset->getInt(15) );
00132       p.second = dat;
00133       fillMap->insert(p);
00134     }
00135   } catch (SQLException &e) {
00136     throw(runtime_error("MonPNIRedDat::fetchData():  "+e.getMessage()));
00137   }
00138 }

float MonPNIRedDat::getADCMeanG1 (  )  const [inline]

Definition at line 22 of file MonPNIRedDat.h.

References m_adcMeanG1.

Referenced by writeArrayDB().

00022 { return m_adcMeanG1; }

float MonPNIRedDat::getADCMeanG16 (  )  const [inline]

Definition at line 28 of file MonPNIRedDat.h.

References m_adcMeanG16.

Referenced by writeArrayDB().

00028 { return m_adcMeanG16; }

float MonPNIRedDat::getADCRMSG1 (  )  const [inline]

Definition at line 25 of file MonPNIRedDat.h.

References m_adcRMSG1.

Referenced by writeArrayDB().

00025 { return m_adcRMSG1; }

float MonPNIRedDat::getADCRMSG16 (  )  const [inline]

Definition at line 31 of file MonPNIRedDat.h.

References m_adcRMSG16.

Referenced by writeArrayDB().

00031 { return m_adcRMSG16; }

float MonPNIRedDat::getPedMeanG1 (  )  const [inline]

Definition at line 34 of file MonPNIRedDat.h.

References m_pedMeanG1.

Referenced by writeArrayDB().

00034 { return m_pedMeanG1; }

float MonPNIRedDat::getPedMeanG16 (  )  const [inline]

Definition at line 40 of file MonPNIRedDat.h.

References m_pedMeanG16.

Referenced by writeArrayDB().

00040 { return m_pedMeanG16; }

float MonPNIRedDat::getPedRMSG1 (  )  const [inline]

Definition at line 37 of file MonPNIRedDat.h.

References m_pedRMSG1.

Referenced by writeArrayDB().

00037 { return m_pedRMSG1; }

float MonPNIRedDat::getPedRMSG16 (  )  const [inline]

Definition at line 43 of file MonPNIRedDat.h.

References m_pedRMSG16.

Referenced by writeArrayDB().

00043 { return m_pedRMSG16; }

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

Implements IDataItem.

Definition at line 19 of file MonPNIRedDat.h.

00019 { return "MON_PN_IRED_DAT"; }

bool MonPNIRedDat::getTaskStatus (  )  const [inline]

Definition at line 46 of file MonPNIRedDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

00046 { return m_taskStatus; }

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

Implements IDataItem.

Definition at line 38 of file MonPNIRedDat.cc.

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

00040 {
00041   this->checkConnection();
00042 
00043   try {
00044     m_writeStmt = m_conn->createStatement();
00045     m_writeStmt->setSQL("INSERT INTO mon_pn_ired_dat (iov_id, logic_id, "
00046                         "adc_mean_g1, adc_rms_g1, adc_mean_g16, adc_rms_g16, ped_mean_g1, ped_rms_g1, ped_mean_g16, ped_rms_g16, task_status) "
00047                         "VALUES (:iov_id, :logic_id, "
00048                         ":3, :4, :5, :6, :7, :8, :9, :10, :11)");
00049   } catch (SQLException &e) {
00050     throw(runtime_error("MonPNIRedDat::prepareWrite():  "+e.getMessage()));
00051   }
00052 }

void MonPNIRedDat::setADCMeanG1 ( float  mean  )  [inline]

Definition at line 21 of file MonPNIRedDat.h.

References m_adcMeanG1.

Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().

00021 { m_adcMeanG1 = mean; }

void MonPNIRedDat::setADCMeanG16 ( float  mean  )  [inline]

Definition at line 27 of file MonPNIRedDat.h.

References m_adcMeanG16.

Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().

00027 { m_adcMeanG16 = mean; }

void MonPNIRedDat::setADCRMSG1 ( float  mean  )  [inline]

Definition at line 24 of file MonPNIRedDat.h.

References m_adcRMSG1.

Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().

00024 { m_adcRMSG1 = mean; }

void MonPNIRedDat::setADCRMSG16 ( float  mean  )  [inline]

Definition at line 30 of file MonPNIRedDat.h.

References m_adcRMSG16.

Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().

00030 { m_adcRMSG16 = mean; }

void MonPNIRedDat::setPedMeanG1 ( float  mean  )  [inline]

Definition at line 33 of file MonPNIRedDat.h.

References m_pedMeanG1.

Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().

00033 { m_pedMeanG1 = mean; }

void MonPNIRedDat::setPedMeanG16 ( float  mean  )  [inline]

Definition at line 39 of file MonPNIRedDat.h.

References m_pedMeanG16.

Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().

00039 { m_pedMeanG16 = mean; }

void MonPNIRedDat::setPedRMSG1 ( float  mean  )  [inline]

Definition at line 36 of file MonPNIRedDat.h.

References m_pedRMSG1.

Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().

00036 { m_pedRMSG1 = mean; }

void MonPNIRedDat::setPedRMSG16 ( float  mean  )  [inline]

Definition at line 42 of file MonPNIRedDat.h.

References m_pedRMSG16.

Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().

00042 { m_pedRMSG16 = mean; }

void MonPNIRedDat::setTaskStatus ( bool  status  )  [inline]

Definition at line 45 of file MonPNIRedDat.h.

References m_taskStatus.

Referenced by fetchData(), EBLaserClient::writeDb(), and EELaserClient::writeDb().

00045 { m_taskStatus = status; }

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

Definition at line 139 of file MonPNIRedDat.cc.

References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, e, getADCMeanG1(), getADCMeanG16(), getADCRMSG1(), getADCRMSG16(), EcalLogicID::getLogicID(), getPedMeanG1(), getPedMeanG16(), getPedRMSG1(), getPedRMSG16(), getTaskStatus(), IDataItem::m_writeStmt, p, r, st, t, tt, w, ww, x, y, and z.

00141 {
00142   this->checkConnection();
00143   this->checkPrepare();
00144 
00145   int iovID = iov->fetchID();
00146   if (!iovID) { throw(runtime_error("MonPNIRedDat::writeArrayDB:  IOV not in DB")); }
00147 
00148 
00149   int nrows=data->size(); 
00150   int* ids= new int[nrows];
00151   int* iovid_vec= new int[nrows];
00152   float* xx= new float[nrows];
00153   float* yy= new float[nrows];
00154   float* zz= new float[nrows];
00155   float* ww= new float[nrows];
00156   float* uu= new float[nrows];
00157   float* tt= new float[nrows];
00158   float* rr= new float[nrows];
00159   float* pp= new float[nrows];
00160   int* st= new int[nrows];
00161 
00162   ub2* ids_len= new ub2[nrows];
00163   ub2* iov_len= new ub2[nrows];
00164   ub2* x_len= new ub2[nrows];
00165   ub2* y_len= new ub2[nrows];
00166   ub2* z_len= new ub2[nrows];
00167   ub2* w_len= new ub2[nrows];
00168   ub2* u_len= new ub2[nrows];
00169   ub2* t_len= new ub2[nrows];
00170   ub2* r_len= new ub2[nrows];
00171   ub2* p_len= new ub2[nrows];
00172   ub2* st_len= new ub2[nrows];
00173 
00174   const EcalLogicID* channel;
00175   const MonPNIRedDat* dataitem;
00176   int count=0;
00177   typedef map< EcalLogicID, MonPNIRedDat >::const_iterator CI;
00178   for (CI p = data->begin(); p != data->end(); ++p) {
00179         channel = &(p->first);
00180         int logicID = channel->getLogicID();
00181         if (!logicID) { throw(runtime_error("MonPNIRedDat::writeArrayDB:  Bad EcalLogicID")); }
00182         ids[count]=logicID;
00183         iovid_vec[count]=iovID;
00184 
00185         dataitem = &(p->second);
00186         // dataIface.writeDB( channel, dataitem, iov);
00187         float x=dataitem->getADCMeanG1();
00188         float y=dataitem->getADCRMSG1();
00189         float z=dataitem->getADCMeanG16();
00190         float w=dataitem->getADCRMSG16();
00191         float u=dataitem->getPedMeanG1();
00192         float t=dataitem->getPedRMSG1();
00193         float r=dataitem->getPedMeanG16();
00194         float p=dataitem->getPedRMSG16();
00195         int statu=dataitem->getTaskStatus();
00196 
00197 
00198 
00199         xx[count]=x;
00200         yy[count]=y;
00201         zz[count]=z;
00202         ww[count]=w;
00203         uu[count]=u;
00204         tt[count]=t;
00205         rr[count]=r;
00206         pp[count]=p;
00207         st[count]=statu;
00208 
00209 
00210         ids_len[count]=sizeof(ids[count]);
00211         iov_len[count]=sizeof(iovid_vec[count]);
00212         
00213         x_len[count]=sizeof(xx[count]);
00214         y_len[count]=sizeof(yy[count]);
00215         z_len[count]=sizeof(zz[count]);
00216         w_len[count]=sizeof(ww[count]);
00217         u_len[count]=sizeof(uu[count]);
00218         t_len[count]=sizeof(tt[count]);
00219         r_len[count]=sizeof(rr[count]);
00220         p_len[count]=sizeof(pp[count]);
00221         st_len[count]=sizeof(st[count]);
00222 
00223         count++;
00224      }
00225 
00226 
00227   try {
00228     m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len);
00229     m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
00230     m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );
00231     m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
00232     m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
00233     m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT , sizeof(ww[0]), w_len );
00234     m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT , sizeof(uu[0]), u_len );
00235     m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIFLOAT , sizeof(tt[0]), t_len );
00236     m_writeStmt->setDataBuffer(9, (dvoid*)rr, OCCIFLOAT , sizeof(rr[0]), r_len );
00237     m_writeStmt->setDataBuffer(10, (dvoid*)pp, OCCIFLOAT , sizeof(pp[0]), p_len );
00238     m_writeStmt->setDataBuffer(11, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len );
00239    
00240 
00241     m_writeStmt->executeArrayUpdate(nrows);
00242 
00243     delete [] ids;
00244     delete [] iovid_vec;
00245     delete [] xx;
00246     delete [] yy;
00247     delete [] zz;
00248     delete [] ww;
00249     delete [] uu;
00250     delete [] tt;
00251     delete [] rr;
00252     delete [] pp;
00253     delete [] st;
00254 
00255     delete [] ids_len;
00256     delete [] iov_len;
00257     delete [] x_len;
00258     delete [] y_len;
00259     delete [] z_len;
00260     delete [] w_len;
00261     delete [] u_len;
00262     delete [] t_len;
00263     delete [] r_len;
00264     delete [] p_len;
00265     delete [] st_len;
00266 
00267 
00268 
00269   } catch (SQLException &e) {
00270     throw(runtime_error("MonPNIRedDat::writeArrayDB():  "+e.getMessage()));
00271   }
00272 }

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

Definition at line 56 of file MonPNIRedDat.cc.

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

00058 {
00059   this->checkConnection();
00060   this->checkPrepare();
00061 
00062   int iovID = iov->fetchID();
00063   if (!iovID) { throw(runtime_error("MonPNIRedDat::writeDB:  IOV not in DB")); }
00064 
00065   int logicID = ecid->getLogicID();
00066   if (!logicID) { throw(runtime_error("MonPNIRedDat::writeDB:  Bad EcalLogicID")); }
00067   
00068   try {
00069     m_writeStmt->setInt(1, iovID);
00070     m_writeStmt->setInt(2, logicID);
00071 
00072     m_writeStmt->setFloat(3, item->getADCMeanG1() );
00073     m_writeStmt->setFloat(4, item->getADCRMSG1() );
00074     m_writeStmt->setFloat(5, item->getADCMeanG16() );
00075     m_writeStmt->setFloat(6, item->getADCRMSG16() );
00076     m_writeStmt->setFloat(7, item->getPedMeanG1() );
00077     m_writeStmt->setFloat(8, item->getPedRMSG1() );
00078     m_writeStmt->setFloat(9, item->getPedMeanG16() );
00079     m_writeStmt->setFloat(10, item->getPedRMSG16() );
00080     m_writeStmt->setInt(11, item->getTaskStatus() );
00081 
00082     m_writeStmt->executeUpdate();
00083   } catch (SQLException &e) {
00084     throw(runtime_error("MonPNIRedDat::writeDB():  "+e.getMessage()));
00085   }
00086 }


Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 14 of file MonPNIRedDat.h.


Member Data Documentation

float MonPNIRedDat::m_adcMeanG1 [private]

Definition at line 62 of file MonPNIRedDat.h.

Referenced by getADCMeanG1(), MonPNIRedDat(), and setADCMeanG1().

float MonPNIRedDat::m_adcMeanG16 [private]

Definition at line 64 of file MonPNIRedDat.h.

Referenced by getADCMeanG16(), MonPNIRedDat(), and setADCMeanG16().

float MonPNIRedDat::m_adcRMSG1 [private]

Definition at line 63 of file MonPNIRedDat.h.

Referenced by getADCRMSG1(), MonPNIRedDat(), and setADCRMSG1().

float MonPNIRedDat::m_adcRMSG16 [private]

Definition at line 65 of file MonPNIRedDat.h.

Referenced by getADCRMSG16(), MonPNIRedDat(), and setADCRMSG16().

float MonPNIRedDat::m_pedMeanG1 [private]

Definition at line 66 of file MonPNIRedDat.h.

Referenced by getPedMeanG1(), MonPNIRedDat(), and setPedMeanG1().

float MonPNIRedDat::m_pedMeanG16 [private]

Definition at line 68 of file MonPNIRedDat.h.

Referenced by getPedMeanG16(), MonPNIRedDat(), and setPedMeanG16().

float MonPNIRedDat::m_pedRMSG1 [private]

Definition at line 67 of file MonPNIRedDat.h.

Referenced by getPedRMSG1(), MonPNIRedDat(), and setPedRMSG1().

float MonPNIRedDat::m_pedRMSG16 [private]

Definition at line 69 of file MonPNIRedDat.h.

Referenced by getPedRMSG16(), MonPNIRedDat(), and setPedRMSG16().

bool MonPNIRedDat::m_taskStatus [private]

Definition at line 70 of file MonPNIRedDat.h.

Referenced by getTaskStatus(), MonPNIRedDat(), and setTaskStatus().


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