00001 #ifndef RUNDCSMAGNET_H 00002 #define RUNDCSMAGNET_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 RunDCSMagnetDat : public IDataItem { 00016 public: 00017 typedef oracle::occi::ResultSet ResultSet; 00018 00019 friend class EcalCondDBInterface; 00020 RunDCSMagnetDat(); 00021 ~RunDCSMagnetDat(); 00022 00023 // User data methods 00024 inline std::string getTable() { return "CMSFWMAGNET_LV"; } 00025 inline std::string getMagnetAccount() { return "CMS_DCS_ENV_PVSS_COND"; } 00026 inline void setMagnetCurrent(float t) { m_current = t; } 00027 inline float getMagnetCurrent() const { return m_current; } 00028 00029 void setTime(Tm start); 00030 Tm getTime() const; 00031 00032 private: 00033 ResultSet* getMagnetRset(); 00034 00035 int nowMicroseconds(); 00036 00037 void fillTheMap(ResultSet *, std::map< EcalLogicID, RunDCSMagnetDat >* ); 00038 00039 void prepareWrite() 00040 throw(std::runtime_error); 00041 00042 void writeDB(const EcalLogicID* ecid, const RunDCSMagnetDat* item, RunIOV* iov ) 00043 throw(std::runtime_error); 00044 00045 void fetchData(std::map< EcalLogicID, RunDCSMagnetDat >* fillMap, RunIOV* iov) 00046 throw(std::runtime_error); 00047 00048 void fetchLastData(std::map< EcalLogicID, RunDCSMagnetDat >* fillMap) 00049 throw(std::runtime_error); 00050 00051 00052 // User data 00053 float m_current; 00054 Tm m_time; 00055 00056 }; 00057 00058 #endif