Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RUNDCSLVEBDAT_H
0002 #define RUNDCSLVEBDAT_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/Oracle/interface/Oracle.h"
0013 
0014 class RunDCSLVDat : public IDataItem {
0015 public:
0016   typedef oracle::occi::ResultSet ResultSet;
0017 
0018   static const int maxDifference = 30 * 60 * 1000000;  // 30 minutes
0019   static const int maxLVDifferenceEB = 1000;           // max LV tolerance in mV for EB
0020   static const int maxLVDifferenceEE = 1000;           // max LV tolerance in mV for EE
0021   static const int minLV = 2000;                       // if LV less than this value (in mV) LV is off
0022 
0023   static const int LVNOTNOMINAL = 1;
0024   static const int LVOFF = 2;
0025 
0026   friend class EcalCondDBInterface;
0027   RunDCSLVDat();
0028   ~RunDCSLVDat() override;
0029 
0030   // User data methods
0031   inline std::string getTable() override { return ""; }
0032   inline std::string getEBAccount() { return "CMS_ECAL_LV_PVSS_COND"; }
0033   inline std::string getEEAccount() { return "CMS_ECAL_LV_PVSS_COND"; }
0034   inline void setLV(float t) { m_lv = t; }
0035   inline void setStatus(int t) { m_status = t; }
0036   inline void setLVNominal(float t) { m_lvnom = t; }
0037   inline float getLV() const { return m_lv; }
0038   inline float getLVNominal() const { return m_lvnom; }
0039   inline int getStatus() const { return m_status; }
0040   int getTimeStatus() { return m_tstatus; }
0041   void setTimeStatus(int t) { m_tstatus = t; }
0042 
0043 private:
0044   void setStatusForBarrel(RunDCSLVDat&, const Tm&);
0045   void setStatusForEndcaps(RunDCSLVDat&, const Tm&);
0046   ResultSet* getBarrelRset();
0047   ResultSet* getEndcapRset();
0048   int nowMicroseconds();
0049   void fillTheMap(ResultSet*, std::map<EcalLogicID, RunDCSLVDat>*);
0050   void prepareWrite() noexcept(false) override;
0051 
0052   void writeDB(const EcalLogicID* ecid, const RunDCSLVDat* item, RunIOV* iov) noexcept(false);
0053 
0054   void fetchData(std::map<EcalLogicID, RunDCSLVDat>* fillMap, RunIOV* iov) noexcept(false);
0055 
0056   void fetchLastData(std::map<EcalLogicID, RunDCSLVDat>* fillMap) noexcept(false);
0057 
0058   // User data
0059   float m_lv;
0060   float m_lvnom;
0061   int m_status;
0062   int m_tstatus;
0063 };
0064 
0065 #endif