CMS 3D CMS Logo

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

#include <ODTowersToByPassDat.h>

Inheritance diagram for ODTowersToByPassDat:
IODConfig IDBObject

Public Member Functions

int getFedId () const
 
int getId () const
 
int getStatus () const
 
std::string getTable () override
 
int getTimeCorr () const
 
int getTrId () const
 
int getTTId () const
 
 ODTowersToByPassDat ()
 
void setFedId (int dac)
 
void setId (int dac)
 
void setStatus (int dac)
 
void setTimeCorr (int dac)
 
void setTrId (int dac)
 
void setTTId (int dac)
 
 ~ODTowersToByPassDat () 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< ODTowersToByPassDat > *fillMap, ODTowersToByPassInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< ODTowersToByPassDat > &data, ODTowersToByPassInfo *iov) noexcept(false)
 
void writeDB (const ODTowersToByPassDat *item, ODTowersToByPassInfo *iov) noexcept(false)
 

Private Attributes

int m_fed
 
int m_ID
 
int m_sta
 
int m_time
 
int m_tr
 
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 ODTowersToByPassDat.h.

Constructor & Destructor Documentation

◆ ODTowersToByPassDat()

ODTowersToByPassDat::ODTowersToByPassDat ( )

Definition at line 10 of file ODTowersToByPassDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
16  m_fed = 0;
17  m_tt = 0;
18  m_tr = 0;
19  m_time = 0;
20  m_sta = 0;
21 }

◆ ~ODTowersToByPassDat()

ODTowersToByPassDat::~ODTowersToByPassDat ( )
override

Definition at line 23 of file ODTowersToByPassDat.cc.

23 {}

Member Function Documentation

◆ fetchData()

void ODTowersToByPassDat::fetchData ( std::vector< ODTowersToByPassDat > *  fillMap,
ODTowersToByPassInfo iov 
)
privatenoexcept

Definition at line 55 of file ODTowersToByPassDat.cc.

55  {
56  this->checkConnection();
57 
58  iov->setConnection(m_env, m_conn);
59  int iovID = iov->fetchID();
60  if (!iovID) {
61  std::cout << "ID not in the DB" << endl;
62  return;
63  }
64 
65  try {
66  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by fed_id, tr_id, tt_id ");
67  m_readStmt->setInt(1, iovID);
68  ResultSet* rset = m_readStmt->executeQuery();
69 
70  // std::vector< ODTowersToByPassDat > p;
72  while (rset->next()) {
73  // dat.setId( rset->getInt(1) );
74  dat.setFedId(rset->getInt(2));
75  dat.setTrId(rset->getInt(3));
76  dat.setTTId(rset->getInt(4));
77  dat.setTimeCorr(rset->getInt(5));
78  dat.setStatus(rset->getInt(6));
79 
80  p->push_back(dat);
81  }
82 
83  } catch (SQLException& e) {
84  throw(std::runtime_error("ODTowersToByPassDat::fetchData(): " + e.getMessage()));
85  }
86 }

References gather_cfg::cout, MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setFedId(), setStatus(), setTimeCorr(), setTrId(), and setTTId().

◆ getFedId()

int ODTowersToByPassDat::getFedId ( ) const
inline

Definition at line 27 of file ODTowersToByPassDat.h.

27 { return m_fed; }

References m_fed.

Referenced by writeArrayDB().

◆ getId()

int ODTowersToByPassDat::getId ( void  ) const
inline

Definition at line 21 of file ODTowersToByPassDat.h.

21 { return m_ID; }

References m_ID.

◆ getStatus()

int ODTowersToByPassDat::getStatus ( ) const
inline

Definition at line 36 of file ODTowersToByPassDat.h.

36 { return m_sta; }

References m_sta.

Referenced by writeArrayDB().

◆ getTable()

std::string ODTowersToByPassDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 18 of file ODTowersToByPassDat.h.

18 { return "TOWERS_TO_BYPASS_DAT"; }

◆ getTimeCorr()

int ODTowersToByPassDat::getTimeCorr ( ) const
inline

Definition at line 33 of file ODTowersToByPassDat.h.

33 { return m_time; }

References m_time.

Referenced by writeArrayDB().

◆ getTrId()

int ODTowersToByPassDat::getTrId ( ) const
inline

Definition at line 24 of file ODTowersToByPassDat.h.

24 { return m_tr; }

References m_tr.

Referenced by writeArrayDB().

◆ getTTId()

int ODTowersToByPassDat::getTTId ( ) const
inline

Definition at line 30 of file ODTowersToByPassDat.h.

30 { return m_tt; }

References m_tt.

Referenced by writeArrayDB().

◆ prepareWrite()

void ODTowersToByPassDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 25 of file ODTowersToByPassDat.cc.

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL("INSERT INTO " + getTable() +
31  " (rec_id, fed_id, tr_id, tt_id, time_corr, STATUS ) "
32  "VALUES (:1, :2, :3, :4, :5 , :6 )");
33  } catch (SQLException& e) {
34  throw(std::runtime_error("ODTowersToByPassDat::prepareWrite(): " + e.getMessage()));
35  }
36 }

References MillePedeFileConverter_cfg::e.

◆ setFedId()

void ODTowersToByPassDat::setFedId ( int  dac)
inline

Definition at line 26 of file ODTowersToByPassDat.h.

26 { m_fed = dac; }

References m_fed.

Referenced by fetchData().

◆ setId()

void ODTowersToByPassDat::setId ( int  dac)
inline

Definition at line 20 of file ODTowersToByPassDat.h.

20 { m_ID = dac; }

References m_ID.

◆ setStatus()

void ODTowersToByPassDat::setStatus ( int  dac)
inline

Definition at line 35 of file ODTowersToByPassDat.h.

35 { m_sta = dac; }

References m_sta.

Referenced by fetchData().

◆ setTimeCorr()

void ODTowersToByPassDat::setTimeCorr ( int  dac)
inline

Definition at line 32 of file ODTowersToByPassDat.h.

32 { m_time = dac; }

References m_time.

Referenced by fetchData().

◆ setTrId()

void ODTowersToByPassDat::setTrId ( int  dac)
inline

Definition at line 23 of file ODTowersToByPassDat.h.

23 { m_tr = dac; }

References m_tr.

Referenced by fetchData().

◆ setTTId()

void ODTowersToByPassDat::setTTId ( int  dac)
inline

Definition at line 29 of file ODTowersToByPassDat.h.

29 { m_tt = dac; }

References m_tt.

Referenced by fetchData().

◆ writeArrayDB()

void ODTowersToByPassDat::writeArrayDB ( const std::vector< ODTowersToByPassDat > &  data,
ODTowersToByPassInfo iov 
)
privatenoexcept

Definition at line 90 of file ODTowersToByPassDat.cc.

91  {
92  this->checkConnection();
93 
94  int iovID = iov->fetchID();
95  if (!iovID) {
96  throw(std::runtime_error("ODDelays::writeArrayDB: ODFEDelaysInfo not in DB"));
97  }
98 
99  int nrows = data.size();
100  int* ids = new int[nrows];
101  int* xx = new int[nrows];
102  int* yy = new int[nrows];
103  int* zz = new int[nrows];
104  int* ww = new int[nrows];
105  int* st = new int[nrows];
106 
107  ub2* ids_len = new ub2[nrows];
108  ub2* x_len = new ub2[nrows];
109  ub2* y_len = new ub2[nrows];
110  ub2* z_len = new ub2[nrows];
111  ub2* w_len = new ub2[nrows];
112  ub2* st_len = new ub2[nrows];
113 
114  ODTowersToByPassDat dataitem;
115 
116  for (int count = 0; count != (int)data.size(); count++) {
117  dataitem = data[count];
118  ids[count] = iovID;
119  xx[count] = dataitem.getFedId();
120  yy[count] = dataitem.getTrId();
121  zz[count] = dataitem.getTTId();
122  ww[count] = dataitem.getTimeCorr();
123  st[count] = dataitem.getStatus();
124 
125  ids_len[count] = sizeof(ids[count]);
126  x_len[count] = sizeof(xx[count]);
127  y_len[count] = sizeof(yy[count]);
128  z_len[count] = sizeof(zz[count]);
129  w_len[count] = sizeof(ww[count]);
130  st_len[count] = sizeof(st[count]);
131  }
132 
133  try {
134  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
135  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
136  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
137  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT, sizeof(zz[0]), z_len);
138  m_writeStmt->setDataBuffer(5, (dvoid*)ww, OCCIINT, sizeof(ww[0]), w_len);
139  m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
140 
141  m_writeStmt->executeArrayUpdate(nrows);
142 
143  delete[] ids;
144  delete[] xx;
145  delete[] yy;
146  delete[] zz;
147  delete[] ww;
148  delete[] st;
149 
150  delete[] ids_len;
151  delete[] x_len;
152  delete[] y_len;
153  delete[] z_len;
154  delete[] w_len;
155  delete[] st_len;
156 
157  } catch (SQLException& e) {
158  throw(std::runtime_error("ODTowersToByPassDat::writeArrayDB(): " + e.getMessage()));
159  }
160 }

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getFedId(), getStatus(), getTimeCorr(), getTrId(), getTTId(), createfilelist::int, geometryCSVtoXML::xx, geometryCSVtoXML::yy, and geometryCSVtoXML::zz.

◆ writeDB()

void ODTowersToByPassDat::writeDB ( const ODTowersToByPassDat item,
ODTowersToByPassInfo iov 
)
privatenoexcept

Definition at line 38 of file ODTowersToByPassDat.cc.

38  {
39  this->checkConnection();
40 
41  try {
42  m_writeStmt->setInt(1, item->getId());
43  m_writeStmt->setInt(2, item->getFedId());
44  m_writeStmt->setInt(3, item->getTrId());
45  m_writeStmt->setInt(4, item->getTTId());
46  m_writeStmt->setInt(5, item->getTimeCorr());
47  m_writeStmt->setInt(6, item->getStatus());
48 
49  m_writeStmt->executeUpdate();
50  } catch (SQLException& e) {
51  throw(std::runtime_error("ODTowersToByPassDat::writeDB(): " + e.getMessage()));
52  }
53 }

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file ODTowersToByPassDat.h.

Member Data Documentation

◆ m_fed

int ODTowersToByPassDat::m_fed
private

Definition at line 49 of file ODTowersToByPassDat.h.

Referenced by getFedId(), and setFedId().

◆ m_ID

int ODTowersToByPassDat::m_ID
private

Definition at line 53 of file ODTowersToByPassDat.h.

Referenced by getId(), and setId().

◆ m_sta

int ODTowersToByPassDat::m_sta
private

Definition at line 52 of file ODTowersToByPassDat.h.

Referenced by getStatus(), and setStatus().

◆ m_time

int ODTowersToByPassDat::m_time
private

Definition at line 51 of file ODTowersToByPassDat.h.

Referenced by getTimeCorr(), and setTimeCorr().

◆ m_tr

int ODTowersToByPassDat::m_tr
private

Definition at line 48 of file ODTowersToByPassDat.h.

Referenced by getTrId(), and setTrId().

◆ m_tt

int ODTowersToByPassDat::m_tt
private

Definition at line 50 of file ODTowersToByPassDat.h.

Referenced by getTTId(), and setTTId().

geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
ODTowersToByPassDat::setFedId
void setFedId(int dac)
Definition: ODTowersToByPassDat.h:26
ODTowersToByPassDat::m_tr
int m_tr
Definition: ODTowersToByPassDat.h:48
ODTowersToByPassDat::getTable
std::string getTable() override
Definition: ODTowersToByPassDat.h:18
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ODTowersToByPassDat::setTrId
void setTrId(int dac)
Definition: ODTowersToByPassDat.h:23
ODTowersToByPassDat::getId
int getId() const
Definition: ODTowersToByPassDat.h:21
ODTowersToByPassDat::setStatus
void setStatus(int dac)
Definition: ODTowersToByPassDat.h:35
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
ODTowersToByPassDat::m_tt
int m_tt
Definition: ODTowersToByPassDat.h:50
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
ODTowersToByPassInfo::fetchID
int fetchID() noexcept(false)
Definition: ODTowersToByPassInfo.cc:153
ODTowersToByPassDat::getTimeCorr
int getTimeCorr() const
Definition: ODTowersToByPassDat.h:33
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
ODTowersToByPassDat::getStatus
int getStatus() const
Definition: ODTowersToByPassDat.h:36
ODTowersToByPassDat
Definition: ODTowersToByPassDat.h:11
ODTowersToByPassDat::m_ID
int m_ID
Definition: ODTowersToByPassDat.h:53
ODTowersToByPassDat::getTTId
int getTTId() const
Definition: ODTowersToByPassDat.h:30
ODTowersToByPassDat::getTrId
int getTrId() const
Definition: ODTowersToByPassDat.h:24
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
ODTowersToByPassDat::m_time
int m_time
Definition: ODTowersToByPassDat.h:51
createfilelist.int
int
Definition: createfilelist.py:10
ODTowersToByPassDat::setTimeCorr
void setTimeCorr(int dac)
Definition: ODTowersToByPassDat.h:32
ODTowersToByPassDat::setTTId
void setTTId(int dac)
Definition: ODTowersToByPassDat.h:29
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
IODConfig::m_writeStmt
Statement * m_writeStmt
Definition: IODConfig.h:33
ODTowersToByPassDat::m_sta
int m_sta
Definition: ODTowersToByPassDat.h:52
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
ODTowersToByPassDat::m_fed
int m_fed
Definition: ODTowersToByPassDat.h:49
ODTowersToByPassDat::getFedId
int getFedId() const
Definition: ODTowersToByPassDat.h:27
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37