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

Definition at line 11 of file FEConfigLUTParamDat.cc.

12 {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_etsat = 0;
19  m_tthreshlow = 0;
20  m_tthreshhigh = 0;
21 
22 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
FEConfigLUTParamDat::~FEConfigLUTParamDat ( )
override

Definition at line 26 of file FEConfigLUTParamDat.cc.

27 {
28 }

Member Function Documentation

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

Definition at line 77 of file FEConfigLUTParamDat.cc.

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

Referenced by getTTThreshhigh().

79 {
80  this->checkConnection();
81  fillMap->clear();
82 
83  iconf->setConnection(m_env, m_conn);
84  int iconfID = iconf->fetchID();
85  if (!iconfID) {
86  // throw(std::runtime_error("FEConfigLUTParamDat::writeDB: ICONF not in DB"));
87  return;
88  }
89 
90  try {
91 
92  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
93  " d.etsat, d.ttthreshlow, d.ttthreshhigh "
94  "FROM channelview cv JOIN "+getTable()+" d "
95  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
96  "WHERE lut_conf_id = :lut_conf_id");
97  m_readStmt->setInt(1, iconfID);
98  ResultSet* rset = m_readStmt->executeQuery();
99 
100  std::pair< EcalLogicID, FEConfigLUTParamDat > p;
102  while(rset->next()) {
103  p.first = EcalLogicID( getOraString(rset,1), // name
104  rset->getInt(2), // logic_id
105  rset->getInt(3), // id1
106  rset->getInt(4), // id2
107  rset->getInt(5), // id3
108  getOraString(rset,6)); // maps_to
109 
110 
111 
112  dat.setETSat( rset->getFloat(7) );
113  dat.setTTThreshlow( rset->getFloat(8) );
114  dat.setTTThreshhigh( rset->getFloat(9) );
115 
116  p.second = dat;
117  fillMap->insert(p);
118  }
119  } catch (SQLException &e) {
120  throw(std::runtime_error(std::string("FEConfigLUTParamDat::fetchData: ")+getOraMessage(&e)));
121  }
122 }
std::string getTable() override
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
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)
float FEConfigLUTParamDat::getETSat ( ) const
inline

Definition at line 27 of file FEConfigLUTParamDat.h.

References m_etsat.

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

27 { return m_etsat; }
std::string FEConfigLUTParamDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigLUTParamDat.h.

18 { return "FE_CONFIG_LUTPARAM_DAT"; }
float FEConfigLUTParamDat::getTTThreshhigh ( ) const
inline
float FEConfigLUTParamDat::getTTThreshlow ( ) const
inline

Definition at line 28 of file FEConfigLUTParamDat.h.

References m_tthreshlow.

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

28 { return m_tthreshlow; }
void FEConfigLUTParamDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 32 of file FEConfigLUTParamDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTTThreshhigh().

34 {
35  this->checkConnection();
36 
37  try {
38  m_writeStmt = m_conn->createStatement();
39  m_writeStmt->setSQL("INSERT INTO "+getTable()+" (lut_conf_id, logic_id, "
40  " etsat, ttthreshlow, ttthreshhigh ) "
41  "VALUES (:lut_conf_id, :logic_id, "
42  ":etsat, :ttthreshlow, :ttthreshhigh )" );
43  } catch (SQLException &e) {
44  throw(std::runtime_error(std::string("FEConfigLUTParamDat::prepareWrite(): ")+getOraMessage(&e)));
45  }
46 }
std::string getTable() override
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void FEConfigLUTParamDat::setETSat ( float  x)
inline

Definition at line 21 of file FEConfigLUTParamDat.h.

References m_etsat, and x.

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

void FEConfigLUTParamDat::setTTThreshhigh ( float  x)
inline

Definition at line 23 of file FEConfigLUTParamDat.h.

References m_tthreshhigh, and x.

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

void FEConfigLUTParamDat::setTTThreshlow ( float  x)
inline

Definition at line 22 of file FEConfigLUTParamDat.h.

References m_tthreshlow, and x.

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

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

Definition at line 124 of file FEConfigLUTParamDat.cc.

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

Referenced by getTTThreshhigh().

126 {
127  this->checkConnection();
128  this->checkPrepare();
129 
130  int iconfID = iconf->fetchID();
131  if (!iconfID) { throw(std::runtime_error("FEConfigLUTParamDat::writeArrayDB: ICONF not in DB")); }
132 
133 
134  int nrows=data->size();
135  int* ids= new int[nrows];
136  int* iov_vec= new int[nrows];
137  float* xx= new float[nrows];
138  float* yy= new float[nrows];
139  float* zz= new float[nrows];
140 
141 
142  ub2* ids_len= new ub2[nrows];
143  ub2* iov_len= new ub2[nrows];
144  ub2* x_len= new ub2[nrows];
145  ub2* y_len= new ub2[nrows];
146  ub2* z_len= new ub2[nrows];
147 
148 
149  const EcalLogicID* channel;
150  const FEConfigLUTParamDat* dataitem;
151  int count=0;
152  typedef map< EcalLogicID, FEConfigLUTParamDat >::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) { throw(std::runtime_error("FEConfigLUTParamDat::writeArrayDB: Bad EcalLogicID")); }
157  ids[count]=logicID;
158  iov_vec[count]=iconfID;
159 
160  dataitem = &(p->second);
161  // dataIface.writeDB( channel, dataitem, conf);
162  float x=dataitem->getETSat();
163  float y=dataitem->getTTThreshlow();
164  float z=dataitem->getTTThreshhigh();
165 
166  xx[count]=x;
167  yy[count]=y;
168  zz[count]=z;
169 
170 
171  ids_len[count]=sizeof(ids[count]);
172  iov_len[count]=sizeof(iov_vec[count]);
173 
174  x_len[count]=sizeof(xx[count]);
175  y_len[count]=sizeof(yy[count]);
176  z_len[count]=sizeof(zz[count]);
177 
178  count++;
179  }
180 
181 
182  try {
183  m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT, sizeof(iov_vec[0]),iov_len);
184  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
185  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );
186  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
187  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
188 
189  m_writeStmt->executeArrayUpdate(nrows);
190 
191  delete [] ids;
192  delete [] iov_vec;
193  delete [] xx;
194  delete [] yy;
195  delete [] zz;
196 
197  delete [] ids_len;
198  delete [] iov_len;
199  delete [] x_len;
200  delete [] y_len;
201  delete [] z_len;
202 
203  } catch (SQLException &e) {
204  throw(std::runtime_error(std::string("FEConfigLUTParamDat::writeArrayDB(): ")+getOraMessage(&e)));
205  }
206 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
float getTTThreshhigh() const
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
float getTTThreshlow() const
int getLogicID() const
Definition: EcalLogicID.cc:41
int fetchID() noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FEConfigLUTParamDat::writeDB ( const EcalLogicID ecid,
const FEConfigLUTParamDat item,
FEConfigLUTInfo iconf 
)
privatenoexcept

Definition at line 50 of file FEConfigLUTParamDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTTThreshhigh().

52 {
53  this->checkConnection();
54  this->checkPrepare();
55 
56  int iconfID = iconf->fetchID();
57  if (!iconfID) { throw(std::runtime_error("FEConfigLUTParamDat::writeDB: ICONF not in DB")); }
58 
59  int logicID = ecid->getLogicID();
60  if (!logicID) { throw(std::runtime_error("FEConfigLUTParamDat::writeDB: Bad EcalLogicID")); }
61 
62  try {
63  m_writeStmt->setInt(1, iconfID);
64  m_writeStmt->setInt(2, logicID);
65  m_writeStmt->setFloat(3, item->getETSat());
66  m_writeStmt->setFloat(4, item->getTTThreshlow());
67  m_writeStmt->setFloat(5, item->getTTThreshhigh());
68 
69  m_writeStmt->executeUpdate();
70  } catch (SQLException &e) {
71  throw(std::runtime_error(std::string("FEConfigLUTParamDat::writeDB(): ")+getOraMessage(&e)));
72  }
73 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
float getTTThreshhigh() const
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
float getTTThreshlow() const
int getLogicID() const
Definition: EcalLogicID.cc:41
int fetchID() noexcept(false)

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigLUTParamDat.h.

Member Data Documentation

float FEConfigLUTParamDat::m_etsat
private

Definition at line 43 of file FEConfigLUTParamDat.h.

Referenced by getETSat(), and setETSat().

float FEConfigLUTParamDat::m_tthreshhigh
private

Definition at line 45 of file FEConfigLUTParamDat.h.

Referenced by getTTThreshhigh(), and setTTThreshhigh().

float FEConfigLUTParamDat::m_tthreshlow
private

Definition at line 44 of file FEConfigLUTParamDat.h.

Referenced by getTTThreshlow(), and setTTThreshlow().