CMS 3D CMS Logo

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

#include <ODBadTTDat.h>

Inheritance diagram for ODBadTTDat:
IODConfig IDBObject

Public Member Functions

int getFedId () const
 
int getId () const
 
int getSMId () const
 
int getStatus () const
 
std::string getTable () override
 
int getTRId () const
 
int getTTId () const
 
 ODBadTTDat ()
 
void setFedId (int dac)
 
void setId (int dac)
 
void setSMId (int dac)
 
void setStatus (int dac)
 
void setTRId (int dac)
 
void setTTId (int dac)
 
 ~ODBadTTDat () 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< ODBadTTDat > *fillMap, ODBadTTInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< ODBadTTDat > &data, ODBadTTInfo *iov) noexcept(false)
 
void writeDB (const ODBadTTDat *item, ODBadTTInfo *iov) noexcept(false)
 

Private Attributes

int m_fed
 
int m_ID
 
int m_sm
 
int m_t1
 
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 10 of file ODBadTTDat.h.

Constructor & Destructor Documentation

◆ ODBadTTDat()

ODBadTTDat::ODBadTTDat ( )

Definition at line 10 of file ODBadTTDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
16  m_sm = 0;
17  m_fed = 0;
18  m_tt = 0;
19  m_t1 = 0;
20 }

◆ ~ODBadTTDat()

ODBadTTDat::~ODBadTTDat ( )
override

Definition at line 22 of file ODBadTTDat.cc.

22 {}

Member Function Documentation

◆ fetchData()

void ODBadTTDat::fetchData ( std::vector< ODBadTTDat > *  fillMap,
ODBadTTInfo iov 
)
privatenoexcept

Definition at line 53 of file ODBadTTDat.cc.

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

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setFedId(), setStatus(), setTRId(), and setTTId().

◆ getFedId()

int ODBadTTDat::getFedId ( ) const
inline

Definition at line 29 of file ODBadTTDat.h.

29 { return m_fed; }

References m_fed.

Referenced by writeArrayDB().

◆ getId()

int ODBadTTDat::getId ( void  ) const
inline

Definition at line 20 of file ODBadTTDat.h.

20 { return m_ID; }

References m_ID.

◆ getSMId()

int ODBadTTDat::getSMId ( ) const
inline

Definition at line 23 of file ODBadTTDat.h.

23 { return m_sm; }

References m_sm.

◆ getStatus()

int ODBadTTDat::getStatus ( ) const
inline

Definition at line 35 of file ODBadTTDat.h.

35 { return m_t1; }

References m_t1.

Referenced by writeArrayDB().

◆ getTable()

std::string ODBadTTDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 17 of file ODBadTTDat.h.

17 { return "BAD_TT_DAT"; }

◆ getTRId()

int ODBadTTDat::getTRId ( ) const
inline

Definition at line 26 of file ODBadTTDat.h.

26 { return m_sm; }

References m_sm.

Referenced by writeArrayDB().

◆ getTTId()

int ODBadTTDat::getTTId ( ) const
inline

Definition at line 32 of file ODBadTTDat.h.

32 { return m_tt; }

References m_tt.

Referenced by writeArrayDB().

◆ prepareWrite()

void ODBadTTDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 24 of file ODBadTTDat.cc.

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

References MillePedeFileConverter_cfg::e.

◆ setFedId()

void ODBadTTDat::setFedId ( int  dac)
inline

Definition at line 28 of file ODBadTTDat.h.

28 { m_fed = dac; }

References m_fed.

Referenced by fetchData().

◆ setId()

void ODBadTTDat::setId ( int  dac)
inline

Definition at line 19 of file ODBadTTDat.h.

19 { m_ID = dac; }

References m_ID.

◆ setSMId()

void ODBadTTDat::setSMId ( int  dac)
inline

Definition at line 22 of file ODBadTTDat.h.

22 { m_sm = dac; }

References m_sm.

◆ setStatus()

void ODBadTTDat::setStatus ( int  dac)
inline

Definition at line 34 of file ODBadTTDat.h.

34 { m_t1 = dac; }

References m_t1.

Referenced by fetchData().

◆ setTRId()

void ODBadTTDat::setTRId ( int  dac)
inline

Definition at line 25 of file ODBadTTDat.h.

25 { m_sm = dac; }

References m_sm.

Referenced by fetchData().

◆ setTTId()

void ODBadTTDat::setTTId ( int  dac)
inline

Definition at line 31 of file ODBadTTDat.h.

31 { m_tt = dac; }

References m_tt.

Referenced by fetchData().

◆ writeArrayDB()

void ODBadTTDat::writeArrayDB ( const std::vector< ODBadTTDat > &  data,
ODBadTTInfo iov 
)
privatenoexcept

Definition at line 86 of file ODBadTTDat.cc.

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

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getFedId(), getStatus(), getTRId(), getTTId(), geometryCSVtoXML::xx, geometryCSVtoXML::yy, and geometryCSVtoXML::zz.

◆ writeDB()

void ODBadTTDat::writeDB ( const ODBadTTDat item,
ODBadTTInfo iov 
)
privatenoexcept

Definition at line 37 of file ODBadTTDat.cc.

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

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 12 of file ODBadTTDat.h.

Member Data Documentation

◆ m_fed

int ODBadTTDat::m_fed
private

Definition at line 48 of file ODBadTTDat.h.

Referenced by getFedId(), and setFedId().

◆ m_ID

int ODBadTTDat::m_ID
private

Definition at line 51 of file ODBadTTDat.h.

Referenced by getId(), and setId().

◆ m_sm

int ODBadTTDat::m_sm
private

Definition at line 47 of file ODBadTTDat.h.

Referenced by getSMId(), getTRId(), setSMId(), and setTRId().

◆ m_t1

int ODBadTTDat::m_t1
private

Definition at line 50 of file ODBadTTDat.h.

Referenced by getStatus(), and setStatus().

◆ m_tt

int ODBadTTDat::m_tt
private

Definition at line 49 of file ODBadTTDat.h.

Referenced by getTTId(), and setTTId().

ODBadTTDat::setTTId
void setTTId(int dac)
Definition: ODBadTTDat.h:31
ODBadTTDat::setFedId
void setFedId(int dac)
Definition: ODBadTTDat.h:28
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
ODBadTTDat::getFedId
int getFedId() const
Definition: ODBadTTDat.h:29
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
ODBadTTDat::getTable
std::string getTable() override
Definition: ODBadTTDat.h:17
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
ODBadTTDat::m_sm
int m_sm
Definition: ODBadTTDat.h:47
ODBadTTDat::getTRId
int getTRId() const
Definition: ODBadTTDat.h:26
ODBadTTDat::m_tt
int m_tt
Definition: ODBadTTDat.h:49
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
ODBadTTDat::setTRId
void setTRId(int dac)
Definition: ODBadTTDat.h:25
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
IODConfig::m_readStmt
Statement * m_readStmt
Definition: IODConfig.h:34
ODBadTTDat::m_fed
int m_fed
Definition: ODBadTTDat.h:48
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
ODBadTTDat::setStatus
void setStatus(int dac)
Definition: ODBadTTDat.h:34
ODBadTTInfo::fetchID
int fetchID() noexcept(false)
Definition: ODBadTTInfo.cc:142
ODBadTTDat
Definition: ODBadTTDat.h:10
ODBadTTDat::getId
int getId() const
Definition: ODBadTTDat.h:20
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
ODBadTTDat::getTTId
int getTTId() const
Definition: ODBadTTDat.h:32
ODBadTTDat::m_ID
int m_ID
Definition: ODBadTTDat.h:51
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
ODBadTTDat::m_t1
int m_t1
Definition: ODBadTTDat.h:50
ODBadTTDat::getStatus
int getStatus() const
Definition: ODBadTTDat.h:35
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37