52{
54 if (!
fIn->ReadBuffer(
reinterpret_cast<char *
>(df),
sizeof(
DataFrame))) {
55 size_t size =
df->header.size;
56 auto frameTime =
df->header.frameTime;
57 uint16_t partitionId =
df->header.partitionId;
58 if (!
fIn->ReadBuffer(
reinterpret_cast<char *
>(
df->hits), size -
sizeof(
DataFrame))) {
59 switch (frameTime) {
60 case SoS: LOG(INFO) <<
"ShipTdcSource: SoS frame.";
return 2;
61 case EoS: LOG(INFO) <<
"ShipTdcSource: EoS frame.";
break;
62 default: break;
63 }
65 if (partitionId == 0x8000) {
66 LOG(DEBUG) << "ShipTdcSource: Event builder meta frame.";
68 LOG(WARNING) << "Late event:";
69 for (
int i = 0;
i < size;
i++) {
70 if (i % 4 == 0) {
71 std::cout << ' ';
72 } else if (i % 16 == 0) {
73 std::cout << '\n';
74 }
75 std::cout << std::hex << +
buffer[
i] << std::dec;
76 }
77 std::cout << std::endl;
78 }
80 }
81 LOG(DEBUG) << "ShipTdcSource: PartitionId " << std::hex << partitionId << std::dec;
82
83 if (
Unpack(
reinterpret_cast<Int_t *
>(&
buffer), size, partitionId)) {
84 return (frameTime ==
EoS) ? 1 : 0;
85 }
86 LOG(WARNING) << "ShipTdcSource: Failed to Unpack.";
87 LOG(WARNING) << "ShipTdcSource: Maybe missing unpacker for PartitionId " << std::hex << partitionId << std::dec;
88 return 3;
89 }
90 LOG(WARNING) << "ShipTdcSource: Failed to read hits.";
91 return 2;
92 }
93 return 1;
94}
unsigned char buffer[UINT16_MAX]
Bool_t Unpack(Int_t *data, Int_t size, uint16_t partitionId)
Int_t UnpackEventFrame(Int_t *data, Int_t total_size)
integer, parameter double