CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
MonPNPedDat Class Reference

#include <MonPNPedDat.h>

Inheritance diagram for MonPNPedDat:
IDataItem IDBObject

Public Member Functions

float getPedMeanG1 () const
 
float getPedMeanG16 () const
 
float getPedRMSG1 () const
 
float getPedRMSG16 () const
 
std::string getTable ()
 
bool getTaskStatus () const
 
 MonPNPedDat ()
 
void setPedMeanG1 (float mean)
 
void setPedMeanG16 (float mean)
 
void setPedRMSG1 (float mean)
 
void setPedRMSG16 (float mean)
 
void setTaskStatus (bool status)
 
 ~MonPNPedDat ()
 
- 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, MonPNPedDat > *fillVec, MonRunIOV *iov) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, MonPNPedDat > *data, MonRunIOV *iov) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const MonPNPedDat *item, MonRunIOV *iov) throw (std::runtime_error)
 

Private Attributes

float m_pedMeanG1
 
float m_pedMeanG16
 
float m_pedRMSG1
 
float m_pedRMSG16
 
bool m_taskStatus
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 
- Protected Member Functions inherited from IDataItem
void checkPrepare () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- 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 MonPNPedDat.h.

Constructor & Destructor Documentation

MonPNPedDat::MonPNPedDat ( )

Definition at line 12 of file MonPNPedDat.cc.

References NULL.

13 {
14  m_env = NULL;
15  m_conn = NULL;
16  m_writeStmt = NULL;
17  m_readStmt = NULL;
18 
19  m_pedMeanG1 = 0;
20  m_pedRMSG1 = 0;
21  m_pedMeanG16 = 0;
22  m_pedRMSG16 = 0;
23  m_taskStatus = 0;
24 }
float m_pedRMSG1
Definition: MonPNPedDat.h:53
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
float m_pedRMSG16
Definition: MonPNPedDat.h:55
#define NULL
Definition: scimark2.h:8
float m_pedMeanG16
Definition: MonPNPedDat.h:54
bool m_taskStatus
Definition: MonPNPedDat.h:56
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
float m_pedMeanG1
Definition: MonPNPedDat.h:52
MonPNPedDat::~MonPNPedDat ( )

Definition at line 28 of file MonPNPedDat.cc.

29 {
30 }

Member Function Documentation

void MonPNPedDat::fetchData ( std::map< EcalLogicID, MonPNPedDat > *  fillVec,
MonRunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 82 of file MonPNPedDat.cc.

References alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setPedMeanG1(), setPedMeanG16(), setPedRMSG1(), setPedRMSG16(), and setTaskStatus().

84 {
85  this->checkConnection();
86  fillMap->clear();
87 
88  iov->setConnection(m_env, m_conn);
89  int iovID = iov->fetchID();
90  if (!iovID) {
91  // throw(std::runtime_error("MonPNPedDat::writeDB: IOV not in DB"));
92  return;
93  }
94 
95  try {
96 
97  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
98  "d.ped_mean_g1,d.ped_rms_g1, d.ped_mean_g16, d.ped_rms_g16, d.task_status "
99  "FROM channelview cv JOIN mon_pn_ped_dat d "
100  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
101  "WHERE d.iov_id = :iov_id");
102  m_readStmt->setInt(1, iovID);
103  ResultSet* rset = m_readStmt->executeQuery();
104 
105  std::pair< EcalLogicID, MonPNPedDat > p;
106  MonPNPedDat dat;
107  while(rset->next()) {
108  p.first = EcalLogicID( rset->getString(1), // name
109  rset->getInt(2), // logic_id
110  rset->getInt(3), // id1
111  rset->getInt(4), // id2
112  rset->getInt(5), // id3
113  rset->getString(6)); // maps_to
114 
115  dat.setPedMeanG1( rset->getFloat(7) );
116  dat.setPedRMSG1( rset->getFloat(8) );
117  dat.setPedMeanG16( rset->getFloat(9) );
118  dat.setPedRMSG16( rset->getFloat(10) );
119  dat.setTaskStatus( rset->getInt(11) );
120  p.second = dat;
121  fillMap->insert(p);
122  }
123  } catch (SQLException &e) {
124  throw(std::runtime_error("MonPNPedDat::fetchData(): "+e.getMessage()));
125  }
126 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setPedRMSG16(float mean)
Definition: MonPNPedDat.h:30
void setPedRMSG1(float mean)
Definition: MonPNPedDat.h:24
void setPedMeanG1(float mean)
Definition: MonPNPedDat.h:21
int fetchID()
Definition: MonRunIOV.cc:118
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setPedMeanG16(float mean)
Definition: MonPNPedDat.h:27
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void setTaskStatus(bool status)
Definition: MonPNPedDat.h:33
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
float MonPNPedDat::getPedMeanG1 ( ) const
inline

Definition at line 22 of file MonPNPedDat.h.

References m_pedMeanG1.

Referenced by writeArrayDB().

22 { return m_pedMeanG1; }
float m_pedMeanG1
Definition: MonPNPedDat.h:52
float MonPNPedDat::getPedMeanG16 ( ) const
inline

Definition at line 28 of file MonPNPedDat.h.

References m_pedMeanG16.

Referenced by writeArrayDB().

28 { return m_pedMeanG16; }
float m_pedMeanG16
Definition: MonPNPedDat.h:54
float MonPNPedDat::getPedRMSG1 ( ) const
inline

Definition at line 25 of file MonPNPedDat.h.

References m_pedRMSG1.

Referenced by writeArrayDB().

25 { return m_pedRMSG1; }
float m_pedRMSG1
Definition: MonPNPedDat.h:53
float MonPNPedDat::getPedRMSG16 ( ) const
inline

Definition at line 31 of file MonPNPedDat.h.

References m_pedRMSG16.

Referenced by writeArrayDB().

31 { return m_pedRMSG16; }
float m_pedRMSG16
Definition: MonPNPedDat.h:55
std::string MonPNPedDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 19 of file MonPNPedDat.h.

19 { return "MON_PN_PED_DAT"; }
bool MonPNPedDat::getTaskStatus ( ) const
inline

Definition at line 34 of file MonPNPedDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

34 { return m_taskStatus; }
bool m_taskStatus
Definition: MonPNPedDat.h:56
void MonPNPedDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 34 of file MonPNPedDat.cc.

References alignCSCRings::e.

36 {
37  this->checkConnection();
38 
39  try {
40  m_writeStmt = m_conn->createStatement();
41  m_writeStmt->setSQL("INSERT INTO mon_pn_ped_dat (iov_id, logic_id, "
42  "ped_mean_g1, ped_rms_g1, ped_mean_g16, ped_rms_g16, task_status) "
43  "VALUES (:iov_id, :logic_id, "
44  ":3, :4, :5, :6, :7)");
45  } catch (SQLException &e) {
46  throw(std::runtime_error("MonPNPedDat::prepareWrite(): "+e.getMessage()));
47  }
48 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41
void MonPNPedDat::setPedMeanG1 ( float  mean)
inline

Definition at line 21 of file MonPNPedDat.h.

References m_pedMeanG1, and timingPdfMaker::mean.

Referenced by fetchData(), and ecaldqm::PedestalWriter::run().

21 { m_pedMeanG1 = mean; }
float m_pedMeanG1
Definition: MonPNPedDat.h:52
void MonPNPedDat::setPedMeanG16 ( float  mean)
inline

Definition at line 27 of file MonPNPedDat.h.

References m_pedMeanG16, and timingPdfMaker::mean.

Referenced by fetchData(), and ecaldqm::PedestalWriter::run().

27 { m_pedMeanG16 = mean; }
float m_pedMeanG16
Definition: MonPNPedDat.h:54
void MonPNPedDat::setPedRMSG1 ( float  mean)
inline

Definition at line 24 of file MonPNPedDat.h.

References m_pedRMSG1, and timingPdfMaker::mean.

Referenced by fetchData(), and ecaldqm::PedestalWriter::run().

24 { m_pedRMSG1 = mean; }
float m_pedRMSG1
Definition: MonPNPedDat.h:53
void MonPNPedDat::setPedRMSG16 ( float  mean)
inline

Definition at line 30 of file MonPNPedDat.h.

References m_pedRMSG16, and timingPdfMaker::mean.

Referenced by fetchData(), and ecaldqm::PedestalWriter::run().

30 { m_pedRMSG16 = mean; }
float m_pedRMSG16
Definition: MonPNPedDat.h:55
void MonPNPedDat::setTaskStatus ( bool  status)
inline

Definition at line 33 of file MonPNPedDat.h.

References m_taskStatus, and ntuplemaker::status.

Referenced by fetchData(), and ecaldqm::PedestalWriter::run().

33 { m_taskStatus = status; }
bool m_taskStatus
Definition: MonPNPedDat.h:56
tuple status
Definition: ntuplemaker.py:245
void MonPNPedDat::writeArrayDB ( const std::map< EcalLogicID, MonPNPedDat > *  data,
MonRunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 128 of file MonPNPedDat.cc.

References prof2calltree::count, data, alignCSCRings::e, EcalLogicID::getLogicID(), getPedMeanG1(), getPedMeanG16(), getPedRMSG1(), getPedRMSG16(), getTaskStatus(), o2o::iov, AlCaHLTBitMon_ParallelJobs::p, w, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

130 {
131  this->checkConnection();
132  this->checkPrepare();
133 
134  int iovID = iov->fetchID();
135  if (!iovID) { throw(std::runtime_error("MonPNPedDat::writeArrayDB: IOV not in DB")); }
136 
137 
138  int nrows=data->size();
139  int* ids= new int[nrows];
140  int* iovid_vec= new int[nrows];
141  float* xx= new float[nrows];
142  float* yy= new float[nrows];
143  float* zz= new float[nrows];
144  float* ww= new float[nrows];
145  int* st= new int[nrows];
146 
147  ub2* ids_len= new ub2[nrows];
148  ub2* iov_len= new ub2[nrows];
149  ub2* x_len= new ub2[nrows];
150  ub2* y_len= new ub2[nrows];
151  ub2* z_len= new ub2[nrows];
152  ub2* w_len= new ub2[nrows];
153 
154  ub2* st_len= new ub2[nrows];
155 
156  const EcalLogicID* channel;
157  const MonPNPedDat* dataitem;
158  int count=0;
159  typedef map< EcalLogicID, MonPNPedDat >::const_iterator CI;
160  for (CI p = data->begin(); p != data->end(); ++p) {
161  channel = &(p->first);
162  int logicID = channel->getLogicID();
163  if (!logicID) { throw(std::runtime_error("MonPNPedDat::writeArrayDB: Bad EcalLogicID")); }
164  ids[count]=logicID;
165  iovid_vec[count]=iovID;
166 
167  dataitem = &(p->second);
168  // dataIface.writeDB( channel, dataitem, iov);
169  float x=dataitem->getPedMeanG1();
170  float y=dataitem->getPedRMSG1();
171  float z=dataitem->getPedMeanG16();
172  float w=dataitem->getPedRMSG16();
173  int statu=dataitem->getTaskStatus();
174 
175 
176 
177  xx[count]=x;
178  yy[count]=y;
179  zz[count]=z;
180  ww[count]=w;
181 
182  st[count]=statu;
183 
184 
185  ids_len[count]=sizeof(ids[count]);
186  iov_len[count]=sizeof(iovid_vec[count]);
187 
188  x_len[count]=sizeof(xx[count]);
189  y_len[count]=sizeof(yy[count]);
190  z_len[count]=sizeof(zz[count]);
191  w_len[count]=sizeof(ww[count]);
192 
193  st_len[count]=sizeof(st[count]);
194 
195  count++;
196  }
197 
198 
199  try {
200  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len);
201  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
202  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );
203  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
204  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
205  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT , sizeof(ww[0]), w_len );
206  m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len );
207 
208 
209  m_writeStmt->executeArrayUpdate(nrows);
210 
211  delete [] ids;
212  delete [] iovid_vec;
213  delete [] xx;
214  delete [] yy;
215  delete [] zz;
216  delete [] ww;
217 
218  delete [] st;
219 
220  delete [] ids_len;
221  delete [] iov_len;
222  delete [] x_len;
223  delete [] y_len;
224  delete [] z_len;
225  delete [] w_len;
226 
227  delete [] st_len;
228 
229 
230 
231  } catch (SQLException &e) {
232  throw(std::runtime_error("MonPNPedDat::writeArrayDB(): "+e.getMessage()));
233  }
234 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
const double w
Definition: UKUtility.cc:23
float getPedRMSG1() const
Definition: MonPNPedDat.h:25
int fetchID()
Definition: MonRunIOV.cc:118
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
float float float z
int getLogicID() const
Definition: EcalLogicID.cc:41
float getPedRMSG16() const
Definition: MonPNPedDat.h:31
void checkPrepare()
Definition: IDataItem.h:31
float getPedMeanG16() const
Definition: MonPNPedDat.h:28
bool getTaskStatus() const
Definition: MonPNPedDat.h:34
float getPedMeanG1() const
Definition: MonPNPedDat.h:22
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Definition: DDAxes.h:10
void checkConnection() const
Definition: IDBObject.h:41
void MonPNPedDat::writeDB ( const EcalLogicID ecid,
const MonPNPedDat item,
MonRunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 52 of file MonPNPedDat.cc.

References alignCSCRings::e, and o2o::iov.

54 {
55  this->checkConnection();
56  this->checkPrepare();
57 
58  int iovID = iov->fetchID();
59  if (!iovID) { throw(std::runtime_error("MonPNPedDat::writeDB: IOV not in DB")); }
60 
61  int logicID = ecid->getLogicID();
62  if (!logicID) { throw(std::runtime_error("MonPNPedDat::writeDB: Bad EcalLogicID")); }
63 
64  try {
65  m_writeStmt->setInt(1, iovID);
66  m_writeStmt->setInt(2, logicID);
67 
68  m_writeStmt->setFloat(3, item->getPedMeanG1() );
69  m_writeStmt->setFloat(4, item->getPedRMSG1() );
70  m_writeStmt->setFloat(5, item->getPedMeanG16() );
71  m_writeStmt->setFloat(6, item->getPedRMSG16() );
72  m_writeStmt->setInt(7, item->getTaskStatus() );
73 
74  m_writeStmt->executeUpdate();
75  } catch (SQLException &e) {
76  throw(std::runtime_error("MonPNPedDat::writeDB(): "+e.getMessage()));
77  }
78 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
float getPedRMSG1() const
Definition: MonPNPedDat.h:25
int fetchID()
Definition: MonRunIOV.cc:118
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
int getLogicID() const
Definition: EcalLogicID.cc:41
float getPedRMSG16() const
Definition: MonPNPedDat.h:31
void checkPrepare()
Definition: IDataItem.h:31
float getPedMeanG16() const
Definition: MonPNPedDat.h:28
bool getTaskStatus() const
Definition: MonPNPedDat.h:34
float getPedMeanG1() const
Definition: MonPNPedDat.h:22
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonPNPedDat.h.

Member Data Documentation

float MonPNPedDat::m_pedMeanG1
private

Definition at line 52 of file MonPNPedDat.h.

Referenced by getPedMeanG1(), and setPedMeanG1().

float MonPNPedDat::m_pedMeanG16
private

Definition at line 54 of file MonPNPedDat.h.

Referenced by getPedMeanG16(), and setPedMeanG16().

float MonPNPedDat::m_pedRMSG1
private

Definition at line 53 of file MonPNPedDat.h.

Referenced by getPedRMSG1(), and setPedRMSG1().

float MonPNPedDat::m_pedRMSG16
private

Definition at line 55 of file MonPNPedDat.h.

Referenced by getPedRMSG16(), and setPedRMSG16().

bool MonPNPedDat::m_taskStatus
private

Definition at line 56 of file MonPNPedDat.h.

Referenced by getTaskStatus(), and setTaskStatus().