CMS 3D CMS Logo

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

#include <ODPedestalOffsetsDat.h>

Inheritance diagram for ODPedestalOffsetsDat:
IODConfig IDBObject

Public Member Functions

int getCrystalId () const
 
int getFedId () const
 
int getHigh () const
 
int getId () const
 
int getLow () const
 
int getMid () const
 
int getSMId () const
 
std::string getTable () override
 
int getTTId () const
 
 ODPedestalOffsetsDat ()
 
void setCrystalId (int dac)
 
void setFedId (int dac)
 
void setHigh (int dac)
 
void setId (int dac)
 
void setLow (int dac)
 
void setMid (int dac)
 
void setSMId (int dac)
 
void setTTId (int dac)
 
 ~ODPedestalOffsetsDat () 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< ODPedestalOffsetsDat > *fillMap, ODFEPedestalOffsetInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< ODPedestalOffsetsDat > &data, ODFEPedestalOffsetInfo *iov) noexcept(false)
 
void writeDB (const ODPedestalOffsetsDat *item, ODFEPedestalOffsetInfo *iov) noexcept(false)
 

Private Attributes

int m_fed
 
int m_high
 
int m_ID
 
int m_low
 
int m_mid
 
int m_sm
 
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 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 ODPedestalOffsetsDat.h.

Constructor & Destructor Documentation

◆ ODPedestalOffsetsDat()

ODPedestalOffsetsDat::ODPedestalOffsetsDat ( )

Definition at line 10 of file ODPedestalOffsetsDat.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_xt = 0;
20  m_low = 0;
21  m_mid = 0;
22  m_high = 0;
23 }

◆ ~ODPedestalOffsetsDat()

ODPedestalOffsetsDat::~ODPedestalOffsetsDat ( )
override

Definition at line 25 of file ODPedestalOffsetsDat.cc.

25 {}

Member Function Documentation

◆ fetchData()

void ODPedestalOffsetsDat::fetchData ( std::vector< ODPedestalOffsetsDat > *  fillMap,
ODFEPedestalOffsetInfo iov 
)
privatenoexcept

Definition at line 59 of file ODPedestalOffsetsDat.cc.

60  {
61  this->checkConnection();
62 
63  iov->setConnection(m_env, m_conn);
64  int iovID = iov->fetchID();
65  if (!iovID) {
66  std::cout << "ID not in the DB" << endl;
67  return;
68  }
69 
70  try {
71  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by sm_id, fed_id, tt_id, cry_id");
72  m_readStmt->setInt(1, iovID);
73  ResultSet* rset = m_readStmt->executeQuery();
74 
75  // std::vector< ODPedestalOffsetsDat > p;
77  while (rset->next()) {
78  // dat.setId( rset->getInt(1) );
79  dat.setSMId(rset->getInt(2));
80  dat.setFedId(rset->getInt(3));
81  dat.setTTId(rset->getInt(4));
82  dat.setCrystalId(rset->getInt(5));
83  dat.setLow(rset->getInt(6));
84  dat.setMid(rset->getInt(7));
85  dat.setHigh(rset->getInt(8));
86 
87  p->push_back(dat);
88  }
89 
90  } catch (SQLException& e) {
91  throw(std::runtime_error("ODPedestalOffsetsDat::fetchData(): " + e.getMessage()));
92  }
93 }

References gather_cfg::cout, MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setCrystalId(), setFedId(), setHigh(), setLow(), setMid(), setSMId(), and setTTId().

◆ getCrystalId()

int ODPedestalOffsetsDat::getCrystalId ( ) const
inline

Definition at line 33 of file ODPedestalOffsetsDat.h.

33 { return m_xt; }

References m_xt.

Referenced by writeArrayDB().

◆ getFedId()

int ODPedestalOffsetsDat::getFedId ( ) const
inline

Definition at line 27 of file ODPedestalOffsetsDat.h.

27 { return m_fed; }

References m_fed.

Referenced by writeArrayDB().

◆ getHigh()

int ODPedestalOffsetsDat::getHigh ( ) const
inline

Definition at line 42 of file ODPedestalOffsetsDat.h.

42 { return m_high; }

References m_high.

Referenced by writeArrayDB().

◆ getId()

int ODPedestalOffsetsDat::getId ( void  ) const
inline

Definition at line 21 of file ODPedestalOffsetsDat.h.

21 { return m_ID; }

References m_ID.

◆ getLow()

int ODPedestalOffsetsDat::getLow ( ) const
inline

Definition at line 36 of file ODPedestalOffsetsDat.h.

36 { return m_low; }

References m_low.

Referenced by writeArrayDB().

◆ getMid()

int ODPedestalOffsetsDat::getMid ( ) const
inline

Definition at line 39 of file ODPedestalOffsetsDat.h.

39 { return m_mid; }

References m_mid.

Referenced by writeArrayDB().

◆ getSMId()

int ODPedestalOffsetsDat::getSMId ( ) const
inline

Definition at line 24 of file ODPedestalOffsetsDat.h.

24 { return m_sm; }

References m_sm.

Referenced by writeArrayDB().

◆ getTable()

std::string ODPedestalOffsetsDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 18 of file ODPedestalOffsetsDat.h.

18 { return "PEDESTAL_OFFSETS_DAT"; }

◆ getTTId()

int ODPedestalOffsetsDat::getTTId ( ) const
inline

Definition at line 30 of file ODPedestalOffsetsDat.h.

30 { return m_tt; }

References m_tt.

Referenced by writeArrayDB().

◆ prepareWrite()

void ODPedestalOffsetsDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 27 of file ODPedestalOffsetsDat.cc.

27  {
28  this->checkConnection();
29 
30  try {
31  m_writeStmt = m_conn->createStatement();
32  m_writeStmt->setSQL("INSERT INTO " + getTable() +
33  " (rec_id, sm_id, fed_id, tt_id, cry_id, low, mid, high) "
34  "VALUES (:1, :2, :3, :4, :5, :6, :7, :8 )");
35  } catch (SQLException& e) {
36  throw(std::runtime_error("ODPedestalOffsetsDat::prepareWrite(): " + e.getMessage()));
37  }
38 }

References MillePedeFileConverter_cfg::e.

◆ setCrystalId()

void ODPedestalOffsetsDat::setCrystalId ( int  dac)
inline

Definition at line 32 of file ODPedestalOffsetsDat.h.

32 { m_xt = dac; }

References m_xt.

Referenced by fetchData().

◆ setFedId()

void ODPedestalOffsetsDat::setFedId ( int  dac)
inline

Definition at line 26 of file ODPedestalOffsetsDat.h.

26 { m_fed = dac; }

References m_fed.

Referenced by fetchData().

◆ setHigh()

void ODPedestalOffsetsDat::setHigh ( int  dac)
inline

Definition at line 41 of file ODPedestalOffsetsDat.h.

41 { m_high = dac; }

References m_high.

Referenced by fetchData().

◆ setId()

void ODPedestalOffsetsDat::setId ( int  dac)
inline

Definition at line 20 of file ODPedestalOffsetsDat.h.

20 { m_ID = dac; }

References m_ID.

◆ setLow()

void ODPedestalOffsetsDat::setLow ( int  dac)
inline

Definition at line 35 of file ODPedestalOffsetsDat.h.

35 { m_low = dac; }

References m_low.

Referenced by fetchData().

◆ setMid()

void ODPedestalOffsetsDat::setMid ( int  dac)
inline

Definition at line 38 of file ODPedestalOffsetsDat.h.

38 { m_mid = dac; }

References m_mid.

Referenced by fetchData().

◆ setSMId()

void ODPedestalOffsetsDat::setSMId ( int  dac)
inline

Definition at line 23 of file ODPedestalOffsetsDat.h.

23 { m_sm = dac; }

References m_sm.

Referenced by fetchData().

◆ setTTId()

void ODPedestalOffsetsDat::setTTId ( int  dac)
inline

Definition at line 29 of file ODPedestalOffsetsDat.h.

29 { m_tt = dac; }

References m_tt.

Referenced by fetchData().

◆ writeArrayDB()

void ODPedestalOffsetsDat::writeArrayDB ( const std::vector< ODPedestalOffsetsDat > &  data,
ODFEPedestalOffsetInfo iov 
)
privatenoexcept

Definition at line 97 of file ODPedestalOffsetsDat.cc.

98  {
99  this->checkConnection();
100 
101  int iovID = iov->fetchID();
102  if (!iovID) {
103  throw(std::runtime_error("ODDelays::writeArrayDB: ODFEDelaysInfo not in DB"));
104  }
105 
106  int nrows = data.size();
107  int* ids = new int[nrows];
108  int* xx = new int[nrows];
109  int* yy = new int[nrows];
110  int* zz = new int[nrows];
111  int* st = new int[nrows];
112  int* xx1 = new int[nrows];
113  int* yy1 = new int[nrows];
114  int* zz1 = new int[nrows];
115 
116  ub2* ids_len = new ub2[nrows];
117  ub2* x_len = new ub2[nrows];
118  ub2* y_len = new ub2[nrows];
119  ub2* z_len = new ub2[nrows];
120  ub2* st_len = new ub2[nrows];
121  ub2* x1_len = new ub2[nrows];
122  ub2* y1_len = new ub2[nrows];
123  ub2* z1_len = new ub2[nrows];
124 
125  ODPedestalOffsetsDat dataitem;
126 
127  int n_data = (int)data.size();
128  for (int count = 0; count < n_data; count++) {
129  dataitem = data[count];
130  ids[count] = iovID;
131  xx[count] = dataitem.getSMId();
132  yy[count] = dataitem.getFedId();
133  zz[count] = dataitem.getTTId();
134  st[count] = dataitem.getCrystalId();
135  xx1[count] = dataitem.getLow();
136  yy1[count] = dataitem.getMid();
137  zz1[count] = dataitem.getHigh();
138 
139  ids_len[count] = sizeof(ids[count]);
140  x_len[count] = sizeof(xx[count]);
141  y_len[count] = sizeof(yy[count]);
142  z_len[count] = sizeof(zz[count]);
143  st_len[count] = sizeof(st[count]);
144  x1_len[count] = sizeof(xx1[count]);
145  y1_len[count] = sizeof(yy1[count]);
146  z1_len[count] = sizeof(zz1[count]);
147  }
148 
149  try {
150  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
151  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
152  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
153  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT, sizeof(zz[0]), z_len);
154  m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
155  m_writeStmt->setDataBuffer(6, (dvoid*)xx1, OCCIINT, sizeof(xx1[0]), x1_len);
156  m_writeStmt->setDataBuffer(7, (dvoid*)yy1, OCCIINT, sizeof(yy1[0]), y1_len);
157  m_writeStmt->setDataBuffer(8, (dvoid*)zz1, OCCIINT, sizeof(zz1[0]), z1_len);
158 
159  m_writeStmt->executeArrayUpdate(nrows);
160 
161  delete[] ids;
162  delete[] xx;
163  delete[] yy;
164  delete[] zz;
165  delete[] st;
166  delete[] xx1;
167  delete[] yy1;
168  delete[] zz1;
169 
170  delete[] ids_len;
171  delete[] x_len;
172  delete[] y_len;
173  delete[] z_len;
174  delete[] st_len;
175  delete[] x1_len;
176  delete[] y1_len;
177  delete[] z1_len;
178 
179  } catch (SQLException& e) {
180  throw(std::runtime_error("ODPedestalOffsetsDat::writeArrayDB(): " + e.getMessage()));
181  }
182 }

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

◆ writeDB()

void ODPedestalOffsetsDat::writeDB ( const ODPedestalOffsetsDat item,
ODFEPedestalOffsetInfo iov 
)
privatenoexcept

Definition at line 40 of file ODPedestalOffsetsDat.cc.

40  {
41  this->checkConnection();
42 
43  try {
44  m_writeStmt->setInt(1, item->getId());
45  m_writeStmt->setInt(2, item->getSMId());
46  m_writeStmt->setInt(3, item->getFedId());
47  m_writeStmt->setInt(4, item->getTTId());
48  m_writeStmt->setInt(5, item->getCrystalId());
49  m_writeStmt->setInt(6, item->getLow());
50  m_writeStmt->setInt(7, item->getMid());
51  m_writeStmt->setInt(8, item->getHigh());
52 
53  m_writeStmt->executeUpdate();
54  } catch (SQLException& e) {
55  throw(std::runtime_error("ODPedestalOffsetsDat::writeDB(): " + e.getMessage()));
56  }
57 }

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file ODPedestalOffsetsDat.h.

Member Data Documentation

◆ m_fed

int ODPedestalOffsetsDat::m_fed
private

Definition at line 55 of file ODPedestalOffsetsDat.h.

Referenced by getFedId(), and setFedId().

◆ m_high

int ODPedestalOffsetsDat::m_high
private

Definition at line 60 of file ODPedestalOffsetsDat.h.

Referenced by getHigh(), and setHigh().

◆ m_ID

int ODPedestalOffsetsDat::m_ID
private

Definition at line 61 of file ODPedestalOffsetsDat.h.

Referenced by getId(), and setId().

◆ m_low

int ODPedestalOffsetsDat::m_low
private

Definition at line 58 of file ODPedestalOffsetsDat.h.

Referenced by getLow(), and setLow().

◆ m_mid

int ODPedestalOffsetsDat::m_mid
private

Definition at line 59 of file ODPedestalOffsetsDat.h.

Referenced by getMid(), and setMid().

◆ m_sm

int ODPedestalOffsetsDat::m_sm
private

Definition at line 54 of file ODPedestalOffsetsDat.h.

Referenced by getSMId(), and setSMId().

◆ m_tt

int ODPedestalOffsetsDat::m_tt
private

Definition at line 56 of file ODPedestalOffsetsDat.h.

Referenced by getTTId(), and setTTId().

◆ m_xt

int ODPedestalOffsetsDat::m_xt
private

Definition at line 57 of file ODPedestalOffsetsDat.h.

Referenced by getCrystalId(), and setCrystalId().

geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
ODPedestalOffsetsDat::getLow
int getLow() const
Definition: ODPedestalOffsetsDat.h:36
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ODPedestalOffsetsDat::setTTId
void setTTId(int dac)
Definition: ODPedestalOffsetsDat.h:29
ODPedestalOffsetsDat::m_mid
int m_mid
Definition: ODPedestalOffsetsDat.h:59
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ODPedestalOffsetsDat::m_fed
int m_fed
Definition: ODPedestalOffsetsDat.h:55
ODPedestalOffsetsDat::getMid
int getMid() const
Definition: ODPedestalOffsetsDat.h:39
ODFEPedestalOffsetInfo::fetchID
int fetchID() noexcept(false)
Definition: ODFEPedestalOffsetInfo.cc:163
ODPedestalOffsetsDat
Definition: ODPedestalOffsetsDat.h:11
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
ODPedestalOffsetsDat::setCrystalId
void setCrystalId(int dac)
Definition: ODPedestalOffsetsDat.h:32
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
ODPedestalOffsetsDat::getTTId
int getTTId() const
Definition: ODPedestalOffsetsDat.h:30
ODPedestalOffsetsDat::m_low
int m_low
Definition: ODPedestalOffsetsDat.h:58
ODPedestalOffsetsDat::m_high
int m_high
Definition: ODPedestalOffsetsDat.h:60
ODPedestalOffsetsDat::setLow
void setLow(int dac)
Definition: ODPedestalOffsetsDat.h:35
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
ODPedestalOffsetsDat::setFedId
void setFedId(int dac)
Definition: ODPedestalOffsetsDat.h:26
ODPedestalOffsetsDat::getSMId
int getSMId() const
Definition: ODPedestalOffsetsDat.h:24
ODPedestalOffsetsDat::setSMId
void setSMId(int dac)
Definition: ODPedestalOffsetsDat.h:23
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
createfilelist.int
int
Definition: createfilelist.py:10
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
ODPedestalOffsetsDat::getFedId
int getFedId() const
Definition: ODPedestalOffsetsDat.h:27
ODPedestalOffsetsDat::m_sm
int m_sm
Definition: ODPedestalOffsetsDat.h:54
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
ODPedestalOffsetsDat::getHigh
int getHigh() const
Definition: ODPedestalOffsetsDat.h:42
ODPedestalOffsetsDat::getId
int getId() const
Definition: ODPedestalOffsetsDat.h:21
IODConfig::m_writeStmt
Statement * m_writeStmt
Definition: IODConfig.h:33
ODPedestalOffsetsDat::m_ID
int m_ID
Definition: ODPedestalOffsetsDat.h:61
ODPedestalOffsetsDat::m_tt
int m_tt
Definition: ODPedestalOffsetsDat.h:56
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
ODPedestalOffsetsDat::m_xt
int m_xt
Definition: ODPedestalOffsetsDat.h:57
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
ODPedestalOffsetsDat::getTable
std::string getTable() override
Definition: ODPedestalOffsetsDat.h:18
ODPedestalOffsetsDat::getCrystalId
int getCrystalId() const
Definition: ODPedestalOffsetsDat.h:33
ODPedestalOffsetsDat::setHigh
void setHigh(int dac)
Definition: ODPedestalOffsetsDat.h:41
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
ODPedestalOffsetsDat::setMid
void setMid(int dac)
Definition: ODPedestalOffsetsDat.h:38
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37