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 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 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 }

◆ ~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.

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 }

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

◆ getLutFg()

unsigned int FEConfigFgrEEStripDat::getLutFg ( ) const
inline

Definition at line 23 of file FEConfigFgrEEStripDat.h.

23 { return m_lut_fg; }

References m_lut_fg.

Referenced by writeArrayDB().

◆ getLUTFgr()

unsigned int FEConfigFgrEEStripDat::getLUTFgr ( ) const
inline

Definition at line 25 of file FEConfigFgrEEStripDat.h.

25 { return m_lut_fg; }

References m_lut_fg.

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

◆ getLutFgr()

unsigned int FEConfigFgrEEStripDat::getLutFgr ( ) const
inline

Definition at line 27 of file FEConfigFgrEEStripDat.h.

27 { return m_lut_fg; }

References 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.

21 { return m_thresh; }

References m_thresh.

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

◆ prepareWrite()

void FEConfigFgrEEStripDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 23 of file FEConfigFgrEEStripDat.cc.

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 }

References MillePedeFileConverter_cfg::e.

◆ setLutFg()

void FEConfigFgrEEStripDat::setLutFg ( unsigned int  mean)
inline

Definition at line 22 of file FEConfigFgrEEStripDat.h.

22 { m_lut_fg = mean; }

References m_lut_fg, and SiStripPI::mean.

Referenced by fetchData().

◆ setLUTFgr()

void FEConfigFgrEEStripDat::setLUTFgr ( unsigned int  mean)
inline

Definition at line 24 of file FEConfigFgrEEStripDat.h.

24 { m_lut_fg = mean; }

References m_lut_fg, and SiStripPI::mean.

◆ setLutFgr()

void FEConfigFgrEEStripDat::setLutFgr ( unsigned int  mean)
inline

Definition at line 26 of file FEConfigFgrEEStripDat.h.

26 { m_lut_fg = mean; }

References m_lut_fg, and SiStripPI::mean.

Referenced by EcalTPGParamBuilder::analyze().

◆ setThreshold()

void FEConfigFgrEEStripDat::setThreshold ( unsigned int  mean)
inline

Definition at line 20 of file FEConfigFgrEEStripDat.h.

20 { m_thresh = mean; }

References m_thresh, and SiStripPI::mean.

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

◆ writeArrayDB()

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

Definition at line 111 of file FEConfigFgrEEStripDat.cc.

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 }

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

◆ writeDB()

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

Definition at line 38 of file FEConfigFgrEEStripDat.cc.

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 }

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

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().

DDAxes::y
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
FEConfigFgrEEStripDat::getTable
std::string getTable() override
Definition: FEConfigFgrEEStripDat.h:18
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
FEConfigFgrInfo::fetchID
int fetchID() noexcept(false)
Definition: FEConfigFgrInfo.cc:161
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
FEConfigFgrEEStripDat::m_thresh
unsigned int m_thresh
Definition: FEConfigFgrEEStripDat.h:39
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
EcalLogicID
Definition: EcalLogicID.h:7
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
FEConfigFgrEEStripDat
Definition: FEConfigFgrEEStripDat.h:11
FEConfigFgrEEStripDat::m_lut_fg
unsigned int m_lut_fg
Definition: FEConfigFgrEEStripDat.h:40
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
FEConfigFgrEEStripDat::getLutFg
unsigned int getLutFg() const
Definition: FEConfigFgrEEStripDat.h:23
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
FEConfigFgrEEStripDat::setLutFg
void setLutFg(unsigned int mean)
Definition: FEConfigFgrEEStripDat.h:22
FEConfigFgrEEStripDat::setThreshold
void setThreshold(unsigned int mean)
Definition: FEConfigFgrEEStripDat.h:20
FEConfigFgrEEStripDat::getThreshold
unsigned int getThreshold() const
Definition: FEConfigFgrEEStripDat.h:21
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37