File indexing completed on 2024-04-06 12:10:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef EventFilter_CTPPSRawToDigi_TotemT2VFATFrame
0011 #define EventFilter_CTPPSRawToDigi_TotemT2VFATFrame
0012
0013 #include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h"
0014
0015 #include <cstdint>
0016
0017
0018
0019
0020 namespace totem::nt2::vfat {
0021
0022 static constexpr size_t num_words_per_channel = 4;
0023
0024 static constexpr size_t num_channels_per_payload = 2;
0025 static constexpr size_t header_offset = 3;
0026
0027 inline uint16_t leadingEdgeTime(const VFATFrame& frame, size_t ch_id) {
0028 return frame.getData()[header_offset + 2 + num_words_per_channel * ch_id] & 0xffff;
0029 }
0030
0031 inline uint16_t trailingEdgeTime(const VFATFrame& frame, size_t ch_id) {
0032 return frame.getData()[header_offset + 3 + num_words_per_channel * ch_id] & 0xffff;
0033 }
0034
0035 inline uint8_t channelMarker(const VFATFrame& frame, size_t ch_id) {
0036 return frame.getData()[header_offset + 1 + num_words_per_channel * ch_id] & 0x1f;
0037 }
0038
0039
0040 inline uint8_t statusMarker(const VFATFrame& frame) { return (frame.getData()[header_offset - 1] >> 8) & 0xf; }
0041
0042
0043 inline uint16_t newChannelId(const VFATFrame& frame, size_t ch_id) {
0044 return frame.getData()[header_offset + 0 + num_words_per_channel * ch_id] & 0xffff;
0045 }
0046 }
0047
0048 #endif