CMS 3D CMS Logo

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

#include <FEConfigParamDat.h>

Inheritance diagram for FEConfigParamDat:
IDataItem IDBObject

Public Member Functions

 FEConfigParamDat ()
 
float getETSat () const
 
float getFGhighratio () const
 
float getFGhighthresh () const
 
float getFGlowratio () const
 
float getFGlowthresh () const
 
std::string getTable () override
 
float getTTThreshhigh () const
 
float getTTThreshlow () const
 
void setETSat (float x)
 
void setFGhighratio (float x)
 
void setFGhighthresh (float x)
 
void setFGlowratio (float x)
 
void setFGlowthresh (float x)
 
void setTTThreshhigh (float x)
 
void setTTThreshlow (float x)
 
 ~FEConfigParamDat () 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, FEConfigParamDat > *fillMap, FEConfigLinInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigParamDat > *data, FEConfigLinInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigParamDat *item, FEConfigLinInfo *iconf) noexcept(false)
 

Private Attributes

float m_etsat
 
float m_fghighthresh
 
float m_fglowthresh
 
float m_highratio
 
float m_lowratio
 
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 FEConfigParamDat.h.

Constructor & Destructor Documentation

◆ FEConfigParamDat()

FEConfigParamDat::FEConfigParamDat ( )

Definition at line 11 of file FEConfigParamDat.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  m_fglowthresh = 0;
21  m_fghighthresh = 0;
22  m_lowratio = 0;
23  m_highratio = 0;
24 }
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

◆ ~FEConfigParamDat()

FEConfigParamDat::~FEConfigParamDat ( )
override

Definition at line 26 of file FEConfigParamDat.cc.

26 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 76 of file FEConfigParamDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setETSat(), setFGhighratio(), setFGhighthresh(), setFGlowratio(), setFGlowthresh(), setTTThreshhigh(), and setTTThreshlow().

76  {
77  this->checkConnection();
78  fillMap->clear();
79 
80  iconf->setConnection(m_env, m_conn);
81  int iconfID = iconf->fetchID();
82  if (!iconfID) {
83  // throw(std::runtime_error("FEConfigParamDat::writeDB: ICONF not in DB"));
84  return;
85  }
86 
87  try {
88  m_readStmt->setSQL(
89  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
90  " d.etsat, d.ttthreshlow, d.ttthreshhigh, d.fg_lowthresh, d.fg_highthresh, d.fg_lowratio, d.fg_highratio "
91  "FROM channelview cv JOIN fe_config_param_dat d "
92  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
93  "WHERE lin_conf_id = :lin_conf_id");
94  m_readStmt->setInt(1, iconfID);
95  ResultSet* rset = m_readStmt->executeQuery();
96 
97  std::pair<EcalLogicID, FEConfigParamDat> p;
98  FEConfigParamDat dat;
99  while (rset->next()) {
100  p.first = EcalLogicID(rset->getString(1), // name
101  rset->getInt(2), // logic_id
102  rset->getInt(3), // id1
103  rset->getInt(4), // id2
104  rset->getInt(5), // id3
105  rset->getString(6)); // maps_to
106 
107  dat.setETSat(rset->getFloat(7));
108  dat.setTTThreshlow(rset->getFloat(8));
109  dat.setTTThreshhigh(rset->getFloat(9));
110  dat.setFGlowthresh(rset->getFloat(10));
111  dat.setFGhighthresh(rset->getFloat(11));
112  dat.setFGlowratio(rset->getFloat(12));
113  dat.setFGhighratio(rset->getFloat(13));
114 
115  p.second = dat;
116  fillMap->insert(p);
117  }
118  } catch (SQLException& e) {
119  throw(std::runtime_error("FEConfigParamDat::fetchData: " + e.getMessage()));
120  }
121 }
void setTTThreshlow(float x)
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void setFGlowratio(float x)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void setFGlowthresh(float x)
void setFGhighthresh(float x)
void setETSat(float x)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
int fetchID() noexcept(false)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void setTTThreshhigh(float x)
void setFGhighratio(float x)

◆ getETSat()

float FEConfigParamDat::getETSat ( ) const
inline

Definition at line 28 of file FEConfigParamDat.h.

References m_etsat.

Referenced by writeArrayDB().

28 { return m_etsat; }

◆ getFGhighratio()

float FEConfigParamDat::getFGhighratio ( ) const
inline

Definition at line 34 of file FEConfigParamDat.h.

References m_highratio.

Referenced by writeArrayDB().

34 { return m_highratio; }

◆ getFGhighthresh()

float FEConfigParamDat::getFGhighthresh ( ) const
inline

Definition at line 32 of file FEConfigParamDat.h.

References m_fghighthresh.

Referenced by writeArrayDB().

32 { return m_fghighthresh; }

◆ getFGlowratio()

float FEConfigParamDat::getFGlowratio ( ) const
inline

Definition at line 33 of file FEConfigParamDat.h.

References m_lowratio.

Referenced by writeArrayDB().

33 { return m_lowratio; }

◆ getFGlowthresh()

float FEConfigParamDat::getFGlowthresh ( ) const
inline

Definition at line 31 of file FEConfigParamDat.h.

References m_fglowthresh.

Referenced by writeArrayDB().

31 { return m_fglowthresh; }

◆ getTable()

std::string FEConfigParamDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigParamDat.h.

18 { return "FE_CONFIG_PARAM_DAT"; }

◆ getTTThreshhigh()

float FEConfigParamDat::getTTThreshhigh ( ) const
inline

Definition at line 30 of file FEConfigParamDat.h.

References m_tthreshhigh.

Referenced by writeArrayDB().

30 { return m_tthreshhigh; }

◆ getTTThreshlow()

float FEConfigParamDat::getTTThreshlow ( ) const
inline

Definition at line 29 of file FEConfigParamDat.h.

References m_tthreshlow.

Referenced by writeArrayDB().

29 { return m_tthreshlow; }

◆ prepareWrite()

void FEConfigParamDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 28 of file FEConfigParamDat.cc.

References MillePedeFileConverter_cfg::e.

28  {
29  this->checkConnection();
30 
31  try {
32  m_writeStmt = m_conn->createStatement();
33  m_writeStmt->setSQL(
34  "INSERT INTO fe_config_param_dat (lin_conf_id, logic_id, "
35  " etsat, ttthreshlow, ttthreshhigh, fg_lowthresh, fg_highthresh, fg_lowratio, fg_highratio ) "
36  "VALUES (:lin_conf_id, :logic_id, "
37  ":etsat, :ttthreshlow, :ttthreshhigh, :fg_lowthresh, :fg_highthresh, :fg_lowratio, :fg_highratio )");
38  } catch (SQLException& e) {
39  throw(std::runtime_error("FEConfigParamDat::prepareWrite(): " + e.getMessage()));
40  }
41 }
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 FEConfigParamDat::setETSat ( float  x)
inline

Definition at line 20 of file FEConfigParamDat.h.

References m_etsat, and x.

Referenced by fetchData().

◆ setFGhighratio()

void FEConfigParamDat::setFGhighratio ( float  x)
inline

Definition at line 26 of file FEConfigParamDat.h.

References m_highratio, and x.

Referenced by fetchData().

◆ setFGhighthresh()

void FEConfigParamDat::setFGhighthresh ( float  x)
inline

Definition at line 24 of file FEConfigParamDat.h.

References m_fghighthresh, and x.

Referenced by fetchData().

◆ setFGlowratio()

void FEConfigParamDat::setFGlowratio ( float  x)
inline

Definition at line 25 of file FEConfigParamDat.h.

References m_lowratio, and x.

Referenced by fetchData().

◆ setFGlowthresh()

void FEConfigParamDat::setFGlowthresh ( float  x)
inline

Definition at line 23 of file FEConfigParamDat.h.

References m_fglowthresh, and x.

Referenced by fetchData().

◆ setTTThreshhigh()

void FEConfigParamDat::setTTThreshhigh ( float  x)
inline

Definition at line 22 of file FEConfigParamDat.h.

References m_tthreshhigh, and x.

Referenced by fetchData().

◆ setTTThreshlow()

void FEConfigParamDat::setTTThreshlow ( float  x)
inline

Definition at line 21 of file FEConfigParamDat.h.

References m_tthreshlow, and x.

Referenced by fetchData().

◆ writeArrayDB()

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

Definition at line 123 of file FEConfigParamDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getETSat(), getFGhighratio(), getFGhighthresh(), getFGlowratio(), getFGlowthresh(), EcalLogicID::getLogicID(), getTTThreshhigh(), getTTThreshlow(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, submitPVValidationJobs::t, groupFilesInBlocks::tt, w(), x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

124  {
125  this->checkConnection();
126  this->checkPrepare();
127 
128  int iconfID = iconf->fetchID();
129  if (!iconfID) {
130  throw(std::runtime_error("FEConfigParamDat::writeArrayDB: ICONF not in DB"));
131  }
132 
133  int nrows = data->size();
134  int* ids = new int[nrows];
135  int* iov_vec = new int[nrows];
136  float* xx = new float[nrows];
137  float* yy = new float[nrows];
138  float* zz = new float[nrows];
139  float* ww = new float[nrows];
140  float* uu = new float[nrows];
141  float* tt = new float[nrows];
142  float* st = new float[nrows];
143 
144  ub2* ids_len = new ub2[nrows];
145  ub2* iov_len = new ub2[nrows];
146  ub2* x_len = new ub2[nrows];
147  ub2* y_len = new ub2[nrows];
148  ub2* z_len = new ub2[nrows];
149  ub2* w_len = new ub2[nrows];
150  ub2* u_len = new ub2[nrows];
151  ub2* t_len = new ub2[nrows];
152  ub2* st_len = new ub2[nrows];
153 
154  const EcalLogicID* channel;
155  const FEConfigParamDat* dataitem;
156  int count = 0;
157  typedef map<EcalLogicID, FEConfigParamDat>::const_iterator CI;
158  for (CI p = data->begin(); p != data->end(); ++p) {
159  channel = &(p->first);
160  int logicID = channel->getLogicID();
161  if (!logicID) {
162  throw(std::runtime_error("FEConfigParamDat::writeArrayDB: Bad EcalLogicID"));
163  }
164  ids[count] = logicID;
165  iov_vec[count] = iconfID;
166 
167  dataitem = &(p->second);
168  // dataIface.writeDB( channel, dataitem, conf);
169  float x = dataitem->getETSat();
170  float y = dataitem->getTTThreshlow();
171  float z = dataitem->getTTThreshhigh();
172  float w = dataitem->getFGlowthresh();
173  float u = dataitem->getFGhighthresh();
174  float t = dataitem->getFGlowratio();
175  float r = dataitem->getFGhighratio();
176 
177  xx[count] = x;
178  yy[count] = y;
179  zz[count] = z;
180  ww[count] = w;
181  uu[count] = u;
182  tt[count] = t;
183  st[count] = r;
184 
185  ids_len[count] = sizeof(ids[count]);
186  iov_len[count] = sizeof(iov_vec[count]);
187 
188  x_len[count] = sizeof(xx[count]);
189  y_len[count] = sizeof(yy[count]);
190  z_len[count] = sizeof(zz[count]);
191  w_len[count] = sizeof(ww[count]);
192  u_len[count] = sizeof(uu[count]);
193  t_len[count] = sizeof(tt[count]);
194  st_len[count] = sizeof(st[count]);
195 
196  count++;
197  }
198 
199  try {
200  m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT, sizeof(iov_vec[0]), iov_len);
201  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
202  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT, sizeof(xx[0]), x_len);
203  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT, sizeof(yy[0]), y_len);
204  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT, sizeof(zz[0]), z_len);
205  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT, sizeof(ww[0]), w_len);
206  m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT, sizeof(uu[0]), u_len);
207  m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIFLOAT, sizeof(tt[0]), t_len);
208  m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIFLOAT, sizeof(st[0]), st_len);
209 
210  m_writeStmt->executeArrayUpdate(nrows);
211 
212  delete[] ids;
213  delete[] iov_vec;
214  delete[] xx;
215  delete[] yy;
216  delete[] zz;
217  delete[] ww;
218  delete[] uu;
219  delete[] tt;
220  delete[] st;
221 
222  delete[] ids_len;
223  delete[] iov_len;
224  delete[] x_len;
225  delete[] y_len;
226  delete[] z_len;
227  delete[] w_len;
228  delete[] u_len;
229  delete[] t_len;
230  delete[] st_len;
231 
232  } catch (SQLException& e) {
233  throw(std::runtime_error("FEConfigParamDat::writeArrayDB(): " + e.getMessage()));
234  }
235 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
T w() const
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
float getTTThreshlow() const
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
float getTTThreshhigh() const
float getFGlowratio() const
int getLogicID() const
Definition: EcalLogicID.cc:28
float getFGhighratio() const
int fetchID() noexcept(false)
float getETSat() const
float getFGhighthresh() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
float getFGlowthresh() const

◆ writeDB()

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

Definition at line 43 of file FEConfigParamDat.cc.

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

45  {
46  this->checkConnection();
47  this->checkPrepare();
48 
49  int iconfID = iconf->fetchID();
50  if (!iconfID) {
51  throw(std::runtime_error("FEConfigParamDat::writeDB: ICONF not in DB"));
52  }
53 
54  int logicID = ecid->getLogicID();
55  if (!logicID) {
56  throw(std::runtime_error("FEConfigParamDat::writeDB: Bad EcalLogicID"));
57  }
58 
59  try {
60  m_writeStmt->setInt(1, iconfID);
61  m_writeStmt->setInt(2, logicID);
62  m_writeStmt->setFloat(3, item->getETSat());
63  m_writeStmt->setFloat(4, item->getTTThreshlow());
64  m_writeStmt->setFloat(5, item->getTTThreshhigh());
65  m_writeStmt->setFloat(6, item->getFGlowthresh());
66  m_writeStmt->setFloat(7, item->getFGhighthresh());
67  m_writeStmt->setFloat(8, item->getFGlowratio());
68  m_writeStmt->setFloat(9, item->getFGhighratio());
69 
70  m_writeStmt->executeUpdate();
71  } catch (SQLException& e) {
72  throw(std::runtime_error("FEConfigParamDat::writeDB(): " + e.getMessage()));
73  }
74 }
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 FEConfigParamDat.h.

Member Data Documentation

◆ m_etsat

float FEConfigParamDat::m_etsat
private

Definition at line 46 of file FEConfigParamDat.h.

Referenced by getETSat(), and setETSat().

◆ m_fghighthresh

float FEConfigParamDat::m_fghighthresh
private

Definition at line 50 of file FEConfigParamDat.h.

Referenced by getFGhighthresh(), and setFGhighthresh().

◆ m_fglowthresh

float FEConfigParamDat::m_fglowthresh
private

Definition at line 49 of file FEConfigParamDat.h.

Referenced by getFGlowthresh(), and setFGlowthresh().

◆ m_highratio

float FEConfigParamDat::m_highratio
private

Definition at line 52 of file FEConfigParamDat.h.

Referenced by getFGhighratio(), and setFGhighratio().

◆ m_lowratio

float FEConfigParamDat::m_lowratio
private

Definition at line 51 of file FEConfigParamDat.h.

Referenced by getFGlowratio(), and setFGlowratio().

◆ m_tthreshhigh

float FEConfigParamDat::m_tthreshhigh
private

Definition at line 48 of file FEConfigParamDat.h.

Referenced by getTTThreshhigh(), and setTTThreshhigh().

◆ m_tthreshlow

float FEConfigParamDat::m_tthreshlow
private

Definition at line 47 of file FEConfigParamDat.h.

Referenced by getTTThreshlow(), and setTTThreshlow().