Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:18

0001 #include "DataFormats/TCDS/interface/BSTRecord.h"
0002 #include "DataFormats/TCDS/interface/TCDSRaw.h"
0003 
0004 BSTRecord::BSTRecord()
0005     : m_gpstime(0),
0006       m_turnCount(0),
0007       m_lhcFill(0),
0008       m_intensityBeam1(0),
0009       m_intensityBeam2(0),
0010       m_beamMomentum(0),
0011       m_beamMode(0),
0012       m_particleBeam1(0),
0013       m_particleBeam2(0),
0014       m_bstMaster(0) {}
0015 
0016 BSTRecord::BSTRecord(const tcds::BST_v1& bst)
0017     : m_gpstime(((uint64_t)(bst.gpstimehigh) << 32) | bst.gpstimelow),
0018       m_turnCount(((uint32_t)(bst.turnCountHigh) << 16) | bst.turnCountLow),
0019       m_lhcFill(((uint32_t)(bst.lhcFillHigh) << 16) | bst.lhcFillLow),
0020       m_intensityBeam1(bst.intensityBeam1),
0021       m_intensityBeam2(bst.intensityBeam2),
0022       m_beamMomentum(bst.beamMomentum),
0023       m_beamMode(bst.beamMode),
0024       m_particleBeam1(bst.particleTypes & 0xFF),
0025       m_particleBeam2(bst.particleTypes >> 8),
0026       m_bstMaster(bst.bstMaster >> 8) {
0027   if (m_beamMomentum == 65535)  // Invalid value
0028     m_beamMomentum = -1;
0029   else if (m_lhcFill >= 5698)  // scale factor changed from 1GeV/LSB to 120MeV/LSB
0030     m_beamMomentum *= 0.120;
0031 }
0032 
0033 std::ostream& operator<<(std::ostream& s, const BSTRecord& record) {
0034   s << "BST record:" << std::endl;
0035   s << "   GpsTime:            " << record.getGpsTime() << std::endl;
0036   s << "   BstMaster:          " << (uint16_t)record.getBstMaster() << std::endl;
0037   s << "   TurnCount:          " << record.getTurnCount() << std::endl;
0038   s << "   LhcFill:            " << record.getLhcFill() << std::endl;
0039   s << "   BeamMode:           " << record.getBeamMode() << std::endl;
0040   s << "   ParticleBeam1:      " << (uint16_t)record.getParticleBeam1() << std::endl;
0041   s << "   ParticleBeam2:      " << (uint16_t)record.getParticleBeam2() << std::endl;
0042   s << "   BeamMomentum:       " << record.getBeamMomentum() << " GeV" << std::endl;
0043   s << "   IntensityBeam1:     " << record.getIntensityBeam1() << " 10E10" << std::endl;
0044   s << "   IntensityBeam2:     " << record.getIntensityBeam2() << " 10E10" << std::endl;
0045 
0046   return s;
0047 }