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
FEConfigParamDat Class Reference

#include <FEConfigParamDat.h>

Inheritance diagram for FEConfigParamDat:
IDataItem IDBObject

Public Member Functions

 FEConfigParamDat ()
 
float getETSat () const
 
float getFGhighratio () const
 
float getFGhighthresh () const
 
float getFGlowratio () const
 
float getFGlowthresh () const
 
std::string getTable ()
 
float getTTThreshhigh () const
 
float getTTThreshlow () const
 
void setETSat (float x)
 
void setFGhighratio (float x)
 
void setFGhighthresh (float x)
 
void setFGlowratio (float x)
 
void setFGlowthresh (float x)
 
void setTTThreshhigh (float x)
 
void setTTThreshlow (float x)
 
 ~FEConfigParamDat ()
 
- 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, FEConfigParamDat > *fillMap, FEConfigLinInfo *iconf) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigParamDat > *data, FEConfigLinInfo *iconf) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const FEConfigParamDat *item, FEConfigLinInfo *iconf) throw (std::runtime_error)
 

Private Attributes

float m_etsat
 
float m_fghighthresh
 
float m_fglowthresh
 
float m_highratio
 
float m_lowratio
 
float m_tthreshhigh
 
float m_tthreshlow
 

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 FEConfigParamDat.h.

Constructor & Destructor Documentation

FEConfigParamDat::FEConfigParamDat ( )

Definition at line 11 of file FEConfigParamDat.cc.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_etsat = 0;
19  m_tthreshlow = 0;
20  m_tthreshhigh = 0;
21  m_fglowthresh = 0;
22  m_fghighthresh = 0;
23  m_lowratio = 0;
24  m_highratio = 0;
25 
26 }
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
FEConfigParamDat::~FEConfigParamDat ( )

Definition at line 30 of file FEConfigParamDat.cc.

31 {
32 }

Member Function Documentation

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

Definition at line 85 of file FEConfigParamDat.cc.

References ExpressReco_HICollisions_FallBack::e, edm::pset::fillMap(), L1TEmulatorMonitor_cff::p, setETSat(), setFGhighratio(), setFGhighthresh(), setFGlowratio(), setFGlowthresh(), setTTThreshhigh(), and setTTThreshlow().

87 {
88  this->checkConnection();
89  fillMap->clear();
90 
91  iconf->setConnection(m_env, m_conn);
92  int iconfID = iconf->fetchID();
93  if (!iconfID) {
94  // throw(std::runtime_error("FEConfigParamDat::writeDB: ICONF not in DB"));
95  return;
96  }
97 
98  try {
99 
100  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
101  " d.etsat, d.ttthreshlow, d.ttthreshhigh, d.fg_lowthresh, d.fg_highthresh, d.fg_lowratio, d.fg_highratio "
102  "FROM channelview cv JOIN fe_config_param_dat d "
103  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
104  "WHERE lin_conf_id = :lin_conf_id");
105  m_readStmt->setInt(1, iconfID);
106  ResultSet* rset = m_readStmt->executeQuery();
107 
108  std::pair< EcalLogicID, FEConfigParamDat > p;
109  FEConfigParamDat dat;
110  while(rset->next()) {
111  p.first = EcalLogicID( rset->getString(1), // name
112  rset->getInt(2), // logic_id
113  rset->getInt(3), // id1
114  rset->getInt(4), // id2
115  rset->getInt(5), // id3
116  rset->getString(6)); // maps_to
117 
118 
119 
120  dat.setETSat( rset->getFloat(7) );
121  dat.setTTThreshlow( rset->getFloat(8) );
122  dat.setTTThreshhigh( rset->getFloat(9) );
123  dat.setFGlowthresh( rset->getFloat(10) );
124  dat.setFGhighthresh( rset->getFloat(11) );
125  dat.setFGlowratio( rset->getFloat(12) );
126  dat.setFGhighratio( rset->getFloat(13) );
127 
128  p.second = dat;
129  fillMap->insert(p);
130  }
131  } catch (SQLException &e) {
132  throw(std::runtime_error("FEConfigParamDat::fetchData: "+e.getMessage()));
133  }
134 }
void setTTThreshlow(float x)
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setFGlowratio(float x)
void setFGlowthresh(float x)
void setFGhighthresh(float x)
void setETSat(float x)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
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 setTTThreshhigh(float x)
void checkConnection() const
Definition: IDBObject.h:41
void setFGhighratio(float x)
float FEConfigParamDat::getETSat ( ) const
inline

Definition at line 29 of file FEConfigParamDat.h.

References m_etsat.

Referenced by writeArrayDB().

29 { return m_etsat; }
float FEConfigParamDat::getFGhighratio ( ) const
inline

Definition at line 35 of file FEConfigParamDat.h.

References m_highratio.

Referenced by writeArrayDB().

35 { return m_highratio; }
float FEConfigParamDat::getFGhighthresh ( ) const
inline

Definition at line 33 of file FEConfigParamDat.h.

References m_fghighthresh.

Referenced by writeArrayDB().

33 { return m_fghighthresh; }
float FEConfigParamDat::getFGlowratio ( ) const
inline

Definition at line 34 of file FEConfigParamDat.h.

References m_lowratio.

Referenced by writeArrayDB().

34 { return m_lowratio ; }
float FEConfigParamDat::getFGlowthresh ( ) const
inline

Definition at line 32 of file FEConfigParamDat.h.

References m_fglowthresh.

Referenced by writeArrayDB().

32 { return m_fglowthresh; }
std::string FEConfigParamDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigParamDat.h.

18 { return "FE_CONFIG_PARAM_DAT"; }
float FEConfigParamDat::getTTThreshhigh ( ) const
inline

Definition at line 31 of file FEConfigParamDat.h.

References m_tthreshhigh.

Referenced by writeArrayDB().

31 { return m_tthreshhigh; }
float FEConfigParamDat::getTTThreshlow ( ) const
inline

Definition at line 30 of file FEConfigParamDat.h.

References m_tthreshlow.

Referenced by writeArrayDB().

30 { return m_tthreshlow; }
void FEConfigParamDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 36 of file FEConfigParamDat.cc.

References ExpressReco_HICollisions_FallBack::e.

38 {
39  this->checkConnection();
40 
41  try {
42  m_writeStmt = m_conn->createStatement();
43  m_writeStmt->setSQL("INSERT INTO fe_config_param_dat (lin_conf_id, logic_id, "
44  " etsat, ttthreshlow, ttthreshhigh, fg_lowthresh, fg_highthresh, fg_lowratio, fg_highratio ) "
45  "VALUES (:lin_conf_id, :logic_id, "
46  ":etsat, :ttthreshlow, :ttthreshhigh, :fg_lowthresh, :fg_highthresh, :fg_lowratio, :fg_highratio )" );
47  } catch (SQLException &e) {
48  throw(std::runtime_error("FEConfigParamDat::prepareWrite(): "+e.getMessage()));
49  }
50 }
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 FEConfigParamDat::setETSat ( float  x)
inline
void FEConfigParamDat::setFGhighratio ( float  x)
inline
void FEConfigParamDat::setFGhighthresh ( float  x)
inline
void FEConfigParamDat::setFGlowratio ( float  x)
inline
void FEConfigParamDat::setFGlowthresh ( float  x)
inline
void FEConfigParamDat::setTTThreshhigh ( float  x)
inline
void FEConfigParamDat::setTTThreshlow ( float  x)
inline
void FEConfigParamDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigParamDat > *  data,
FEConfigLinInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 136 of file FEConfigParamDat.cc.

References prof2calltree::count, runTheMatrix::data, ExpressReco_HICollisions_FallBack::e, getETSat(), getFGhighratio(), getFGhighthresh(), getFGlowratio(), getFGlowthresh(), EcalLogicID::getLogicID(), getTTThreshhigh(), getTTThreshlow(), L1TEmulatorMonitor_cff::p, csvReporter::r, matplotRender::t, ExpressReco_HICollisions_FallBack::x, ExpressReco_HICollisions_FallBack::y, and z.

138 {
139  this->checkConnection();
140  this->checkPrepare();
141 
142  int iconfID = iconf->fetchID();
143  if (!iconfID) { throw(std::runtime_error("FEConfigParamDat::writeArrayDB: ICONF not in DB")); }
144 
145 
146  int nrows=data->size();
147  int* ids= new int[nrows];
148  int* iov_vec= new int[nrows];
149  float* xx= new float[nrows];
150  float* yy= new float[nrows];
151  float* zz= new float[nrows];
152  float* ww= new float[nrows];
153  float* uu= new float[nrows];
154  float* tt= new float[nrows];
155  float* st= new float[nrows];
156 
157  ub2* ids_len= new ub2[nrows];
158  ub2* iov_len= new ub2[nrows];
159  ub2* x_len= new ub2[nrows];
160  ub2* y_len= new ub2[nrows];
161  ub2* z_len= new ub2[nrows];
162  ub2* w_len= new ub2[nrows];
163  ub2* u_len= new ub2[nrows];
164  ub2* t_len= new ub2[nrows];
165  ub2* st_len= new ub2[nrows];
166 
167  const EcalLogicID* channel;
168  const FEConfigParamDat* dataitem;
169  int count=0;
170  typedef map< EcalLogicID, FEConfigParamDat >::const_iterator CI;
171  for (CI p = data->begin(); p != data->end(); ++p) {
172  channel = &(p->first);
173  int logicID = channel->getLogicID();
174  if (!logicID) { throw(std::runtime_error("FEConfigParamDat::writeArrayDB: Bad EcalLogicID")); }
175  ids[count]=logicID;
176  iov_vec[count]=iconfID;
177 
178  dataitem = &(p->second);
179  // dataIface.writeDB( channel, dataitem, conf);
180  float x=dataitem->getETSat();
181  float y=dataitem->getTTThreshlow();
182  float z=dataitem->getTTThreshhigh();
183  float w=dataitem->getFGlowthresh();
184  float u=dataitem->getFGhighthresh();
185  float t=dataitem->getFGlowratio();
186  float r=dataitem->getFGhighratio();
187 
188  xx[count]=x;
189  yy[count]=y;
190  zz[count]=z;
191  ww[count]=w;
192  uu[count]=u;
193  tt[count]=t;
194  st[count]=r;
195 
196 
197  ids_len[count]=sizeof(ids[count]);
198  iov_len[count]=sizeof(iov_vec[count]);
199 
200  x_len[count]=sizeof(xx[count]);
201  y_len[count]=sizeof(yy[count]);
202  z_len[count]=sizeof(zz[count]);
203  w_len[count]=sizeof(ww[count]);
204  u_len[count]=sizeof(uu[count]);
205  t_len[count]=sizeof(tt[count]);
206  st_len[count]=sizeof(st[count]);
207 
208  count++;
209  }
210 
211 
212  try {
213  m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT, sizeof(iov_vec[0]),iov_len);
214  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
215  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );
216  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
217  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
218  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT , sizeof(ww[0]), w_len );
219  m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT , sizeof(uu[0]), u_len );
220  m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIFLOAT , sizeof(tt[0]), t_len );
221  m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIFLOAT , sizeof(st[0]), st_len );
222 
223 
224  m_writeStmt->executeArrayUpdate(nrows);
225 
226  delete [] ids;
227  delete [] iov_vec;
228  delete [] xx;
229  delete [] yy;
230  delete [] zz;
231  delete [] ww;
232  delete [] uu;
233  delete [] tt;
234  delete [] st;
235 
236  delete [] ids_len;
237  delete [] iov_len;
238  delete [] x_len;
239  delete [] y_len;
240  delete [] z_len;
241  delete [] w_len;
242  delete [] u_len;
243  delete [] t_len;
244  delete [] st_len;
245 
246  } catch (SQLException &e) {
247  throw(std::runtime_error("FEConfigParamDat::writeArrayDB(): "+e.getMessage()));
248  }
249 }
float getTTThreshlow() const
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
float getETSat() const
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
Definition: DDAxes.h:10
float getFGhighthresh() const
float getFGlowratio() const
int getLogicID() const
Definition: EcalLogicID.cc:42
float getFGlowthresh() const
float getTTThreshhigh() const
void checkPrepare()
Definition: IDataItem.h:27
float getFGhighratio() const
void checkConnection() const
Definition: IDBObject.h:41
void FEConfigParamDat::writeDB ( const EcalLogicID ecid,
const FEConfigParamDat item,
FEConfigLinInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 54 of file FEConfigParamDat.cc.

References ExpressReco_HICollisions_FallBack::e.

56 {
57  this->checkConnection();
58  this->checkPrepare();
59 
60  int iconfID = iconf->fetchID();
61  if (!iconfID) { throw(std::runtime_error("FEConfigParamDat::writeDB: ICONF not in DB")); }
62 
63  int logicID = ecid->getLogicID();
64  if (!logicID) { throw(std::runtime_error("FEConfigParamDat::writeDB: Bad EcalLogicID")); }
65 
66  try {
67  m_writeStmt->setInt(1, iconfID);
68  m_writeStmt->setInt(2, logicID);
69  m_writeStmt->setFloat(3, item->getETSat());
70  m_writeStmt->setFloat(4, item->getTTThreshlow());
71  m_writeStmt->setFloat(5, item->getTTThreshhigh());
72  m_writeStmt->setFloat(6, item->getFGlowthresh());
73  m_writeStmt->setFloat(7, item->getFGhighthresh());
74  m_writeStmt->setFloat(8, item->getFGlowratio());
75  m_writeStmt->setFloat(9, item->getFGhighratio());
76 
77  m_writeStmt->executeUpdate();
78  } catch (SQLException &e) {
79  throw(std::runtime_error("FEConfigParamDat::writeDB(): "+e.getMessage()));
80  }
81 }
float getTTThreshlow() const
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
float getETSat() const
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
float getFGhighthresh() const
float getFGlowratio() const
int getLogicID() const
Definition: EcalLogicID.cc:42
float getFGlowthresh() const
float getTTThreshhigh() const
void checkPrepare()
Definition: IDataItem.h:27
float getFGhighratio() const
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigParamDat.h.

Member Data Documentation

float FEConfigParamDat::m_etsat
private

Definition at line 53 of file FEConfigParamDat.h.

Referenced by getETSat(), and setETSat().

float FEConfigParamDat::m_fghighthresh
private

Definition at line 57 of file FEConfigParamDat.h.

Referenced by getFGhighthresh(), and setFGhighthresh().

float FEConfigParamDat::m_fglowthresh
private

Definition at line 56 of file FEConfigParamDat.h.

Referenced by getFGlowthresh(), and setFGlowthresh().

float FEConfigParamDat::m_highratio
private

Definition at line 59 of file FEConfigParamDat.h.

Referenced by getFGhighratio(), and setFGhighratio().

float FEConfigParamDat::m_lowratio
private

Definition at line 58 of file FEConfigParamDat.h.

Referenced by getFGlowratio(), and setFGlowratio().

float FEConfigParamDat::m_tthreshhigh
private

Definition at line 55 of file FEConfigParamDat.h.

Referenced by getTTThreshhigh(), and setTTThreshhigh().

float FEConfigParamDat::m_tthreshlow
private

Definition at line 54 of file FEConfigParamDat.h.

Referenced by getTTThreshlow(), and setTTThreshlow().