CMS 3D CMS Logo

TotemT2VFATFrame.h
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of the TOTEM offline software.
4 * Authors:
5 * Edoardo Bossini
6 * Laurent Forthomme
7 *
8 ****************************************************************************/
9 
10 #ifndef EventFilter_CTPPSRawToDigi_TotemT2VFATFrame
11 #define EventFilter_CTPPSRawToDigi_TotemT2VFATFrame
12 
14 
15 #include <cstdint>
16 
20 namespace totem::nt2::vfat {
22  static constexpr size_t num_words_per_channel = 4;
25  static constexpr size_t header_offset = 3;
27  inline uint16_t leadingEdgeTime(const VFATFrame& frame, size_t ch_id) {
28  return frame.getData()[header_offset + 2 + num_words_per_channel * ch_id] & 0xffff;
29  }
31  inline uint16_t trailingEdgeTime(const VFATFrame& frame, size_t ch_id) {
32  return frame.getData()[header_offset + 3 + num_words_per_channel * ch_id] & 0xffff;
33  }
35  inline uint8_t channelMarker(const VFATFrame& frame, size_t ch_id) {
36  return frame.getData()[header_offset + 1 + num_words_per_channel * ch_id] & 0x1f;
37  }
38 
40  inline uint8_t statusMarker(const VFATFrame& frame) { return (frame.getData()[header_offset - 1] >> 8) & 0xf; }
41 
43  inline uint16_t newChannelId(const VFATFrame& frame, size_t ch_id) {
44  return frame.getData()[header_offset + 0 + num_words_per_channel * ch_id] & 0xffff;
45  }
46 } // namespace totem::nt2::vfat
47 
48 #endif
static constexpr size_t num_words_per_channel
multiplicity of 32-bit words combined into a single channel payload
uint16_t leadingEdgeTime(const VFATFrame &frame, size_t ch_id)
get timing information for single leading edge
uint16_t trailingEdgeTime(const VFATFrame &frame, size_t ch_id)
get timing information for single trailing edge
uint16_t newChannelId(const VFATFrame &frame, size_t ch_id)
retrieve the HW identifier for this channel, in firmware >2.1
uint8_t statusMarker(const VFATFrame &frame)
retrieve the header status flags
static constexpr size_t header_offset
static constexpr size_t num_channels_per_payload
multiplicity of channels combined into a single payload
uint8_t channelMarker(const VFATFrame &frame, size_t ch_id)
retrieve this channel marker