CMS 3D CMS Logo

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

#include <FEConfigLinParamDat.h>

Inheritance diagram for FEConfigLinParamDat:
IDataItem IDBObject

Public Member Functions

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

Private Attributes

float m_etsat
 

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

Constructor & Destructor Documentation

◆ FEConfigLinParamDat()

FEConfigLinParamDat::FEConfigLinParamDat ( )

Definition at line 11 of file FEConfigLinParamDat.cc.

11  {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_etsat = 0;
18 }

◆ ~FEConfigLinParamDat()

FEConfigLinParamDat::~FEConfigLinParamDat ( )
override

Definition at line 20 of file FEConfigLinParamDat.cc.

20 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 64 of file FEConfigLinParamDat.cc.

65  {
66  this->checkConnection();
67  fillMap->clear();
68 
69  iconf->setConnection(m_env, m_conn);
70  int iconfID = iconf->fetchID();
71  if (!iconfID) {
72  // throw(std::runtime_error("FEConfigLinParamDat::writeDB: ICONF not in DB"));
73  return;
74  }
75 
76  try {
77  m_readStmt->setSQL(
78  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
79  " d.etsat "
80  "FROM channelview cv JOIN " +
81  getTable() +
82  " d "
83  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
84  "WHERE lin_conf_id = :lin_conf_id");
85  m_readStmt->setInt(1, iconfID);
86  ResultSet* rset = m_readStmt->executeQuery();
87 
88  std::pair<EcalLogicID, FEConfigLinParamDat> p;
90  while (rset->next()) {
91  p.first = EcalLogicID(rset->getString(1), // name
92  rset->getInt(2), // logic_id
93  rset->getInt(3), // id1
94  rset->getInt(4), // id2
95  rset->getInt(5), // id3
96  rset->getString(6)); // maps_to
97 
98  dat.setETSat(rset->getFloat(7));
99 
100  p.second = dat;
101  fillMap->insert(p);
102  }
103  } catch (SQLException& e) {
104  throw(std::runtime_error("FEConfigLinParamDat::fetchData: " + e.getMessage()));
105  }
106 }

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

◆ getETSat()

float FEConfigLinParamDat::getETSat ( ) const
inline

Definition at line 22 of file FEConfigLinParamDat.h.

22 { return m_etsat; }

References m_etsat.

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

◆ getTable()

std::string FEConfigLinParamDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigLinParamDat.h.

18 { return "FE_CONFIG_LINPARAM_DAT"; }

◆ prepareWrite()

void FEConfigLinParamDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 22 of file FEConfigLinParamDat.cc.

22  {
23  this->checkConnection();
24 
25  try {
26  m_writeStmt = m_conn->createStatement();
27  m_writeStmt->setSQL("INSERT INTO " + getTable() +
28  " (lin_conf_id, logic_id, "
29  " etsat ) "
30  "VALUES (:lin_conf_id, :logic_id, "
31  ":etsat )");
32  } catch (SQLException& e) {
33  throw(std::runtime_error("FEConfigLinParamDat::prepareWrite(): " + e.getMessage()));
34  }
35 }

References MillePedeFileConverter_cfg::e.

◆ setETSat()

void FEConfigLinParamDat::setETSat ( float  x)
inline

Definition at line 20 of file FEConfigLinParamDat.h.

20 { m_etsat = x; }

References m_etsat, and x.

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

◆ writeArrayDB()

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

Definition at line 108 of file FEConfigLinParamDat.cc.

109  {
110  this->checkConnection();
111  this->checkPrepare();
112 
113  int iconfID = iconf->fetchID();
114  if (!iconfID) {
115  throw(std::runtime_error("FEConfigLinParamDat::writeArrayDB: ICONF not in DB"));
116  }
117 
118  int nrows = data->size();
119  int* ids = new int[nrows];
120  int* iov_vec = new int[nrows];
121  float* xx = new float[nrows];
122 
123  ub2* ids_len = new ub2[nrows];
124  ub2* iov_len = new ub2[nrows];
125  ub2* x_len = new ub2[nrows];
126 
127  const EcalLogicID* channel;
128  const FEConfigLinParamDat* dataitem;
129  int count = 0;
130  typedef map<EcalLogicID, FEConfigLinParamDat>::const_iterator CI;
131  for (CI p = data->begin(); p != data->end(); ++p) {
132  channel = &(p->first);
133  int logicID = channel->getLogicID();
134  if (!logicID) {
135  throw(std::runtime_error("FEConfigLinParamDat::writeArrayDB: Bad EcalLogicID"));
136  }
137  ids[count] = logicID;
138  iov_vec[count] = iconfID;
139 
140  dataitem = &(p->second);
141  float x = dataitem->getETSat();
142 
143  xx[count] = x;
144 
145  ids_len[count] = sizeof(ids[count]);
146  iov_len[count] = sizeof(iov_vec[count]);
147  x_len[count] = sizeof(xx[count]);
148 
149  count++;
150  }
151 
152  try {
153  m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT, sizeof(iov_vec[0]), iov_len);
154  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
155  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT, sizeof(xx[0]), x_len);
156 
157  m_writeStmt->executeArrayUpdate(nrows);
158 
159  delete[] ids;
160  delete[] iov_vec;
161  delete[] xx;
162 
163  delete[] ids_len;
164  delete[] iov_len;
165  delete[] x_len;
166 
167  } catch (SQLException& e) {
168  throw(std::runtime_error("FEConfigLinParamDat::writeArrayDB(): " + e.getMessage()));
169  }
170 }

References KineDebug3::count(), std::data(), MillePedeFileConverter_cfg::e, getETSat(), EcalLogicID::getLogicID(), AlCaHLTBitMon_ParallelJobs::p, x, and geometryCSVtoXML::xx.

◆ writeDB()

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

Definition at line 37 of file FEConfigLinParamDat.cc.

39  {
40  this->checkConnection();
41  this->checkPrepare();
42 
43  int iconfID = iconf->fetchID();
44  if (!iconfID) {
45  throw(std::runtime_error("FEConfigLinParamDat::writeDB: ICONF not in DB"));
46  }
47 
48  int logicID = ecid->getLogicID();
49  if (!logicID) {
50  throw(std::runtime_error("FEConfigLinParamDat::writeDB: Bad EcalLogicID"));
51  }
52 
53  try {
54  m_writeStmt->setInt(1, iconfID);
55  m_writeStmt->setInt(2, logicID);
56  m_writeStmt->setFloat(3, item->getETSat());
57 
58  m_writeStmt->executeUpdate();
59  } catch (SQLException& e) {
60  throw(std::runtime_error("FEConfigLinParamDat::writeDB(): " + e.getMessage()));
61  }
62 }

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigLinParamDat.h.

Member Data Documentation

◆ m_etsat

float FEConfigLinParamDat::m_etsat
private

Definition at line 34 of file FEConfigLinParamDat.h.

Referenced by getETSat(), and setETSat().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
FEConfigLinParamDat::setETSat
void setETSat(float x)
Definition: FEConfigLinParamDat.h:20
FEConfigLinParamDat::getETSat
float getETSat() const
Definition: FEConfigLinParamDat.h:22
FEConfigLinParamDat::m_etsat
float m_etsat
Definition: FEConfigLinParamDat.h:34
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
FEConfigLinInfo::fetchID
int fetchID() noexcept(false)
Definition: FEConfigLinInfo.cc:161
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
FEConfigLinParamDat
Definition: FEConfigLinParamDat.h:11
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
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
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
FEConfigLinParamDat::getTable
std::string getTable() override
Definition: FEConfigLinParamDat.h:18
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37