CMS 3D CMS Logo

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

#include <RunDCSHVDat.h>

Inheritance diagram for RunDCSHVDat:
IDataItem IDBObject

Public Types

typedef oracle::occi::ResultSet ResultSet
 

Public Member Functions

std::string getEBAccount ()
 
std::string getEEAccount ()
 
float getHV () const
 
float getHVNominal () const
 
int getStatus () const
 
std::string getTable ()
 
int getTimeStatus ()
 
 RunDCSHVDat ()
 
void setHV (float t)
 
void setHVNominal (float t)
 
void setStatus (int t)
 
void setTimeStatus (int t)
 
 ~RunDCSHVDat ()
 
- 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 ()
 

Static Public Attributes

static const int HVNOTNOMINAL = 1
 
static const int HVOFF = 2
 
static const int maxDifference = 30*60*1000000
 
static const int maxHVDifferenceEB = 300
 
static const int maxHVDifferenceEE = 5000
 
static const int minHV = 10000
 
- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 

Private Member Functions

void fetchData (std::map< EcalLogicID, RunDCSHVDat > *fillMap, RunIOV *iov) throw (std::runtime_error)
 
void fetchHistoricalData (std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > > *fillMap, const Tm &timeStart) throw (std::runtime_error)
 
void fetchLastData (std::map< EcalLogicID, RunDCSHVDat > *fillMap) throw (std::runtime_error)
 
void fillTheMap (ResultSet *, std::map< EcalLogicID, RunDCSHVDat > *)
 
void fillTheMapByTime (ResultSet *rset, std::list< DataReducer< RunDCSHVDat >::MyData< RunDCSHVDat > > *my_data_list)
 
ResultSetgetBarrelRset ()
 
ResultSetgetBarrelRset (const Tm &timeStart)
 
ResultSetgetEndcapAnodeRset ()
 
ResultSetgetEndcapAnodeRset (const Tm &timestart)
 
ResultSetgetEndcapDynodeRset ()
 
ResultSetgetEndcapDynodeRset (const Tm &timestart)
 
int nowMicroseconds ()
 
void prepareWrite () throw (std::runtime_error)
 
void setStatusForBarrel (RunDCSHVDat &, const Tm &)
 
void setStatusForEndcaps (RunDCSHVDat &, const Tm &)
 
void writeDB (const EcalLogicID *ecid, const RunDCSHVDat *item, RunIOV *iov) throw (std::runtime_error)
 

Private Attributes

float m_hv
 
float m_hvnom
 
int m_status
 
int m_tstatus
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- 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 15 of file RunDCSHVDat.h.

Member Typedef Documentation

typedef oracle::occi::ResultSet RunDCSHVDat::ResultSet

Definition at line 17 of file RunDCSHVDat.h.

Constructor & Destructor Documentation

RunDCSHVDat::RunDCSHVDat ( )

Definition at line 15 of file RunDCSHVDat.cc.

References NULL.

16 {
17  m_env = NULL;
18  m_conn = NULL;
19  m_writeStmt = NULL;
20  m_readStmt = NULL;
21 
22  m_hv = 0;
23  m_hvnom = 0;
24  m_status= 0;
25  m_tstatus= 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
float m_hv
Definition: RunDCSHVDat.h:77
#define NULL
Definition: scimark2.h:8
float m_hvnom
Definition: RunDCSHVDat.h:78
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
RunDCSHVDat::~RunDCSHVDat ( )

Definition at line 30 of file RunDCSHVDat.cc.

31 {
32 }

Member Function Documentation

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

Definition at line 52 of file RunDCSHVDat.cc.

54 {
55  fetchLastData(fillMap);
56 
57 }
void fetchLastData(std::map< EcalLogicID, RunDCSHVDat > *fillMap)
Definition: RunDCSHVDat.cc:355
void RunDCSHVDat::fetchHistoricalData ( std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > > *  fillMap,
const Tm timeStart 
)
throw (std::runtime_error
)
private

Definition at line 381 of file RunDCSHVDat.cc.

References alignCSCRings::e, DataReducer< T >::getReducedDataList(), AlCaHLTBitMon_ParallelJobs::p, and DataReducer< T >::setDataList().

383 {
384  this->checkConnection();
385 
386  fillMap->clear();
387 
388  std::list< DataReducer<RunDCSHVDat>::MyData<RunDCSHVDat> > my_data_list;
389 
390 
391  try {
392 
393  std::pair< EcalLogicID, RunDCSHVDat > p;
394  RunDCSHVDat dat;
395 
396  ResultSet* rset1 = getBarrelRset(timeStart);
397  fillTheMapByTime(rset1, &my_data_list);
398 
399  ResultSet* rset2 = getEndcapAnodeRset(timeStart);
400  fillTheMapByTime(rset2, &my_data_list);
401 
402  ResultSet* rset3 = getEndcapDynodeRset(timeStart);
403  fillTheMapByTime(rset3, &my_data_list);
404 
405 
407  my_dr.setDataList(my_data_list);
408  my_dr.getReducedDataList(fillMap);
409 
410 
411  }
412  catch (SQLException &e) {
413  throw(std::runtime_error("RunDCSHVDat::fetchData(): "+e.getMessage()));
414  }
415 }
void setDataList(std::list< MyData< T > > _list)
Definition: DataReducer.h:60
ResultSet * getEndcapDynodeRset()
Definition: RunDCSHVDat.cc:187
ResultSet * getEndcapAnodeRset()
Definition: RunDCSHVDat.cc:170
ResultSet * getBarrelRset()
Definition: RunDCSHVDat.cc:153
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void getReducedDataList(std::list< std::pair< Tm, DataMap > > *my_new_list)
Definition: DataReducer.h:67
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void fillTheMapByTime(ResultSet *rset, std::list< DataReducer< RunDCSHVDat >::MyData< RunDCSHVDat > > *my_data_list)
Definition: RunDCSHVDat.cc:244
void checkConnection() const
Definition: IDBObject.h:41
void RunDCSHVDat::fetchLastData ( std::map< EcalLogicID, RunDCSHVDat > *  fillMap)
throw (std::runtime_error
)
private

Definition at line 355 of file RunDCSHVDat.cc.

References alignCSCRings::e, and AlCaHLTBitMon_ParallelJobs::p.

357 {
358  this->checkConnection();
359 
360  fillMap->clear();
361 
362  try {
363  std::pair< EcalLogicID, RunDCSHVDat > p;
364  RunDCSHVDat dat;
365 
366  ResultSet* rset = getBarrelRset();
367 
368  fillTheMap(rset, fillMap);
369  rset = getEndcapAnodeRset();
370 
371  fillTheMap(rset, fillMap);
372  rset = getEndcapDynodeRset();
373 
374  fillTheMap(rset, fillMap);
375  }
376  catch (SQLException &e) {
377  throw(std::runtime_error("RunDCSHVDat::fetchData(): "+e.getMessage()));
378  }
379 }
ResultSet * getEndcapDynodeRset()
Definition: RunDCSHVDat.cc:187
ResultSet * getEndcapAnodeRset()
Definition: RunDCSHVDat.cc:170
ResultSet * getBarrelRset()
Definition: RunDCSHVDat.cc:153
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSHVDat > *)
Definition: RunDCSHVDat.cc:204
void checkConnection() const
Definition: IDBObject.h:41
void RunDCSHVDat::fillTheMap ( ResultSet rset,
std::map< EcalLogicID, RunDCSHVDat > *  fillMap 
)
private

Definition at line 204 of file RunDCSHVDat.cc.

References DateHandler::dateToTm(), cuy::dh, alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, setHV(), setHVNominal(), and setStatus().

205  {
206 
207  // method for last value queries
208 
209  std::pair< EcalLogicID, RunDCSHVDat > p;
210  RunDCSHVDat dat;
212 
213  try {
214  while(rset->next()) {
215  p.first = EcalLogicID( rset->getString(1), // name
216  rset->getInt(2), // logic_id
217  rset->getInt(3), // id1
218  rset->getInt(4), // id2
219  rset->getInt(5), // id3
220  rset->getString(6)); // maps_to
221 
222  dat.setHV( rset->getFloat(7) );
223  dat.setHVNominal( rset->getFloat(8) );
224  Date sinceDate = rset->getDate(9);
225  Tm sinceTm = dh.dateToTm( sinceDate );
226  dat.setStatus(0);
227  if (p.first.getName() == "EB_HV_channel") {
228  setStatusForBarrel(dat, sinceTm);
229  } else {
230  setStatusForEndcaps(dat, sinceTm);
231  }
232  p.second = dat;
233  fillMap->insert(p);
234  }
235  }
236  catch (SQLException &e) {
237  throw(std::runtime_error("RunDCSHVDat::fetchData(): "+e.getMessage()));
238  }
239 }
void setStatusForEndcaps(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:337
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setStatusForBarrel(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:315
void setStatus(int t)
Definition: RunDCSHVDat.h:36
void setHVNominal(float t)
Definition: RunDCSHVDat.h:37
void setHV(float t)
Definition: RunDCSHVDat.h:35
Definition: Tm.h:13
tuple dh
Definition: cuy.py:353
void RunDCSHVDat::fillTheMapByTime ( ResultSet rset,
std::list< DataReducer< RunDCSHVDat >::MyData< RunDCSHVDat > > *  my_data_list 
)
private

Definition at line 244 of file RunDCSHVDat.cc.

References prof2calltree::count, gather_cfg::cout, cuy::dh, alignCSCRings::e, getHV(), EcalLogicID::getID1(), EcalLogicID::getID2(), EcalLogicID::getName(), AlCaHLTBitMon_ParallelJobs::p, createTree::pp, setHV(), setHVNominal(), setStatus(), Tm::setToString(), and Tm::str().

245  {
246 
247  // std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > >* fillMap) {
248 
249  // method for historic queries
250 
251  RunDCSHVDat dat;
253 
254 
255  try {
256  int count=-1;
257  while(rset->next()) {
258  EcalLogicID ec = EcalLogicID( rset->getString(1), // name
259  rset->getInt(2), // logic_id
260  rset->getInt(3), // id1
261  rset->getInt(4), // id2
262  rset->getInt(5), // id3
263  rset->getString(6)); // maps_to
264 
265 
266  dat.setHV( rset->getFloat(7) );
267  dat.setHVNominal( rset->getFloat(8) );
268  // Date sinceDate = rset->getDate(9);
269  // Tm sinceTm = dh.dateToTm( sinceDate );
270  // Date sinceDate = rset->getDate(9);
271  Timestamp ora_timestamp = rset->getTimestamp(9);
272  Tm sinceTm; // YYYY-MM-DD HH:MM:SS
273  sinceTm.setToString(ora_timestamp.toText("yyyy-mm-dd hh24:mi:ss",0));
274 
275  dat.setStatus(0);
276  if (ec.getName() == "EB_HV_channel") {
277  setStatusForBarrel(dat, sinceTm);
278  } else {
279  setStatusForEndcaps(dat, sinceTm);
280  }
281 
282  std::pair< EcalLogicID, RunDCSHVDat > d;
283  d.first=ec;
284  d.second=dat;
285  std::pair< Tm, std::pair< EcalLogicID, RunDCSHVDat > > p;
286  p.first=sinceTm;
287  p.second = d;
288 
290  pp.m_iData=p;
291 
292  my_data_list->push_back(pp);
293  count++;
294  if(count<100) std::cout<<"DCS DB : size:"<< my_data_list->size()<<" Tm " <<sinceTm.str()<<" "<<ec.getID1()<<" "<<ec.getID2()<<" "<<dat.getHV()<<std::endl;
295  }
296  std::cout<<"DCS DB : size:"<< my_data_list->size()<<std::endl;
297 
298 
299  }
300  catch (SQLException &e) {
301  throw(std::runtime_error("RunDCSHVDat::fetchData(): "+e.getMessage()));
302  }
303 }
void setStatusForEndcaps(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:337
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
tuple pp
Definition: createTree.py:15
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setStatusForBarrel(RunDCSHVDat &, const Tm &)
Definition: RunDCSHVDat.cc:315
int getID2() const
Definition: EcalLogicID.cc:51
std::string getName() const
Definition: EcalLogicID.cc:36
void setToString(const std::string s)
Definition: Tm.cc:193
int getID1() const
Definition: EcalLogicID.cc:46
void setStatus(int t)
Definition: RunDCSHVDat.h:36
void setHVNominal(float t)
Definition: RunDCSHVDat.h:37
std::string str() const
Definition: Tm.cc:89
tuple cout
Definition: gather_cfg.py:121
void setHV(float t)
Definition: RunDCSHVDat.h:35
Definition: Tm.h:13
float getHV() const
Definition: RunDCSHVDat.h:38
tuple dh
Definition: cuy.py:353
ResultSet * RunDCSHVDat::getBarrelRset ( )
private

Definition at line 153 of file RunDCSHVDat.cc.

References alignCSCRings::e, NULL, and o2o::query.

153  {
154  ResultSet* rset = NULL;
155  string query = "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
156  " d.VALUE_NUMBER, h.nominal_value , d.CHANGE_DATE "
157  "FROM "+ getEBAccount()+".FWCAENCHANNEL_LV d "
158  " JOIN "+ getEBAccount()+".HV_MAPPING h on "
159  " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and DPE_NAME='ACTUAL_VMON' ";
160  try {
161  m_readStmt->setSQL(query);
162  rset = m_readStmt->executeQuery();
163  }
164  catch (SQLException e) {
165  throw(std::runtime_error("RunDCSHVDat::getBarrelRset(): " + e.getMessage() + " " + query));
166  }
167  return rset;
168 }
#define NULL
Definition: scimark2.h:8
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
std::string getEBAccount()
Definition: RunDCSHVDat.h:33
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
ResultSet * RunDCSHVDat::getBarrelRset ( const Tm timeStart)
private

Definition at line 61 of file RunDCSHVDat.cc.

References cuy::dh, alignCSCRings::e, NULL, o2o::query, and DateHandler::tmToDate().

61  {
62 
64 
65  ResultSet* rset = NULL;
66  string query="SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
67  " d.actual_vmon, h.nominal_value , d.change_date "
68  " FROM "+ getEBAccount()+".FWCAENCHANNEL d "
69  " JOIN "+ getEBAccount()+".HV_MAPPING h on h.DPID = d.DPID "
70  " join "+ getEBAccount()+".CHANNELVIEW cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name "
71  " AND d.change_date> :1 AND d.actual_vmon is not null order by change_date " ;
72  try {
73  m_readStmt->setSQL(query);
74 
75  m_readStmt->setDate(1, dh.tmToDate(timeStart));
76 
77  rset = m_readStmt->executeQuery();
78  }
79  catch (SQLException e) {
80  throw(std::runtime_error("RunDCSHVDat::getBarrelRset(): " + e.getMessage() + " " + query));
81  }
82  return rset;
83 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
std::string getEBAccount()
Definition: RunDCSHVDat.h:33
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
tuple dh
Definition: cuy.py:353
std::string RunDCSHVDat::getEBAccount ( )
inline

Definition at line 33 of file RunDCSHVDat.h.

33 { return "CMS_ECAL_HV_PVSS_COND"; }
std::string RunDCSHVDat::getEEAccount ( )
inline

Definition at line 34 of file RunDCSHVDat.h.

34 { return "CMS_EE_HV_PVSS_COND"; }
ResultSet * RunDCSHVDat::getEndcapAnodeRset ( )
private

Definition at line 170 of file RunDCSHVDat.cc.

References alignCSCRings::e, NULL, and o2o::query.

170  {
171  ResultSet* rset = NULL;
172  string query = "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
173  " d.value_number, '800' NOMINAL_VALUE , d.CHANGE_DATE "
174  "FROM "+ getEEAccount()+".FWCAENCHANNEL_LV d "
175  " JOIN "+ getEEAccount()+".EE_HVA_MAPPING h on "
176  " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and dpe_name='ACTUAL_VMON' ";
177  try {
178  m_readStmt->setSQL(query);
179  rset = m_readStmt->executeQuery();
180  }
181  catch (SQLException e) {
182  throw(std::runtime_error("RunDCSHVDat::getEndcapAnodeRset(): " + e.getMessage() + " " + query));
183  }
184  return rset;
185 }
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
#define NULL
Definition: scimark2.h:8
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
ResultSet * RunDCSHVDat::getEndcapAnodeRset ( const Tm timestart)
private

Definition at line 85 of file RunDCSHVDat.cc.

References cuy::dh, alignCSCRings::e, NULL, o2o::query, and DateHandler::tmToDate().

85  {
86 
88 
89  ResultSet* rset = NULL;
90  string query="SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
91  " d.actual_vmon, '800' nominal_value , d.change_date "
92  " FROM "+ getEEAccount()+".FWCAENCHANNEL d "
93  " JOIN "+ getEEAccount()+".EE_HVA_MAPPING h on h.DPID = d.DPID "
94  " join "+ getEEAccount()+".CHANNELVIEW cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name "
95  " AND d.change_date> :1 AND d.actual_vmon is not null order by change_date " ;
96  try {
97  m_readStmt->setSQL(query);
98 
99  m_readStmt->setDate(1, dh.tmToDate(timeStart));
100 
101  rset = m_readStmt->executeQuery();
102  }
103  catch (SQLException e) {
104  throw(std::runtime_error("RunDCSHVDat::getBarrelRset(): " + e.getMessage() + " " + query));
105  }
106  return rset;
107 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
#define NULL
Definition: scimark2.h:8
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
tuple dh
Definition: cuy.py:353
ResultSet * RunDCSHVDat::getEndcapDynodeRset ( )
private

Definition at line 187 of file RunDCSHVDat.cc.

References alignCSCRings::e, NULL, and o2o::query.

187  {
188  ResultSet* rset = NULL;
189  string query = "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
190  " d.value_number, '600' NOMINAL_VALUE , d.CHANGE_DATE "
191  "FROM "+ getEEAccount()+".FWCAENCHANNEL_LV d "
192  " JOIN "+ getEEAccount()+".EE_HVD_MAPPING h on "
193  " h.DPID = d.DPID join channelview cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name and dpe_name='ACTUAL_VMON' ";
194  try {
195  m_readStmt->setSQL(query);
196  rset = m_readStmt->executeQuery();
197  }
198  catch (SQLException e) {
199  throw(std::runtime_error("RunDCSHVDat::getEndcapDynodeRset(): " + e.getMessage() + " " + query));
200  }
201  return rset;
202 }
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
#define NULL
Definition: scimark2.h:8
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
ResultSet * RunDCSHVDat::getEndcapDynodeRset ( const Tm timestart)
private

Definition at line 109 of file RunDCSHVDat.cc.

References cuy::dh, alignCSCRings::e, NULL, o2o::query, and DateHandler::tmToDate().

109  {
110 
112 
113  ResultSet* rset = NULL;
114  string query="SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
115  " d.actual_vmon, '600' nominal_value , d.change_date "
116  " FROM "+ getEEAccount()+".FWCAENCHANNEL d "
117  " JOIN "+ getEEAccount()+".EE_HVD_MAPPING h on h.DPID = d.DPID "
118  " join "+ getEEAccount()+".CHANNELVIEW cv on cv.logic_id=h.logic_id WHERE cv.maps_to = cv.name "
119  " AND d.change_date> :1 AND d.actual_vmon is not null order by change_date " ;
120  try {
121  m_readStmt->setSQL(query);
122 
123  m_readStmt->setDate(1, dh.tmToDate(timeStart));
124 
125  rset = m_readStmt->executeQuery();
126  }
127  catch (SQLException e) {
128  throw(std::runtime_error("RunDCSHVDat::getBarrelRset(): " + e.getMessage() + " " + query));
129  }
130  return rset;
131 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string getEEAccount()
Definition: RunDCSHVDat.h:34
#define NULL
Definition: scimark2.h:8
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
tuple dh
Definition: cuy.py:353
float RunDCSHVDat::getHV ( ) const
inline
float RunDCSHVDat::getHVNominal ( ) const
inline
int RunDCSHVDat::getStatus ( void  ) const
inline

Definition at line 40 of file RunDCSHVDat.h.

References m_status.

Referenced by popcon::EcalDCSHandler::printHVDataSet(), and popcon::EcalDCSHandler::updateHV().

40 { return m_status; }
std::string RunDCSHVDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 32 of file RunDCSHVDat.h.

32 { return ""; }
int RunDCSHVDat::getTimeStatus ( )
inline

Definition at line 41 of file RunDCSHVDat.h.

References m_tstatus.

41 {return m_tstatus;}
int RunDCSHVDat::nowMicroseconds ( )
private

Definition at line 305 of file RunDCSHVDat.cc.

References Tm::microsTime(), and Tm::setToCurrentGMTime().

305  {
306  Tm t_now_gmt;
307 
308  t_now_gmt.setToCurrentGMTime();
309  int t_now_gmt_micros = t_now_gmt.microsTime();
310  return t_now_gmt_micros;
311 }
void setToCurrentGMTime()
Definition: Tm.cc:177
uint64_t microsTime() const
Definition: Tm.cc:126
Definition: Tm.h:13
void RunDCSHVDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 36 of file RunDCSHVDat.cc.

38 {
39 
40 
41 }
void RunDCSHVDat::setHV ( float  t)
inline

Definition at line 35 of file RunDCSHVDat.h.

References m_hv, and lumiQTWidget::t.

Referenced by fillTheMap(), and fillTheMapByTime().

35 { m_hv = t; }
float m_hv
Definition: RunDCSHVDat.h:77
void RunDCSHVDat::setHVNominal ( float  t)
inline

Definition at line 37 of file RunDCSHVDat.h.

References m_hvnom, and lumiQTWidget::t.

Referenced by fillTheMap(), and fillTheMapByTime().

37 { m_hvnom = t; }
float m_hvnom
Definition: RunDCSHVDat.h:78
void RunDCSHVDat::setStatus ( int  t)
inline

Definition at line 36 of file RunDCSHVDat.h.

References m_status, and lumiQTWidget::t.

Referenced by fillTheMap(), fillTheMapByTime(), setStatusForBarrel(), and setStatusForEndcaps().

36 { m_status = t; }
void RunDCSHVDat::setStatusForBarrel ( RunDCSHVDat dat,
const Tm sinceTm 
)
private

Definition at line 315 of file RunDCSHVDat.cc.

References getHV(), getHVNominal(), Tm::microsTime(), query::result, setStatus(), and setTimeStatus().

315  {
316  int t_now_gmt_micros = nowMicroseconds();
317 
318  float hv_diff=dat.getHV() - dat.getHVNominal();
319  if(hv_diff<0) hv_diff=-hv_diff;
320  if (hv_diff*1000 > maxHVDifferenceEB) {
321  dat.setStatus(HVNOTNOMINAL);
322  }
323  if (dat.getHV()*1000 < minHV) {
324  dat.setStatus(HVOFF);
325  }
326 
327  int result=0;
328  long long d= (t_now_gmt_micros - sinceTm.microsTime()) ;
329  if (d> maxDifference) {
330  result= -d/1000000 ;
331  }
332  dat.setTimeStatus(result);
333 
334 
335 }
static const int maxHVDifferenceEB
Definition: RunDCSHVDat.h:20
float getHVNominal() const
Definition: RunDCSHVDat.h:39
static const int HVNOTNOMINAL
Definition: RunDCSHVDat.h:24
uint64_t microsTime() const
Definition: Tm.cc:126
tuple result
Definition: query.py:137
static const int minHV
Definition: RunDCSHVDat.h:22
void setTimeStatus(int t)
Definition: RunDCSHVDat.h:42
void setStatus(int t)
Definition: RunDCSHVDat.h:36
static const int HVOFF
Definition: RunDCSHVDat.h:25
int nowMicroseconds()
Definition: RunDCSHVDat.cc:305
float getHV() const
Definition: RunDCSHVDat.h:38
static const int maxDifference
Definition: RunDCSHVDat.h:19
void RunDCSHVDat::setStatusForEndcaps ( RunDCSHVDat dat,
const Tm sinceTm 
)
private

Definition at line 337 of file RunDCSHVDat.cc.

References getHV(), getHVNominal(), Tm::microsTime(), query::result, setStatus(), and setTimeStatus().

337  {
338  int t_now_gmt_micros = nowMicroseconds();
339 
340  if (fabs(dat.getHV() - dat.getHVNominal())*1000 > maxHVDifferenceEE) {
341  dat.setStatus(HVNOTNOMINAL);
342  }
343  if (dat.getHV()*1000 < minHV) {
344  dat.setStatus(HVOFF);
345  }
346 
347  int result=0;
348  long long d= (t_now_gmt_micros - sinceTm.microsTime()) ;
349  if (d> maxDifference) {
350  result= -d/1000000 ;
351  }
352  dat.setTimeStatus(result);
353 }
float getHVNominal() const
Definition: RunDCSHVDat.h:39
static const int HVNOTNOMINAL
Definition: RunDCSHVDat.h:24
uint64_t microsTime() const
Definition: Tm.cc:126
tuple result
Definition: query.py:137
static const int minHV
Definition: RunDCSHVDat.h:22
static const int maxHVDifferenceEE
Definition: RunDCSHVDat.h:21
void setTimeStatus(int t)
Definition: RunDCSHVDat.h:42
void setStatus(int t)
Definition: RunDCSHVDat.h:36
static const int HVOFF
Definition: RunDCSHVDat.h:25
int nowMicroseconds()
Definition: RunDCSHVDat.cc:305
float getHV() const
Definition: RunDCSHVDat.h:38
static const int maxDifference
Definition: RunDCSHVDat.h:19
void RunDCSHVDat::setTimeStatus ( int  t)
inline

Definition at line 42 of file RunDCSHVDat.h.

References m_tstatus, and lumiQTWidget::t.

Referenced by setStatusForBarrel(), and setStatusForEndcaps().

42 {m_tstatus=t; }
void RunDCSHVDat::writeDB ( const EcalLogicID ecid,
const RunDCSHVDat item,
RunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 45 of file RunDCSHVDat.cc.

47 {
48 }

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 27 of file RunDCSHVDat.h.

Member Data Documentation

const int RunDCSHVDat::HVNOTNOMINAL = 1
static

Definition at line 24 of file RunDCSHVDat.h.

Referenced by popcon::EcalDCSHandler::updateHV().

const int RunDCSHVDat::HVOFF = 2
static

Definition at line 25 of file RunDCSHVDat.h.

Referenced by popcon::EcalDCSHandler::updateHV().

float RunDCSHVDat::m_hv
private

Definition at line 77 of file RunDCSHVDat.h.

Referenced by getHV(), and setHV().

float RunDCSHVDat::m_hvnom
private

Definition at line 78 of file RunDCSHVDat.h.

Referenced by getHVNominal(), and setHVNominal().

int RunDCSHVDat::m_status
private

Definition at line 79 of file RunDCSHVDat.h.

Referenced by getStatus(), and setStatus().

int RunDCSHVDat::m_tstatus
private

Definition at line 80 of file RunDCSHVDat.h.

Referenced by getTimeStatus(), and setTimeStatus().

const int RunDCSHVDat::maxDifference = 30*60*1000000
static

Definition at line 19 of file RunDCSHVDat.h.

const int RunDCSHVDat::maxHVDifferenceEB = 300
static

Definition at line 20 of file RunDCSHVDat.h.

const int RunDCSHVDat::maxHVDifferenceEE = 5000
static

Definition at line 21 of file RunDCSHVDat.h.

const int RunDCSHVDat::minHV = 10000
static

Definition at line 22 of file RunDCSHVDat.h.