CMS 3D CMS Logo

RunInfoSchema.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_RunInfoSchema_h
2 #define CondCore_CondDB_RunInfoSchema_h
3 
4 #include "DbCore.h"
5 #include "IDbSchema.h"
6 //
7 #include <boost/date_time/posix_time/posix_time.hpp>
8 
9 namespace cond {
10 
11  namespace persistency {
12 
13  conddb_table( RUN_INFO ) {
14 
16  conddb_column( START_TIME, boost::posix_time::ptime );
17  conddb_column( END_TIME, boost::posix_time::ptime );
18 
19  struct MAX_RUN_NUMBER {
20  typedef cond::Time_t type;
21  static constexpr size_t size = 0;
22  static std::string tableName(){ return RUN_NUMBER::tableName(); }
24  return "MAX("+RUN_NUMBER::fullyQualifiedName()+")";
25  }
26  };
27 
28  struct MIN_RUN_NUMBER {
29  typedef cond::Time_t type;
30  static constexpr size_t size = 0;
31  static std::string tableName(){ return RUN_NUMBER::tableName(); }
33  return "MIN("+RUN_NUMBER::fullyQualifiedName()+")";
34  }
35  };
36 
37  struct MIN_START_TIME {
38  typedef boost::posix_time::ptime type;
39  static constexpr size_t size = 0;
40  static std::string tableName(){ return START_TIME::tableName(); }
42  return "MIN("+START_TIME::fullyQualifiedName()+")";
43  }
44  };
45 
46  class Table : public IRunInfoTable {
47  public:
48  explicit Table( coral::ISchema& schema );
49  virtual ~Table(){}
50  bool exists();
51  void create();
52  bool select( cond::Time_t runNumber, boost::posix_time::ptime& start, boost::posix_time::ptime& end );
53  cond::Time_t getLastInserted();
54  bool getInclusiveRunRange( cond::Time_t lower, cond::Time_t upper,
55  std::vector<std::tuple<cond::Time_t,boost::posix_time::ptime,boost::posix_time::ptime> >& runData );
56  bool getInclusiveTimeRange( const boost::posix_time::ptime& lower ,const boost::posix_time::ptime& upper,
57  std::vector<std::tuple<cond::Time_t,boost::posix_time::ptime,boost::posix_time::ptime> >& runData );
58  void insertOne( cond::Time_t runNumber, const boost::posix_time::ptime& start, const boost::posix_time::ptime& end);
59  void insert( const std::vector<std::tuple<cond::Time_t,boost::posix_time::ptime,boost::posix_time::ptime> >& runs );
60  void updateEnd( cond::Time_t runNumber, const boost::posix_time::ptime& end );
61 
62  private:
63  coral::ISchema& m_schema;
64  };
65  }
66 
67 
68  class RunInfoSchema : public IRunInfoSchema {
69  public:
70  explicit RunInfoSchema( coral::ISchema& schema );
71  virtual ~RunInfoSchema(){}
72  bool exists();
73  bool create();
74  IRunInfoTable& runInfoTable();
75  private:
77  };
78 
79  }
80 }
81 #endif
size
Write out results.
Definition: start.py:1
def create(alignables, pedeDump, additionalData, outputFile, config)
#define conddb_column(...)
Definition: DbCore.h:73
#define constexpr
unsigned long long Time_t
Definition: Time.h:16
#define end
Definition: vmac.h:37
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
Definition: plugin.cc:24
#define conddb_table(NAME)
Definition: DbCore.h:48