Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DATAFORMATS_TCDS_BSTRECORD_H
0002 #define DATAFORMATS_TCDS_BSTRECORD_H
0003 
0004 //---------------------------------------------------------------------------
0005 //! \class BSTRecord
0006 //!
0007 //! \brief Class representing the Beam Synchronous Timing (BST)
0008 //! information included in the TCDS record.
0009 //! Beam parameters provided by BST are defined in:
0010 //! https://edms.cern.ch/document/638899/2.0
0011 //!
0012 //! \author S. Di Guida - INFN and Marconi University
0013 //! \author Remi Mommsen - Fermilab
0014 //!
0015 //---------------------------------------------------------------------------
0016 
0017 #include <ostream>
0018 #include <cstdint>
0019 
0020 #include "DataFormats/TCDS/interface/TCDSRaw.h"
0021 
0022 class BSTRecord {
0023 public:
0024   enum BeamMode {
0025     NOMODE = 0,
0026     SETUP = 1,
0027     INJPILOR = 3,
0028     INJINTR = 4,
0029     INJNOMN = 5,
0030     PRERAMP = 6,
0031     RAMP = 7,
0032     FLATTOP = 8,
0033     SQUEEZE = 9,
0034     ADJUST = 10,
0035     STABLE = 11,
0036     UNSTABLE = 12,
0037     BEAMDUMP = 13,
0038     RAMPDOWN = 14,
0039     RECOVERY = 15,
0040     INJDUMP = 16,
0041     CIRCDUMP = 17,
0042     ABORT = 18,
0043     CYCLING = 19,
0044     WBDUMP = 20,
0045     NOBEAM = 21,
0046   };
0047 
0048   enum Particle {
0049     PROTON = 0,
0050     LEAD = 1,
0051   };
0052 
0053   BSTRecord();
0054 
0055   BSTRecord(const tcds::BST_v1&);
0056 
0057   // Microseconds since Epoch
0058   uint64_t const getGpsTime() const { return m_gpstime; }
0059 
0060   // BST beam master
0061   uint8_t const getBstMaster() const { return m_bstMaster; }
0062 
0063   // Turn count
0064   uint32_t const getTurnCount() const { return m_turnCount; }
0065 
0066   // Fill number
0067   uint32_t const getLhcFill() const { return m_lhcFill; }
0068 
0069   // Beam Mode. The return value corresponds to BSTRecord::BeamMode
0070   uint16_t const getBeamMode() const { return m_beamMode; }
0071 
0072   // Particle type BSTRecord::Particle in beam 1
0073   uint8_t const getParticleBeam1() const { return m_particleBeam1; }
0074 
0075   // Particle type BSTRecord::Particle in beam 2
0076   uint8_t const getParticleBeam2() const { return m_particleBeam2; }
0077 
0078   // Beam momentum (GeV/c). Returns -1 if no valid value is available
0079   int32_t const getBeamMomentum() const { return m_beamMomentum; }
0080 
0081   // Intensity of Beam 1 (10E10 charges)
0082   uint32_t const getIntensityBeam1() const { return m_intensityBeam1; }
0083 
0084   // Intensity of Beam 2 (10E10 charges)
0085   uint32_t const getIntensityBeam2() const { return m_intensityBeam2; }
0086 
0087 private:
0088   uint64_t m_gpstime;
0089   uint32_t m_turnCount;
0090   uint32_t m_lhcFill;
0091   uint32_t m_intensityBeam1;
0092   uint32_t m_intensityBeam2;
0093   int32_t m_beamMomentum;
0094   uint16_t m_beamMode;
0095   uint8_t m_particleBeam1;
0096   uint8_t m_particleBeam2;
0097   uint8_t m_bstMaster;
0098 };
0099 
0100 /// Pretty-print operator for BSTRecord
0101 std::ostream& operator<<(std::ostream&, const BSTRecord&);
0102 
0103 #endif  // DATAFORMATS_TCDS_BSTRECORD_H