CMS 3D CMS Logo

convertSyncValue.h
Go to the documentation of this file.
1 #ifndef CondCore_HDF5ESSource_convertSyncValue_h
2 #define CondCore_HDF5ESSource_convertSyncValue_h
3 // -*- C++ -*-
4 //
5 // Package: CondCore/HDF5ESSource
6 // Class : convertSyncValue
7 //
16 //
17 // Original Author: Christopher Jones
18 // Created: Tue, 20 Jun 2023 18:26:32 GMT
19 //
20 
21 // system include files
22 
23 // user include files
25 #include "IOVSyncValue.h"
26 
27 // forward declarations
28 
29 namespace cond::hdf5 {
30  inline IOVSyncValue convertSyncValue(edm::IOVSyncValue const& iFrom, bool iIsRunLumi) {
31  if (iIsRunLumi) {
32  return IOVSyncValue{iFrom.eventID().run(), iFrom.eventID().luminosityBlock()};
33  }
34  return IOVSyncValue{iFrom.time().unixTime(), iFrom.time().microsecondOffset()};
35  }
36 
37  inline edm::IOVSyncValue convertSyncValue(IOVSyncValue const& iFrom, bool iIsRunLumi) {
38  if (iIsRunLumi) {
39  return edm::IOVSyncValue{edm::EventID{iFrom.high_, iFrom.low_, 0}};
40  }
41  return edm::IOVSyncValue{edm::Timestamp{(static_cast<uint64_t>(iFrom.high_) << 32) + iFrom.low_}};
42  }
43 } // namespace cond::hdf5
44 
45 #endif
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
unsigned int microsecondOffset() const
Microseconds offset within second.
Definition: Timestamp.h:36
RunNumber_t run() const
Definition: EventID.h:38
unsigned long long uint64_t
Definition: Time.h:13
const EventID & eventID() const
Definition: IOVSyncValue.h:40
const Timestamp & time() const
Definition: IOVSyncValue.h:42
IOVSyncValue convertSyncValue(edm::IOVSyncValue const &iFrom, bool iIsRunLumi)
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:33