Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:28

0001 #ifndef L1GlobalTrigger_L1GtfeExtWord_h
0002 #define L1GlobalTrigger_L1GtfeExtWord_h
0003 
0004 /**
0005  * \class L1GtfeExtWord
0006  *
0007  *
0008  * Description: L1 Global Trigger - extended GTFE block in the readout record.
0009  *
0010  * Implementation:
0011  *    <TODO: enter implementation details>
0012  *
0013  * \author: Vasile Mihai Ghete - HEPHY Vienna
0014  *
0015  *
0016  */
0017 
0018 // system include files
0019 #include <vector>
0020 #include <iosfwd>
0021 
0022 // user include files
0023 #include "FWCore/Utilities/interface/typedefs.h"
0024 
0025 // base class
0026 #include "DataFormats/L1GlobalTrigger/interface/L1GtfeWord.h"
0027 
0028 // forward declarations
0029 
0030 // class declaration
0031 class L1GtfeExtWord : public L1GtfeWord {
0032 public:
0033   /// constructors
0034   L1GtfeExtWord();  // empty constructor, all members set to zero;
0035 
0036   /// all members set to zero, m_bst has bstSizeBytes zero elements
0037   L1GtfeExtWord(int bstSizeBytes);
0038 
0039   /// constructor from unpacked values, m_bst size taken from bstValue
0040   L1GtfeExtWord(cms_uint16_t boardIdValue,
0041                 cms_uint16_t recordLengthValue,
0042                 cms_uint16_t recordLength1Value,
0043                 cms_uint16_t bxNrValue,
0044                 cms_uint32_t setupVersionValue,
0045                 cms_uint16_t activeBoardsValue,
0046                 cms_uint16_t altNrBxBoardValue,
0047                 cms_uint32_t totalTriggerNrValue,  // end of L1GtfeWord
0048                 const std::vector<cms_uint16_t>& bstValue,
0049                 cms_uint16_t bstSourceValue);
0050 
0051   /// destructor
0052   ~L1GtfeExtWord() override;
0053 
0054   /// equal operator
0055   bool operator==(const L1GtfeExtWord&) const;
0056 
0057   /// unequal operator
0058   bool operator!=(const L1GtfeExtWord&) const;
0059 
0060 public:
0061   /// get the full BST block
0062   inline const std::vector<cms_uint16_t>& bst() const { return m_bst; }
0063 
0064   /// get the size of the BST block
0065   inline const unsigned int bstLengthBytes() const { return m_bst.size(); }
0066 
0067 public:
0068   /// LHC-BOB-ES-0001 (EDMS 638899)
0069 
0070   const cms_uint64_t gpsTime() const;
0071   void setGpsTime(const cms_uint64_t);
0072 
0073   const cms_uint16_t bstMasterStatus() const;
0074   const cms_uint32_t turnCountNumber() const;
0075   const cms_uint32_t lhcFillNumber() const;
0076   const cms_uint16_t beamMode() const;
0077   const cms_uint16_t particleTypeBeam1() const;
0078   const cms_uint16_t particleTypeBeam2() const;
0079   const cms_uint16_t beamMomentum() const;
0080   const cms_uint32_t totalIntensityBeam1() const;
0081   const cms_uint32_t totalIntensityBeam2() const;
0082 
0083 public:
0084   /// get/set BST block for index iB
0085   const cms_uint16_t bst(int iB) const;
0086   void setBst(const cms_uint16_t bstVal, const int iB);
0087 
0088   /// set the BST block for index iB from a 64-bits word
0089   void setBst(const cms_uint64_t& word64, const int iB);
0090 
0091   /// set the BST block in a 64-bits word, having the index iWord
0092   /// in the GTFE raw record
0093   void setBstWord64(cms_uint64_t& word64, int iB, const int iWord);
0094 
0095   /// get/set hex message indicating the source of BST message
0096   inline const cms_uint16_t bstSource() const { return m_bstSource; }
0097 
0098   inline void setBstSource(const cms_uint16_t bstSourceVal) { m_bstSource = bstSourceVal; }
0099 
0100   /// set the hex message indicating the source of BST message from a 64-bits word
0101   void setBstSource(const cms_uint64_t& word64);
0102 
0103   /// set hex message indicating the source of BST message in a 64-bits word,
0104   /// having the index iWord in the GTFE raw record
0105   void setBstSourceWord64(cms_uint64_t& word64, const int iWord);
0106 
0107 public:
0108   /// get the size of the GTFE block in GT EVM record (in multiple of 8 bits)
0109   const unsigned int getSize() const;
0110 
0111 public:
0112   /// resize the BST vector to get the right size of the block
0113   void resize(int bstSizeBytes);
0114 
0115   /// reset the content of a L1GtfeExtWord
0116   void reset() override;
0117 
0118   /// pretty print the content of a L1GtfeExtWord
0119   void print(std::ostream& myCout) const override;
0120 
0121   /// unpack GTFE
0122   /// gtfePtr pointer to the beginning of the GTFE block in the raw data
0123   void unpack(const unsigned char* gtfePtr) override;
0124 
0125 private:
0126   /// block description in the raw GT record
0127 
0128   /// index of first word for BST blocks
0129   static const int BstFirstWord;
0130 
0131   /// size in bits for a BST block
0132   static const int BstBitSize;
0133 
0134   /// BST block mask, correlated with the number of bits of a block
0135   /// 8 bit = 0xFF
0136   static const cms_uint64_t BstBlockMask;
0137 
0138   /// BST blocks: conversion to defined quantities (LHC-BOB-ES-0001)
0139 
0140   static const int GpsTimeFirstBlock;
0141   static const int GpsTimeLastBlock;
0142 
0143   static const int BstMasterStatusFirstBlock;
0144   static const int BstMasterStatusLastBlock;
0145 
0146   static const int TurnCountNumberFirstBlock;
0147   static const int TurnCountNumberLastBlock;
0148 
0149   static const int LhcFillNumberFirstBlock;
0150   static const int LhcFillNumberLastBlock;
0151 
0152   static const int BeamModeFirstBlock;
0153   static const int BeamModeLastBlock;
0154 
0155   static const int ParticleTypeBeam1FirstBlock;
0156   static const int ParticleTypeBeam1LastBlock;
0157 
0158   static const int ParticleTypeBeam2FirstBlock;
0159   static const int ParticleTypeBeam2LastBlock;
0160 
0161   static const int BeamMomentumFirstBlock;
0162   static const int BeamMomentumLastBlock;
0163 
0164   static const int TotalIntensityBeam1FirstBlock;
0165   static const int TotalIntensityBeam1LastBlock;
0166 
0167   static const int TotalIntensityBeam2FirstBlock;
0168   static const int TotalIntensityBeam2LastBlock;
0169 
0170   // BST message source written always in the last word of GTFE extended
0171   static const cms_uint64_t BstSourceMask;
0172 
0173   static const int BstSourceShift;
0174 
0175 private:
0176   /// BST message - each byte is an vector element
0177   std::vector<cms_uint16_t> m_bst;
0178 
0179   /// hex message indicating the source of BST message (beam or simulated)
0180   cms_uint16_t m_bstSource;
0181 };
0182 
0183 #endif /*L1GlobalTrigger_L1GtfeExtWord_h*/