CMS 3D CMS Logo

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

#include <FEConfigLinDat.h>

Inheritance diagram for FEConfigLinDat:
IDataItem IDBObject

Public Member Functions

 FEConfigLinDat ()
 
int getMultX1 () const
 
int getMultX12 () const
 
int getMultX6 () const
 
int getShift1 () const
 
int getShift12 () const
 
int getShift6 () const
 
std::string getTable () override
 
void setMultX1 (int x)
 
void setMultX12 (int x)
 
void setMultX6 (int x)
 
void setShift1 (int x)
 
void setShift12 (int x)
 
void setShift6 (int x)
 
 ~FEConfigLinDat () 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, FEConfigLinDat > *fillMap, FEConfigLinInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigLinDat > *data, FEConfigLinInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigLinDat *item, FEConfigLinInfo *iconf) noexcept(false)
 

Private Attributes

int m_multx1
 
int m_multx12
 
int m_multx6
 
int m_shift1
 
int m_shift12
 
int m_shift6
 

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

Constructor & Destructor Documentation

◆ FEConfigLinDat()

FEConfigLinDat::FEConfigLinDat ( )

Definition at line 11 of file FEConfigLinDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_multx12 = 0;
18  m_multx6 = 0;
19  m_multx1 = 0;
20  m_shift12 = 0;
21  m_shift6 = 0;
22  m_shift1 = 0;
23 }
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

◆ ~FEConfigLinDat()

FEConfigLinDat::~FEConfigLinDat ( )
override

Definition at line 25 of file FEConfigLinDat.cc.

25 {}

Member Function Documentation

◆ fetchData()

void FEConfigLinDat::fetchData ( std::map< EcalLogicID, FEConfigLinDat > *  fillMap,
FEConfigLinInfo iconf 
)
privatenoexcept

Definition at line 74 of file FEConfigLinDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setMultX1(), setMultX12(), setMultX6(), setShift1(), setShift12(), and setShift6().

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("FEConfigLinDat::writeDB: ICONF not in DB"));
82  return;
83  }
84 
85  try {
86  m_readStmt->setSQL(
87  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
88  "d.multx12, d.multx6, d.multx1, d.shift12, d.shift6, d.shift1 "
89  "FROM channelview cv JOIN fe_config_lin_dat d "
90  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
91  "WHERE lin_conf_id = :lin_conf_id");
92  m_readStmt->setInt(1, iconfID);
93  ResultSet* rset = m_readStmt->executeQuery();
94 
95  std::pair<EcalLogicID, FEConfigLinDat> p;
96  FEConfigLinDat dat;
97  while (rset->next()) {
98  p.first = EcalLogicID(rset->getString(1), // name
99  rset->getInt(2), // logic_id
100  rset->getInt(3), // id1
101  rset->getInt(4), // id2
102  rset->getInt(5), // id3
103  rset->getString(6)); // maps_to
104 
105  dat.setMultX12(rset->getInt(7));
106  dat.setMultX6(rset->getInt(8));
107  dat.setMultX1(rset->getInt(9));
108  dat.setShift12(rset->getInt(10));
109  dat.setShift6(rset->getInt(11));
110  dat.setShift1(rset->getInt(12));
111 
112  p.second = dat;
113  fillMap->insert(p);
114  }
115  } catch (SQLException& e) {
116  throw(std::runtime_error("FEConfigLinDat::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
void setShift12(int x)
void setMultX1(int x)
void setShift6(int x)
void setShift1(int x)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
void setMultX6(int x)
int fetchID() noexcept(false)
void setMultX12(int x)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23

◆ getMultX1()

int FEConfigLinDat::getMultX1 ( ) const
inline

Definition at line 29 of file FEConfigLinDat.h.

References m_multx1.

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

29 { return m_multx1; }

◆ getMultX12()

int FEConfigLinDat::getMultX12 ( ) const
inline

Definition at line 27 of file FEConfigLinDat.h.

References m_multx12.

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

27 { return m_multx12; }

◆ getMultX6()

int FEConfigLinDat::getMultX6 ( ) const
inline

Definition at line 28 of file FEConfigLinDat.h.

References m_multx6.

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

28 { return m_multx6; }

◆ getShift1()

int FEConfigLinDat::getShift1 ( ) const
inline

Definition at line 32 of file FEConfigLinDat.h.

References m_shift1.

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

32 { return m_shift1; }

◆ getShift12()

int FEConfigLinDat::getShift12 ( ) const
inline

Definition at line 30 of file FEConfigLinDat.h.

References m_shift12.

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

30 { return m_shift12; }

◆ getShift6()

int FEConfigLinDat::getShift6 ( ) const
inline

Definition at line 31 of file FEConfigLinDat.h.

References m_shift6.

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

31 { return m_shift6; }

◆ getTable()

std::string FEConfigLinDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigLinDat.h.

18 { return "FE_CONFIG_LIN_DAT"; }

◆ prepareWrite()

void FEConfigLinDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 27 of file FEConfigLinDat.cc.

References MillePedeFileConverter_cfg::e.

27  {
28  this->checkConnection();
29 
30  try {
31  m_writeStmt = m_conn->createStatement();
32  m_writeStmt->setSQL(
33  "INSERT INTO fe_config_lin_dat (lin_conf_id, logic_id, "
34  " multx12, multx6, multx1, shift12, shift6, shift1 ) "
35  "VALUES (:lin_conf_id, :logic_id, "
36  ":multx12, :multx6, :multx1, :shift12, :shift6, :shift1 )");
37  } catch (SQLException& e) {
38  throw(std::runtime_error("FEConfigLinDat::prepareWrite(): " + e.getMessage()));
39  }
40 }
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

◆ setMultX1()

void FEConfigLinDat::setMultX1 ( int  x)
inline

Definition at line 22 of file FEConfigLinDat.h.

References m_multx1, and x.

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

◆ setMultX12()

void FEConfigLinDat::setMultX12 ( int  x)
inline

Definition at line 20 of file FEConfigLinDat.h.

References m_multx12, and x.

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

◆ setMultX6()

void FEConfigLinDat::setMultX6 ( int  x)
inline

Definition at line 21 of file FEConfigLinDat.h.

References m_multx6, and x.

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

◆ setShift1()

void FEConfigLinDat::setShift1 ( int  x)
inline

Definition at line 25 of file FEConfigLinDat.h.

References m_shift1, and x.

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

◆ setShift12()

void FEConfigLinDat::setShift12 ( int  x)
inline

Definition at line 23 of file FEConfigLinDat.h.

References m_shift12, and x.

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

◆ setShift6()

void FEConfigLinDat::setShift6 ( int  x)
inline

Definition at line 24 of file FEConfigLinDat.h.

References m_shift6, and x.

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

◆ writeArrayDB()

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

Definition at line 120 of file FEConfigLinDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getMultX1(), getMultX12(), getMultX6(), getShift1(), getShift12(), getShift6(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, findQualityFiles::rr, alignCSCRings::s, contentValuesCheck::ss, w(), 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("FEConfigLinDat::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  int* yy = new int[nrows];
135  int* zz = new int[nrows];
136  int* ww = new int[nrows];
137  int* rr = new int[nrows];
138  int* ss = new int[nrows];
139 
140  ub2* ids_len = new ub2[nrows];
141  ub2* iconf_len = new ub2[nrows];
142  ub2* x_len = new ub2[nrows];
143  ub2* y_len = new ub2[nrows];
144  ub2* z_len = new ub2[nrows];
145  ub2* w_len = new ub2[nrows];
146  ub2* r_len = new ub2[nrows];
147  ub2* s_len = new ub2[nrows];
148 
149  const EcalLogicID* channel;
150  const FEConfigLinDat* dataitem;
151  int count = 0;
152  typedef map<EcalLogicID, FEConfigLinDat>::const_iterator CI;
153  for (CI p = data->begin(); p != data->end(); ++p) {
154  channel = &(p->first);
155  int logicID = channel->getLogicID();
156  if (!logicID) {
157  throw(std::runtime_error("FEConfigLinDat::writeArrayDB: Bad EcalLogicID"));
158  }
159  ids[count] = logicID;
160  iconfid_vec[count] = iconfID;
161 
162  dataitem = &(p->second);
163  // dataIface.writeDB( channel, dataitem, iconf);
164  int x = dataitem->getMultX12();
165  int y = dataitem->getMultX6();
166  int z = dataitem->getMultX1();
167  int w = dataitem->getShift12();
168  int r = dataitem->getShift6();
169  int s = dataitem->getShift1();
170 
171  xx[count] = x;
172  yy[count] = y;
173  zz[count] = z;
174  ww[count] = w;
175  rr[count] = r;
176  ss[count] = s;
177 
178  ids_len[count] = sizeof(ids[count]);
179  iconf_len[count] = sizeof(iconfid_vec[count]);
180 
181  x_len[count] = sizeof(xx[count]);
182  y_len[count] = sizeof(yy[count]);
183  z_len[count] = sizeof(zz[count]);
184  w_len[count] = sizeof(ww[count]);
185  r_len[count] = sizeof(rr[count]);
186  s_len[count] = sizeof(ss[count]);
187 
188  count++;
189  }
190 
191  try {
192  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]), iconf_len);
193  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
194  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
195  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
196  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT, sizeof(zz[0]), z_len);
197  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT, sizeof(ww[0]), w_len);
198  m_writeStmt->setDataBuffer(7, (dvoid*)rr, OCCIINT, sizeof(rr[0]), r_len);
199  m_writeStmt->setDataBuffer(8, (dvoid*)ss, OCCIINT, sizeof(ss[0]), s_len);
200 
201  m_writeStmt->executeArrayUpdate(nrows);
202 
203  delete[] ids;
204  delete[] iconfid_vec;
205  delete[] xx;
206  delete[] yy;
207  delete[] zz;
208  delete[] ww;
209  delete[] rr;
210  delete[] ss;
211 
212  delete[] ids_len;
213  delete[] iconf_len;
214  delete[] x_len;
215  delete[] y_len;
216  delete[] z_len;
217  delete[] w_len;
218  delete[] r_len;
219  delete[] s_len;
220 
221  } catch (SQLException& e) {
222  throw(std::runtime_error("FEConfigLinDat::writeArrayDB(): " + e.getMessage()));
223  }
224 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
int getMultX1() const
T w() const
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
int getShift12() const
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int getLogicID() const
Definition: EcalLogicID.cc:28
int getMultX12() const
int getShift1() const
int fetchID() noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
int getShift6() const
int getMultX6() const

◆ writeDB()

void FEConfigLinDat::writeDB ( const EcalLogicID ecid,
const FEConfigLinDat item,
FEConfigLinInfo iconf 
)
privatenoexcept

Definition at line 42 of file FEConfigLinDat.cc.

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

44  {
45  this->checkConnection();
46  this->checkPrepare();
47 
48  int iconfID = iconf->fetchID();
49  if (!iconfID) {
50  throw(std::runtime_error("FEConfigLinDat::writeDB: ICONF not in DB"));
51  }
52 
53  int logicID = ecid->getLogicID();
54  if (!logicID) {
55  throw(std::runtime_error("FEConfigLinDat::writeDB: Bad EcalLogicID"));
56  }
57 
58  try {
59  m_writeStmt->setInt(1, iconfID);
60  m_writeStmt->setInt(2, logicID);
61  m_writeStmt->setInt(3, item->getMultX12());
62  m_writeStmt->setInt(4, item->getMultX6());
63  m_writeStmt->setInt(5, item->getMultX1());
64  m_writeStmt->setInt(6, item->getShift12());
65  m_writeStmt->setInt(7, item->getShift6());
66  m_writeStmt->setInt(8, item->getShift1());
67 
68  m_writeStmt->executeUpdate();
69  } catch (SQLException& e) {
70  throw(std::runtime_error("FEConfigLinDat::writeDB(): " + e.getMessage()));
71  }
72 }
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
int fetchID() noexcept(false)

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigLinDat.h.

Member Data Documentation

◆ m_multx1

int FEConfigLinDat::m_multx1
private

Definition at line 46 of file FEConfigLinDat.h.

Referenced by getMultX1(), and setMultX1().

◆ m_multx12

int FEConfigLinDat::m_multx12
private

Definition at line 44 of file FEConfigLinDat.h.

Referenced by getMultX12(), and setMultX12().

◆ m_multx6

int FEConfigLinDat::m_multx6
private

Definition at line 45 of file FEConfigLinDat.h.

Referenced by getMultX6(), and setMultX6().

◆ m_shift1

int FEConfigLinDat::m_shift1
private

Definition at line 49 of file FEConfigLinDat.h.

Referenced by getShift1(), and setShift1().

◆ m_shift12

int FEConfigLinDat::m_shift12
private

Definition at line 47 of file FEConfigLinDat.h.

Referenced by getShift12(), and setShift12().

◆ m_shift6

int FEConfigLinDat::m_shift6
private

Definition at line 48 of file FEConfigLinDat.h.

Referenced by getShift6(), and setShift6().