CMS 3D CMS Logo

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

#include <CaliCrystalIntercalDat.h>

Inheritance diagram for CaliCrystalIntercalDat:
IDataItem IDBObject

Public Member Functions

 CaliCrystalIntercalDat ()
 
float getCali () const
 
float getCaliRMS () const
 
int getNumEvents () const
 
std::string getTable () override
 
bool getTaskStatus () const
 
void setCali (float c)
 
void setCaliRMS (float c)
 
void setNumEvents (int n)
 
void setTaskStatus (bool s)
 
 ~CaliCrystalIntercalDat () override
 
- Public Member Functions inherited from IDataItem
 IDataItem ()
 
- 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::map< EcalLogicID, CaliCrystalIntercalDat > *fillVec, CaliIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, CaliCrystalIntercalDat > *data, CaliIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const CaliCrystalIntercalDat *item, CaliIOV *iov) noexcept(false)
 

Private Attributes

float m_cali
 
float m_caliRMS
 
int m_numEvents
 
bool m_taskStatus
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static const int ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IDataItem
void checkPrepare () noexcept(false)
 
void createReadStatement () 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 IDataItem
oracle::occi::Statement * m_readStmt
 
oracle::occi::Statement * m_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 12 of file CaliCrystalIntercalDat.h.

Constructor & Destructor Documentation

◆ CaliCrystalIntercalDat()

CaliCrystalIntercalDat::CaliCrystalIntercalDat ( )

Definition at line 12 of file CaliCrystalIntercalDat.cc.

12  {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16 
17  m_cali = 0;
18  m_caliRMS = 0;
19  m_numEvents = 0;
20  m_taskStatus = false;
21 }

◆ ~CaliCrystalIntercalDat()

CaliCrystalIntercalDat::~CaliCrystalIntercalDat ( )
override

Definition at line 23 of file CaliCrystalIntercalDat.cc.

23 {}

Member Function Documentation

◆ fetchData()

void CaliCrystalIntercalDat::fetchData ( std::map< EcalLogicID, CaliCrystalIntercalDat > *  fillVec,
CaliIOV iov 
)
privatenoexcept

Definition at line 71 of file CaliCrystalIntercalDat.cc.

72  {
73  this->checkConnection();
74  fillMap->clear();
75 
76  iov->setConnection(m_env, m_conn);
77  int iovID = iov->fetchID();
78  if (!iovID) {
79  // throw(std::runtime_error("CaliCrystalIntercalDat::writeDB: IOV not in DB"));
80  return;
81  }
82 
83  try {
84  m_readStmt->setSQL(
85  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
86  "d.cali, d.cali_rms, d.num_events, d.task_status "
87  "FROM channelview cv JOIN cali_crystal_intercal_dat d "
88  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
89  "WHERE d.iov_id = :iov_id");
90  m_readStmt->setInt(1, iovID);
91  ResultSet* rset = m_readStmt->executeQuery();
92 
93  std::pair<EcalLogicID, CaliCrystalIntercalDat> p;
95  while (rset->next()) {
96  p.first = EcalLogicID(rset->getString(1), // name
97  rset->getInt(2), // logic_id
98  rset->getInt(3), // id1
99  rset->getInt(4), // id2
100  rset->getInt(5), // id3
101  rset->getString(6)); // maps_to
102 
103  dat.setCali(rset->getFloat(7));
104  dat.setCaliRMS(rset->getFloat(8));
105  dat.setNumEvents(rset->getInt(9));
106  dat.setTaskStatus(rset->getInt(10));
107 
108  p.second = dat;
109  fillMap->insert(p);
110  }
111  } catch (SQLException& e) {
112  throw(std::runtime_error("CaliCrystalIntercalDat::fetchData(): " + e.getMessage()));
113  }
114 }

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setCali(), setCaliRMS(), setNumEvents(), and setTaskStatus().

◆ getCali()

float CaliCrystalIntercalDat::getCali ( ) const
inline

Definition at line 22 of file CaliCrystalIntercalDat.h.

22 { return m_cali; }

References m_cali.

Referenced by writeArrayDB().

◆ getCaliRMS()

float CaliCrystalIntercalDat::getCaliRMS ( ) const
inline

Definition at line 25 of file CaliCrystalIntercalDat.h.

25 { return m_caliRMS; }

References m_caliRMS.

Referenced by writeArrayDB().

◆ getNumEvents()

int CaliCrystalIntercalDat::getNumEvents ( ) const
inline

Definition at line 28 of file CaliCrystalIntercalDat.h.

28 { return m_numEvents; }

References m_numEvents.

Referenced by writeArrayDB().

◆ getTable()

std::string CaliCrystalIntercalDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file CaliCrystalIntercalDat.h.

19 { return "CALI_CRYSTAL_INTERCAL_DAT"; }

◆ getTaskStatus()

bool CaliCrystalIntercalDat::getTaskStatus ( ) const
inline

Definition at line 31 of file CaliCrystalIntercalDat.h.

31 { return m_taskStatus; }

References m_taskStatus.

Referenced by writeArrayDB().

◆ prepareWrite()

void CaliCrystalIntercalDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 25 of file CaliCrystalIntercalDat.cc.

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL(
31  "INSERT INTO cali_crystal_intercal_dat (iov_id, logic_id, "
32  "cali, cali_rms, num_events, task_status) "
33  "VALUES (:iov_id, :logic_id, "
34  ":3, :4, :5, :6)");
35  } catch (SQLException& e) {
36  throw(std::runtime_error("CaliCrystalIntercalDat::prepareWrite(): " + e.getMessage()));
37  }
38 }

References MillePedeFileConverter_cfg::e.

◆ setCali()

void CaliCrystalIntercalDat::setCali ( float  c)
inline

Definition at line 21 of file CaliCrystalIntercalDat.h.

21 { m_cali = c; }

References HltBtagPostValidation_cff::c, and m_cali.

Referenced by fetchData().

◆ setCaliRMS()

void CaliCrystalIntercalDat::setCaliRMS ( float  c)
inline

Definition at line 24 of file CaliCrystalIntercalDat.h.

24 { m_caliRMS = c; }

References HltBtagPostValidation_cff::c, and m_caliRMS.

Referenced by fetchData().

◆ setNumEvents()

void CaliCrystalIntercalDat::setNumEvents ( int  n)
inline

Definition at line 27 of file CaliCrystalIntercalDat.h.

27 { m_numEvents = n; }

References m_numEvents, and dqmiodumpmetadata::n.

Referenced by fetchData().

◆ setTaskStatus()

void CaliCrystalIntercalDat::setTaskStatus ( bool  s)
inline

Definition at line 30 of file CaliCrystalIntercalDat.h.

30 { m_taskStatus = s; }

References m_taskStatus, and alignCSCRings::s.

Referenced by fetchData().

◆ writeArrayDB()

void CaliCrystalIntercalDat::writeArrayDB ( const std::map< EcalLogicID, CaliCrystalIntercalDat > *  data,
CaliIOV iov 
)
privatenoexcept

Definition at line 116 of file CaliCrystalIntercalDat.cc.

117  {
118  this->checkConnection();
119  this->checkPrepare();
120 
121  int iovID = iov->fetchID();
122  if (!iovID) {
123  throw(std::runtime_error("CaliCrystalIntercalDat::writeArrayDB: IOV not in DB"));
124  }
125 
126  int nrows = data->size();
127  int* ids = new int[nrows];
128  int* iovid_vec = new int[nrows];
129  float* xx = new float[nrows];
130  float* yy = new float[nrows];
131  int* tt = new int[nrows];
132  int* st = new int[nrows];
133 
134  ub2* ids_len = new ub2[nrows];
135  ub2* iov_len = new ub2[nrows];
136  ub2* x_len = new ub2[nrows];
137  ub2* y_len = new ub2[nrows];
138  ub2* tt_len = new ub2[nrows];
139  ub2* st_len = new ub2[nrows];
140 
141  const EcalLogicID* channel;
142  const CaliCrystalIntercalDat* dataitem;
143  int count = 0;
144  typedef map<EcalLogicID, CaliCrystalIntercalDat>::const_iterator CI;
145  for (CI p = data->begin(); p != data->end(); ++p) {
146  channel = &(p->first);
147  int logicID = channel->getLogicID();
148  if (!logicID) {
149  throw(std::runtime_error("CaliCrystalIntercalDat::writeArrayDB: Bad EcalLogicID"));
150  }
151  ids[count] = logicID;
152  iovid_vec[count] = iovID;
153 
154  dataitem = &(p->second);
155  // dataIface.writeDB( channel, dataitem, iov);
156  float x = dataitem->getCali();
157  float y = dataitem->getCaliRMS();
158  int xtt = dataitem->getNumEvents();
159  int statu = dataitem->getTaskStatus();
160 
161  xx[count] = x;
162  yy[count] = y;
163  tt[count] = xtt;
164  st[count] = statu;
165 
166  ids_len[count] = sizeof(ids[count]);
167  iov_len[count] = sizeof(iovid_vec[count]);
168 
169  x_len[count] = sizeof(xx[count]);
170  y_len[count] = sizeof(yy[count]);
171  tt_len[count] = sizeof(tt[count]);
172  st_len[count] = sizeof(st[count]);
173 
174  count++;
175  }
176 
177  try {
178  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]), iov_len);
179  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
180  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT, sizeof(xx[0]), x_len);
181  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT, sizeof(yy[0]), y_len);
182  m_writeStmt->setDataBuffer(5, (dvoid*)tt, OCCIINT, sizeof(tt[0]), tt_len);
183  m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
184 
185  m_writeStmt->executeArrayUpdate(nrows);
186 
187  delete[] ids;
188  delete[] iovid_vec;
189  delete[] xx;
190  delete[] yy;
191  delete[] st;
192  delete[] tt;
193 
194  delete[] ids_len;
195  delete[] iov_len;
196  delete[] x_len;
197  delete[] y_len;
198  delete[] tt_len;
199  delete[] st_len;
200 
201  } catch (SQLException& e) {
202  throw(std::runtime_error("MonPedestalsDat::writeArrayDB(): " + e.getMessage()));
203  }
204 }

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getCali(), getCaliRMS(), EcalLogicID::getLogicID(), getNumEvents(), getTaskStatus(), AlCaHLTBitMon_ParallelJobs::p, groupFilesInBlocks::tt, x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

◆ writeDB()

void CaliCrystalIntercalDat::writeDB ( const EcalLogicID ecid,
const CaliCrystalIntercalDat item,
CaliIOV iov 
)
privatenoexcept

Definition at line 40 of file CaliCrystalIntercalDat.cc.

42  {
43  this->checkConnection();
44  this->checkPrepare();
45 
46  int iovID = iov->fetchID();
47  if (!iovID) {
48  throw(std::runtime_error("CaliCrystalIntercalDat::writeDB: IOV not in DB"));
49  }
50 
51  int logicID = ecid->getLogicID();
52  if (!logicID) {
53  throw(std::runtime_error("CaliCrystalIntercalDat::writeDB: Bad EcalLogicID"));
54  }
55 
56  try {
57  m_writeStmt->setInt(1, iovID);
58  m_writeStmt->setInt(2, logicID);
59 
60  m_writeStmt->setFloat(3, item->getCali());
61  m_writeStmt->setFloat(4, item->getCaliRMS());
62  m_writeStmt->setInt(5, item->getNumEvents());
63  m_writeStmt->setInt(6, item->getTaskStatus());
64 
65  m_writeStmt->executeUpdate();
66  } catch (SQLException& e) {
67  throw(std::runtime_error("CaliCrystalIntercalDat::writeDB(): " + e.getMessage()));
68  }
69 }

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file CaliCrystalIntercalDat.h.

Member Data Documentation

◆ m_cali

float CaliCrystalIntercalDat::m_cali
private

Definition at line 43 of file CaliCrystalIntercalDat.h.

Referenced by getCali(), and setCali().

◆ m_caliRMS

float CaliCrystalIntercalDat::m_caliRMS
private

Definition at line 44 of file CaliCrystalIntercalDat.h.

Referenced by getCaliRMS(), and setCaliRMS().

◆ m_numEvents

int CaliCrystalIntercalDat::m_numEvents
private

Definition at line 45 of file CaliCrystalIntercalDat.h.

Referenced by getNumEvents(), and setNumEvents().

◆ m_taskStatus

bool CaliCrystalIntercalDat::m_taskStatus
private

Definition at line 46 of file CaliCrystalIntercalDat.h.

Referenced by getTaskStatus(), and setTaskStatus().

DDAxes::y
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
CaliCrystalIntercalDat::setCali
void setCali(float c)
Definition: CaliCrystalIntercalDat.h:21
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CaliIOV::fetchID
int fetchID() noexcept(false) override
Definition: CaliIOV.cc:48
CaliCrystalIntercalDat::m_caliRMS
float m_caliRMS
Definition: CaliCrystalIntercalDat.h:44
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
CaliCrystalIntercalDat::getTaskStatus
bool getTaskStatus() const
Definition: CaliCrystalIntercalDat.h:31
CaliCrystalIntercalDat::m_numEvents
int m_numEvents
Definition: CaliCrystalIntercalDat.h:45
alignCSCRings.s
s
Definition: alignCSCRings.py:92
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
CaliCrystalIntercalDat
Definition: CaliCrystalIntercalDat.h:12
CaliCrystalIntercalDat::getNumEvents
int getNumEvents() const
Definition: CaliCrystalIntercalDat.h:28
EcalLogicID
Definition: EcalLogicID.h:7
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
CaliCrystalIntercalDat::getCaliRMS
float getCaliRMS() const
Definition: CaliCrystalIntercalDat.h:25
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
CaliCrystalIntercalDat::getCali
float getCali() const
Definition: CaliCrystalIntercalDat.h:22
CaliCrystalIntercalDat::setTaskStatus
void setTaskStatus(bool s)
Definition: CaliCrystalIntercalDat.h:30
CaliCrystalIntercalDat::m_cali
float m_cali
Definition: CaliCrystalIntercalDat.h:43
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
CaliCrystalIntercalDat::setNumEvents
void setNumEvents(int n)
Definition: CaliCrystalIntercalDat.h:27
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
CaliCrystalIntercalDat::m_taskStatus
bool m_taskStatus
Definition: CaliCrystalIntercalDat.h:46
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
CaliCrystalIntercalDat::setCaliRMS
void setCaliRMS(float c)
Definition: CaliCrystalIntercalDat.h:24
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37