File indexing completed on 2024-04-06 12:10:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef EventFilter_CTPPSRawToDigi_DiamondVFATFrame
0012 #define EventFilter_CTPPSRawToDigi_DiamondVFATFrame
0013
0014 #include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h"
0015
0016 #include <cstdint>
0017
0018
0019
0020
0021 namespace pps::diamond::vfat {
0022
0023 inline uint32_t correctTime(const uint32_t& time) { return (time & 0xFFE7FFFF) << 2 | (time & 0x00180000) >> 19; }
0024
0025
0026 inline uint32_t getLeadingEdgeTime(const VFATFrame& frame) {
0027 uint32_t time = ((frame.getData()[7] & 0x1f) << 16) + frame.getData()[8];
0028 return correctTime(time);
0029 }
0030
0031 inline uint32_t getTrailingEdgeTime(const VFATFrame& frame) {
0032 uint32_t time = ((frame.getData()[5] & 0x1f) << 16) + frame.getData()[6];
0033 return correctTime(time);
0034 }
0035
0036 inline uint32_t getThresholdVoltage(const VFATFrame& frame) {
0037 return ((frame.getData()[3] & 0x7ff) << 16) + frame.getData()[4];
0038 }
0039
0040 inline VFATFrame::word getMultihit(const VFATFrame& frame) { return frame.getData()[2] & 0x01; }
0041
0042 inline VFATFrame::word getHptdcErrorFlag(const VFATFrame& frame) { return frame.getData()[1] & 0xFFFF; }
0043 }
0044
0045 #endif