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

#include <FEConfigFgrParamDat.h>

Inheritance diagram for FEConfigFgrParamDat:
IDataItem IDBObject

Public Member Functions

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

Private Attributes

float m_fghighthresh
 
float m_fglowthresh
 
float m_highratio
 
float m_lowratio
 

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

Constructor & Destructor Documentation

FEConfigFgrParamDat::FEConfigFgrParamDat ( )

Definition at line 11 of file FEConfigFgrParamDat.cc.

References NULL.

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

Definition at line 27 of file FEConfigFgrParamDat.cc.

28 {
29 }

Member Function Documentation

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

Definition at line 79 of file FEConfigFgrParamDat.cc.

References alignCSCRings::e, edm::pset::fillMap(), AlCaHLTBitMon_ParallelJobs::p, setFGhighratio(), setFGhighthresh(), setFGlowratio(), and setFGlowthresh().

81 {
82  this->checkConnection();
83  fillMap->clear();
84 
85  iconf->setConnection(m_env, m_conn);
86  int iconfID = iconf->fetchID();
87  if (!iconfID) {
88  // throw(std::runtime_error("FEConfigFgrParamDat::writeDB: ICONF not in DB"));
89  return;
90  }
91 
92  try {
93 
94  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
95  " d.fg_lowthresh, d.fg_highthresh, d.fg_lowratio, d.fg_highratio "
96  "FROM channelview cv JOIN "+ getTable() +" d "
97  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
98  "WHERE fgr_conf_id = :fgr_conf_id");
99  m_readStmt->setInt(1, iconfID);
100  ResultSet* rset = m_readStmt->executeQuery();
101 
102  std::pair< EcalLogicID, FEConfigFgrParamDat > p;
104  while(rset->next()) {
105  p.first = EcalLogicID( rset->getString(1), // name
106  rset->getInt(2), // logic_id
107  rset->getInt(3), // id1
108  rset->getInt(4), // id2
109  rset->getInt(5), // id3
110  rset->getString(6)); // maps_to
111 
112  dat.setFGlowthresh( rset->getFloat(7) );
113  dat.setFGhighthresh( rset->getFloat(8) );
114  dat.setFGlowratio( rset->getFloat(9) );
115  dat.setFGhighratio( rset->getFloat(10) );
116 
117  p.second = dat;
118  fillMap->insert(p);
119  }
120  } catch (SQLException &e) {
121  throw(std::runtime_error("FEConfigFgrParamDat::fetchData: "+e.getMessage()));
122  }
123 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setFGhighratio(float x)
void setFGlowthresh(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 setFGlowratio(float x)
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 setFGhighthresh(float x)
void checkConnection() const
Definition: IDBObject.h:41
float FEConfigFgrParamDat::getFGhighratio ( ) const
inline

Definition at line 29 of file FEConfigFgrParamDat.h.

References m_highratio.

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

29 { return m_highratio; }
float FEConfigFgrParamDat::getFGhighthresh ( ) const
inline
float FEConfigFgrParamDat::getFGlowratio ( ) const
inline

Definition at line 28 of file FEConfigFgrParamDat.h.

References m_lowratio.

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

28 { return m_lowratio ; }
float FEConfigFgrParamDat::getFGlowthresh ( ) const
inline

Definition at line 26 of file FEConfigFgrParamDat.h.

References m_fglowthresh.

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

26 { return m_fglowthresh; }
std::string FEConfigFgrParamDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigFgrParamDat.h.

18 { return "FE_CONFIG_FGRPARAM_DAT"; }
void FEConfigFgrParamDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 33 of file FEConfigFgrParamDat.cc.

References alignCSCRings::e.

35 {
36  this->checkConnection();
37 
38  try {
39  m_writeStmt = m_conn->createStatement();
40  m_writeStmt->setSQL("INSERT INTO "+ getTable()+" (fgr_conf_id, logic_id, "
41  " fg_lowthresh, fg_highthresh, fg_lowratio, fg_highratio ) "
42  "VALUES (:fgr_conf_id, :logic_id, "
43  " :fg_lowthresh, :fg_highthresh, :fg_lowratio, :fg_highratio )" );
44  } catch (SQLException &e) {
45  throw(std::runtime_error("FEConfigFgrParamDat::prepareWrite(): "+e.getMessage()));
46  }
47 }
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 FEConfigFgrParamDat::setFGhighratio ( float  x)
inline

Definition at line 24 of file FEConfigFgrParamDat.h.

References m_highratio, and vdt::x.

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

24 { m_highratio = x; }
x
Definition: VDTMath.h:216
void FEConfigFgrParamDat::setFGhighthresh ( float  x)
inline

Definition at line 22 of file FEConfigFgrParamDat.h.

References m_fghighthresh, and vdt::x.

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

void FEConfigFgrParamDat::setFGlowratio ( float  x)
inline

Definition at line 23 of file FEConfigFgrParamDat.h.

References m_lowratio, and vdt::x.

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

23 { m_lowratio = x; }
x
Definition: VDTMath.h:216
void FEConfigFgrParamDat::setFGlowthresh ( float  x)
inline

Definition at line 21 of file FEConfigFgrParamDat.h.

References m_fglowthresh, and vdt::x.

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

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

Definition at line 125 of file FEConfigFgrParamDat.cc.

References prof2calltree::count, data, alignCSCRings::e, getFGhighratio(), getFGhighthresh(), getFGlowratio(), getFGlowthresh(), EcalLogicID::getLogicID(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, lumiQTWidget::t, groupFilesInBlocks::tt, and w().

127 {
128  this->checkConnection();
129  this->checkPrepare();
130 
131  int iconfID = iconf->fetchID();
132  if (!iconfID) { throw(std::runtime_error("FEConfigFgrParamDat::writeArrayDB: ICONF not in DB")); }
133 
134 
135  int nrows=data->size();
136  int* ids= new int[nrows];
137  int* iov_vec= new int[nrows];
138  float* ww= new float[nrows];
139  float* uu= new float[nrows];
140  float* tt= new float[nrows];
141  float* st= new float[nrows];
142 
143  ub2* ids_len= new ub2[nrows];
144  ub2* iov_len= new ub2[nrows];
145  ub2* w_len= new ub2[nrows];
146  ub2* u_len= new ub2[nrows];
147  ub2* t_len= new ub2[nrows];
148  ub2* st_len= new ub2[nrows];
149 
150  const EcalLogicID* channel;
151  const FEConfigFgrParamDat* dataitem;
152  int count=0;
153  typedef map< EcalLogicID, FEConfigFgrParamDat >::const_iterator CI;
154  for (CI p = data->begin(); p != data->end(); ++p) {
155  channel = &(p->first);
156  int logicID = channel->getLogicID();
157  if (!logicID) { throw(std::runtime_error("FEConfigFgrParamDat::writeArrayDB: Bad EcalLogicID")); }
158  ids[count]=logicID;
159  iov_vec[count]=iconfID;
160 
161  dataitem = &(p->second);
162  // dataIface.writeDB( channel, dataitem, conf);
163  float w=dataitem->getFGlowthresh();
164  float u=dataitem->getFGhighthresh();
165  float t=dataitem->getFGlowratio();
166  float r=dataitem->getFGhighratio();
167 
168  ww[count]=w;
169  uu[count]=u;
170  tt[count]=t;
171  st[count]=r;
172 
173 
174  ids_len[count]=sizeof(ids[count]);
175  iov_len[count]=sizeof(iov_vec[count]);
176 
177  w_len[count]=sizeof(ww[count]);
178  u_len[count]=sizeof(uu[count]);
179  t_len[count]=sizeof(tt[count]);
180  st_len[count]=sizeof(st[count]);
181 
182  count++;
183  }
184 
185 
186  try {
187  m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT, sizeof(iov_vec[0]),iov_len);
188  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
189  m_writeStmt->setDataBuffer(3, (dvoid*)ww, OCCIFLOAT , sizeof(ww[0]), w_len );
190  m_writeStmt->setDataBuffer(4, (dvoid*)uu, OCCIFLOAT , sizeof(uu[0]), u_len );
191  m_writeStmt->setDataBuffer(5, (dvoid*)tt, OCCIFLOAT , sizeof(tt[0]), t_len );
192  m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIFLOAT , sizeof(st[0]), st_len );
193 
194 
195  m_writeStmt->executeArrayUpdate(nrows);
196 
197  delete [] ids;
198  delete [] iov_vec;
199  delete [] ww;
200  delete [] uu;
201  delete [] tt;
202  delete [] st;
203 
204  delete [] ids_len;
205  delete [] iov_len;
206  delete [] w_len;
207  delete [] u_len;
208  delete [] t_len;
209  delete [] st_len;
210 
211  } catch (SQLException &e) {
212  throw(std::runtime_error("FEConfigFgrParamDat::writeArrayDB(): "+e.getMessage()));
213  }
214 }
float getFGlowthresh() const
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:24
float getFGhighthresh() const
float getFGhighratio() const
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
int getLogicID() const
Definition: EcalLogicID.cc:42
void checkPrepare()
Definition: IDataItem.h:27
float getFGlowratio() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void checkConnection() const
Definition: IDBObject.h:41
T w() const
void FEConfigFgrParamDat::writeDB ( const EcalLogicID ecid,
const FEConfigFgrParamDat item,
FEConfigFgrInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 51 of file FEConfigFgrParamDat.cc.

References alignCSCRings::e.

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

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigFgrParamDat.h.

Member Data Documentation

float FEConfigFgrParamDat::m_fghighthresh
private

Definition at line 48 of file FEConfigFgrParamDat.h.

Referenced by getFGhighthresh(), and setFGhighthresh().

float FEConfigFgrParamDat::m_fglowthresh
private

Definition at line 47 of file FEConfigFgrParamDat.h.

Referenced by getFGlowthresh(), and setFGlowthresh().

float FEConfigFgrParamDat::m_highratio
private

Definition at line 50 of file FEConfigFgrParamDat.h.

Referenced by getFGhighratio(), and setFGhighratio().

float FEConfigFgrParamDat::m_lowratio
private

Definition at line 49 of file FEConfigFgrParamDat.h.

Referenced by getFGlowratio(), and setFGlowratio().