CMS 3D CMS Logo

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

#include <FEConfigBadStripDat.h>

Inheritance diagram for FEConfigBadStripDat:
IODConfig IDBObject

Public Member Functions

 FEConfigBadStripDat ()
 
int getFedId () const
 
int getId () const
 
int getStatus () const
 
int getStripId () const
 
std::string getTable () override
 
int getTCCId () const
 
int getTTId () const
 
void setFedId (int dac)
 
void setId (int dac)
 
void setStatus (int dac)
 
void setStripId (int dac)
 
void setTCCId (int dac)
 
void setTTId (int dac)
 
 ~FEConfigBadStripDat () 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< FEConfigBadStripDat > *fillMap, FEConfigBadStripInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< FEConfigBadStripDat > &data, FEConfigBadStripInfo *iov) noexcept(false)
 
void writeDB (const FEConfigBadStripDat *item, FEConfigBadStripInfo *iov) noexcept(false)
 

Private Attributes

int m_fed
 
int m_ID
 
int m_t1
 
int m_tcc
 
int m_tt
 
int m_xt
 

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 10 of file FEConfigBadStripDat.h.

Constructor & Destructor Documentation

◆ FEConfigBadStripDat()

FEConfigBadStripDat::FEConfigBadStripDat ( )

Definition at line 10 of file FEConfigBadStripDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
16  m_tcc = 0;
17  m_fed = 0;
18  m_tt = 0;
19  m_xt = 0;
20  m_t1 = 0;
21 }
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

◆ ~FEConfigBadStripDat()

FEConfigBadStripDat::~FEConfigBadStripDat ( )
override

Definition at line 23 of file FEConfigBadStripDat.cc.

23 {}

Member Function Documentation

◆ fetchData()

void FEConfigBadStripDat::fetchData ( std::vector< FEConfigBadStripDat > *  fillMap,
FEConfigBadStripInfo iov 
)
privatenoexcept

Definition at line 55 of file FEConfigBadStripDat.cc.

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

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

◆ getFedId()

int FEConfigBadStripDat::getFedId ( ) const
inline

Definition at line 23 of file FEConfigBadStripDat.h.

References m_fed.

Referenced by writeArrayDB().

23 { return m_fed; }

◆ getId()

int FEConfigBadStripDat::getId ( void  ) const
inline

Definition at line 20 of file FEConfigBadStripDat.h.

References m_ID.

20 { return m_ID; }

◆ getStatus()

int FEConfigBadStripDat::getStatus ( ) const
inline

Definition at line 35 of file FEConfigBadStripDat.h.

References m_t1.

Referenced by popcon::EcalTPGBadStripHandler::getNewObjects(), and writeArrayDB().

35 { return m_t1; }

◆ getStripId()

int FEConfigBadStripDat::getStripId ( ) const
inline

Definition at line 32 of file FEConfigBadStripDat.h.

References m_xt.

Referenced by popcon::EcalTPGBadStripHandler::getNewObjects(), and writeArrayDB().

32 { return m_xt; }

◆ getTable()

std::string FEConfigBadStripDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 17 of file FEConfigBadStripDat.h.

17 { return "FE_CONFIG_BadST_DAT"; }

◆ getTCCId()

int FEConfigBadStripDat::getTCCId ( ) const
inline

Definition at line 26 of file FEConfigBadStripDat.h.

References m_tcc.

Referenced by popcon::EcalTPGBadStripHandler::getNewObjects(), and writeArrayDB().

26 { return m_tcc; }

◆ getTTId()

int FEConfigBadStripDat::getTTId ( ) const
inline

Definition at line 29 of file FEConfigBadStripDat.h.

References m_tt.

Referenced by popcon::EcalTPGBadStripHandler::getNewObjects(), and writeArrayDB().

29 { return m_tt; }

◆ prepareWrite()

void FEConfigBadStripDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 25 of file FEConfigBadStripDat.cc.

References MillePedeFileConverter_cfg::e.

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL("INSERT INTO " + getTable() +
31  " (rec_id, tcc_id,fed_id, tt_id, st_id, status ) "
32  "VALUES (:1, :2, :3, :4, :5 ,:6 )");
33  } catch (SQLException& e) {
34  throw(std::runtime_error("FEConfigBadStripDat::prepareWrite(): " + e.getMessage()));
35  }
36 }
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
std::string getTable() override
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20

◆ setFedId()

void FEConfigBadStripDat::setFedId ( int  dac)
inline

Definition at line 22 of file FEConfigBadStripDat.h.

References m_fed.

Referenced by fetchData().

22 { m_fed = dac; }

◆ setId()

void FEConfigBadStripDat::setId ( int  dac)
inline

Definition at line 19 of file FEConfigBadStripDat.h.

References m_ID.

19 { m_ID = dac; }

◆ setStatus()

void FEConfigBadStripDat::setStatus ( int  dac)
inline

Definition at line 34 of file FEConfigBadStripDat.h.

References m_t1.

Referenced by fetchData().

34 { m_t1 = dac; }

◆ setStripId()

void FEConfigBadStripDat::setStripId ( int  dac)
inline

Definition at line 31 of file FEConfigBadStripDat.h.

References m_xt.

Referenced by fetchData().

31 { m_xt = dac; }

◆ setTCCId()

void FEConfigBadStripDat::setTCCId ( int  dac)
inline

Definition at line 25 of file FEConfigBadStripDat.h.

References m_tcc.

Referenced by fetchData().

25 { m_tcc = dac; }

◆ setTTId()

void FEConfigBadStripDat::setTTId ( int  dac)
inline

Definition at line 28 of file FEConfigBadStripDat.h.

References m_tt.

Referenced by fetchData().

28 { m_tt = dac; }

◆ writeArrayDB()

void FEConfigBadStripDat::writeArrayDB ( const std::vector< FEConfigBadStripDat > &  data,
FEConfigBadStripInfo iov 
)
privatenoexcept

Definition at line 90 of file FEConfigBadStripDat.cc.

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

91  {
92  this->checkConnection();
93 
94  int iovID = iov->fetchID();
95  if (!iovID) {
96  throw(std::runtime_error("FEConfigDelays::writeArrayDB: FEConfigBadStripInfo 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* z1 = 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* z1_len = new ub2[nrows];
112  ub2* st_len = new ub2[nrows];
113 
114  FEConfigBadStripDat dataitem;
115 
116  for (size_t count = 0; count != data.size(); count++) {
117  dataitem = data[count];
118  ids[count] = iovID;
119  xx[count] = dataitem.getTCCId();
120  yy[count] = dataitem.getFedId();
121  zz[count] = dataitem.getTTId();
122  z1[count] = dataitem.getStripId();
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  z1_len[count] = sizeof(z1[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*)z1, OCCIINT, sizeof(z1[0]), z1_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[] z1;
148  delete[] st;
149 
150  delete[] ids_len;
151  delete[] x_len;
152  delete[] y_len;
153  delete[] z_len;
154  delete[] z1_len;
155  delete[] st_len;
156 
157  } catch (SQLException& e) {
158  throw(std::runtime_error("FEConfigBadStripDat::writeArrayDB(): " + e.getMessage()));
159  }
160 }
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:80
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20

◆ writeDB()

void FEConfigBadStripDat::writeDB ( const FEConfigBadStripDat item,
FEConfigBadStripInfo iov 
)
privatenoexcept

Definition at line 38 of file FEConfigBadStripDat.cc.

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

38  {
39  this->checkConnection();
40 
41  try {
42  m_writeStmt->setInt(1, item->getId());
43  m_writeStmt->setInt(2, item->getTCCId());
44  m_writeStmt->setInt(3, item->getFedId());
45  m_writeStmt->setInt(4, item->getTTId());
46  m_writeStmt->setInt(5, item->getStripId());
47  m_writeStmt->setInt(6, item->getStatus());
48 
49  m_writeStmt->executeUpdate();
50  } catch (SQLException& e) {
51  throw(std::runtime_error("FEConfigBadStripDat::writeDB(): " + e.getMessage()));
52  }
53 }
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 12 of file FEConfigBadStripDat.h.

Member Data Documentation

◆ m_fed

int FEConfigBadStripDat::m_fed
private

Definition at line 48 of file FEConfigBadStripDat.h.

Referenced by getFedId(), and setFedId().

◆ m_ID

int FEConfigBadStripDat::m_ID
private

Definition at line 52 of file FEConfigBadStripDat.h.

Referenced by getId(), and setId().

◆ m_t1

int FEConfigBadStripDat::m_t1
private

Definition at line 51 of file FEConfigBadStripDat.h.

Referenced by getStatus(), and setStatus().

◆ m_tcc

int FEConfigBadStripDat::m_tcc
private

Definition at line 47 of file FEConfigBadStripDat.h.

Referenced by getTCCId(), and setTCCId().

◆ m_tt

int FEConfigBadStripDat::m_tt
private

Definition at line 49 of file FEConfigBadStripDat.h.

Referenced by getTTId(), and setTTId().

◆ m_xt

int FEConfigBadStripDat::m_xt
private

Definition at line 50 of file FEConfigBadStripDat.h.

Referenced by getStripId(), and setStripId().