CMS 3D CMS Logo

FEConfigLUTDat Class Reference

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

Inheritance diagram for FEConfigLUTDat:

IDataItem IDBObject

List of all members.

Public Member Functions

 FEConfigLUTDat ()
int getLUTGroupId () const
std::string getTable ()
void setLUTGroupId (int x)
 ~FEConfigLUTDat ()

Private Member Functions

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

Private Attributes

int m_group_id

Friends

class EcalCondDBInterface


Detailed Description

Definition at line 11 of file FEConfigLUTDat.h.


Constructor & Destructor Documentation

FEConfigLUTDat::FEConfigLUTDat (  ) 

Definition at line 11 of file FEConfigLUTDat.cc.

References IDBObject::m_conn, IDBObject::m_env, m_group_id, IDataItem::m_readStmt, 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 
00020 }

FEConfigLUTDat::~FEConfigLUTDat (  ) 

Definition at line 24 of file FEConfigLUTDat.cc.

00025 {
00026 }


Member Function Documentation

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

int FEConfigLUTDat::getLUTGroupId (  )  const [inline]

Definition at line 21 of file FEConfigLUTDat.h.

References m_group_id.

Referenced by writeArrayDB().

00021 { return m_group_id; }

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

Implements IDataItem.

Definition at line 18 of file FEConfigLUTDat.h.

00018 { return "FE_CONFIG_LUT_DAT"; }

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

Implements IDataItem.

Definition at line 30 of file FEConfigLUTDat.cc.

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

00032 {
00033   this->checkConnection();
00034 
00035   try {
00036     m_writeStmt = m_conn->createStatement();
00037     m_writeStmt->setSQL("INSERT INTO fe_config_lut_dat (lut_conf_id, logic_id, "
00038                       "group_id ) "
00039                       "VALUES (:lut_conf_id, :logic_id, "
00040                       ":group_id )" );
00041   } catch (SQLException &e) {
00042     throw(runtime_error("FEConfigLUTDat::prepareWrite():  "+e.getMessage()));
00043   }
00044 }

void FEConfigLUTDat::setLUTGroupId ( int  x  )  [inline]

Definition at line 20 of file FEConfigLUTDat.h.

References m_group_id.

Referenced by EcalTPGParamBuilder::analyze().

00020 { m_group_id = x; }

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

Definition at line 115 of file FEConfigLUTDat.cc.

References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, EcalLogicID::getLogicID(), getLUTGroupId(), IDataItem::m_writeStmt, and x.

00117 {
00118   this->checkConnection();
00119   this->checkPrepare();
00120 
00121   int iconfID = iconf->fetchID();
00122   if (!iconfID) { throw(runtime_error("FEConfigLUTDat::writeArrayDB:  ICONF not in DB")); }
00123 
00124 
00125   int nrows=data->size(); 
00126   int* ids= new int[nrows];
00127   int* iconfid_vec= new int[nrows];
00128   int* xx= new int[nrows];
00129 
00130   ub2* ids_len= new ub2[nrows];
00131   ub2* iconf_len= new ub2[nrows];
00132   ub2* x_len= new ub2[nrows];
00133 
00134 
00135   const EcalLogicID* channel;
00136   const FEConfigLUTDat* dataitem;
00137   int count=0;
00138   typedef map< EcalLogicID, FEConfigLUTDat >::const_iterator CI;
00139   for (CI p = data->begin(); p != data->end(); ++p) {
00140         channel = &(p->first);
00141         int logicID = channel->getLogicID();
00142         if (!logicID) { throw(runtime_error("FEConfigLUTDat::writeArrayDB:  Bad EcalLogicID")); }
00143         ids[count]=logicID;
00144         iconfid_vec[count]=iconfID;
00145 
00146         dataitem = &(p->second);
00147         // dataIface.writeDB( channel, dataitem, iconf);
00148         int x=dataitem->getLUTGroupId();
00149 
00150         xx[count]=x;
00151 
00152         ids_len[count]=sizeof(ids[count]);
00153         iconf_len[count]=sizeof(iconfid_vec[count]);
00154         
00155         x_len[count]=sizeof(xx[count]);
00156 
00157         count++;
00158      }
00159 
00160 
00161   try {
00162     m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len);
00163     m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
00164     m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len );
00165 
00166     m_writeStmt->executeArrayUpdate(nrows);
00167 
00168     delete [] ids;
00169     delete [] iconfid_vec;
00170     delete [] xx;
00171 
00172     delete [] ids_len;
00173     delete [] iconf_len;
00174     delete [] x_len;
00175 
00176   } catch (SQLException &e) {
00177     throw(runtime_error("FEConfigLUTDat::writeArrayDB():  "+e.getMessage()));
00178   }
00179 }

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

Definition at line 47 of file FEConfigLUTDat.cc.

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

00049 {
00050   this->checkConnection();
00051   this->checkPrepare();
00052 
00053   int iconfID = iconf->fetchID();
00054   if (!iconfID) { throw(runtime_error("FEConfigLUTDat::writeDB:  ICONF not in DB")); }
00055 
00056   int logicID = ecid->getLogicID();
00057   if (!logicID) { throw(runtime_error("FEConfigLUTDat::writeDB:  Bad EcalLogicID")); }
00058  
00059   try {
00060     m_writeStmt->setInt(1, iconfID);
00061     m_writeStmt->setInt(2, logicID);
00062     m_writeStmt->setInt(3, item->getLUTGroupId());
00063 
00064     m_writeStmt->executeUpdate();
00065   } catch (SQLException &e) {
00066     throw(runtime_error("FEConfigLUTDat::writeDB():  "+e.getMessage()));
00067   }
00068 }


Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 13 of file FEConfigLUTDat.h.


Member Data Documentation

int FEConfigLUTDat::m_group_id [private]

Definition at line 39 of file FEConfigLUTDat.h.

Referenced by FEConfigLUTDat(), getLUTGroupId(), and setLUTGroupId().


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