File indexing completed on 2024-04-06 12:10:44
0001 #ifndef EventFilter_HGCalRawToDigi_HGCalRawDataPackingTools_h
0002 #define EventFilter_HGCalRawToDigi_HGCalRawDataPackingTools_h
0003
0004 #include "EventFilter/HGCalRawToDigi/interface/SlinkTypes.h"
0005
0006 namespace hgcal {
0007 namespace econd {
0008 struct ERxData;
0009
0010
0011
0012
0013
0014 std::vector<uint32_t> produceERxData(
0015 const ERxChannelEnable&, const ERxData&, bool passZS, bool passZSm1, bool hasToA, bool char_mode);
0016
0017
0018
0019
0020 std::vector<uint32_t> eRxSubPacketHeader(uint8_t stat,
0021 uint8_t ham,
0022 bool bitE,
0023 uint16_t common_mode0,
0024 uint16_t common_mode1,
0025 const ERxChannelEnable& channel_enable);
0026 std::vector<uint32_t> eRxSubPacketHeader(
0027 uint8_t stat, uint8_t ham, bool bitE, uint16_t common_mode0, uint16_t common_mode1, uint64_t channels_map);
0028
0029
0030
0031
0032 std::vector<uint32_t> eventPacketHeader(uint16_t header,
0033 uint16_t payload,
0034 bool bitP,
0035 bool bitE,
0036 uint8_t ht,
0037 uint8_t ebo,
0038 bool bitM,
0039 bool bitT,
0040 uint8_t hamming,
0041 uint16_t bx,
0042 uint16_t l1a,
0043 uint8_t orb,
0044 bool bitS,
0045 uint8_t RR);
0046
0047
0048
0049 uint32_t buildIdleWord(uint8_t bufStat, uint8_t err, uint8_t rr, uint32_t progPattern);
0050 }
0051
0052 namespace backend {
0053 enum ECONDPacketStatus {
0054 Normal = 0x0,
0055 PayloadCRCError = 0x1,
0056 EventIDMismatch = 0x2,
0057 EBTimeout = 0x4,
0058 BCIDOrbitIDMismatch = 0x5,
0059 MainBufferOverflow = 0x6,
0060 InactiveECOND = 0x7
0061 };
0062
0063
0064
0065 std::vector<uint32_t> buildCaptureBlockHeader(uint32_t bunch_crossing,
0066 uint32_t event_counter,
0067 uint32_t orbit_counter,
0068 const std::vector<ECONDPacketStatus>& econd_statuses);
0069
0070
0071
0072 std::vector<uint32_t> buildSlinkHeader(
0073 uint8_t boe, uint8_t v, uint64_t global_event_id, uint32_t content_id, uint32_t fed_id);
0074
0075
0076
0077 std::vector<uint32_t> buildSlinkTrailer(uint8_t eoe,
0078 uint16_t daqcrc,
0079 uint32_t event_length,
0080 uint16_t bxid,
0081 uint32_t orbit_id,
0082 uint16_t crc,
0083 uint16_t status);
0084
0085 enum SlinkEmulationFlag { Subsystem = 0, SlinkRocketSenderCore = 1, DTH = 2 };
0086
0087
0088 uint32_t buildSlinkContentId(SlinkEmulationFlag, uint8_t l1a_subtype, uint16_t l1a_fragment_cnt);
0089
0090
0091
0092 uint16_t buildSlinkRocketStatus(
0093 bool fed_crc_err, bool slinkrocket_crc_err, bool source_id_err, bool sync_lost, bool fragment_trunc);
0094 }
0095 }
0096
0097 #endif