CMS 3D CMS Logo

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

#include <FEConfigWeightGroupDat.h>

Inheritance diagram for FEConfigWeightGroupDat:
IDataItem IDBObject

Public Member Functions

 FEConfigWeightGroupDat ()
 
std::string getTable () override
 
float getWeight0 () const
 
float getWeight1 () const
 
float getWeight2 () const
 
float getWeight3 () const
 
float getWeight4 () 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 setWeightGroupId (int x)
 
 ~FEConfigWeightGroupDat () 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, FEConfigWeightGroupDat > *fillMap, FEConfigWeightInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigWeightGroupDat > *data, FEConfigWeightInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigWeightGroupDat *item, FEConfigWeightInfo *iconf) noexcept(false)
 

Private Attributes

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

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static const int 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 FEConfigWeightGroupDat.h.

Constructor & Destructor Documentation

◆ FEConfigWeightGroupDat()

FEConfigWeightGroupDat::FEConfigWeightGroupDat ( )

Definition at line 11 of file FEConfigWeightGroupDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_group_id = 0;
18  m_w0 = 0;
19  m_w1 = 0;
20  m_w2 = 0;
21  m_w3 = 0;
22  m_w4 = 0;
23 }

◆ ~FEConfigWeightGroupDat()

FEConfigWeightGroupDat::~FEConfigWeightGroupDat ( )
override

Definition at line 25 of file FEConfigWeightGroupDat.cc.

25 {}

Member Function Documentation

◆ fetchData()

void FEConfigWeightGroupDat::fetchData ( std::map< EcalLogicID, FEConfigWeightGroupDat > *  fillMap,
FEConfigWeightInfo iconf 
)
privatenoexcept

Definition at line 73 of file FEConfigWeightGroupDat.cc.

74  {
75  this->checkConnection();
76  fillMap->clear();
77 
78  iconf->setConnection(m_env, m_conn);
79  int iconfID = iconf->fetchID();
80  if (!iconfID) {
81  throw(std::runtime_error("FEConfigWeightGroupDat::fetchData: ICONF not in DB"));
82  return;
83  }
84 
85  try {
86  m_readStmt->setSQL(
87  "SELECT d.group_id, d.w0, d.w1, d.w2, d.w3, d.w4 "
88  "FROM fe_weight_per_group_dat d "
89  "WHERE wei_conf_id = :wei_conf_id order by d.group_id ");
90  m_readStmt->setInt(1, iconfID);
91  ResultSet* rset = m_readStmt->executeQuery();
92 
93  std::pair<EcalLogicID, FEConfigWeightGroupDat> p;
95  int ig = -1;
96  while (rset->next()) {
97  ig++; // we create a dummy logic_id
98  p.first = EcalLogicID("Group_id", // name
99  ig); // logic_id
100 
101  dat.setWeightGroupId(rset->getInt(1));
102  dat.setWeight0(rset->getFloat(2));
103  dat.setWeight1(rset->getFloat(3));
104  dat.setWeight2(rset->getFloat(4));
105  dat.setWeight3(rset->getFloat(5));
106  dat.setWeight4(rset->getFloat(6));
107 
108  p.second = dat;
109  fillMap->insert(p);
110  }
111  } catch (SQLException& e) {
112  throw(std::runtime_error("FEConfigWeightGroupDat::fetchData: " + e.getMessage()));
113  }
114 }

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

◆ getTable()

std::string FEConfigWeightGroupDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigWeightGroupDat.h.

18 { return "FE_CONFIG_WEIGHT_PER_GROUP_DAT"; }

◆ getWeight0()

float FEConfigWeightGroupDat::getWeight0 ( ) const
inline

Definition at line 24 of file FEConfigWeightGroupDat.h.

24 { return m_w0; }

References m_w0.

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

◆ getWeight1()

float FEConfigWeightGroupDat::getWeight1 ( ) const
inline

Definition at line 26 of file FEConfigWeightGroupDat.h.

26 { return m_w1; }

References m_w1.

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

◆ getWeight2()

float FEConfigWeightGroupDat::getWeight2 ( ) const
inline

Definition at line 28 of file FEConfigWeightGroupDat.h.

28 { return m_w2; }

References m_w2.

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

◆ getWeight3()

float FEConfigWeightGroupDat::getWeight3 ( ) const
inline

Definition at line 30 of file FEConfigWeightGroupDat.h.

30 { return m_w3; }

References m_w3.

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

◆ getWeight4()

float FEConfigWeightGroupDat::getWeight4 ( ) const
inline

Definition at line 32 of file FEConfigWeightGroupDat.h.

32 { return m_w4; }

References m_w4.

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

◆ getWeightGroupId()

int FEConfigWeightGroupDat::getWeightGroupId ( ) const
inline

Definition at line 21 of file FEConfigWeightGroupDat.h.

21 { return m_group_id; }

References m_group_id.

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

◆ prepareWrite()

void FEConfigWeightGroupDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 27 of file FEConfigWeightGroupDat.cc.

27  {
28  this->checkConnection();
29 
30  try {
31  m_writeStmt = m_conn->createStatement();
32  m_writeStmt->setSQL(
33  "INSERT INTO fe_weight_per_group_dat (wei_conf_id, group_id, "
34  " w0, w1, w2, w3, w4 ) "
35  "VALUES (:wei_conf_id, :group_id, "
36  ":w0, :w1, :w2, :w3, :w4 )");
37  } catch (SQLException& e) {
38  throw(std::runtime_error("FEConfigWeightGroupDat::prepareWrite(): " + e.getMessage()));
39  }
40 }

References MillePedeFileConverter_cfg::e.

◆ setWeight0()

void FEConfigWeightGroupDat::setWeight0 ( float  x)
inline

Definition at line 23 of file FEConfigWeightGroupDat.h.

23 { m_w0 = x; }

References m_w0, and x.

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

◆ setWeight1()

void FEConfigWeightGroupDat::setWeight1 ( float  x)
inline

Definition at line 25 of file FEConfigWeightGroupDat.h.

25 { m_w1 = x; }

References m_w1, and x.

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

◆ setWeight2()

void FEConfigWeightGroupDat::setWeight2 ( float  x)
inline

Definition at line 27 of file FEConfigWeightGroupDat.h.

27 { m_w2 = x; }

References m_w2, and x.

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

◆ setWeight3()

void FEConfigWeightGroupDat::setWeight3 ( float  x)
inline

Definition at line 29 of file FEConfigWeightGroupDat.h.

29 { m_w3 = x; }

References m_w3, and x.

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

◆ setWeight4()

void FEConfigWeightGroupDat::setWeight4 ( float  x)
inline

Definition at line 31 of file FEConfigWeightGroupDat.h.

31 { m_w4 = x; }

References m_w4, and x.

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

◆ setWeightGroupId()

void FEConfigWeightGroupDat::setWeightGroupId ( int  x)
inline

Definition at line 20 of file FEConfigWeightGroupDat.h.

20 { m_group_id = x; }

References m_group_id, and x.

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

◆ writeArrayDB()

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

Definition at line 116 of file FEConfigWeightGroupDat.cc.

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

References KineDebug3::count(), std::data(), MillePedeFileConverter_cfg::e, getWeight0(), getWeight1(), getWeight2(), getWeight3(), getWeight4(), getWeightGroupId(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, findQualityFiles::rr, alignCSCRings::s, contentValuesCheck::ss, OrderedSet::t, groupFilesInBlocks::tt, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

◆ writeDB()

void FEConfigWeightGroupDat::writeDB ( const EcalLogicID ecid,
const FEConfigWeightGroupDat item,
FEConfigWeightInfo iconf 
)
privatenoexcept

Definition at line 42 of file FEConfigWeightGroupDat.cc.

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

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigWeightGroupDat.h.

Member Data Documentation

◆ m_group_id

int FEConfigWeightGroupDat::m_group_id
private

Definition at line 45 of file FEConfigWeightGroupDat.h.

Referenced by getWeightGroupId(), and setWeightGroupId().

◆ m_w0

float FEConfigWeightGroupDat::m_w0
private

Definition at line 46 of file FEConfigWeightGroupDat.h.

Referenced by getWeight0(), and setWeight0().

◆ m_w1

float FEConfigWeightGroupDat::m_w1
private

Definition at line 47 of file FEConfigWeightGroupDat.h.

Referenced by getWeight1(), and setWeight1().

◆ m_w2

float FEConfigWeightGroupDat::m_w2
private

Definition at line 48 of file FEConfigWeightGroupDat.h.

Referenced by getWeight2(), and setWeight2().

◆ m_w3

float FEConfigWeightGroupDat::m_w3
private

Definition at line 49 of file FEConfigWeightGroupDat.h.

Referenced by getWeight3(), and setWeight3().

◆ m_w4

float FEConfigWeightGroupDat::m_w4
private

Definition at line 50 of file FEConfigWeightGroupDat.h.

Referenced by getWeight4(), and setWeight4().

FEConfigWeightGroupDat::m_w1
float m_w1
Definition: FEConfigWeightGroupDat.h:47
DDAxes::y
FEConfigWeightGroupDat::getWeight1
float getWeight1() const
Definition: FEConfigWeightGroupDat.h:26
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
FEConfigWeightGroupDat::setWeight4
void setWeight4(float x)
Definition: FEConfigWeightGroupDat.h:31
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
findQualityFiles.rr
string rr
Definition: findQualityFiles.py:185
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
FEConfigWeightGroupDat::m_group_id
int m_group_id
Definition: FEConfigWeightGroupDat.h:45
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
FEConfigWeightGroupDat::getWeight2
float getWeight2() const
Definition: FEConfigWeightGroupDat.h:28
FEConfigWeightGroupDat::getWeight4
float getWeight4() const
Definition: FEConfigWeightGroupDat.h:32
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
FEConfigWeightGroupDat::m_w0
float m_w0
Definition: FEConfigWeightGroupDat.h:46
DDAxes::z
EcalLogicID
Definition: EcalLogicID.h:7
OrderedSet.t
t
Definition: OrderedSet.py:90
FEConfigWeightGroupDat::getWeight3
float getWeight3() const
Definition: FEConfigWeightGroupDat.h:30
FEConfigWeightGroupDat::m_w2
float m_w2
Definition: FEConfigWeightGroupDat.h:48
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
FEConfigWeightGroupDat
Definition: FEConfigWeightGroupDat.h:11
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
FEConfigWeightGroupDat::setWeightGroupId
void setWeightGroupId(int x)
Definition: FEConfigWeightGroupDat.h:20
FEConfigWeightGroupDat::getWeightGroupId
int getWeightGroupId() const
Definition: FEConfigWeightGroupDat.h:21
FEConfigWeightGroupDat::setWeight2
void setWeight2(float x)
Definition: FEConfigWeightGroupDat.h:27
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
alignCSCRings.r
r
Definition: alignCSCRings.py:93
FEConfigWeightGroupDat::setWeight0
void setWeight0(float x)
Definition: FEConfigWeightGroupDat.h:23
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
FEConfigWeightInfo::fetchID
int fetchID() noexcept(false)
Definition: FEConfigWeightInfo.cc:161
FEConfigWeightGroupDat::setWeight1
void setWeight1(float x)
Definition: FEConfigWeightGroupDat.h:25
FEConfigWeightGroupDat::m_w4
float m_w4
Definition: FEConfigWeightGroupDat.h:50
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
FEConfigWeightGroupDat::m_w3
float m_w3
Definition: FEConfigWeightGroupDat.h:49
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
FEConfigWeightGroupDat::setWeight3
void setWeight3(float x)
Definition: FEConfigWeightGroupDat.h:29
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FEConfigWeightGroupDat::getWeight0
float getWeight0() const
Definition: FEConfigWeightGroupDat.h:24