Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:12

0001 #include <iomanip>
0002 #include <ctime>
0003 
0004 #include "DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h"
0005 #include "DataFormats/OnlineMetaData/interface/OnlineMetaDataRaw.h"
0006 
0007 OnlineLuminosityRecord::OnlineLuminosityRecord()
0008     : timestamp_(edm::Timestamp::invalidTimestamp()), instLumi_(0), avgPileUp_(0), lumiSection_(0), lumiNibble_(0) {}
0009 
0010 OnlineLuminosityRecord::OnlineLuminosityRecord(const online::Luminosity_v1& lumi) {
0011   // DIP timestamp is in milliseconds
0012   const uint64_t seconds = lumi.timestamp / 1000;
0013   const uint32_t microseconds = (lumi.timestamp % 1000) * 1000;
0014   timestamp_ = edm::Timestamp((seconds << 32) | microseconds);
0015   instLumi_ = lumi.instLumi;
0016   avgPileUp_ = lumi.avgPileUp;
0017   lumiSection_ = lumi.lumiSection;
0018   lumiNibble_ = lumi.lumiNibble;
0019 }
0020 
0021 OnlineLuminosityRecord::~OnlineLuminosityRecord() {}
0022 
0023 std::ostream& operator<<(std::ostream& s, const OnlineLuminosityRecord& luminosity) {
0024   const time_t ts = luminosity.timestamp().unixTime();
0025 
0026   s << "timeStamp:        " << asctime(localtime(&ts));
0027   s << "lumiSection:      " << luminosity.lumiSection() << std::endl;
0028   s << "lumiNibble:       " << luminosity.lumiNibble() << std::endl;
0029 
0030   std::streamsize ss = s.precision();
0031   s.setf(std::ios::fixed);
0032   s.precision(2);
0033   s << "instLumi:         " << luminosity.instLumi() << std::endl;
0034   s << "avgPileUp:        " << luminosity.avgPileUp() << std::endl;
0035   s.unsetf(std::ios::fixed);
0036   s.precision(ss);
0037 
0038   return s;
0039 }