Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DataFormats_FEDRawData_FEDTrailer_h
0002 #define DataFormats_FEDRawData_FEDTrailer_h
0003 
0004 /** \class FEDTrailer
0005  *  Helper class to interpret/create FED trailer words.
0006  *
0007  *  \author N. Amapane - CERN, R. Mommsen - FNAL
0008  */
0009 
0010 #include <cstdint>
0011 
0012 struct fedt_struct;
0013 
0014 class FEDTrailer {
0015 public:
0016   /// Constructor
0017   FEDTrailer(const unsigned char* trailer);
0018 
0019   /// Destructor
0020   virtual ~FEDTrailer();
0021 
0022   /// The length of the event fragment counted in 64-bit words including header and trailer
0023   uint32_t fragmentLength() const;
0024 
0025   /// Cyclic Redundancy Code of the event fragment including header and trailer
0026   uint16_t crc() const;
0027 
0028   /// Event fragment status information
0029   uint8_t evtStatus() const;
0030 
0031   /// Current value of the Trigger Throttling System bits
0032   uint8_t ttsBits() const;
0033 
0034   /// 0 -> the current trailer word is the last one.
0035   /// 1 -> other trailer words can follow
0036   bool moreTrailers() const;
0037 
0038   /// True if the CRC value has been modified by the S-link sender card
0039   bool crcModified() const;
0040 
0041   /// True if the FRL has detected a transmission error over the s-link cable
0042   bool slinkError() const;
0043 
0044   /// True if the FED_ID given by the FED is not the one expected by the FRL
0045   bool wrongFedId() const;
0046 
0047   /// Check that the trailer is OK
0048   bool check() const;
0049 
0050   /// Return the word containing the consistency checks
0051   uint32_t conscheck() const;
0052 
0053   /// Set all fields in the trailer
0054   static void set(
0055       unsigned char* trailer, uint32_t lenght, uint16_t crc, uint8_t evt_stat, uint8_t tts, bool moreTrailers = false);
0056 
0057   static const uint32_t length;
0058 
0059 private:
0060   const fedt_struct* theTrailer;
0061 };
0062 #endif  // DataFormats_FEDRawData_FEDTrailer_h