85 static const unsigned int common_mode_channel =
roc_version_ == 2 ? 19 : 1;
86 static const unsigned int calib_channel = 20;
88 static uint32_t head1, head2, w;
93 }
while (head1 != 0xbeef2021 and head1 != 0xbeef2022);
107 eh.
version = (head1 >> 28) & packing::utility::mask<4>;
108 eh.
fpga = (head1 >> 20) & packing::utility::mask<8>;
109 eh.
nsamples = (head1 >> 16) & packing::utility::mask<4>;
110 eventlen = head1 & packing::utility::mask<16>;
123 "HcalRawDecoder only knows version 1 and 2 of DAQ format.");
127 std::vector<uint32_t> length_per_sample(eh.
nsamples, 0);
128 for (uint32_t i_sample{0}; i_sample < eh.
nsamples; i_sample++) {
129 if (i_sample % 2 == 0) {
134 uint32_t shift_in_word = 16 * (i_sample % 2);
135 length_per_sample[i_sample] =
136 (w >> shift_in_word) & packing::utility::mask<12>;
145 for (
int i_word{n_words}; i_word < 8; i_word++) {
155 eh.
spill = ((head1 >> 12) & 0xfff);
156 eh.
bunch = (head1 & 0xfff);
165 eh.
run = (head1 & 0xFFF);
166 eh.
DD = (head1 >> 23) & 0x1F;
167 eh.
MM = (head1 >> 28) & 0xF;
168 eh.
hh = (head1 >> 18) & 0x1F;
169 eh.
mm = (head1 >> 12) & 0x3F;
181 std::vector<ldmx::HgcrocDigiCollection::Sample>>
183 std::size_t i_sample{0};
184 while (i_event < eventlen) {
185 reader >> head1 >> head2;
205 [[maybe_unused]] uint32_t hgcroc_version =
206 (head1 >> 28) & packing::utility::mask<4>;
207 uint32_t fpga = (head1 >> 20) & packing::utility::mask<8>;
208 uint32_t nlinks = (head1 >> 14) & packing::utility::mask<6>;
209 [[maybe_unused]] uint32_t len = head1 & packing::utility::mask<12>;
213 [[maybe_unused]] uint32_t bx_id =
214 (head2 >> 20) & packing::utility::mask<12>;
215 [[maybe_unused]] uint32_t rreq =
216 (head2 >> 10) & packing::utility::mask<10>;
217 [[maybe_unused]] uint32_t orbit = head2 & packing::utility::mask<10>;
219 std::vector<uint32_t> length_per_link(nlinks, 0);
220 for (uint32_t i_link{0}; i_link < nlinks; i_link++) {
221 if (i_link % 4 == 0) {
226 uint32_t shift_in_word = 8 * (i_link % 4);
227 [[maybe_unused]]
bool rid_ok =
228 ((w >> (shift_in_word + 7)) & packing::utility::mask<1>) == 1;
229 [[maybe_unused]]
bool cdc_ok =
230 ((w >> (shift_in_word + 6)) & packing::utility::mask<1>) == 1;
231 length_per_link[i_link] =
232 (w >> shift_in_word) & packing::utility::mask<6>;
245 for (uint32_t i_link{0}; i_link < nlinks; i_link++) {
250 if (length_per_link.at(i_link) < 2) {
259 [[maybe_unused]] uint32_t roc_id =
260 (w >> 16) & packing::utility::mask<16>;
261 [[maybe_unused]]
bool crc_ok =
262 ((w >> 15) & packing::utility::mask<1>) == 1;
266 std::bitset<40> ro_map = w & packing::utility::mask<8>;
278 for (uint32_t i_word{2}; i_word < length_per_link.at(i_link);
283 }
while (j < 40 and not ro_map.test(j));
305 [[maybe_unused]] uint32_t v3_bx_id =
306 (w >> 16) & packing::utility::mask<12>;
307 [[maybe_unused]] uint32_t short_event =
308 (w >> 10) & packing::utility::mask<6>;
309 [[maybe_unused]] uint32_t short_orbit =
310 (w >> 7) & packing::utility::mask<3>;
311 [[maybe_unused]] uint32_t hamming_errs =
312 (w >> 4) & packing::utility::mask<3>;
313 }
else if (j == common_mode_channel) {
318 }
else if (j == calib_channel) {
321 }
else if (j == 39) {
326 bool good_idle = (w == 0xaccccccc);
329 bool good_crc = (link_crc.
get() == w);
359 j - 1 - 1 * (j > common_mode_channel) -
360 1 * (j > calib_channel));
362 eid_to_samples[eid].emplace_back(w);
370 [[maybe_unused]] uint32_t crc = w;
382 if (eh.
version == 2u and length_per_sample.at(i_sample) % 2 == 1) {
391 reader >> head1 >> head2;
394 return eid_to_samples;