CMS 3D CMS Logo

AuxiliaryMakers.cc
Go to the documentation of this file.
1 #include <sys/time.h>
2 
5 
6 namespace evf{
7  namespace evtn{
8 
10  unsigned int runNumber,
11  unsigned int lumiSection,
12  const edm::EventAuxiliary::ExperimentType& eventType,
13  const std::string& processGUID,
14  bool verifyLumiSection){
15  edm::EventID eventId(runNumber, // check that runnumber from record is consistent
16  lumiSection,
17  tcds->header.eventNumber);
18 
19  edm::TimeValue_t time = static_cast<edm::TimeValue_t>(((uint64_t)tcds->bst.gpstimehigh << 32) | tcds->bst.gpstimelow);
20  if (time == 0) {
21  timeval stv;
22  gettimeofday(&stv,nullptr);
23  time = stv.tv_sec;
24  time = (time << 32) + stv.tv_usec;
25  }
26 
27  const uint64_t orbitnr = ((uint64_t)tcds->header.orbitHigh << 16) | tcds->header.orbitLow;
28  const uint32_t recordLumiSection = tcds->header.lumiSection;
29 
30  if (verifyLumiSection && recordLumiSection != lumiSection)
31  edm::LogWarning("AuxiliaryMakers") << "Lumisection mismatch, external : " << lumiSection << ", record : " << recordLumiSection;
32  if ((orbitnr >> 18) + 1 != recordLumiSection)
33  edm::LogWarning("AuxiliaryMakers") << "Lumisection and orbit number mismatch, LS : " << lumiSection << ", LS from orbit: " << ((orbitnr >> 18) + 1) << ", orbit:" << orbitnr;
34 
35  return edm::EventAuxiliary(eventId,
36  processGUID,
37  edm::Timestamp(time),
38  true,
39  eventType,
40  (int)tcds->header.bxid,
41  ((uint32_t)(tcds->bst.lhcFillHigh)<<16)|tcds->bst.lhcFillLow,
42  (int)(orbitnr&0x7fffffffU));//framework supports only 32-bit signed
43  }
44  }
45 }
Definition: fillJson.h:27
edm::EventAuxiliary makeEventAuxiliary(const tcds::Raw_v1 *, unsigned int runNumber, unsigned int lumiSection, const edm::EventAuxiliary::ExperimentType &, const std::string &processGUID, bool verifyLumiSection)
const uint16_t orbitLow
Definition: TCDSRaw.h:50
const uint32_t lumiSection
Definition: TCDSRaw.h:44
const uint16_t bxid
Definition: TCDSRaw.h:49
const uint64_t eventNumber
Definition: TCDSRaw.h:53
Definition: TCDSRaw.h:16
const uint32_t orbitHigh
Definition: TCDSRaw.h:51
const struct BST_v1 bst
Definition: TCDSRaw.h:118
unsigned long long TimeValue_t
Definition: Timestamp.h:28
unsigned long long uint64_t
Definition: Time.h:15
const uint16_t lhcFillLow
Definition: TCDSRaw.h:84
const uint32_t gpstimelow
Definition: TCDSRaw.h:77
const uint32_t gpstimehigh
Definition: TCDSRaw.h:78
const struct Header_v1 header
Definition: TCDSRaw.h:116
const uint16_t lhcFillHigh
Definition: TCDSRaw.h:85