CMS 3D CMS Logo

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

#include <FEConfigFgrEETowerDat.h>

Inheritance diagram for FEConfigFgrEETowerDat:
IDataItem IDBObject

Public Member Functions

 FEConfigFgrEETowerDat ()
 
int getLUTValue () const
 
int getLutValue () const
 
std::string getTable () override
 
void setLUTValue (int mean)
 
void setLutValue (int mean)
 
 ~FEConfigFgrEETowerDat () 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, FEConfigFgrEETowerDat > *fillMap, FEConfigFgrInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigFgrEETowerDat > *data, FEConfigFgrInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigFgrEETowerDat *item, FEConfigFgrInfo *iconf) noexcept(false)
 

Private Attributes

int m_lut
 

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

Constructor & Destructor Documentation

◆ FEConfigFgrEETowerDat()

FEConfigFgrEETowerDat::FEConfigFgrEETowerDat ( )

Definition at line 11 of file FEConfigFgrEETowerDat.cc.

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

◆ ~FEConfigFgrEETowerDat()

FEConfigFgrEETowerDat::~FEConfigFgrEETowerDat ( )
override

Definition at line 20 of file FEConfigFgrEETowerDat.cc.

20 {}

Member Function Documentation

◆ fetchData()

void FEConfigFgrEETowerDat::fetchData ( std::map< EcalLogicID, FEConfigFgrEETowerDat > *  fillMap,
FEConfigFgrInfo iconf 
)
privatenoexcept

Definition at line 64 of file FEConfigFgrEETowerDat.cc.

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

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("FEConfigFgrEETowerDat::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.lut_value "
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 fgr_conf_id = :fgr_conf_id");
85  m_readStmt->setInt(1, iconfID);
86  ResultSet* rset = m_readStmt->executeQuery();
87 
88  std::pair<EcalLogicID, FEConfigFgrEETowerDat> 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.setLutValue(rset->getInt(7));
99 
100  p.second = dat;
101  fillMap->insert(p);
102  }
103  } catch (SQLException& e) {
104  throw(std::runtime_error("FEConfigFgrEETowerDat::fetchData: " + e.getMessage()));
105  }
106 }
int fetchID() noexcept(false)
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
std::string getTable() override
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23

◆ getLUTValue()

int FEConfigFgrEETowerDat::getLUTValue ( ) const
inline

Definition at line 21 of file FEConfigFgrEETowerDat.h.

References m_lut.

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

◆ getLutValue()

int FEConfigFgrEETowerDat::getLutValue ( ) const
inline

Definition at line 23 of file FEConfigFgrEETowerDat.h.

References m_lut.

Referenced by writeArrayDB().

◆ getTable()

std::string FEConfigFgrEETowerDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigFgrEETowerDat.h.

18 { return "FE_CONFIG_FGREETT_DAT"; }

◆ prepareWrite()

void FEConfigFgrEETowerDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 22 of file FEConfigFgrEETowerDat.cc.

References MillePedeFileConverter_cfg::e.

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

◆ setLUTValue()

void FEConfigFgrEETowerDat::setLUTValue ( int  mean)
inline

◆ setLutValue()

void FEConfigFgrEETowerDat::setLutValue ( int  mean)
inline

◆ writeArrayDB()

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

Definition at line 108 of file FEConfigFgrEETowerDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getLutValue(), AlCaHLTBitMon_ParallelJobs::p, x, and geometryCSVtoXML::xx.

109  {
110  this->checkConnection();
111  this->checkPrepare();
112 
113  int iconfID = iconf->fetchID();
114  if (!iconfID) {
115  throw(std::runtime_error("FEConfigFgrEETowerDat::writeArrayDB: ICONF not in DB"));
116  }
117 
118  int nrows = data->size();
119  int* ids = new int[nrows];
120  int* iconfid_vec = new int[nrows];
121  int* xx = new int[nrows];
122 
123  ub2* ids_len = new ub2[nrows];
124  ub2* iconf_len = new ub2[nrows];
125  ub2* x_len = new ub2[nrows];
126 
127  const EcalLogicID* channel;
128  const FEConfigFgrEETowerDat* dataitem;
129  int count = 0;
130  typedef map<EcalLogicID, FEConfigFgrEETowerDat>::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("FEConfigFgrEETowerDat::writeArrayDB: Bad EcalLogicID"));
136  }
137  ids[count] = logicID;
138  iconfid_vec[count] = iconfID;
139 
140  dataitem = &(p->second);
141  // dataIface.writeDB( channel, dataitem, iconf);
142  int x = dataitem->getLutValue();
143 
144  xx[count] = x;
145 
146  ids_len[count] = sizeof(ids[count]);
147  iconf_len[count] = sizeof(iconfid_vec[count]);
148 
149  x_len[count] = sizeof(xx[count]);
150 
151  count++;
152  }
153 
154  try {
155  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]), iconf_len);
156  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
157  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
158 
159  m_writeStmt->executeArrayUpdate(nrows);
160 
161  delete[] ids;
162  delete[] iconfid_vec;
163  delete[] xx;
164 
165  delete[] ids_len;
166  delete[] iconf_len;
167  delete[] x_len;
168 
169  } catch (SQLException& e) {
170  throw(std::runtime_error("FEConfigFgrEETowerDat::writeArrayDB(): " + e.getMessage()));
171  }
172 }
int fetchID() noexcept(false)
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
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80

◆ writeDB()

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

Definition at line 37 of file FEConfigFgrEETowerDat.cc.

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

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigFgrEETowerDat.h.

Member Data Documentation

◆ m_lut

int FEConfigFgrEETowerDat::m_lut
private

Definition at line 36 of file FEConfigFgrEETowerDat.h.

Referenced by getLUTValue(), getLutValue(), setLUTValue(), and setLutValue().