otsdaq-mu2e-stm  5.02.01
checkData.hh
1 
5 #ifndef CHECKDATA_hh
6 #define CHECKDATA_hh
7 
8 #include<iostream>
9 #include<fstream>
10 #include<vector>
11 
12 // Hex reader
13 #include "STMDAQ-TestBeam/utils/dataVars.hh"
14 
15 // Logger
16 #include "STMDAQ-TestBeam/utils/Logger.hh"
17 
18 // UDPsocket
19 #include "STMDAQ-TestBeam/utils/UDPsocket.hh"
20 
21 // Queue
22 #include "STMDAQ-TestBeam/utils/queue.hh"
23 
24 class checkData {
25 
26 private:
27 
28  // The last packet number
29  uint32_t last_packet[CHNUM] = {};
30 
31  // Booleans to check for 0xDEADBEEF
32  bool deadbeef[CHNUM] = {false,false};
33 
34 public:
35 
36  // Standard constructor - shouldn't be used
37  checkData();
38 
39  // Boolean whether this is the first packet of the data run
40  bool firstPacket = true;
41 
42  // A dropped packet counter
43  uint64_t dropped_packet_count[CHNUM] = {};
44 
45  // Set the stored last packet number
46  void setLastPacketNum(int chan, uint32_t lastPacket){
47  last_packet[chan] = lastPacket;
48  }
49 
50  // Get the stored last packet number
51  uint32_t getLastPacketNum(int chan){
52  return last_packet[chan];
53  }
54 
55  // Process packet data
56  // void check_packets(int chan, int packet_num, uint64_t data_len, int16_t *data);
57  void check_packets(int chan, uint64_t data_len, int16_t *data);
58 
59  // Check for dropped packets
60  void check_dropped_packets(int chan, uint32_t packet_num, uint32_t last_packet);
61 
62  // Check the packet header end
63  void check_pHdr(uint32_t packet_num, int16_t pHdr_end);
64 
65  // Check for correct header format
66  void check_tHdrs(int chan, int16_t *data, uint64_t packet_start);
67 
68  // Check firmware trigger/event header
69  uint64_t check_fw_tHdr(int chan, int16_t *data, uint64_t hdr_index);
70 
71 
72 };
73 
74 #endif
Definition: data.hh:4