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 const int 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 }

◆ ~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.

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 }

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

◆ getCurrent()

int ODGolBiasCurrentDat::getCurrent ( ) const
inline

Definition at line 33 of file ODGolBiasCurrentDat.h.

33 { return m_cur; }

References m_cur.

Referenced by writeArrayDB().

◆ getFedId()

int ODGolBiasCurrentDat::getFedId ( ) const
inline

Definition at line 27 of file ODGolBiasCurrentDat.h.

27 { return m_fed; }

References m_fed.

Referenced by writeArrayDB().

◆ getGolId()

int ODGolBiasCurrentDat::getGolId ( ) const
inline

Definition at line 24 of file ODGolBiasCurrentDat.h.

24 { return m_gol; }

References m_gol.

Referenced by writeArrayDB().

◆ getId()

int ODGolBiasCurrentDat::getId ( void  ) const
inline

Definition at line 21 of file ODGolBiasCurrentDat.h.

21 { return m_ID; }

References m_ID.

◆ getPLLCurrent()

int ODGolBiasCurrentDat::getPLLCurrent ( ) const
inline

Definition at line 36 of file ODGolBiasCurrentDat.h.

36 { return m_pll_cur; }

References m_pll_cur.

Referenced by writeArrayDB().

◆ getStatus()

int ODGolBiasCurrentDat::getStatus ( ) const
inline

Definition at line 39 of file ODGolBiasCurrentDat.h.

39 { return m_sta; }

References m_sta.

Referenced by writeArrayDB().

◆ 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.

30 { return m_tt; }

References m_tt.

Referenced by writeArrayDB().

◆ prepareWrite()

void ODGolBiasCurrentDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 26 of file ODGolBiasCurrentDat.cc.

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 }

References MillePedeFileConverter_cfg::e.

◆ setCurrent()

void ODGolBiasCurrentDat::setCurrent ( int  dac)
inline

Definition at line 32 of file ODGolBiasCurrentDat.h.

32 { m_cur = dac; }

References m_cur.

Referenced by fetchData().

◆ setFedId()

void ODGolBiasCurrentDat::setFedId ( int  dac)
inline

Definition at line 26 of file ODGolBiasCurrentDat.h.

26 { m_fed = dac; }

References m_fed.

Referenced by fetchData().

◆ setGolId()

void ODGolBiasCurrentDat::setGolId ( int  dac)
inline

Definition at line 23 of file ODGolBiasCurrentDat.h.

23 { m_gol = dac; }

References m_gol.

Referenced by fetchData().

◆ setId()

void ODGolBiasCurrentDat::setId ( int  dac)
inline

Definition at line 20 of file ODGolBiasCurrentDat.h.

20 { m_ID = dac; }

References m_ID.

◆ setPLLCurrent()

void ODGolBiasCurrentDat::setPLLCurrent ( int  x)
inline

Definition at line 35 of file ODGolBiasCurrentDat.h.

35 { m_pll_cur = x; }

References m_pll_cur, and x.

Referenced by fetchData().

◆ setStatus()

void ODGolBiasCurrentDat::setStatus ( int  dac)
inline

Definition at line 38 of file ODGolBiasCurrentDat.h.

38 { m_sta = dac; }

References m_sta.

Referenced by fetchData().

◆ setTTId()

void ODGolBiasCurrentDat::setTTId ( int  dac)
inline

Definition at line 29 of file ODGolBiasCurrentDat.h.

29 { m_tt = dac; }

References m_tt.

Referenced by fetchData().

◆ writeArrayDB()

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

Definition at line 93 of file ODGolBiasCurrentDat.cc.

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 }

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.

◆ writeDB()

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

Definition at line 39 of file ODGolBiasCurrentDat.cc.

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 }

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

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

geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
ODGolBiasCurrentDat::getPLLCurrent
int getPLLCurrent() const
Definition: ODGolBiasCurrentDat.h:36
ODGolBiasCurrentDat::getTable
std::string getTable() override
Definition: ODGolBiasCurrentDat.h:18
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ODGolBiasCurrentDat::setGolId
void setGolId(int dac)
Definition: ODGolBiasCurrentDat.h:23
ODGolBiasCurrentDat::getId
int getId() const
Definition: ODGolBiasCurrentDat.h:21
DDAxes::x
ODGolBiasCurrentDat::getTTId
int getTTId() const
Definition: ODGolBiasCurrentDat.h:30
ODGolBiasCurrentDat::getStatus
int getStatus() const
Definition: ODGolBiasCurrentDat.h:39
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
ODGolBiasCurrentDat::m_gol
int m_gol
Definition: ODGolBiasCurrentDat.h:51
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
ODGolBiasCurrentDat::getGolId
int getGolId() const
Definition: ODGolBiasCurrentDat.h:24
ODGolBiasCurrentDat::m_sta
int m_sta
Definition: ODGolBiasCurrentDat.h:56
ODGolBiasCurrentDat
Definition: ODGolBiasCurrentDat.h:11
ODGolBiasCurrentDat::getCurrent
int getCurrent() const
Definition: ODGolBiasCurrentDat.h:33
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
GetRecoTauVFromDQM_MC_cff.kk
kk
Definition: GetRecoTauVFromDQM_MC_cff.py:84
ODGolBiasCurrentDat::m_tt
int m_tt
Definition: ODGolBiasCurrentDat.h:53
ODGolBiasCurrentDat::m_cur
int m_cur
Definition: ODGolBiasCurrentDat.h:54
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
IODConfig::m_readStmt
Statement * m_readStmt
Definition: IODConfig.h:34
ODGolBiasCurrentDat::m_fed
int m_fed
Definition: ODGolBiasCurrentDat.h:52
createfilelist.int
int
Definition: createfilelist.py:10
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
ODGolBiasCurrentInfo::fetchID
int fetchID() noexcept(false)
Definition: ODGolBiasCurrentInfo.cc:153
ODGolBiasCurrentDat::setCurrent
void setCurrent(int dac)
Definition: ODGolBiasCurrentDat.h:32
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
IODConfig::m_writeStmt
Statement * m_writeStmt
Definition: IODConfig.h:33
ODGolBiasCurrentDat::getFedId
int getFedId() const
Definition: ODGolBiasCurrentDat.h:27
ODGolBiasCurrentDat::setPLLCurrent
void setPLLCurrent(int x)
Definition: ODGolBiasCurrentDat.h:35
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
ODGolBiasCurrentDat::m_ID
int m_ID
Definition: ODGolBiasCurrentDat.h:57
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
ODGolBiasCurrentDat::setTTId
void setTTId(int dac)
Definition: ODGolBiasCurrentDat.h:29
ODGolBiasCurrentDat::setFedId
void setFedId(int dac)
Definition: ODGolBiasCurrentDat.h:26
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
ODGolBiasCurrentDat::setStatus
void setStatus(int dac)
Definition: ODGolBiasCurrentDat.h:38
ODGolBiasCurrentDat::m_pll_cur
int m_pll_cur
Definition: ODGolBiasCurrentDat.h:55