CMS 3D CMS Logo

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

#include <FEConfigTimingDat.h>

Inheritance diagram for FEConfigTimingDat:
IDataItem IDBObject

Public Member Functions

 FEConfigTimingDat ()
 
std::string getTable () override
 
int getTimingPar1 () const
 
int getTimingPar2 () const
 
void setTimingPar1 (int x)
 
void setTimingPar2 (int x)
 
 ~FEConfigTimingDat () 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, FEConfigTimingDat > *fillMap, FEConfigTimingInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigTimingDat > *data, FEConfigTimingInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigTimingDat *item, FEConfigTimingInfo *iconf) noexcept(false)
 

Private Attributes

int m_par1
 
int m_par2
 

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

Constructor & Destructor Documentation

◆ FEConfigTimingDat()

FEConfigTimingDat::FEConfigTimingDat ( )

Definition at line 11 of file FEConfigTimingDat.cc.

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

◆ ~FEConfigTimingDat()

FEConfigTimingDat::~FEConfigTimingDat ( )
override

Definition at line 21 of file FEConfigTimingDat.cc.

21 {}

Member Function Documentation

◆ fetchData()

void FEConfigTimingDat::fetchData ( std::map< EcalLogicID, FEConfigTimingDat > *  fillMap,
FEConfigTimingInfo iconf 
)
privatenoexcept

Definition at line 64 of file FEConfigTimingDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setTimingPar1(), and setTimingPar2().

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

◆ getTable()

std::string FEConfigTimingDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigTimingDat.h.

18 { return "FE_CONFIG_Time_DAT"; }

◆ getTimingPar1()

int FEConfigTimingDat::getTimingPar1 ( ) const
inline

Definition at line 21 of file FEConfigTimingDat.h.

References m_par1.

Referenced by writeArrayDB().

21 { return m_par1; }

◆ getTimingPar2()

int FEConfigTimingDat::getTimingPar2 ( ) const
inline

Definition at line 23 of file FEConfigTimingDat.h.

References m_par2.

Referenced by writeArrayDB().

23 { return m_par2; }

◆ prepareWrite()

void FEConfigTimingDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 23 of file FEConfigTimingDat.cc.

References MillePedeFileConverter_cfg::e.

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

◆ setTimingPar1()

void FEConfigTimingDat::setTimingPar1 ( int  x)
inline

Definition at line 20 of file FEConfigTimingDat.h.

References m_par1, and x.

Referenced by fetchData().

◆ setTimingPar2()

void FEConfigTimingDat::setTimingPar2 ( int  x)
inline

Definition at line 22 of file FEConfigTimingDat.h.

References m_par2, and x.

Referenced by fetchData().

◆ writeArrayDB()

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

Definition at line 107 of file FEConfigTimingDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getTimingPar1(), getTimingPar2(), AlCaHLTBitMon_ParallelJobs::p, x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

108  {
109  this->checkConnection();
110  this->checkPrepare();
111 
112  int iconfID = iconf->fetchID();
113  if (!iconfID) {
114  throw(std::runtime_error("FEConfigTimingDat::writeArrayDB: tim_conf_id not in DB"));
115  }
116 
117  int nrows = data->size();
118  int* ids = new int[nrows];
119  int* iconfid_vec = new int[nrows];
120  int* xx = new int[nrows];
121  int* yy = 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  ub2* y_len = new ub2[nrows];
127 
128  const EcalLogicID* channel;
129  const FEConfigTimingDat* dataitem;
130  int count = 0;
131  typedef map<EcalLogicID, FEConfigTimingDat>::const_iterator CI;
132  for (CI p = data->begin(); p != data->end(); ++p) {
133  channel = &(p->first);
134  int logicID = channel->getLogicID();
135  if (!logicID) {
136  throw(std::runtime_error("FEConfigTimingDat::writeArrayDB: Bad EcalLogicID"));
137  }
138  ids[count] = logicID;
139  iconfid_vec[count] = iconfID;
140 
141  dataitem = &(p->second);
142  // dataIface.writeDB( channel, dataitem, iconf);
143  int x = dataitem->getTimingPar1();
144  int y = dataitem->getTimingPar2();
145 
146  xx[count] = x;
147  yy[count] = y;
148 
149  ids_len[count] = sizeof(ids[count]);
150  iconf_len[count] = sizeof(iconfid_vec[count]);
151 
152  x_len[count] = sizeof(xx[count]);
153  y_len[count] = sizeof(yy[count]);
154 
155  count++;
156  }
157 
158  try {
159  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]), iconf_len);
160  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
161  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
162  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
163 
164  m_writeStmt->executeArrayUpdate(nrows);
165 
166  delete[] ids;
167  delete[] iconfid_vec;
168  delete[] xx;
169  delete[] yy;
170 
171  delete[] ids_len;
172  delete[] iconf_len;
173  delete[] x_len;
174  delete[] y_len;
175 
176  } catch (SQLException& e) {
177  throw(std::runtime_error("FEConfigTimingDat::writeArrayDB(): " + e.getMessage()));
178  }
179 }
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 getTimingPar2() const
int getLogicID() const
Definition: EcalLogicID.cc:28
int fetchID() noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
int getTimingPar1() const

◆ writeDB()

void FEConfigTimingDat::writeDB ( const EcalLogicID ecid,
const FEConfigTimingDat item,
FEConfigTimingInfo iconf 
)
privatenoexcept

Definition at line 36 of file FEConfigTimingDat.cc.

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

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

Member Data Documentation

◆ m_par1

int FEConfigTimingDat::m_par1
private

Definition at line 35 of file FEConfigTimingDat.h.

Referenced by getTimingPar1(), and setTimingPar1().

◆ m_par2

int FEConfigTimingDat::m_par2
private

Definition at line 36 of file FEConfigTimingDat.h.

Referenced by getTimingPar2(), and setTimingPar2().