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::FEConfigFgrParamDat ( )

Definition at line 11 of file FEConfigFgrParamDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_fglowthresh = 0;
18  m_fghighthresh = 0;
19  m_lowratio = 0;
20  m_highratio = 0;
21 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24

◆ ~FEConfigFgrParamDat()

FEConfigFgrParamDat::~FEConfigFgrParamDat ( )
override

Definition at line 23 of file FEConfigFgrParamDat.cc.

23 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 70 of file FEConfigFgrParamDat.cc.

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

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

◆ getFGhighratio()

float FEConfigFgrParamDat::getFGhighratio ( ) const
inline

Definition at line 28 of file FEConfigFgrParamDat.h.

References m_highratio.

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

28 { return m_highratio; }

◆ getFGhighthresh()

float FEConfigFgrParamDat::getFGhighthresh ( ) const
inline

◆ getFGlowratio()

float FEConfigFgrParamDat::getFGlowratio ( ) const
inline

Definition at line 27 of file FEConfigFgrParamDat.h.

References m_lowratio.

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

27 { return m_lowratio; }

◆ getFGlowthresh()

float FEConfigFgrParamDat::getFGlowthresh ( ) const
inline

◆ getTable()

std::string FEConfigFgrParamDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigFgrParamDat.h.

18 { return "FE_CONFIG_FGRPARAM_DAT"; }

◆ prepareWrite()

void FEConfigFgrParamDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 25 of file FEConfigFgrParamDat.cc.

References MillePedeFileConverter_cfg::e.

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL("INSERT INTO " + getTable() +
31  " (fgr_conf_id, logic_id, "
32  " fg_lowthresh, fg_highthresh, fg_lowratio, fg_highratio ) "
33  "VALUES (:fgr_conf_id, :logic_id, "
34  " :fg_lowthresh, :fg_highthresh, :fg_lowratio, :fg_highratio )");
35  } catch (SQLException& e) {
36  throw(std::runtime_error("FEConfigFgrParamDat::prepareWrite(): " + e.getMessage()));
37  }
38 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
std::string getTable() override

◆ setFGhighratio()

void FEConfigFgrParamDat::setFGhighratio ( float  x)
inline

Definition at line 23 of file FEConfigFgrParamDat.h.

References m_highratio, and x.

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

◆ setFGhighthresh()

void FEConfigFgrParamDat::setFGhighthresh ( float  x)
inline

Definition at line 21 of file FEConfigFgrParamDat.h.

References m_fghighthresh, and x.

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

◆ setFGlowratio()

void FEConfigFgrParamDat::setFGlowratio ( float  x)
inline

Definition at line 22 of file FEConfigFgrParamDat.h.

References m_lowratio, and x.

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

◆ setFGlowthresh()

void FEConfigFgrParamDat::setFGlowthresh ( float  x)
inline

Definition at line 20 of file FEConfigFgrParamDat.h.

References m_fglowthresh, and x.

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

◆ writeArrayDB()

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

Definition at line 117 of file FEConfigFgrParamDat.cc.

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

118  {
119  this->checkConnection();
120  this->checkPrepare();
121 
122  int iconfID = iconf->fetchID();
123  if (!iconfID) {
124  throw(std::runtime_error("FEConfigFgrParamDat::writeArrayDB: ICONF not in DB"));
125  }
126 
127  int nrows = data->size();
128  int* ids = new int[nrows];
129  int* iov_vec = new int[nrows];
130  float* ww = new float[nrows];
131  float* uu = new float[nrows];
132  float* tt = new float[nrows];
133  float* st = new float[nrows];
134 
135  ub2* ids_len = new ub2[nrows];
136  ub2* iov_len = new ub2[nrows];
137  ub2* w_len = new ub2[nrows];
138  ub2* u_len = new ub2[nrows];
139  ub2* t_len = new ub2[nrows];
140  ub2* st_len = new ub2[nrows];
141 
142  const EcalLogicID* channel;
143  const FEConfigFgrParamDat* dataitem;
144  int count = 0;
145  typedef map<EcalLogicID, FEConfigFgrParamDat>::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) {
150  throw(std::runtime_error("FEConfigFgrParamDat::writeArrayDB: Bad EcalLogicID"));
151  }
152  ids[count] = logicID;
153  iov_vec[count] = iconfID;
154 
155  dataitem = &(p->second);
156  // dataIface.writeDB( channel, dataitem, conf);
157  float w = dataitem->getFGlowthresh();
158  float u = dataitem->getFGhighthresh();
159  float t = dataitem->getFGlowratio();
160  float r = dataitem->getFGhighratio();
161 
162  ww[count] = w;
163  uu[count] = u;
164  tt[count] = t;
165  st[count] = r;
166 
167  ids_len[count] = sizeof(ids[count]);
168  iov_len[count] = sizeof(iov_vec[count]);
169 
170  w_len[count] = sizeof(ww[count]);
171  u_len[count] = sizeof(uu[count]);
172  t_len[count] = sizeof(tt[count]);
173  st_len[count] = sizeof(st[count]);
174 
175  count++;
176  }
177 
178  try {
179  m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT, sizeof(iov_vec[0]), iov_len);
180  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
181  m_writeStmt->setDataBuffer(3, (dvoid*)ww, OCCIFLOAT, sizeof(ww[0]), w_len);
182  m_writeStmt->setDataBuffer(4, (dvoid*)uu, OCCIFLOAT, sizeof(uu[0]), u_len);
183  m_writeStmt->setDataBuffer(5, (dvoid*)tt, OCCIFLOAT, sizeof(tt[0]), t_len);
184  m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIFLOAT, sizeof(st[0]), st_len);
185 
186  m_writeStmt->executeArrayUpdate(nrows);
187 
188  delete[] ids;
189  delete[] iov_vec;
190  delete[] ww;
191  delete[] uu;
192  delete[] tt;
193  delete[] st;
194 
195  delete[] ids_len;
196  delete[] iov_len;
197  delete[] w_len;
198  delete[] u_len;
199  delete[] t_len;
200  delete[] st_len;
201 
202  } catch (SQLException& e) {
203  throw(std::runtime_error("FEConfigFgrParamDat::writeArrayDB(): " + e.getMessage()));
204  }
205 }
int fetchID() noexcept(false)
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
T w() const
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
float getFGhighratio() const
Definition: TTTypes.h:54
int getLogicID() const
Definition: EcalLogicID.cc:28
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
float getFGlowthresh() const
float getFGlowratio() const
float getFGhighthresh() const

◆ writeDB()

void FEConfigFgrParamDat::writeDB ( const EcalLogicID ecid,
const FEConfigFgrParamDat item,
FEConfigFgrInfo iconf 
)
privatenoexcept

Definition at line 40 of file FEConfigFgrParamDat.cc.

References MillePedeFileConverter_cfg::e, and B2GTnPMonitor_cfi::item.

42  {
43  this->checkConnection();
44  this->checkPrepare();
45 
46  int iconfID = iconf->fetchID();
47  if (!iconfID) {
48  throw(std::runtime_error("FEConfigFgrParamDat::writeDB: ICONF not in DB"));
49  }
50 
51  int logicID = ecid->getLogicID();
52  if (!logicID) {
53  throw(std::runtime_error("FEConfigFgrParamDat::writeDB: Bad EcalLogicID"));
54  }
55 
56  try {
57  m_writeStmt->setInt(1, iconfID);
58  m_writeStmt->setInt(2, logicID);
59  m_writeStmt->setFloat(3, item->getFGlowthresh());
60  m_writeStmt->setFloat(4, item->getFGhighthresh());
61  m_writeStmt->setFloat(5, item->getFGlowratio());
62  m_writeStmt->setFloat(6, item->getFGhighratio());
63 
64  m_writeStmt->executeUpdate();
65  } catch (SQLException& e) {
66  throw(std::runtime_error("FEConfigFgrParamDat::writeDB(): " + e.getMessage()));
67  }
68 }
int fetchID() noexcept(false)
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int getLogicID() const
Definition: EcalLogicID.cc:28

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigFgrParamDat.h.

Member Data Documentation

◆ m_fghighthresh

float FEConfigFgrParamDat::m_fghighthresh
private

Definition at line 41 of file FEConfigFgrParamDat.h.

Referenced by getFGhighthresh(), and setFGhighthresh().

◆ m_fglowthresh

float FEConfigFgrParamDat::m_fglowthresh
private

Definition at line 40 of file FEConfigFgrParamDat.h.

Referenced by getFGlowthresh(), and setFGlowthresh().

◆ m_highratio

float FEConfigFgrParamDat::m_highratio
private

Definition at line 43 of file FEConfigFgrParamDat.h.

Referenced by getFGhighratio(), and setFGhighratio().

◆ m_lowratio

float FEConfigFgrParamDat::m_lowratio
private

Definition at line 42 of file FEConfigFgrParamDat.h.

Referenced by getFGlowratio(), and setFGlowratio().