CMS 3D CMS Logo

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

#include <FEConfigLUTParamDat.h>

Inheritance diagram for FEConfigLUTParamDat:
IDataItem IDBObject

Public Member Functions

 FEConfigLUTParamDat ()
 
float getETSat () const
 
std::string getTable () override
 
float getTTThreshhigh () const
 
float getTTThreshlow () const
 
void setETSat (float x)
 
void setTTThreshhigh (float x)
 
void setTTThreshlow (float x)
 
 ~FEConfigLUTParamDat () 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, FEConfigLUTParamDat > *fillMap, FEConfigLUTInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigLUTParamDat > *data, FEConfigLUTInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigLUTParamDat *item, FEConfigLUTInfo *iconf) noexcept(false)
 

Private Attributes

float m_etsat
 
float m_tthreshhigh
 
float m_tthreshlow
 

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

Constructor & Destructor Documentation

◆ FEConfigLUTParamDat()

FEConfigLUTParamDat::FEConfigLUTParamDat ( )

Definition at line 11 of file FEConfigLUTParamDat.cc.

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

◆ ~FEConfigLUTParamDat()

FEConfigLUTParamDat::~FEConfigLUTParamDat ( )
override

Definition at line 22 of file FEConfigLUTParamDat.cc.

22 {}

Member Function Documentation

◆ fetchData()

void FEConfigLUTParamDat::fetchData ( std::map< EcalLogicID, FEConfigLUTParamDat > *  fillMap,
FEConfigLUTInfo iconf 
)
privatenoexcept

Definition at line 68 of file FEConfigLUTParamDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setETSat(), setTTThreshhigh(), and setTTThreshlow().

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

◆ getETSat()

float FEConfigLUTParamDat::getETSat ( ) const
inline

Definition at line 24 of file FEConfigLUTParamDat.h.

References m_etsat.

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

24 { return m_etsat; }

◆ getTable()

std::string FEConfigLUTParamDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigLUTParamDat.h.

18 { return "FE_CONFIG_LUTPARAM_DAT"; }

◆ getTTThreshhigh()

float FEConfigLUTParamDat::getTTThreshhigh ( ) const
inline

◆ getTTThreshlow()

float FEConfigLUTParamDat::getTTThreshlow ( ) const
inline

Definition at line 25 of file FEConfigLUTParamDat.h.

References m_tthreshlow.

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

25 { return m_tthreshlow; }

◆ prepareWrite()

void FEConfigLUTParamDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 24 of file FEConfigLUTParamDat.cc.

References MillePedeFileConverter_cfg::e.

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

◆ setETSat()

void FEConfigLUTParamDat::setETSat ( float  x)
inline

Definition at line 20 of file FEConfigLUTParamDat.h.

References m_etsat, and x.

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

◆ setTTThreshhigh()

void FEConfigLUTParamDat::setTTThreshhigh ( float  x)
inline

Definition at line 22 of file FEConfigLUTParamDat.h.

References m_tthreshhigh, and x.

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

◆ setTTThreshlow()

void FEConfigLUTParamDat::setTTThreshlow ( float  x)
inline

Definition at line 21 of file FEConfigLUTParamDat.h.

References m_tthreshlow, and x.

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

◆ writeArrayDB()

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

Definition at line 114 of file FEConfigLUTParamDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getETSat(), EcalLogicID::getLogicID(), getTTThreshhigh(), getTTThreshlow(), AlCaHLTBitMon_ParallelJobs::p, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

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

◆ writeDB()

void FEConfigLUTParamDat::writeDB ( const EcalLogicID ecid,
const FEConfigLUTParamDat item,
FEConfigLUTInfo iconf 
)
privatenoexcept

Definition at line 39 of file FEConfigLUTParamDat.cc.

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

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

Member Data Documentation

◆ m_etsat

float FEConfigLUTParamDat::m_etsat
private

Definition at line 38 of file FEConfigLUTParamDat.h.

Referenced by getETSat(), and setETSat().

◆ m_tthreshhigh

float FEConfigLUTParamDat::m_tthreshhigh
private

Definition at line 40 of file FEConfigLUTParamDat.h.

Referenced by getTTThreshhigh(), and setTTThreshhigh().

◆ m_tthreshlow

float FEConfigLUTParamDat::m_tthreshlow
private

Definition at line 39 of file FEConfigLUTParamDat.h.

Referenced by getTTThreshlow(), and setTTThreshlow().