CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
FEConfigOddWeightGroupDat Class Reference

#include <FEConfigOddWeightGroupDat.h>

Inheritance diagram for FEConfigOddWeightGroupDat:
IDataItem IDBObject

Public Member Functions

 FEConfigOddWeightGroupDat ()
 
std::string getTable () override
 
float getWeight0 () const
 
float getWeight1 () const
 
float getWeight2 () const
 
float getWeight3 () const
 
float getWeight4 () const
 
float getWeight5 () const
 
int getWeightGroupId () const
 
void setWeight0 (float x)
 
void setWeight1 (float x)
 
void setWeight2 (float x)
 
void setWeight3 (float x)
 
void setWeight4 (float x)
 
void setWeight5 (float x)
 
void setWeightGroupId (int x)
 
 ~FEConfigOddWeightGroupDat () 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, FEConfigOddWeightGroupDat > *fillMap, FEConfigOddWeightInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigOddWeightGroupDat > *data, FEConfigOddWeightInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigOddWeightGroupDat *item, FEConfigOddWeightInfo *iconf) noexcept(false)
 

Private Attributes

int m_group_id
 
float m_w0
 
float m_w1
 
float m_w2
 
float m_w3
 
float m_w4
 
float m_w5
 

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

Constructor & Destructor Documentation

◆ FEConfigOddWeightGroupDat()

FEConfigOddWeightGroupDat::FEConfigOddWeightGroupDat ( )

Definition at line 12 of file FEConfigOddWeightGroupDat.cc.

12  {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_group_id = 0;
19  m_w0 = 0;
20  m_w1 = 0;
21  m_w2 = 0;
22  m_w3 = 0;
23  m_w4 = 0;
24  m_w5 = 0;
25 }
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

◆ ~FEConfigOddWeightGroupDat()

FEConfigOddWeightGroupDat::~FEConfigOddWeightGroupDat ( )
override

Definition at line 27 of file FEConfigOddWeightGroupDat.cc.

27 {}

Member Function Documentation

◆ fetchData()

void FEConfigOddWeightGroupDat::fetchData ( std::map< EcalLogicID, FEConfigOddWeightGroupDat > *  fillMap,
FEConfigOddWeightInfo iconf 
)
privatenoexcept

Definition at line 76 of file FEConfigOddWeightGroupDat.cc.

References MillePedeFileConverter_cfg::e, Exception, AlCaHLTBitMon_ParallelJobs::p, setWeight0(), setWeight1(), setWeight2(), setWeight3(), setWeight4(), setWeight5(), and setWeightGroupId().

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("FEConfigOddWeightGroupDat::fetchData: ICONF not in DB"));
85  return;
86  }
87 
88  try {
89  m_readStmt->setSQL(
90  "SELECT d.group_id, d.w0, d.w1, d.w2, d.w3, d.w4, d.w5 "
91  "FROM fe_weight2_per_group_dat d "
92  "WHERE wei2_conf_id = :wei2_conf_id order by d.group_id ");
93  m_readStmt->setInt(1, iconfID);
94  ResultSet* rset = m_readStmt->executeQuery();
95 
96  std::pair<EcalLogicID, FEConfigOddWeightGroupDat> p;
98  int ig = -1;
99  while (rset->next()) {
100  ig++; // we create a dummy logic_id
101  p.first = EcalLogicID("Group_id", // name
102  ig); // logic_id
103 
104  dat.setWeightGroupId(rset->getInt(1));
105  dat.setWeight0(rset->getFloat(2));
106  dat.setWeight1(rset->getFloat(3));
107  dat.setWeight2(rset->getFloat(4));
108  dat.setWeight3(rset->getFloat(5));
109  dat.setWeight4(rset->getFloat(6));
110  dat.setWeight5(rset->getFloat(7));
111 
112  p.second = dat;
113  fillMap->insert(p);
114  }
115  } catch (SQLException& e) {
116  throw cms::Exception("SQLException") << "FEConfigOddWeightGroupDat::fetchData: " << e.getMessage();
117  }
118 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
int fetchID() noexcept(false)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23

◆ getTable()

std::string FEConfigOddWeightGroupDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigOddWeightGroupDat.h.

18 { return "FE_WEIGHT2_PER_GROUP_DAT"; }

◆ getWeight0()

float FEConfigOddWeightGroupDat::getWeight0 ( ) const
inline

◆ getWeight1()

float FEConfigOddWeightGroupDat::getWeight1 ( ) const
inline

◆ getWeight2()

float FEConfigOddWeightGroupDat::getWeight2 ( ) const
inline

◆ getWeight3()

float FEConfigOddWeightGroupDat::getWeight3 ( ) const
inline

◆ getWeight4()

float FEConfigOddWeightGroupDat::getWeight4 ( ) const
inline

◆ getWeight5()

float FEConfigOddWeightGroupDat::getWeight5 ( ) const
inline

Definition at line 34 of file FEConfigOddWeightGroupDat.h.

References m_w5.

Referenced by writeArrayDB().

◆ getWeightGroupId()

int FEConfigOddWeightGroupDat::getWeightGroupId ( ) const
inline

◆ prepareWrite()

void FEConfigOddWeightGroupDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 29 of file FEConfigOddWeightGroupDat.cc.

References MillePedeFileConverter_cfg::e, and Exception.

29  {
30  this->checkConnection();
31 
32  try {
33  m_writeStmt = m_conn->createStatement();
34  m_writeStmt->setSQL(
35  "INSERT INTO fe_weight2_per_group_dat (wei2_conf_id, group_id, "
36  " w0, w1, w2, w3, w4, w5 ) "
37  "VALUES (:wei2_conf_id, :group_id, "
38  ":w0, :w1, :w2, :w3, :w4, :w5 )");
39  } catch (SQLException& e) {
40  throw cms::Exception("SQLException") << "FEConfigOddWeightGroupDat::prepareWrite(): " << e.getMessage();
41  }
42 }
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

◆ setWeight0()

void FEConfigOddWeightGroupDat::setWeight0 ( float  x)
inline

Definition at line 23 of file FEConfigOddWeightGroupDat.h.

References m_w0, and x.

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

◆ setWeight1()

void FEConfigOddWeightGroupDat::setWeight1 ( float  x)
inline

Definition at line 25 of file FEConfigOddWeightGroupDat.h.

References m_w1, and x.

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

◆ setWeight2()

void FEConfigOddWeightGroupDat::setWeight2 ( float  x)
inline

Definition at line 27 of file FEConfigOddWeightGroupDat.h.

References m_w2, and x.

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

◆ setWeight3()

void FEConfigOddWeightGroupDat::setWeight3 ( float  x)
inline

Definition at line 29 of file FEConfigOddWeightGroupDat.h.

References m_w3, and x.

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

◆ setWeight4()

void FEConfigOddWeightGroupDat::setWeight4 ( float  x)
inline

Definition at line 31 of file FEConfigOddWeightGroupDat.h.

References m_w4, and x.

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

◆ setWeight5()

void FEConfigOddWeightGroupDat::setWeight5 ( float  x)
inline

Definition at line 33 of file FEConfigOddWeightGroupDat.h.

References m_w5, and x.

Referenced by fetchData().

◆ setWeightGroupId()

void FEConfigOddWeightGroupDat::setWeightGroupId ( int  x)
inline

Definition at line 20 of file FEConfigOddWeightGroupDat.h.

References m_group_id, and x.

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

◆ writeArrayDB()

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

Definition at line 120 of file FEConfigOddWeightGroupDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, Exception, getWeight0(), getWeight1(), getWeight2(), getWeight3(), getWeight4(), getWeight5(), getWeightGroupId(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, findQualityFiles::rr, alignCSCRings::s, contentValuesCheck::ss, submitPVValidationJobs::t, groupFilesInBlocks::tt, w(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::ww, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

121  {
122  this->checkConnection();
123  this->checkPrepare();
124 
125  int iconfID = iconf->fetchID();
126  if (!iconfID) {
127  throw(std::runtime_error("FEConfigOddWeightGroupDat::writeArrayDB: ICONF not in DB"));
128  }
129 
130  int nrows = data->size();
131  int* ids = new int[nrows];
132  int* iconfid_vec = new int[nrows];
133  int* xx = new int[nrows];
134  float* yy = new float[nrows];
135  float* zz = new float[nrows];
136  float* rr = new float[nrows];
137  float* ss = new float[nrows];
138  float* tt = new float[nrows];
139  float* ww = new float[nrows];
140 
141  ub2* ids_len = new ub2[nrows];
142  ub2* iconf_len = new ub2[nrows];
143  ub2* x_len = new ub2[nrows];
144  ub2* y_len = new ub2[nrows];
145  ub2* z_len = new ub2[nrows];
146  ub2* r_len = new ub2[nrows];
147  ub2* s_len = new ub2[nrows];
148  ub2* t_len = new ub2[nrows];
149  ub2* w_len = new ub2[nrows];
150 
151  // const EcalLogicID* channel;
152  const FEConfigOddWeightGroupDat* dataitem;
153  int count = 0;
154  typedef map<EcalLogicID, FEConfigOddWeightGroupDat>::const_iterator CI;
155  for (CI p = data->begin(); p != data->end(); ++p) {
156  // channel = &(p->first);
157  // int logicID = channel->getLogicID();
158  // if (!logicID) { throw(std::runtime_error("FEConfigOddWeightGroupDat::writeArrayDB: Bad EcalLogicID")); }
159  // ids[count]=logicID;
160  iconfid_vec[count] = iconfID;
161 
162  dataitem = &(p->second);
163  // dataIface.writeDB( channel, dataitem, iconf);
164  int x = dataitem->getWeightGroupId();
165  float y = dataitem->getWeight0();
166  float z = dataitem->getWeight1();
167  float r = dataitem->getWeight2();
168  float s = dataitem->getWeight3();
169  float t = dataitem->getWeight4();
170  float w = dataitem->getWeight5();
171 
172  xx[count] = x;
173  yy[count] = y;
174  zz[count] = z;
175  rr[count] = r;
176  ss[count] = s;
177  tt[count] = t;
178  ww[count] = w;
179 
180  // ids_len[count]=sizeof(ids[count]);
181  iconf_len[count] = sizeof(iconfid_vec[count]);
182 
183  x_len[count] = sizeof(xx[count]);
184  y_len[count] = sizeof(yy[count]);
185  z_len[count] = sizeof(zz[count]);
186  r_len[count] = sizeof(rr[count]);
187  s_len[count] = sizeof(ss[count]);
188  t_len[count] = sizeof(tt[count]);
189  w_len[count] = sizeof(ww[count]);
190 
191  count++;
192  }
193 
194  try {
195  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]), iconf_len);
196  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
197  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIFLOAT, sizeof(yy[0]), y_len);
198  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIFLOAT, sizeof(zz[0]), z_len);
199  m_writeStmt->setDataBuffer(5, (dvoid*)rr, OCCIFLOAT, sizeof(rr[0]), r_len);
200  m_writeStmt->setDataBuffer(6, (dvoid*)ss, OCCIFLOAT, sizeof(ss[0]), s_len);
201  m_writeStmt->setDataBuffer(7, (dvoid*)tt, OCCIFLOAT, sizeof(tt[0]), t_len);
202  m_writeStmt->setDataBuffer(8, (dvoid*)ww, OCCIFLOAT, sizeof(ww[0]), w_len);
203 
204  m_writeStmt->executeArrayUpdate(nrows);
205 
206  delete[] ids;
207  delete[] iconfid_vec;
208  delete[] xx;
209  delete[] yy;
210  delete[] zz;
211  delete[] rr;
212  delete[] ss;
213  delete[] tt;
214  delete[] ww;
215 
216  delete[] ids_len;
217  delete[] iconf_len;
218  delete[] x_len;
219  delete[] y_len;
220  delete[] z_len;
221  delete[] r_len;
222  delete[] s_len;
223  delete[] t_len;
224  delete[] w_len;
225 
226  } catch (SQLException& e) {
227  throw cms::Exception("SQLException") << "FEConfigOddWeightGroupDat::writeArrayDB(): " << e.getMessage();
228  }
229 }
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
Definition: TTTypes.h:54
int fetchID() noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80

◆ writeDB()

void FEConfigOddWeightGroupDat::writeDB ( const EcalLogicID ecid,
const FEConfigOddWeightGroupDat item,
FEConfigOddWeightInfo iconf 
)
privatenoexcept

Definition at line 44 of file FEConfigOddWeightGroupDat.cc.

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

46  {
47  this->checkConnection();
48  this->checkPrepare();
49 
50  int iconfID = iconf->fetchID();
51  if (!iconfID) {
52  throw(std::runtime_error("FEConfigOddWeightGroupDat::writeDB: ICONF not in DB"));
53  }
54  /* no need for the logic id in this table
55  int logicID = ecid->getLogicID();
56  if (!logicID) { throw(std::runtime_error("FEConfigOddWeightGroupDat::writeDB: Bad EcalLogicID")); }
57  */
58 
59  try {
60  m_writeStmt->setInt(1, iconfID);
61 
62  m_writeStmt->setInt(2, item->getWeightGroupId());
63  m_writeStmt->setFloat(3, item->getWeight0());
64  m_writeStmt->setFloat(4, item->getWeight1());
65  m_writeStmt->setFloat(5, item->getWeight2());
66  m_writeStmt->setFloat(6, item->getWeight3());
67  m_writeStmt->setFloat(7, item->getWeight4());
68  m_writeStmt->setFloat(8, item->getWeight5());
69 
70  m_writeStmt->executeUpdate();
71  } catch (SQLException& e) {
72  throw cms::Exception("SQLException") << "FEConfigOddWeightGroupDat::writeDB(): " << e.getMessage();
73  }
74 }
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 fetchID() noexcept(false)

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigOddWeightGroupDat.h.

Member Data Documentation

◆ m_group_id

int FEConfigOddWeightGroupDat::m_group_id
private

Definition at line 50 of file FEConfigOddWeightGroupDat.h.

Referenced by getWeightGroupId(), and setWeightGroupId().

◆ m_w0

float FEConfigOddWeightGroupDat::m_w0
private

Definition at line 51 of file FEConfigOddWeightGroupDat.h.

Referenced by getWeight0(), and setWeight0().

◆ m_w1

float FEConfigOddWeightGroupDat::m_w1
private

Definition at line 52 of file FEConfigOddWeightGroupDat.h.

Referenced by getWeight1(), and setWeight1().

◆ m_w2

float FEConfigOddWeightGroupDat::m_w2
private

Definition at line 53 of file FEConfigOddWeightGroupDat.h.

Referenced by getWeight2(), and setWeight2().

◆ m_w3

float FEConfigOddWeightGroupDat::m_w3
private

Definition at line 54 of file FEConfigOddWeightGroupDat.h.

Referenced by getWeight3(), and setWeight3().

◆ m_w4

float FEConfigOddWeightGroupDat::m_w4
private

Definition at line 55 of file FEConfigOddWeightGroupDat.h.

Referenced by getWeight4(), and setWeight4().

◆ m_w5

float FEConfigOddWeightGroupDat::m_w5
private

Definition at line 56 of file FEConfigOddWeightGroupDat.h.

Referenced by getWeight5(), and setWeight5().