CMS 3D CMS Logo

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

#include <FEConfigFgrEEStripDat.h>

Inheritance diagram for FEConfigFgrEEStripDat:
IDataItem IDBObject

Public Member Functions

 FEConfigFgrEEStripDat ()
 
unsigned int getLutFg () const
 
unsigned int getLUTFgr () const
 
unsigned int getLutFgr () const
 
std::string getTable () override
 
unsigned int getThreshold () const
 
void setLutFg (unsigned int mean)
 
void setLUTFgr (unsigned int mean)
 
void setLutFgr (unsigned int mean)
 
void setThreshold (unsigned int mean)
 
 ~FEConfigFgrEEStripDat () 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, FEConfigFgrEEStripDat > *fillMap, FEConfigFgrInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigFgrEEStripDat > *data, FEConfigFgrInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigFgrEEStripDat *item, FEConfigFgrInfo *iconf) noexcept(false)
 

Private Attributes

unsigned int m_lut_fg
 
unsigned int m_thresh
 

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

Constructor & Destructor Documentation

◆ FEConfigFgrEEStripDat()

FEConfigFgrEEStripDat::FEConfigFgrEEStripDat ( )

Definition at line 11 of file FEConfigFgrEEStripDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_thresh = 0;
18  m_lut_fg = 0;
19 }
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

◆ ~FEConfigFgrEEStripDat()

FEConfigFgrEEStripDat::~FEConfigFgrEEStripDat ( )
override

Definition at line 21 of file FEConfigFgrEEStripDat.cc.

21 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 66 of file FEConfigFgrEEStripDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setLutFg(), and setThreshold().

67  {
68  this->checkConnection();
69  fillMap->clear();
70 
71  iconf->setConnection(m_env, m_conn);
72  int iconfID = iconf->fetchID();
73  if (!iconfID) {
74  // throw(std::runtime_error("FEConfigFgrEEStripDat::writeDB: ICONF not in DB"));
75  return;
76  }
77 
78  try {
79  m_readStmt->setSQL(
80  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
81  "d.threshold, d.lut_fg "
82  "FROM channelview cv JOIN " +
83  getTable() +
84  " d "
85  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
86  "WHERE fgr_conf_id = :fgr_conf_id");
87  m_readStmt->setInt(1, iconfID);
88  ResultSet* rset = m_readStmt->executeQuery();
89 
90  std::pair<EcalLogicID, FEConfigFgrEEStripDat> p;
92  while (rset->next()) {
93  p.first = EcalLogicID(rset->getString(1), // name
94  rset->getInt(2), // logic_id
95  rset->getInt(3), // id1
96  rset->getInt(4), // id2
97  rset->getInt(5), // id3
98  rset->getString(6)); // maps_to
99 
100  dat.setThreshold(rset->getUInt(7));
101  dat.setLutFg(rset->getUInt(8));
102 
103  p.second = dat;
104  fillMap->insert(p);
105  }
106  } catch (SQLException& e) {
107  throw(std::runtime_error("FEConfigFgrEEStripDat::fetchData: " + e.getMessage()));
108  }
109 }
int fetchID() noexcept(false)
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 setThreshold(unsigned int mean)
void setLutFg(unsigned int mean)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
std::string getTable() override

◆ getLutFg()

unsigned int FEConfigFgrEEStripDat::getLutFg ( ) const
inline

Definition at line 23 of file FEConfigFgrEEStripDat.h.

References m_lut_fg.

Referenced by writeArrayDB().

23 { return m_lut_fg; }

◆ getLUTFgr()

unsigned int FEConfigFgrEEStripDat::getLUTFgr ( ) const
inline

Definition at line 25 of file FEConfigFgrEEStripDat.h.

References m_lut_fg.

Referenced by popcon::EcalTPGFineGrainStripEEHandler::getNewObjects().

25 { return m_lut_fg; }

◆ getLutFgr()

unsigned int FEConfigFgrEEStripDat::getLutFgr ( ) const
inline

Definition at line 27 of file FEConfigFgrEEStripDat.h.

References m_lut_fg.

27 { return m_lut_fg; }

◆ getTable()

std::string FEConfigFgrEEStripDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigFgrEEStripDat.h.

18 { return "FE_CONFIG_FGREEST_DAT"; }

◆ getThreshold()

unsigned int FEConfigFgrEEStripDat::getThreshold ( ) const
inline

Definition at line 21 of file FEConfigFgrEEStripDat.h.

References m_thresh.

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

21 { return m_thresh; }

◆ prepareWrite()

void FEConfigFgrEEStripDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 23 of file FEConfigFgrEEStripDat.cc.

References MillePedeFileConverter_cfg::e.

23  {
24  this->checkConnection();
25 
26  try {
27  m_writeStmt = m_conn->createStatement();
28  m_writeStmt->setSQL("INSERT INTO " + getTable() +
29  " (fgr_conf_id, logic_id, "
30  "threshold, lut_fg ) "
31  "VALUES (:fgr_conf_id, :logic_id, "
32  ":threshold, :lut_fg )");
33  } catch (SQLException& e) {
34  throw(std::runtime_error("FEConfigFgrEEStripDat::prepareWrite(): " + e.getMessage()));
35  }
36 }
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

◆ setLutFg()

void FEConfigFgrEEStripDat::setLutFg ( unsigned int  mean)
inline

Definition at line 22 of file FEConfigFgrEEStripDat.h.

References m_lut_fg, and SiStripPI::mean.

Referenced by fetchData().

◆ setLUTFgr()

void FEConfigFgrEEStripDat::setLUTFgr ( unsigned int  mean)
inline

◆ setLutFgr()

void FEConfigFgrEEStripDat::setLutFgr ( unsigned int  mean)
inline

◆ setThreshold()

void FEConfigFgrEEStripDat::setThreshold ( unsigned int  mean)
inline

◆ writeArrayDB()

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

Definition at line 111 of file FEConfigFgrEEStripDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getLutFg(), getThreshold(), AlCaHLTBitMon_ParallelJobs::p, x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

112  {
113  this->checkConnection();
114  this->checkPrepare();
115 
116  int iconfID = iconf->fetchID();
117  if (!iconfID) {
118  throw(std::runtime_error("FEConfigFgrEEStripDat::writeArrayDB: ICONF not in DB"));
119  }
120 
121  int nrows = data->size();
122  int* ids = new int[nrows];
123  int* iconfid_vec = new int[nrows];
124  unsigned int* xx = new unsigned int[nrows];
125  unsigned int* yy = new unsigned int[nrows];
126 
127  ub2* ids_len = new ub2[nrows];
128  ub2* iconf_len = new ub2[nrows];
129  ub2* x_len = new ub2[nrows];
130  ub2* y_len = new ub2[nrows];
131 
132  const EcalLogicID* channel;
133  const FEConfigFgrEEStripDat* dataitem;
134  int count = 0;
135  typedef map<EcalLogicID, FEConfigFgrEEStripDat>::const_iterator CI;
136  for (CI p = data->begin(); p != data->end(); ++p) {
137  channel = &(p->first);
138  int logicID = channel->getLogicID();
139  if (!logicID) {
140  throw(std::runtime_error("FEConfigFgrEEStripDat::writeArrayDB: Bad EcalLogicID"));
141  }
142  ids[count] = logicID;
143  iconfid_vec[count] = iconfID;
144 
145  dataitem = &(p->second);
146  // dataIface.writeDB( channel, dataitem, iconf);
147  unsigned int x = dataitem->getThreshold();
148  unsigned int y = dataitem->getLutFg();
149 
150  xx[count] = x;
151  yy[count] = y;
152 
153  ids_len[count] = sizeof(ids[count]);
154  iconf_len[count] = sizeof(iconfid_vec[count]);
155 
156  x_len[count] = sizeof(xx[count]);
157  y_len[count] = sizeof(yy[count]);
158 
159  count++;
160  }
161 
162  try {
163  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]), iconf_len);
164  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
165  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIUNSIGNED_INT, sizeof(xx[0]), x_len);
166  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIUNSIGNED_INT, sizeof(yy[0]), y_len);
167 
168  m_writeStmt->executeArrayUpdate(nrows);
169 
170  delete[] ids;
171  delete[] iconfid_vec;
172  delete[] xx;
173  delete[] yy;
174 
175  delete[] ids_len;
176  delete[] iconf_len;
177  delete[] x_len;
178  delete[] y_len;
179 
180  } catch (SQLException& e) {
181  throw(std::runtime_error("FEConfigFgrEEStripDat::writeArrayDB(): " + e.getMessage()));
182  }
183 }
int fetchID() noexcept(false)
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
unsigned int getThreshold() const
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int getLogicID() const
Definition: EcalLogicID.cc:28
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
unsigned int getLutFg() const

◆ writeDB()

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

Definition at line 38 of file FEConfigFgrEEStripDat.cc.

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

40  {
41  this->checkConnection();
42  this->checkPrepare();
43 
44  int iconfID = iconf->fetchID();
45  if (!iconfID) {
46  throw(std::runtime_error("FEConfigFgrEEStripDat::writeDB: ICONF not in DB"));
47  }
48 
49  int logicID = ecid->getLogicID();
50  if (!logicID) {
51  throw(std::runtime_error("FEConfigFgrEEStripDat::writeDB: Bad EcalLogicID"));
52  }
53 
54  try {
55  m_writeStmt->setInt(1, iconfID);
56  m_writeStmt->setInt(2, logicID);
57  m_writeStmt->setUInt(3, item->getThreshold());
58  m_writeStmt->setUInt(4, item->getLutFg());
59 
60  m_writeStmt->executeUpdate();
61  } catch (SQLException& e) {
62  throw(std::runtime_error("FEConfigFgrEEStripDat::writeDB(): " + e.getMessage()));
63  }
64 }
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 FEConfigFgrEEStripDat.h.

Member Data Documentation

◆ m_lut_fg

unsigned int FEConfigFgrEEStripDat::m_lut_fg
private

Definition at line 40 of file FEConfigFgrEEStripDat.h.

Referenced by getLutFg(), getLUTFgr(), getLutFgr(), setLutFg(), setLUTFgr(), and setLutFgr().

◆ m_thresh

unsigned int FEConfigFgrEEStripDat::m_thresh
private

Definition at line 39 of file FEConfigFgrEEStripDat.h.

Referenced by getThreshold(), and setThreshold().