CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/OnlineDB/EcalCondDB/interface/RunDCSHVDat.h

Go to the documentation of this file.
00001 #ifndef RUNDCSHVEBDAT_H
00002 #define RUNDCSHVEBDAT_H
00003 
00004 #include <vector>
00005 #include <stdexcept>
00006 
00007 #include "OnlineDB/EcalCondDB/interface/IDataItem.h"
00008 #include "OnlineDB/EcalCondDB/interface/RunIOV.h"
00009 #include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"
00010 #include "OnlineDB/EcalCondDB/interface/Tm.h"
00011 #include "OnlineDB/EcalCondDB/interface/DateHandler.h"
00012 #include "OnlineDB/EcalCondDB/interface/DataReducer.h"
00013 #include "OnlineDB/Oracle/interface/Oracle.h"
00014 
00015 class RunDCSHVDat : public IDataItem {
00016  public:
00017   typedef oracle::occi::ResultSet ResultSet;
00018 
00019   static const int maxDifference = 30*60*1000000; // 30 minutes
00020   static const int maxHVDifferenceEB = 300;       // max HV tolerance in mV for EB
00021   static const int maxHVDifferenceEE = 5000;         // max HV tolerance in mV for EE
00022   static const int minHV = 10000;                 // if HV less than this value (in mV) HV is off
00023   
00024   static const int HVNOTNOMINAL = 1;
00025   static const int HVOFF        = 2;
00026 
00027   friend class EcalCondDBInterface;
00028   RunDCSHVDat();
00029   ~RunDCSHVDat();
00030 
00031   // User data methods
00032   inline std::string getTable() { return ""; }
00033   inline std::string getEBAccount() { return "CMS_ECAL_HV_PVSS_COND"; }
00034   inline std::string getEEAccount() { return "CMS_EE_HV_PVSS_COND"; }
00035   inline void setHV(float t) { m_hv = t; }
00036   inline void setStatus(int t) { m_status = t; }
00037   inline void setHVNominal(float t) { m_hvnom = t; }
00038   inline float getHV() const { return m_hv; }
00039   inline float getHVNominal() const { return m_hvnom; }
00040   inline int getStatus() const { return m_status; }
00041   int getTimeStatus() {return m_tstatus;}
00042   void setTimeStatus(int t ) {m_tstatus=t; } 
00043  private:
00044   void setStatusForBarrel(RunDCSHVDat&, Tm);
00045   void setStatusForEndcaps(RunDCSHVDat&, Tm);
00046   ResultSet* getBarrelRset();
00047   ResultSet* getBarrelRset(Tm timeStart) ;
00048 
00049   ResultSet* getEndcapAnodeRset();
00050   ResultSet* getEndcapDynodeRset();
00051 
00052   ResultSet* getEndcapAnodeRset(Tm timestart);
00053   ResultSet* getEndcapDynodeRset(Tm timestart);
00054   int nowMicroseconds();
00055   void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSHVDat >* );
00056   //  void fillTheMapByTime(ResultSet *, std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > >* ) ;
00057   void fillTheMapByTime(ResultSet *rset, std::list<  DataReducer<RunDCSHVDat>::MyData<RunDCSHVDat>  >* my_data_list ) ;
00058 
00059 
00060   void prepareWrite() 
00061     throw(std::runtime_error);
00062 
00063   void writeDB(const EcalLogicID* ecid, const RunDCSHVDat* item, RunIOV* iov )
00064     throw(std::runtime_error);
00065 
00066   void fetchData(std::map< EcalLogicID, RunDCSHVDat >* fillMap, RunIOV* iov)
00067      throw(std::runtime_error);
00068 
00069   void fetchLastData(std::map< EcalLogicID, RunDCSHVDat >* fillMap)
00070      throw(std::runtime_error);
00071 
00072   void fetchHistoricalData(std::list< std::pair<Tm, std::map< EcalLogicID, RunDCSHVDat > > >* fillMap, Tm timeStart  )
00073     throw(std::runtime_error);
00074 
00075 
00076   // User data
00077   float m_hv;
00078   float m_hvnom;
00079   int m_status;
00080   int m_tstatus; 
00081 };
00082 
00083 #endif