CMS 3D CMS Logo

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 () override
 
void setFGhighratio (float x)
 
void setFGhighthresh (float x)
 
void setFGlowratio (float x)
 
void setFGlowthresh (float x)
 
 ~FEConfigFgrParamDat () override
 
- Public Member Functions inherited from IDataItem
 IDataItem ()
 
- 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) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigFgrParamDat > *data, FEConfigFgrInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigFgrParamDat *item, FEConfigFgrInfo *iconf) noexcept(false)
 

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 () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- 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.

12 {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
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:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
FEConfigFgrParamDat::~FEConfigFgrParamDat ( )
override

Definition at line 27 of file FEConfigFgrParamDat.cc.

28 {
29 }

Member Function Documentation

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

Definition at line 79 of file FEConfigFgrParamDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setFGhighratio(), setFGhighthresh(), setFGlowratio(), and setFGlowthresh().

Referenced by getFGhighratio().

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 }
int fetchID() noexcept(false)
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)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
void setFGlowratio(float x)
std::string getTable() override
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void setFGhighthresh(float x)
float FEConfigFgrParamDat::getFGhighratio ( ) const
inline
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
std::string FEConfigFgrParamDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigFgrParamDat.h.

18 { return "FE_CONFIG_FGRPARAM_DAT"; }
void FEConfigFgrParamDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 33 of file FEConfigFgrParamDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getFGhighratio().

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:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
std::string getTable() override
void FEConfigFgrParamDat::setFGhighratio ( float  x)
inline

Definition at line 24 of file FEConfigFgrParamDat.h.

References m_highratio, and x.

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

void FEConfigFgrParamDat::setFGhighthresh ( float  x)
inline

Definition at line 22 of file FEConfigFgrParamDat.h.

References m_fghighthresh, and 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 x.

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

void FEConfigFgrParamDat::setFGlowthresh ( float  x)
inline

Definition at line 21 of file FEConfigFgrParamDat.h.

References m_fglowthresh, and x.

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

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

Definition at line 125 of file FEConfigFgrParamDat.cc.

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

Referenced by getFGhighratio().

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 }
int fetchID() noexcept(false)
float getFGlowthresh() const
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
float getFGhighthresh() const
const double w
Definition: UKUtility.cc:23
float getFGhighratio() const
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getLogicID() const
Definition: EcalLogicID.cc:41
float getFGlowratio() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FEConfigFgrParamDat::writeDB ( const EcalLogicID ecid,
const FEConfigFgrParamDat item,
FEConfigFgrInfo iconf 
)
privatenoexcept

Definition at line 51 of file FEConfigFgrParamDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getFGhighratio().

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 }
int fetchID() noexcept(false)
float getFGlowthresh() const
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
float getFGhighthresh() const
float getFGhighratio() const
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getLogicID() const
Definition: EcalLogicID.cc:41
float getFGlowratio() const

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 44 of file FEConfigFgrParamDat.h.

Referenced by getFGhighthresh(), and setFGhighthresh().

float FEConfigFgrParamDat::m_fglowthresh
private

Definition at line 43 of file FEConfigFgrParamDat.h.

Referenced by getFGlowthresh(), and setFGlowthresh().

float FEConfigFgrParamDat::m_highratio
private

Definition at line 46 of file FEConfigFgrParamDat.h.

Referenced by getFGhighratio(), and setFGhighratio().

float FEConfigFgrParamDat::m_lowratio
private

Definition at line 45 of file FEConfigFgrParamDat.h.

Referenced by getFGlowratio(), and setFGlowratio().