Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:57

0001 #ifndef RUNDCSHVEBDAT_H
0002 #define RUNDCSHVEBDAT_H
0003 
0004 #include <vector>
0005 #include <stdexcept>
0006 
0007 #include "OnlineDB/EcalCondDB/interface/IDataItem.h"
0008 #include "OnlineDB/EcalCondDB/interface/RunIOV.h"
0009 #include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"
0010 #include "OnlineDB/EcalCondDB/interface/Tm.h"
0011 #include "OnlineDB/EcalCondDB/interface/DateHandler.h"
0012 #include "OnlineDB/EcalCondDB/interface/DataReducer.h"
0013 #include "OnlineDB/Oracle/interface/Oracle.h"
0014 
0015 class RunDCSHVDat : public IDataItem {
0016 public:
0017   typedef oracle::occi::ResultSet ResultSet;
0018 
0019   static const int maxDifference = 30 * 60 * 1000000;  // 30 minutes
0020   static const int maxHVDifferenceEB = 300;            // max HV tolerance in mV for EB
0021   static const int maxHVDifferenceEE = 5000;           // max HV tolerance in mV for EE
0022   static const int minHV = 10000;                      // if HV less than this value (in mV) HV is off
0023 
0024   static const int HVNOTNOMINAL = 1;
0025   static const int HVOFF = 2;
0026 
0027   friend class EcalCondDBInterface;
0028   RunDCSHVDat();
0029   ~RunDCSHVDat() override;
0030 
0031   // User data methods
0032   inline std::string getTable() override { return ""; }
0033   inline std::string getEBAccount() { return "CMS_ECAL_HV_PVSS_COND"; }
0034   inline std::string getEEAccount() { return "CMS_EE_HV_PVSS_COND"; }
0035   inline void setHV(float t) { m_hv = t; }
0036   inline void setStatus(int t) { m_status = t; }
0037   inline void setHVNominal(float t) { m_hvnom = t; }
0038   inline float getHV() const { return m_hv; }
0039   inline float getHVNominal() const { return m_hvnom; }
0040   inline int getStatus() const { return m_status; }
0041   int getTimeStatus() { return m_tstatus; }
0042   void setTimeStatus(int t) { m_tstatus = t; }
0043 
0044 private:
0045   void setStatusForBarrel(RunDCSHVDat&, const Tm&);
0046   void setStatusForEndcaps(RunDCSHVDat&, const Tm&);
0047   ResultSet* getBarrelRset();
0048   ResultSet* getBarrelRset(const Tm& timeStart);
0049 
0050   ResultSet* getEndcapAnodeRset();
0051   ResultSet* getEndcapDynodeRset();
0052 
0053   ResultSet* getEndcapAnodeRset(const Tm& timestart);
0054   ResultSet* getEndcapDynodeRset(const Tm& timestart);
0055   int nowMicroseconds();
0056   void fillTheMap(ResultSet*, std::map<EcalLogicID, RunDCSHVDat>*);
0057   //  void fillTheMapByTime(ResultSet *, std::list< std::pair< Tm, std::map< EcalLogicID, RunDCSHVDat > > >* ) ;
0058   void fillTheMapByTime(ResultSet* rset, std::list<DataReducer<RunDCSHVDat>::MyData<RunDCSHVDat> >* my_data_list);
0059 
0060   void prepareWrite() noexcept(false) override;
0061 
0062   void writeDB(const EcalLogicID* ecid, const RunDCSHVDat* item, RunIOV* iov) noexcept(false);
0063 
0064   void fetchData(std::map<EcalLogicID, RunDCSHVDat>* fillMap, RunIOV* iov) noexcept(false);
0065 
0066   void fetchLastData(std::map<EcalLogicID, RunDCSHVDat>* fillMap) noexcept(false);
0067 
0068   void fetchHistoricalData(std::list<std::pair<Tm, std::map<EcalLogicID, RunDCSHVDat> > >* fillMap,
0069                            const Tm& timeStart) noexcept(false);
0070 
0071   // User data
0072   float m_hv;
0073   float m_hvnom;
0074   int m_status;
0075   int m_tstatus;
0076 };
0077 
0078 #endif