CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
FEConfigFgrEEStripDat Class Reference

#include <FEConfigFgrEEStripDat.h>

Inheritance diagram for FEConfigFgrEEStripDat:
IDataItem IDBObject

Public Member Functions

 FEConfigFgrEEStripDat ()
 
unsigned int getLutFg () const
 
unsigned int getLUTFgr () const
 
unsigned int getLutFgr () const
 
std::string getTable ()
 
unsigned int getThreshold () const
 
void setLutFg (unsigned int mean)
 
void setLUTFgr (unsigned int mean)
 
void setLutFgr (unsigned int mean)
 
void setThreshold (unsigned int mean)
 
 ~FEConfigFgrEEStripDat ()
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Private Member Functions

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

Private Attributes

unsigned int m_lut_fg
 
unsigned int m_thresh
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 
- Protected Member Functions inherited from IDataItem
void checkPrepare () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- Protected Attributes inherited from IDataItem
oracle::occi::Statement * m_readStmt
 
oracle::occi::Statement * m_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 11 of file FEConfigFgrEEStripDat.h.

Constructor & Destructor Documentation

FEConfigFgrEEStripDat::FEConfigFgrEEStripDat ( )

Definition at line 11 of file FEConfigFgrEEStripDat.cc.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_thresh = 0;
19  m_lut_fg = 0;
20 
21 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:25
FEConfigFgrEEStripDat::~FEConfigFgrEEStripDat ( )

Definition at line 25 of file FEConfigFgrEEStripDat.cc.

26 {
27 }

Member Function Documentation

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

Definition at line 75 of file FEConfigFgrEEStripDat.cc.

References alignCSCRings::e, edm::pset::fillMap(), AlCaHLTBitMon_ParallelJobs::p, setLutFg(), and setThreshold().

77 {
78  this->checkConnection();
79  fillMap->clear();
80 
81  iconf->setConnection(m_env, m_conn);
82  int iconfID = iconf->fetchID();
83  if (!iconfID) {
84  // throw(std::runtime_error("FEConfigFgrEEStripDat::writeDB: ICONF not in DB"));
85  return;
86  }
87 
88  try {
89 
90  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
91  "d.threshold, d.lut_fg "
92  "FROM channelview cv JOIN "+getTable()+" d "
93  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
94  "WHERE fgr_conf_id = :fgr_conf_id");
95  m_readStmt->setInt(1, iconfID);
96  ResultSet* rset = m_readStmt->executeQuery();
97 
98  std::pair< EcalLogicID, FEConfigFgrEEStripDat > p;
100  while(rset->next()) {
101  p.first = EcalLogicID( rset->getString(1), // name
102  rset->getInt(2), // logic_id
103  rset->getInt(3), // id1
104  rset->getInt(4), // id2
105  rset->getInt(5), // id3
106  rset->getString(6)); // maps_to
107 
108  dat.setThreshold( rset->getUInt(7) );
109  dat.setLutFg( rset->getUInt(8) );
110 
111  p.second = dat;
112  fillMap->insert(p);
113  }
114  } catch (SQLException &e) {
115  throw(std::runtime_error("FEConfigFgrEEStripDat::fetchData: "+e.getMessage()));
116  }
117 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void setThreshold(unsigned int mean)
void setLutFg(unsigned int mean)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:25
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void fillMap(Registry *reg, regmap_type &fillme)
Definition: Registry.cc:24
void checkConnection() const
Definition: IDBObject.h:41
unsigned int FEConfigFgrEEStripDat::getLutFg ( ) const
inline

Definition at line 23 of file FEConfigFgrEEStripDat.h.

References m_lut_fg.

Referenced by writeArrayDB().

23 { return m_lut_fg; }
unsigned int FEConfigFgrEEStripDat::getLUTFgr ( ) const
inline

Definition at line 25 of file FEConfigFgrEEStripDat.h.

References m_lut_fg.

Referenced by popcon::EcalTPGFineGrainStripEEHandler::getNewObjects().

25 { return m_lut_fg; }
unsigned int FEConfigFgrEEStripDat::getLutFgr ( ) const
inline

Definition at line 27 of file FEConfigFgrEEStripDat.h.

References m_lut_fg.

27 { return m_lut_fg; }
std::string FEConfigFgrEEStripDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigFgrEEStripDat.h.

18 { return "FE_CONFIG_FGREEST_DAT"; }
unsigned int FEConfigFgrEEStripDat::getThreshold ( ) const
inline

Definition at line 21 of file FEConfigFgrEEStripDat.h.

References m_thresh.

Referenced by popcon::EcalTPGFineGrainStripEEHandler::getNewObjects(), and writeArrayDB().

21 { return m_thresh; }
void FEConfigFgrEEStripDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 31 of file FEConfigFgrEEStripDat.cc.

References alignCSCRings::e.

33 {
34  this->checkConnection();
35 
36  try {
37  m_writeStmt = m_conn->createStatement();
38  m_writeStmt->setSQL("INSERT INTO "+getTable()+" (fgr_conf_id, logic_id, "
39  "threshold, lut_fg ) "
40  "VALUES (:fgr_conf_id, :logic_id, "
41  ":threshold, :lut_fg )" );
42  } catch (SQLException &e) {
43  throw(std::runtime_error("FEConfigFgrEEStripDat::prepareWrite(): "+e.getMessage()));
44  }
45 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void checkConnection() const
Definition: IDBObject.h:41
void FEConfigFgrEEStripDat::setLutFg ( unsigned int  mean)
inline

Definition at line 22 of file FEConfigFgrEEStripDat.h.

References m_lut_fg, and timingPdfMaker::mean.

Referenced by fetchData().

void FEConfigFgrEEStripDat::setLUTFgr ( unsigned int  mean)
inline

Definition at line 24 of file FEConfigFgrEEStripDat.h.

References m_lut_fg, and timingPdfMaker::mean.

void FEConfigFgrEEStripDat::setLutFgr ( unsigned int  mean)
inline

Definition at line 26 of file FEConfigFgrEEStripDat.h.

References m_lut_fg, and timingPdfMaker::mean.

Referenced by EcalTPGParamBuilder::analyze().

void FEConfigFgrEEStripDat::setThreshold ( unsigned int  mean)
inline

Definition at line 20 of file FEConfigFgrEEStripDat.h.

References m_thresh, and timingPdfMaker::mean.

Referenced by EcalTPGParamBuilder::analyze(), and fetchData().

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

Definition at line 119 of file FEConfigFgrEEStripDat.cc.

References prof2calltree::count, data, alignCSCRings::e, EcalLogicID::getLogicID(), getLutFg(), getThreshold(), AlCaHLTBitMon_ParallelJobs::p, vdt::x, and detailsBasic3DVector::y.

121 {
122  this->checkConnection();
123  this->checkPrepare();
124 
125  int iconfID = iconf->fetchID();
126  if (!iconfID) { throw(std::runtime_error("FEConfigFgrEEStripDat::writeArrayDB: ICONF not in DB")); }
127 
128 
129  int nrows=data->size();
130  int* ids= new int[nrows];
131  int* iconfid_vec= new int[nrows];
132  unsigned int* xx= new unsigned int[nrows];
133  unsigned int* yy= new unsigned int[nrows];
134 
135 
136  ub2* ids_len= new ub2[nrows];
137  ub2* iconf_len= new ub2[nrows];
138  ub2* x_len= new ub2[nrows];
139  ub2* y_len= new ub2[nrows];
140 
141 
142  const EcalLogicID* channel;
143  const FEConfigFgrEEStripDat* dataitem;
144  int count=0;
145  typedef map< EcalLogicID, FEConfigFgrEEStripDat >::const_iterator CI;
146  for (CI p = data->begin(); p != data->end(); ++p) {
147  channel = &(p->first);
148  int logicID = channel->getLogicID();
149  if (!logicID) { throw(std::runtime_error("FEConfigFgrEEStripDat::writeArrayDB: Bad EcalLogicID")); }
150  ids[count]=logicID;
151  iconfid_vec[count]=iconfID;
152 
153  dataitem = &(p->second);
154  // dataIface.writeDB( channel, dataitem, iconf);
155  unsigned int x=dataitem->getThreshold();
156  unsigned int y=dataitem->getLutFg();
157 
158  xx[count]=x;
159  yy[count]=y;
160 
161 
162  ids_len[count]=sizeof(ids[count]);
163  iconf_len[count]=sizeof(iconfid_vec[count]);
164 
165  x_len[count]=sizeof(xx[count]);
166  y_len[count]=sizeof(yy[count]);
167 
168  count++;
169  }
170 
171 
172  try {
173  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len);
174  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
175  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIUNSIGNED_INT , sizeof(xx[0]), x_len );
176  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIUNSIGNED_INT , sizeof(yy[0]), y_len );
177 
178  m_writeStmt->executeArrayUpdate(nrows);
179 
180  delete [] ids;
181  delete [] iconfid_vec;
182  delete [] xx;
183  delete [] yy;
184 
185  delete [] ids_len;
186  delete [] iconf_len;
187  delete [] x_len;
188  delete [] y_len;
189 
190  } catch (SQLException &e) {
191  throw(std::runtime_error("FEConfigFgrEEStripDat::writeArrayDB(): "+e.getMessage()));
192  }
193 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
unsigned int getThreshold() const
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
int getLogicID() const
Definition: EcalLogicID.cc:42
unsigned int getLutFg() const
void checkPrepare()
Definition: IDataItem.h:27
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
x
Definition: VDTMath.h:216
void checkConnection() const
Definition: IDBObject.h:41
void FEConfigFgrEEStripDat::writeDB ( const EcalLogicID ecid,
const FEConfigFgrEEStripDat item,
FEConfigFgrInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 49 of file FEConfigFgrEEStripDat.cc.

References alignCSCRings::e.

51 {
52  this->checkConnection();
53  this->checkPrepare();
54 
55  int iconfID = iconf->fetchID();
56  if (!iconfID) { throw(std::runtime_error("FEConfigFgrEEStripDat::writeDB: ICONF not in DB")); }
57 
58  int logicID = ecid->getLogicID();
59  if (!logicID) { throw(std::runtime_error("FEConfigFgrEEStripDat::writeDB: Bad EcalLogicID")); }
60 
61  try {
62  m_writeStmt->setInt(1, iconfID);
63  m_writeStmt->setInt(2, logicID);
64  m_writeStmt->setUInt(3, item->getThreshold());
65  m_writeStmt->setUInt(4, item->getLutFg());
66 
67  m_writeStmt->executeUpdate();
68  } catch (SQLException &e) {
69  throw(std::runtime_error("FEConfigFgrEEStripDat::writeDB(): "+e.getMessage()));
70  }
71 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
unsigned int getThreshold() const
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
int getLogicID() const
Definition: EcalLogicID.cc:42
unsigned int getLutFg() const
void checkPrepare()
Definition: IDataItem.h:27
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigFgrEEStripDat.h.

Member Data Documentation

unsigned int FEConfigFgrEEStripDat::m_lut_fg
private

Definition at line 46 of file FEConfigFgrEEStripDat.h.

Referenced by getLutFg(), getLUTFgr(), getLutFgr(), setLutFg(), setLUTFgr(), and setLutFgr().

unsigned int FEConfigFgrEEStripDat::m_thresh
private

Definition at line 45 of file FEConfigFgrEEStripDat.h.

Referenced by getThreshold(), and setThreshold().