CMS 3D CMS Logo

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

#include <ODGolBiasCurrentDat.h>

Inheritance diagram for ODGolBiasCurrentDat:
IODConfig IDBObject

Public Member Functions

int getCurrent () const
 
int getFedId () const
 
int getGolId () const
 
int getId () const
 
int getPLLCurrent () const
 
int getStatus () const
 
std::string getTable () override
 
int getTTId () const
 
 ODGolBiasCurrentDat ()
 
void setCurrent (int dac)
 
void setFedId (int dac)
 
void setGolId (int dac)
 
void setId (int dac)
 
void setPLLCurrent (int x)
 
void setStatus (int dac)
 
void setTTId (int dac)
 
 ~ODGolBiasCurrentDat () override
 
- Public Member Functions inherited from IODConfig
std::string getConfigTag ()
 
void setConfigTag (std::string x)
 
- 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::vector< ODGolBiasCurrentDat > *fillMap, ODGolBiasCurrentInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< ODGolBiasCurrentDat > &data, ODGolBiasCurrentInfo *iov) noexcept(false)
 
void writeDB (const ODGolBiasCurrentDat *item, ODGolBiasCurrentInfo *iov) noexcept(false)
 

Private Attributes

int m_cur
 
int m_fed
 
int m_gol
 
int m_ID
 
int m_pll_cur
 
int m_sta
 
int m_tt
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Public Types inherited from IODConfig
typedef oracle::occi::Clob Clob
 
typedef oracle::occi::SQLException SQLException
 
typedef oracle::occi::Statement Statement
 
typedef oracle::occi::Stream Stream
 
- Public Attributes inherited from IODConfig
std::string m_config_tag
 
- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IODConfig
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) noexcept(false)
 
unsigned char * readClob (Clob &clob, int size) 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 IODConfig
Statementm_readStmt
 
Statementm_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 11 of file ODGolBiasCurrentDat.h.

Constructor & Destructor Documentation

◆ ODGolBiasCurrentDat()

ODGolBiasCurrentDat::ODGolBiasCurrentDat ( )

Definition at line 10 of file ODGolBiasCurrentDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
16  m_gol = 0;
17  m_fed = 0;
18  m_tt = 0;
19  m_cur = 0;
20  m_pll_cur = 0;
21  m_sta = 0;
22 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
Statement * m_writeStmt
Definition: IODConfig.h:33
Statement * m_readStmt
Definition: IODConfig.h:34

◆ ~ODGolBiasCurrentDat()

ODGolBiasCurrentDat::~ODGolBiasCurrentDat ( )
override

Definition at line 24 of file ODGolBiasCurrentDat.cc.

24 {}

Member Function Documentation

◆ fetchData()

void ODGolBiasCurrentDat::fetchData ( std::vector< ODGolBiasCurrentDat > *  fillMap,
ODGolBiasCurrentInfo iov 
)
privatenoexcept

Definition at line 57 of file ODGolBiasCurrentDat.cc.

References gather_cfg::cout, MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setCurrent(), setFedId(), setGolId(), setPLLCurrent(), setStatus(), and setTTId().

57  {
58  this->checkConnection();
59 
60  iov->setConnection(m_env, m_conn);
61  int iovID = iov->fetchID();
62  if (!iovID) {
63  std::cout << "ID not in the DB" << endl;
64  return;
65  }
66 
67  try {
68  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by fed_id, tt_id, gol_id ");
69  m_readStmt->setInt(1, iovID);
70  ResultSet* rset = m_readStmt->executeQuery();
71 
72  // std::vector< ODGolBiasCurrentDat > p;
74  while (rset->next()) {
75  // dat.setId( rset->getInt(1) );
76  dat.setFedId(rset->getInt(2));
77  dat.setTTId(rset->getInt(3));
78  dat.setGolId(rset->getInt(4));
79  dat.setCurrent(rset->getInt(5));
80  dat.setPLLCurrent(rset->getInt(6));
81  dat.setStatus(rset->getInt(7));
82 
83  p->push_back(dat);
84  }
85 
86  } catch (SQLException& e) {
87  throw(std::runtime_error("ODGolBiasCurrentDat::fetchData(): " + e.getMessage()));
88  }
89 }
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
int fetchID() noexcept(false)
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
std::string getTable() override
Statement * m_readStmt
Definition: IODConfig.h:34
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23

◆ getCurrent()

int ODGolBiasCurrentDat::getCurrent ( ) const
inline

Definition at line 33 of file ODGolBiasCurrentDat.h.

References m_cur.

Referenced by writeArrayDB().

33 { return m_cur; }

◆ getFedId()

int ODGolBiasCurrentDat::getFedId ( ) const
inline

Definition at line 27 of file ODGolBiasCurrentDat.h.

References m_fed.

Referenced by writeArrayDB().

27 { return m_fed; }

◆ getGolId()

int ODGolBiasCurrentDat::getGolId ( ) const
inline

Definition at line 24 of file ODGolBiasCurrentDat.h.

References m_gol.

Referenced by writeArrayDB().

24 { return m_gol; }

◆ getId()

int ODGolBiasCurrentDat::getId ( void  ) const
inline

Definition at line 21 of file ODGolBiasCurrentDat.h.

References m_ID.

21 { return m_ID; }

◆ getPLLCurrent()

int ODGolBiasCurrentDat::getPLLCurrent ( ) const
inline

Definition at line 36 of file ODGolBiasCurrentDat.h.

References m_pll_cur.

Referenced by writeArrayDB().

36 { return m_pll_cur; }

◆ getStatus()

int ODGolBiasCurrentDat::getStatus ( ) const
inline

Definition at line 39 of file ODGolBiasCurrentDat.h.

References m_sta.

Referenced by writeArrayDB().

39 { return m_sta; }

◆ getTable()

std::string ODGolBiasCurrentDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 18 of file ODGolBiasCurrentDat.h.

18 { return "GOL_BIAS_CURRENT_DAT"; }

◆ getTTId()

int ODGolBiasCurrentDat::getTTId ( ) const
inline

Definition at line 30 of file ODGolBiasCurrentDat.h.

References m_tt.

Referenced by writeArrayDB().

30 { return m_tt; }

◆ prepareWrite()

void ODGolBiasCurrentDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 26 of file ODGolBiasCurrentDat.cc.

References MillePedeFileConverter_cfg::e.

26  {
27  this->checkConnection();
28 
29  try {
30  m_writeStmt = m_conn->createStatement();
31  m_writeStmt->setSQL("INSERT INTO " + getTable() +
32  " (rec_id, fed_id, tt_id, gol_id, gol_current, pll_current, status ) "
33  "VALUES (:1, :2, :3, :4, :5 , :6, :7)");
34  } catch (SQLException& e) {
35  throw(std::runtime_error("ODGolBiasCurrentDat::prepareWrite(): " + e.getMessage()));
36  }
37 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
Statement * m_writeStmt
Definition: IODConfig.h:33
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
std::string getTable() override

◆ setCurrent()

void ODGolBiasCurrentDat::setCurrent ( int  dac)
inline

Definition at line 32 of file ODGolBiasCurrentDat.h.

References m_cur.

Referenced by fetchData().

32 { m_cur = dac; }

◆ setFedId()

void ODGolBiasCurrentDat::setFedId ( int  dac)
inline

Definition at line 26 of file ODGolBiasCurrentDat.h.

References m_fed.

Referenced by fetchData().

26 { m_fed = dac; }

◆ setGolId()

void ODGolBiasCurrentDat::setGolId ( int  dac)
inline

Definition at line 23 of file ODGolBiasCurrentDat.h.

References m_gol.

Referenced by fetchData().

23 { m_gol = dac; }

◆ setId()

void ODGolBiasCurrentDat::setId ( int  dac)
inline

Definition at line 20 of file ODGolBiasCurrentDat.h.

References m_ID.

20 { m_ID = dac; }

◆ setPLLCurrent()

void ODGolBiasCurrentDat::setPLLCurrent ( int  x)
inline

Definition at line 35 of file ODGolBiasCurrentDat.h.

References m_pll_cur, and x.

Referenced by fetchData().

◆ setStatus()

void ODGolBiasCurrentDat::setStatus ( int  dac)
inline

Definition at line 38 of file ODGolBiasCurrentDat.h.

References m_sta.

Referenced by fetchData().

38 { m_sta = dac; }

◆ setTTId()

void ODGolBiasCurrentDat::setTTId ( int  dac)
inline

Definition at line 29 of file ODGolBiasCurrentDat.h.

References m_tt.

Referenced by fetchData().

29 { m_tt = dac; }

◆ writeArrayDB()

void ODGolBiasCurrentDat::writeArrayDB ( const std::vector< ODGolBiasCurrentDat > &  data,
ODGolBiasCurrentInfo iov 
)
privatenoexcept

Definition at line 93 of file ODGolBiasCurrentDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getCurrent(), getFedId(), getGolId(), getPLLCurrent(), getStatus(), getTTId(), createfilelist::int, GetRecoTauVFromDQM_MC_cff::kk, geometryCSVtoXML::xx, geometryCSVtoXML::yy, and geometryCSVtoXML::zz.

94  {
95  this->checkConnection();
96 
97  int iovID = iov->fetchID();
98  if (!iovID) {
99  throw(std::runtime_error("ODDelays::writeArrayDB: ODFEDelaysInfo not in DB"));
100  }
101 
102  int nrows = data.size();
103  int* ids = new int[nrows];
104  int* xx = new int[nrows];
105  int* yy = new int[nrows];
106  int* zz = new int[nrows];
107  int* ww = new int[nrows];
108  int* kk = new int[nrows];
109  int* st = new int[nrows];
110 
111  ub2* ids_len = new ub2[nrows];
112  ub2* x_len = new ub2[nrows];
113  ub2* y_len = new ub2[nrows];
114  ub2* z_len = new ub2[nrows];
115  ub2* w_len = new ub2[nrows];
116  ub2* k_len = new ub2[nrows];
117  ub2* st_len = new ub2[nrows];
118 
119  ODGolBiasCurrentDat dataitem;
120 
121  for (int count = 0; count != (int)data.size(); count++) {
122  dataitem = data[count];
123  ids[count] = iovID;
124  xx[count] = dataitem.getFedId();
125  yy[count] = dataitem.getTTId();
126  zz[count] = dataitem.getGolId();
127  ww[count] = dataitem.getCurrent();
128  kk[count] = dataitem.getPLLCurrent();
129  st[count] = dataitem.getStatus();
130 
131  ids_len[count] = sizeof(ids[count]);
132  x_len[count] = sizeof(xx[count]);
133  y_len[count] = sizeof(yy[count]);
134  z_len[count] = sizeof(zz[count]);
135  w_len[count] = sizeof(ww[count]);
136  k_len[count] = sizeof(kk[count]);
137  st_len[count] = sizeof(st[count]);
138  }
139 
140  try {
141  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
142  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
143  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
144  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT, sizeof(zz[0]), z_len);
145  m_writeStmt->setDataBuffer(5, (dvoid*)ww, OCCIINT, sizeof(ww[0]), w_len);
146  m_writeStmt->setDataBuffer(6, (dvoid*)kk, OCCIINT, sizeof(kk[0]), k_len);
147  m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
148 
149  m_writeStmt->executeArrayUpdate(nrows);
150 
151  delete[] ids;
152  delete[] xx;
153  delete[] yy;
154  delete[] zz;
155  delete[] ww;
156  delete[] kk;
157  delete[] st;
158 
159  delete[] ids_len;
160  delete[] x_len;
161  delete[] y_len;
162  delete[] z_len;
163  delete[] w_len;
164  delete[] k_len;
165  delete[] st_len;
166 
167  } catch (SQLException& e) {
168  throw(std::runtime_error("ODGolBiasCurrentDat::writeArrayDB(): " + e.getMessage()));
169  }
170 }
Statement * m_writeStmt
Definition: IODConfig.h:33
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
int fetchID() noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20

◆ writeDB()

void ODGolBiasCurrentDat::writeDB ( const ODGolBiasCurrentDat item,
ODGolBiasCurrentInfo iov 
)
privatenoexcept

Definition at line 39 of file ODGolBiasCurrentDat.cc.

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

39  {
40  this->checkConnection();
41 
42  try {
43  m_writeStmt->setInt(1, item->getId());
44  m_writeStmt->setInt(2, item->getFedId());
45  m_writeStmt->setInt(3, item->getTTId());
46  m_writeStmt->setInt(4, item->getGolId());
47  m_writeStmt->setInt(5, item->getCurrent());
48  m_writeStmt->setInt(6, item->getPLLCurrent());
49  m_writeStmt->setInt(7, item->getStatus());
50 
51  m_writeStmt->executeUpdate();
52  } catch (SQLException& e) {
53  throw(std::runtime_error("ODGolBiasCurrentDat::writeDB(): " + e.getMessage()));
54  }
55 }
Statement * m_writeStmt
Definition: IODConfig.h:33
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file ODGolBiasCurrentDat.h.

Member Data Documentation

◆ m_cur

int ODGolBiasCurrentDat::m_cur
private

Definition at line 54 of file ODGolBiasCurrentDat.h.

Referenced by getCurrent(), and setCurrent().

◆ m_fed

int ODGolBiasCurrentDat::m_fed
private

Definition at line 52 of file ODGolBiasCurrentDat.h.

Referenced by getFedId(), and setFedId().

◆ m_gol

int ODGolBiasCurrentDat::m_gol
private

Definition at line 51 of file ODGolBiasCurrentDat.h.

Referenced by getGolId(), and setGolId().

◆ m_ID

int ODGolBiasCurrentDat::m_ID
private

Definition at line 57 of file ODGolBiasCurrentDat.h.

Referenced by getId(), and setId().

◆ m_pll_cur

int ODGolBiasCurrentDat::m_pll_cur
private

Definition at line 55 of file ODGolBiasCurrentDat.h.

Referenced by getPLLCurrent(), and setPLLCurrent().

◆ m_sta

int ODGolBiasCurrentDat::m_sta
private

Definition at line 56 of file ODGolBiasCurrentDat.h.

Referenced by getStatus(), and setStatus().

◆ m_tt

int ODGolBiasCurrentDat::m_tt
private

Definition at line 53 of file ODGolBiasCurrentDat.h.

Referenced by getTTId(), and setTTId().