CMS 3D CMS Logo

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

#include <ODDelaysDat.h>

Inheritance diagram for ODDelaysDat:
IODConfig IDBObject

Public Member Functions

int getFedId () const
 
int getId () const
 
int getSMId () const
 
std::string getTable () override
 
int getTimeOffset () const
 
int getTTId () const
 
 ODDelaysDat ()
 
void setFedId (int dac)
 
void setId (int dac)
 
void setSMId (int dac)
 
void setTimeOffset (int dac)
 
void setTTId (int dac)
 
 ~ODDelaysDat () 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< ODDelaysDat > *fillMap, int id) noexcept(false)
 
void fetchData (std::vector< ODDelaysDat > *fillMap, ODFEDelaysInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< ODDelaysDat > &data, ODFEDelaysInfo *iov) noexcept(false)
 
void writeDB (const ODDelaysDat *item, ODFEDelaysInfo *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 ODDelaysDat.h.

Constructor & Destructor Documentation

◆ ODDelaysDat()

ODDelaysDat::ODDelaysDat ( )

Definition at line 10 of file ODDelaysDat.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 }

◆ ~ODDelaysDat()

ODDelaysDat::~ODDelaysDat ( )
override

Definition at line 22 of file ODDelaysDat.cc.

22 {}

Member Function Documentation

◆ fetchData() [1/2]

void ODDelaysDat::fetchData ( std::vector< ODDelaysDat > *  fillMap,
int  id 
)
privatenoexcept

Definition at line 59 of file ODDelaysDat.cc.

59  {
60  this->checkConnection();
61 
62  if (!iovID) {
63  // throw(std::runtime_error("ODDelaysDat::writeDB: IOV not in DB"));
64  return;
65  }
66 
67  try {
68  m_readStmt = m_conn->createStatement();
69  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by sm_id, fed_id, tt_id");
70  m_readStmt->setInt(1, iovID);
71  ResultSet* rset = m_readStmt->executeQuery();
72 
73  // std::vector< ODDelaysDat > p;
74  ODDelaysDat dat;
75  while (rset->next()) {
76  // dat.setId( rset->getInt(1) );
77  dat.setSMId(rset->getInt(2));
78  dat.setFedId(rset->getInt(3));
79  dat.setTTId(rset->getInt(4));
80  dat.setTimeOffset(rset->getInt(5));
81 
82  p->push_back(dat);
83  }
84  } catch (SQLException& e) {
85  throw(std::runtime_error("ODDelaysDat::fetchData(): " + e.getMessage()));
86  }
87 }

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setFedId(), setSMId(), setTimeOffset(), and setTTId().

Referenced by EcalCondDBInterface::fetchFEDelaysForRun().

◆ fetchData() [2/2]

void ODDelaysDat::fetchData ( std::vector< ODDelaysDat > *  fillMap,
ODFEDelaysInfo iov 
)
privatenoexcept

Definition at line 53 of file ODDelaysDat.cc.

53  {
54  iov->setConnection(m_env, m_conn);
55  int iovID = iov->fetchID();
56  fetchData(p, iovID);
57 }

References AlCaHLTBitMon_ParallelJobs::p.

◆ getFedId()

int ODDelaysDat::getFedId ( ) const
inline

Definition at line 26 of file ODDelaysDat.h.

26 { return m_fed; }

References m_fed.

Referenced by writeArrayDB().

◆ getId()

int ODDelaysDat::getId ( void  ) const
inline

Definition at line 20 of file ODDelaysDat.h.

20 { return m_ID; }

References m_ID.

◆ getSMId()

int ODDelaysDat::getSMId ( ) const
inline

Definition at line 23 of file ODDelaysDat.h.

23 { return m_sm; }

References m_sm.

Referenced by writeArrayDB().

◆ getTable()

std::string ODDelaysDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 17 of file ODDelaysDat.h.

17 { return "DELAYS_DAT"; }

◆ getTimeOffset()

int ODDelaysDat::getTimeOffset ( ) const
inline

Definition at line 32 of file ODDelaysDat.h.

32 { return m_t1; }

References m_t1.

Referenced by writeArrayDB().

◆ getTTId()

int ODDelaysDat::getTTId ( ) const
inline

Definition at line 29 of file ODDelaysDat.h.

29 { return m_tt; }

References m_tt.

Referenced by writeArrayDB().

◆ prepareWrite()

void ODDelaysDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 24 of file ODDelaysDat.cc.

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

References MillePedeFileConverter_cfg::e.

◆ setFedId()

void ODDelaysDat::setFedId ( int  dac)
inline

Definition at line 25 of file ODDelaysDat.h.

25 { m_fed = dac; }

References m_fed.

Referenced by fetchData().

◆ setId()

void ODDelaysDat::setId ( int  dac)
inline

Definition at line 19 of file ODDelaysDat.h.

19 { m_ID = dac; }

References m_ID.

◆ setSMId()

void ODDelaysDat::setSMId ( int  dac)
inline

Definition at line 22 of file ODDelaysDat.h.

22 { m_sm = dac; }

References m_sm.

Referenced by fetchData().

◆ setTimeOffset()

void ODDelaysDat::setTimeOffset ( int  dac)
inline

Definition at line 31 of file ODDelaysDat.h.

31 { m_t1 = dac; }

References m_t1.

Referenced by fetchData().

◆ setTTId()

void ODDelaysDat::setTTId ( int  dac)
inline

Definition at line 28 of file ODDelaysDat.h.

28 { m_tt = dac; }

References m_tt.

Referenced by fetchData().

◆ writeArrayDB()

void ODDelaysDat::writeArrayDB ( const std::vector< ODDelaysDat > &  data,
ODFEDelaysInfo iov 
)
privatenoexcept

Definition at line 91 of file ODDelaysDat.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* st = new int[nrows];
105 
106  ub2* ids_len = new ub2[nrows];
107  ub2* x_len = new ub2[nrows];
108  ub2* y_len = new ub2[nrows];
109  ub2* z_len = new ub2[nrows];
110  ub2* st_len = new ub2[nrows];
111 
112  ODDelaysDat dataitem;
113 
114  int n_data = (int)data.size();
115 
116  for (int count = 0; count < n_data; count++) {
117  dataitem = data[count];
118  ids[count] = iovID;
119  xx[count] = dataitem.getSMId();
120  yy[count] = dataitem.getFedId();
121  zz[count] = dataitem.getTTId();
122  st[count] = dataitem.getTimeOffset();
123 
124  ids_len[count] = sizeof(ids[count]);
125  x_len[count] = sizeof(xx[count]);
126  y_len[count] = sizeof(yy[count]);
127  z_len[count] = sizeof(zz[count]);
128  st_len[count] = sizeof(st[count]);
129  }
130 
131  try {
132  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
133  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
134  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
135  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT, sizeof(zz[0]), z_len);
136  m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
137 
138  m_writeStmt->executeArrayUpdate(nrows);
139 
140  delete[] ids;
141  delete[] xx;
142  delete[] yy;
143  delete[] zz;
144  delete[] st;
145 
146  delete[] ids_len;
147  delete[] x_len;
148  delete[] y_len;
149  delete[] z_len;
150  delete[] st_len;
151 
152  } catch (SQLException& e) {
153  throw(std::runtime_error("ODDelaysDat::writeArrayDB(): " + e.getMessage()));
154  }
155 }

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

◆ writeDB()

void ODDelaysDat::writeDB ( const ODDelaysDat item,
ODFEDelaysInfo iov 
)
privatenoexcept

Definition at line 37 of file ODDelaysDat.cc.

37  {
38  this->checkConnection();
39 
40  try {
41  m_writeStmt->setInt(1, item->getId());
42  m_writeStmt->setInt(2, item->getSMId());
43  m_writeStmt->setInt(3, item->getFedId());
44  m_writeStmt->setInt(4, item->getTTId());
45  m_writeStmt->setInt(5, item->getTimeOffset());
46 
47  m_writeStmt->executeUpdate();
48  } catch (SQLException& e) {
49  throw(std::runtime_error("ODDelaysDat::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 ODDelaysDat.h.

Member Data Documentation

◆ m_fed

int ODDelaysDat::m_fed
private

Definition at line 46 of file ODDelaysDat.h.

Referenced by getFedId(), and setFedId().

◆ m_ID

int ODDelaysDat::m_ID
private

Definition at line 49 of file ODDelaysDat.h.

Referenced by getId(), and setId().

◆ m_sm

int ODDelaysDat::m_sm
private

Definition at line 45 of file ODDelaysDat.h.

Referenced by getSMId(), and setSMId().

◆ m_t1

int ODDelaysDat::m_t1
private

Definition at line 48 of file ODDelaysDat.h.

Referenced by getTimeOffset(), and setTimeOffset().

◆ m_tt

int ODDelaysDat::m_tt
private

Definition at line 47 of file ODDelaysDat.h.

Referenced by getTTId(), and setTTId().

geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ODDelaysDat::m_fed
int m_fed
Definition: ODDelaysDat.h:46
ODDelaysDat::m_ID
int m_ID
Definition: ODDelaysDat.h:49
ODDelaysDat::setFedId
void setFedId(int dac)
Definition: ODDelaysDat.h:25
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
ODDelaysDat::getTimeOffset
int getTimeOffset() const
Definition: ODDelaysDat.h:32
ODDelaysDat::m_t1
int m_t1
Definition: ODDelaysDat.h:48
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
ODDelaysDat::m_sm
int m_sm
Definition: ODDelaysDat.h:45
ODDelaysDat::m_tt
int m_tt
Definition: ODDelaysDat.h:47
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
ODDelaysDat::getSMId
int getSMId() const
Definition: ODDelaysDat.h:23
ODDelaysDat::fetchData
void fetchData(std::vector< ODDelaysDat > *fillMap, int id) noexcept(false)
Definition: ODDelaysDat.cc:59
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
ODDelaysDat::getTable
std::string getTable() override
Definition: ODDelaysDat.h:17
IODConfig::m_readStmt
Statement * m_readStmt
Definition: IODConfig.h:34
ODDelaysDat::getId
int getId() const
Definition: ODDelaysDat.h:20
createfilelist.int
int
Definition: createfilelist.py:10
ODFEDelaysInfo::fetchID
int fetchID() noexcept(false)
Definition: ODFEDelaysInfo.cc:145
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
ODDelaysDat
Definition: ODDelaysDat.h:10
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
ODDelaysDat::getFedId
int getFedId() const
Definition: ODDelaysDat.h:26
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
ODDelaysDat::getTTId
int getTTId() const
Definition: ODDelaysDat.h:29
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
ODDelaysDat::setTimeOffset
void setTimeOffset(int dac)
Definition: ODDelaysDat.h:31
ODDelaysDat::setSMId
void setSMId(int dac)
Definition: ODDelaysDat.h:22
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
ODDelaysDat::setTTId
void setTTId(int dac)
Definition: ODDelaysDat.h:28