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
MonTestPulseDat Class Reference

#include <MonTestPulseDat.h>

Inheritance diagram for MonTestPulseDat:
IDataItem IDBObject

Public Member Functions

float getADCMeanG1 () const
 
float getADCMeanG12 () const
 
float getADCMeanG6 () const
 
float getADCRMSG1 () const
 
float getADCRMSG12 () const
 
float getADCRMSG6 () const
 
std::string getTable ()
 
bool getTaskStatus () const
 
 MonTestPulseDat ()
 
void setADCMeanG1 (float mean)
 
void setADCMeanG12 (float mean)
 
void setADCMeanG6 (float mean)
 
void setADCRMSG1 (float rms)
 
void setADCRMSG12 (float rms)
 
void setADCRMSG6 (float rms)
 
void setTaskStatus (bool status)
 
 ~MonTestPulseDat ()
 
- 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, MonTestPulseDat > *fillMap, MonRunIOV *iov) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, MonTestPulseDat > *data, MonRunIOV *iov) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const MonTestPulseDat *item, MonRunIOV *iov) throw (std::runtime_error)
 

Private Attributes

float m_adcMeanG1
 
float m_adcMeanG12
 
float m_adcMeanG6
 
float m_adcRMSG1
 
float m_adcRMSG12
 
float m_adcRMSG6
 
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 MonTestPulseDat.h.

Constructor & Destructor Documentation

MonTestPulseDat::MonTestPulseDat ( )

Definition at line 12 of file MonTestPulseDat.cc.

References NULL.

13 {
14  m_env = NULL;
15  m_conn = NULL;
16  m_writeStmt = NULL;
17  m_readStmt = NULL;
18 
19  m_adcMeanG1 = 0;
20  m_adcRMSG1 = 0;
21  m_adcMeanG6 = 0;
22  m_adcRMSG6 = 0;
23  m_adcMeanG12 = 0;
24  m_adcRMSG12 = 0;
25  m_taskStatus = 0;
26 }
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
#define NULL
Definition: scimark2.h:8
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
MonTestPulseDat::~MonTestPulseDat ( )

Definition at line 30 of file MonTestPulseDat.cc.

31 {
32 }

Member Function Documentation

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

Definition at line 85 of file MonTestPulseDat.cc.

References dat, alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setADCMeanG1(), setADCMeanG12(), setADCMeanG6(), setADCRMSG1(), setADCRMSG12(), setADCRMSG6(), and setTaskStatus().

87 {
88  this->checkConnection();
89  fillMap->clear();
90 
91  iov->setConnection(m_env, m_conn);
92  int iovID = iov->fetchID();
93  if (!iovID) {
94  // throw(std::runtime_error("MonTestPulseDat::writeDB: IOV not in DB"));
95  return;
96  }
97 
98  try {
99 
100  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
101  "d.adc_mean_g1, d.adc_rms_g1, d.adc_mean_g6, d.adc_rms_g6, d.adc_mean_g12, d.adc_rms_g12, d.task_status "
102  "FROM channelview cv JOIN mon_test_pulse_dat d "
103  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
104  "WHERE d.iov_id = :iov_id");
105  m_readStmt->setInt(1, iovID);
106  ResultSet* rset = m_readStmt->executeQuery();
107 
108  std::pair< EcalLogicID, MonTestPulseDat > p;
110  while(rset->next()) {
111  p.first = EcalLogicID( rset->getString(1), // name
112  rset->getInt(2), // logic_id
113  rset->getInt(3), // id1
114  rset->getInt(4), // id2
115  rset->getInt(5), // id3
116  rset->getString(6)); // maps_to
117 
118  dat.setADCMeanG1( rset->getFloat(7) );
119  dat.setADCRMSG1( rset->getFloat(8) );
120  dat.setADCMeanG6( rset->getFloat(9) );
121  dat.setADCRMSG6( rset->getFloat(10) );
122  dat.setADCMeanG12( rset->getFloat(11) );
123  dat.setADCRMSG12( rset->getFloat(12) );
124  dat.setTaskStatus( rset->getInt(13) );
125 
126  p.second = dat;
127  fillMap->insert(p);
128  }
129  } catch (SQLException &e) {
130  throw(std::runtime_error("MonTestPulseDat::fetchData(): "+e.getMessage()));
131  }
132 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setADCRMSG1(float rms)
void setADCMeanG1(float mean)
void setADCMeanG6(float mean)
int fetchID()
Definition: MonRunIOV.cc:118
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setADCMeanG12(float mean)
void setTaskStatus(bool status)
void setADCRMSG12(float rms)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
void setADCRMSG6(float rms)
static std::vector< std::string > checklist dat
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
float MonTestPulseDat::getADCMeanG1 ( ) const
inline

Definition at line 22 of file MonTestPulseDat.h.

References m_adcMeanG1.

Referenced by writeArrayDB().

22 { return m_adcMeanG1; }
float MonTestPulseDat::getADCMeanG12 ( ) const
inline

Definition at line 34 of file MonTestPulseDat.h.

References m_adcMeanG12.

Referenced by writeArrayDB().

34 { return m_adcMeanG12; }
float MonTestPulseDat::getADCMeanG6 ( ) const
inline

Definition at line 28 of file MonTestPulseDat.h.

References m_adcMeanG6.

Referenced by writeArrayDB().

28 { return m_adcMeanG6; }
float MonTestPulseDat::getADCRMSG1 ( ) const
inline

Definition at line 25 of file MonTestPulseDat.h.

References m_adcRMSG1.

Referenced by writeArrayDB().

25 { return m_adcRMSG1; }
float MonTestPulseDat::getADCRMSG12 ( ) const
inline

Definition at line 37 of file MonTestPulseDat.h.

References m_adcRMSG12.

Referenced by writeArrayDB().

37 { return m_adcRMSG12; }
float MonTestPulseDat::getADCRMSG6 ( ) const
inline

Definition at line 31 of file MonTestPulseDat.h.

References m_adcRMSG6.

Referenced by writeArrayDB().

31 { return m_adcRMSG6; }
std::string MonTestPulseDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 19 of file MonTestPulseDat.h.

19 { return "MON_TEST_PULSE_DAT"; }
bool MonTestPulseDat::getTaskStatus ( ) const
inline

Definition at line 40 of file MonTestPulseDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

40 { return m_taskStatus; }
void MonTestPulseDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 36 of file MonTestPulseDat.cc.

References alignCSCRings::e.

38 {
39  this->checkConnection();
40 
41  try {
42  m_writeStmt = m_conn->createStatement();
43  m_writeStmt->setSQL("INSERT INTO mon_test_pulse_dat (iov_id, logic_id, "
44  "adc_mean_g1, adc_rms_g1, adc_mean_g6, adc_rms_g6, adc_mean_g12, adc_rms_g12, task_status) "
45  "VALUES (:iov_id, :logic_id, "
46  ":adc_mean_g1, :adc_rms_g1, :adc_rms_g6, :adc_rms_g6, :adc_mean_g12, :adc_rms_g12, :task_status)");
47  } catch (SQLException &e) {
48  throw(std::runtime_error("MonTestPulseDat::prepareWrite(): "+e.getMessage()));
49  }
50 }
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 MonTestPulseDat::setADCMeanG1 ( float  mean)
inline

Definition at line 21 of file MonTestPulseDat.h.

References m_adcMeanG1, and timingPdfMaker::mean.

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

void MonTestPulseDat::setADCMeanG12 ( float  mean)
inline

Definition at line 33 of file MonTestPulseDat.h.

References m_adcMeanG12, and timingPdfMaker::mean.

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

void MonTestPulseDat::setADCMeanG6 ( float  mean)
inline

Definition at line 27 of file MonTestPulseDat.h.

References m_adcMeanG6, and timingPdfMaker::mean.

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

void MonTestPulseDat::setADCRMSG1 ( float  rms)
inline

Definition at line 24 of file MonTestPulseDat.h.

References m_adcRMSG1, and plotscripts::rms().

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

24 { m_adcRMSG1 = rms; }
void MonTestPulseDat::setADCRMSG12 ( float  rms)
inline

Definition at line 36 of file MonTestPulseDat.h.

References m_adcRMSG12, and plotscripts::rms().

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

36 { m_adcRMSG12 = rms; }
void MonTestPulseDat::setADCRMSG6 ( float  rms)
inline

Definition at line 30 of file MonTestPulseDat.h.

References m_adcRMSG6, and plotscripts::rms().

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

30 { m_adcRMSG6 = rms; }
void MonTestPulseDat::setTaskStatus ( bool  status)
inline

Definition at line 39 of file MonTestPulseDat.h.

References m_taskStatus, and ntuplemaker::status.

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

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

Definition at line 134 of file MonTestPulseDat.cc.

References prof2calltree::count, data, alignCSCRings::e, getADCMeanG1(), getADCMeanG12(), getADCMeanG6(), getADCRMSG1(), getADCRMSG12(), getADCRMSG6(), EcalLogicID::getLogicID(), getTaskStatus(), o2o::iov, AlCaHLTBitMon_ParallelJobs::p, edmStreamStallGrapher::t, groupFilesInBlocks::tt, w, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

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

Definition at line 54 of file MonTestPulseDat.cc.

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonTestPulseDat.h.

Member Data Documentation

float MonTestPulseDat::m_adcMeanG1
private

Definition at line 57 of file MonTestPulseDat.h.

Referenced by getADCMeanG1(), and setADCMeanG1().

float MonTestPulseDat::m_adcMeanG12
private

Definition at line 61 of file MonTestPulseDat.h.

Referenced by getADCMeanG12(), and setADCMeanG12().

float MonTestPulseDat::m_adcMeanG6
private

Definition at line 59 of file MonTestPulseDat.h.

Referenced by getADCMeanG6(), and setADCMeanG6().

float MonTestPulseDat::m_adcRMSG1
private

Definition at line 58 of file MonTestPulseDat.h.

Referenced by getADCRMSG1(), and setADCRMSG1().

float MonTestPulseDat::m_adcRMSG12
private

Definition at line 62 of file MonTestPulseDat.h.

Referenced by getADCRMSG12(), and setADCRMSG12().

float MonTestPulseDat::m_adcRMSG6
private

Definition at line 60 of file MonTestPulseDat.h.

Referenced by getADCRMSG6(), and setADCRMSG6().

bool MonTestPulseDat::m_taskStatus
private

Definition at line 63 of file MonTestPulseDat.h.

Referenced by getTaskStatus(), and setTaskStatus().