Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RUNIOV_H
0002 #define RUNIOV_H
0003 
0004 #include <stdexcept>
0005 #include <iostream>
0006 
0007 #include "OnlineDB/EcalCondDB/interface/IIOV.h"
0008 #include "OnlineDB/EcalCondDB/interface/RunTag.h"
0009 #include "OnlineDB/EcalCondDB/interface/Tm.h"
0010 
0011 typedef int run_t;
0012 
0013 class RunIOV : public IIOV {
0014 public:
0015   friend class EcalCondDBInterface;
0016 
0017   RunIOV();
0018   ~RunIOV() override;
0019 
0020   // Methods for user data

0021   void setRunNumber(run_t run);
0022   run_t getRunNumber() const;
0023   void setRunStart(const Tm& start);
0024   Tm getRunStart() const;
0025   void setRunEnd(const Tm& end);
0026   Tm getRunEnd() const;
0027   void setRunTag(const RunTag& tag);
0028   RunTag getRunTag() const;
0029   void setID(int id);
0030 
0031   void setDBInsertionTime(const Tm& dbtime) { m_dbtime = dbtime; }
0032   Tm getDBInsertionTime() { return m_dbtime; }
0033 
0034   // Methods from IUniqueDBObject

0035   int getID() { return m_ID; };
0036 
0037   int fetchID() noexcept(false) override;
0038   int fetchIDByRunAndTag() noexcept(false);
0039   void setByID(int id) noexcept(false) override;
0040 
0041   // operators

0042   inline bool operator==(const RunIOV& r) const {
0043     return (m_runNum == r.m_runNum && m_runStart == r.m_runStart && m_runEnd == r.m_runEnd && m_runTag == r.m_runTag);
0044   }
0045 
0046   inline bool operator!=(const RunIOV& r) const { return !(*this == r); }
0047 
0048 private:
0049   // User data for this IOV

0050   run_t m_runNum;
0051   Tm m_runStart;
0052   Tm m_runEnd;
0053   RunTag m_runTag;
0054   Tm m_dbtime;
0055 
0056   int writeDB() noexcept(false);
0057   int updateEndTimeDB() noexcept(false);
0058   int updateStartTimeDB() noexcept(false);
0059 
0060   void setByRun(RunTag* tag, run_t run) noexcept(false);
0061   void setByRun(std::string location, run_t run) noexcept(false);
0062   void setByTime(std::string location, const Tm& t) noexcept(false);
0063   void setByRecentData(std::string dataTable, RunTag* tag, run_t run = (unsigned int)-1) noexcept(false);
0064   void setByRecentData(std::string dataTable, std::string location, run_t run) noexcept(false);
0065 
0066   /*   void fetchEarliest(RunIOV* fillIOV, RunTag* tag) const noexcept(false); */
0067   /*   void fetchLatest(RunIOV* fillIOV, RunTag* tag) const noexcept(false); */
0068   /*   oracle::occi::Statement* prepareFetch(const std::string sql, RunTag* tag) const noexcept(false); */
0069   /*   void fill(RunIOV* target, oracle::occi::ResultSet* rset) const noexcept(false); */
0070 
0071   /*   // Methods for fetching by Tm */
0072   /*   void fetchAt(RunIOV* iov, const Tm eventTm, RunTag* tag) const noexcept(false); */
0073   /*   void fetchWithin(std::vector<RunIOV>* fillVec, const Tm beginTm, const Tm endTm, RunTag* tag) const noexcept(false); */
0074 
0075   /*   // Methods for fetching by run_t */
0076   /*   void fetchAt(RunIOV* fillIOV, const run_t run, RunTag* tag) const noexcept(false); */
0077   /*   void fetchWithin(std::vector<RunIOV>* fillVec, const run_t beginRun, const run_t endRun, RunTag* tag) const noexcept(false); */
0078 };
0079 
0080 #endif