Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-11 16:22:55

0001 #include <sys/time.h>
0002 
0003 #include "EventFilter/Utilities/interface/AuxiliaryMakers.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 
0006 namespace evf {
0007   namespace evtn {
0008 
0009     edm::EventAuxiliary makeEventAuxiliary(const tcds::Raw_v1* tcds,
0010                                            unsigned int runNumber,
0011                                            unsigned int lumiSection,
0012                                            bool isRealData,
0013                                            const edm::EventAuxiliary::ExperimentType& eventType,
0014                                            const std::string& processGUID,
0015                                            bool verifyLumiSection,
0016                                            bool suppressWarning) {
0017       edm::EventID eventId(runNumber,  // check that runnumber from record is consistent
0018                            lumiSection,
0019                            tcds->header.eventNumber);
0020 
0021       edm::TimeValue_t time =
0022           static_cast<edm::TimeValue_t>(((uint64_t)tcds->bst.gpstimehigh << 32) | tcds->bst.gpstimelow);
0023       if (time == 0) {
0024         timeval stv;
0025         gettimeofday(&stv, nullptr);
0026         time = stv.tv_sec;
0027         time = (time << 32) + stv.tv_usec;
0028       }
0029 
0030       const uint64_t orbitnr = ((uint64_t)tcds->header.orbitHigh << 16) | tcds->header.orbitLow;
0031       const uint32_t recordLumiSection = tcds->header.lumiSection;
0032 
0033       if (isRealData && !suppressWarning) {
0034         //warnings are disabled for generated data
0035         if (verifyLumiSection && recordLumiSection != lumiSection)
0036           edm::LogWarning("AuxiliaryMakers")
0037               << "Lumisection mismatch, external : " << lumiSection << ", record : " << recordLumiSection;
0038         if ((orbitnr >> 18) + 1 != recordLumiSection)
0039           edm::LogWarning("AuxiliaryMakers") << "Lumisection and orbit number mismatch, LS : " << lumiSection
0040                                              << ", LS from orbit: " << ((orbitnr >> 18) + 1) << ", orbit:" << orbitnr;
0041       }
0042 
0043       return edm::EventAuxiliary(eventId,
0044                                  processGUID,
0045                                  edm::Timestamp(time),
0046                                  isRealData,
0047                                  eventType,
0048                                  (int)tcds->header.bxid,
0049                                  ((uint32_t)(tcds->bst.lhcFillHigh) << 16) | tcds->bst.lhcFillLow,
0050                                  (int)(orbitnr & 0x7fffffffU));  //framework supports only 32-bit signed
0051     }
0052   }  // namespace evtn
0053 }  // namespace evf