CMS 3D CMS Logo

FEConfigFgrGroupDat Class Reference

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

Inheritance diagram for FEConfigFgrGroupDat:

IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigFgrGroupDat ()
int getFgrGroupId () const
int getLUTConfId () const
float getRatioHigh () const
float getRatioLow () const
std::string getTable ()
float getThreshHigh () const
float getThreshLow () const
void setFgrGroupId (int x)
void setLUTConfId (int x)
void setRatioHigh (float x)
void setRatioLow (float x)
void setThreshHigh (float x)
void setThreshLow (float x)
 ~FEConfigFgrGroupDat ()

Private Member Functions

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

Private Attributes

int m_group_id
int m_lut_id
float m_ratio_high
float m_ratio_low
float m_thresh_high
float m_thresh_low

Friends

class EcalCondDBInterface


Detailed Description

Definition at line 11 of file FEConfigFgrGroupDat.h.


Constructor & Destructor Documentation

FEConfigFgrGroupDat::FEConfigFgrGroupDat (  ) 

Definition at line 11 of file FEConfigFgrGroupDat.cc.

References IDBObject::m_conn, IDBObject::m_env, m_group_id, m_lut_id, m_ratio_high, m_ratio_low, IDataItem::m_readStmt, m_thresh_high, m_thresh_low, IDataItem::m_writeStmt, and NULL.

00012 {
00013   m_env = NULL;
00014   m_conn = NULL;
00015   m_writeStmt = NULL;
00016   m_readStmt = NULL;
00017 
00018   m_group_id=0;
00019   m_thresh_low = 0;
00020   m_thresh_high = 0;
00021   m_ratio_low = 0;
00022   m_ratio_high = 0;
00023   m_lut_id = 0;
00024 
00025 }

FEConfigFgrGroupDat::~FEConfigFgrGroupDat (  ) 

Definition at line 29 of file FEConfigFgrGroupDat.cc.

00030 {
00031 }


Member Function Documentation

void FEConfigFgrGroupDat::fetchData ( std::map< EcalLogicID, FEConfigFgrGroupDat > *  fillMap,
FEConfigFgrInfo iconf 
) throw (std::runtime_error) [private]

int FEConfigFgrGroupDat::getFgrGroupId (  )  const [inline]

Definition at line 21 of file FEConfigFgrGroupDat.h.

References m_group_id.

Referenced by writeArrayDB().

00021 { return m_group_id; }

int FEConfigFgrGroupDat::getLUTConfId (  )  const [inline]

Definition at line 32 of file FEConfigFgrGroupDat.h.

References m_lut_id.

Referenced by writeArrayDB().

00032 { return m_lut_id; }

float FEConfigFgrGroupDat::getRatioHigh (  )  const [inline]

Definition at line 30 of file FEConfigFgrGroupDat.h.

References m_ratio_high.

Referenced by writeArrayDB().

00030 { return m_ratio_high; }

float FEConfigFgrGroupDat::getRatioLow (  )  const [inline]

Definition at line 28 of file FEConfigFgrGroupDat.h.

References m_ratio_low.

Referenced by writeArrayDB().

00028 { return m_ratio_low; }

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

Implements IDataItem.

Definition at line 18 of file FEConfigFgrGroupDat.h.

00018 { return "FE_CONFIG_FGR_PER_GROUP_DAT"; }

float FEConfigFgrGroupDat::getThreshHigh (  )  const [inline]

Definition at line 26 of file FEConfigFgrGroupDat.h.

References m_thresh_high.

Referenced by writeArrayDB().

00026 { return m_thresh_high; }

float FEConfigFgrGroupDat::getThreshLow (  )  const [inline]

Definition at line 24 of file FEConfigFgrGroupDat.h.

References m_thresh_low.

Referenced by writeArrayDB().

00024 { return m_thresh_low; }

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

Implements IDataItem.

Definition at line 35 of file FEConfigFgrGroupDat.cc.

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

00037 {
00038   this->checkConnection();
00039 
00040   try {
00041     m_writeStmt = m_conn->createStatement();
00042     m_writeStmt->setSQL("INSERT INTO fe_fgr_per_group_dat (fgr_conf_id, group_id, "
00043                       " threshold_low, threshold_high, ratio_low, ratio_high, lut_conf_id ) "
00044                       "VALUES (:fgr_conf_id, :group_id, "
00045                       ":3, :4, :5, :6, :7 )" );
00046   } catch (SQLException &e) {
00047     throw(runtime_error("FEConfigFgrGroupDat::prepareWrite():  "+e.getMessage()));
00048   }
00049 }

void FEConfigFgrGroupDat::setFgrGroupId ( int  x  )  [inline]

Definition at line 20 of file FEConfigFgrGroupDat.h.

References m_group_id.

Referenced by EcalTPGParamBuilder::analyze().

00020 { m_group_id = x; }

void FEConfigFgrGroupDat::setLUTConfId ( int  x  )  [inline]

Definition at line 31 of file FEConfigFgrGroupDat.h.

References m_lut_id.

Referenced by EcalTPGParamBuilder::analyze().

00031 { m_lut_id = x; }

void FEConfigFgrGroupDat::setRatioHigh ( float  x  )  [inline]

Definition at line 29 of file FEConfigFgrGroupDat.h.

References m_ratio_high.

Referenced by EcalTPGParamBuilder::analyze().

00029 { m_ratio_high = x; }

void FEConfigFgrGroupDat::setRatioLow ( float  x  )  [inline]

Definition at line 27 of file FEConfigFgrGroupDat.h.

References m_ratio_low.

Referenced by EcalTPGParamBuilder::analyze().

00027 { m_ratio_low = x; }

void FEConfigFgrGroupDat::setThreshHigh ( float  x  )  [inline]

Definition at line 25 of file FEConfigFgrGroupDat.h.

References m_thresh_high.

Referenced by EcalTPGParamBuilder::analyze().

00025 { m_thresh_high = x; }

void FEConfigFgrGroupDat::setThreshLow ( float  x  )  [inline]

Definition at line 23 of file FEConfigFgrGroupDat.h.

References m_thresh_low.

Referenced by EcalTPGParamBuilder::analyze().

00023 { m_thresh_low = x; }

void FEConfigFgrGroupDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigFgrGroupDat > *  data,
FEConfigFgrInfo iconf 
) throw (std::runtime_error) [private]

Definition at line 128 of file FEConfigFgrGroupDat.cc.

References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, getFgrGroupId(), getLUTConfId(), getRatioHigh(), getRatioLow(), getThreshHigh(), getThreshLow(), IDataItem::m_writeStmt, r, s, ss, t, tt, x, y, and z.

00130 {
00131   this->checkConnection();
00132   this->checkPrepare();
00133 
00134   int iconfID = iconf->fetchID();
00135   if (!iconfID) { throw(runtime_error("FEConfigFgrGroupDat::writeArrayDB:  ICONF not in DB")); }
00136 
00137 
00138   int nrows=data->size(); 
00139   int* ids= new int[nrows];
00140   int* iconfid_vec= new int[nrows];
00141   int* xx= new int[nrows];
00142   float* yy= new float[nrows];
00143   float* zz= new float[nrows];
00144   float* rr= new float[nrows];
00145   float* ss= new float[nrows];
00146   int* tt= new int[nrows];
00147 
00148 
00149   ub2* ids_len= new ub2[nrows];
00150   ub2* iconf_len= new ub2[nrows];
00151   ub2* x_len= new ub2[nrows];
00152   ub2* y_len= new ub2[nrows];
00153   ub2* z_len= new ub2[nrows];
00154   ub2* r_len= new ub2[nrows];
00155   ub2* s_len= new ub2[nrows];
00156   ub2* t_len= new ub2[nrows];
00157 
00158 
00159   const EcalLogicID* channel;
00160   const FEConfigFgrGroupDat* dataitem;
00161   int count=0;
00162   typedef map< EcalLogicID, FEConfigFgrGroupDat >::const_iterator CI;
00163   for (CI p = data->begin(); p != data->end(); ++p) {
00164         channel = &(p->first);
00165         //      int logicID = channel->getLogicID();
00166         //      if (!logicID) { throw(runtime_error("FEConfigFgrGroupDat::writeArrayDB:  Bad EcalLogicID")); }
00167         //      ids[count]=logicID;
00168         iconfid_vec[count]=iconfID;
00169 
00170         dataitem = &(p->second);
00171         // dataIface.writeDB( channel, dataitem, iconf);
00172         int x=dataitem->getFgrGroupId();
00173         float y=dataitem->getThreshLow();
00174         float z=dataitem->getThreshHigh();
00175         float r=dataitem->getRatioLow();
00176         float s=dataitem->getRatioHigh();
00177         int t=dataitem->getLUTConfId();
00178 
00179         xx[count]=x;
00180         yy[count]=y;
00181         zz[count]=z;
00182         rr[count]=r;
00183         ss[count]=s;
00184         tt[count]=t;
00185 
00186         //      ids_len[count]=sizeof(ids[count]);
00187         iconf_len[count]=sizeof(iconfid_vec[count]);
00188         
00189         x_len[count]=sizeof(xx[count]);
00190         y_len[count]=sizeof(yy[count]);
00191         z_len[count]=sizeof(zz[count]);
00192         r_len[count]=sizeof(rr[count]);
00193         s_len[count]=sizeof(ss[count]);
00194         t_len[count]=sizeof(tt[count]);
00195 
00196         count++;
00197      }
00198 
00199 
00200   try {
00201     m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len);
00202     m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len );
00203     m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
00204     m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
00205     m_writeStmt->setDataBuffer(5, (dvoid*)rr, OCCIFLOAT , sizeof(rr[0]), r_len );
00206     m_writeStmt->setDataBuffer(6, (dvoid*)ss, OCCIFLOAT , sizeof(ss[0]), s_len );
00207     m_writeStmt->setDataBuffer(7, (dvoid*)tt, OCCIINT , sizeof(tt[0]), t_len );
00208 
00209     m_writeStmt->executeArrayUpdate(nrows);
00210 
00211     delete [] ids;
00212     delete [] iconfid_vec;
00213     delete [] xx;
00214     delete [] yy;
00215     delete [] zz;
00216     delete [] rr;
00217     delete [] ss;
00218     delete [] tt;
00219 
00220     delete [] ids_len;
00221     delete [] iconf_len;
00222     delete [] x_len;
00223     delete [] y_len;
00224     delete [] z_len;
00225     delete [] r_len;
00226     delete [] s_len;
00227     delete [] t_len;
00228 
00229   } catch (SQLException &e) {
00230     throw(runtime_error("FEConfigFgrGroupDat::writeArrayDB():  "+e.getMessage()));
00231   }
00232 }

void FEConfigFgrGroupDat::writeDB ( const EcalLogicID ecid,
const FEConfigFgrGroupDat item,
FEConfigFgrInfo iconf 
) throw (std::runtime_error) [private]

Definition at line 53 of file FEConfigFgrGroupDat.cc.

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

00055 {
00056   this->checkConnection();
00057   this->checkPrepare();
00058 
00059   int iconfID = iconf->fetchID();
00060   if (!iconfID) { throw(runtime_error("FEConfigFgrGroupDat::writeDB:  ICONF not in DB")); }
00061   /* no need for the logic id in this table 
00062      int logicID = ecid->getLogicID();
00063      if (!logicID) { throw(runtime_error("FEConfigFgrGroupDat::writeDB:  Bad EcalLogicID")); }
00064   */
00065 
00066   try {
00067     m_writeStmt->setInt(1, iconfID);
00068 
00069     m_writeStmt->setInt(2, item->getFgrGroupId());
00070     m_writeStmt->setFloat(3, item->getThreshLow());
00071     m_writeStmt->setFloat(4, item->getThreshHigh());
00072     m_writeStmt->setFloat(5, item->getRatioLow());
00073     m_writeStmt->setFloat(6, item->getRatioHigh());
00074     m_writeStmt->setInt(7, item->getLUTConfId());
00075 
00076     m_writeStmt->executeUpdate();
00077   } catch (SQLException &e) {
00078     throw(runtime_error("FEConfigFgrGroupDat::writeDB():  "+e.getMessage()));
00079   }
00080 }


Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigFgrGroupDat.h.


Member Data Documentation

int FEConfigFgrGroupDat::m_group_id [private]

Definition at line 50 of file FEConfigFgrGroupDat.h.

Referenced by FEConfigFgrGroupDat(), getFgrGroupId(), and setFgrGroupId().

int FEConfigFgrGroupDat::m_lut_id [private]

Definition at line 55 of file FEConfigFgrGroupDat.h.

Referenced by FEConfigFgrGroupDat(), getLUTConfId(), and setLUTConfId().

float FEConfigFgrGroupDat::m_ratio_high [private]

Definition at line 54 of file FEConfigFgrGroupDat.h.

Referenced by FEConfigFgrGroupDat(), getRatioHigh(), and setRatioHigh().

float FEConfigFgrGroupDat::m_ratio_low [private]

Definition at line 53 of file FEConfigFgrGroupDat.h.

Referenced by FEConfigFgrGroupDat(), getRatioLow(), and setRatioLow().

float FEConfigFgrGroupDat::m_thresh_high [private]

Definition at line 52 of file FEConfigFgrGroupDat.h.

Referenced by FEConfigFgrGroupDat(), getThreshHigh(), and setThreshHigh().

float FEConfigFgrGroupDat::m_thresh_low [private]

Definition at line 51 of file FEConfigFgrGroupDat.h.

Referenced by FEConfigFgrGroupDat(), getThreshLow(), and setThreshLow().


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