81 static const unsigned int common_mode_channel =
roc_version_ == 2 ? 19 : 1;
82 static const unsigned int calib_channel = 20;
84 static uint32_t head1, head2, w;
89 }
while (head1 != 0xbeef2021 and head1 != 0xbeef2022);
103 eh.
version_ = (head1 >> 28) & packing::utility::MASK<4>;
104 eh.
fpga_ = (head1 >> 20) & packing::utility::MASK<8>;
105 eh.
nsamples_ = (head1 >> 16) & packing::utility::MASK<4>;
106 eventlen = head1 & packing::utility::MASK<16>;
119 "HcalRawDecoder only knows version 1 and 2 of DAQ format.");
123 std::vector<uint32_t> length_per_sample(eh.
nsamples_, 0);
124 for (uint32_t i_sample{0}; i_sample < eh.
nsamples_; i_sample++) {
125 if (i_sample % 2 == 0) {
130 uint32_t shift_in_word = 16 * (i_sample % 2);
131 length_per_sample[i_sample] =
132 (w >> shift_in_word) & packing::utility::MASK<12>;
141 for (
int i_word{n_words}; i_word < 8; i_word++) {
151 eh.
spill_ = ((head1 >> 12) & 0xfff);
152 eh.
bunch_ = (head1 & 0xfff);
161 eh.
run_ = (head1 & 0xFFF);
162 eh.
dd_ = (head1 >> 23) & 0x1F;
163 eh.
mm_ = (head1 >> 28) & 0xF;
164 eh.
hh_ = (head1 >> 18) & 0x1F;
165 eh.
mm_ = (head1 >> 12) & 0x3F;
177 std::vector<ldmx::HgcrocDigiCollection::Sample>>
179 std::size_t i_sample{0};
180 while (i_event < eventlen) {
181 reader >> head1 >> head2;
201 [[maybe_unused]] uint32_t hgcroc_version =
202 (head1 >> 28) & packing::utility::MASK<4>;
203 uint32_t fpga = (head1 >> 20) & packing::utility::MASK<8>;
204 uint32_t nlinks = (head1 >> 14) & packing::utility::MASK<6>;
205 [[maybe_unused]] uint32_t len = head1 & packing::utility::MASK<12>;
209 [[maybe_unused]] uint32_t bx_id =
210 (head2 >> 20) & packing::utility::MASK<12>;
211 [[maybe_unused]] uint32_t rreq =
212 (head2 >> 10) & packing::utility::MASK<10>;
213 [[maybe_unused]] uint32_t orbit = head2 & packing::utility::MASK<10>;
215 std::vector<uint32_t> length_per_link(nlinks, 0);
216 for (uint32_t i_link{0}; i_link < nlinks; i_link++) {
217 if (i_link % 4 == 0) {
222 uint32_t shift_in_word = 8 * (i_link % 4);
223 [[maybe_unused]]
bool rid_ok =
224 ((w >> (shift_in_word + 7)) & packing::utility::MASK<1>) == 1;
225 [[maybe_unused]]
bool cdc_ok =
226 ((w >> (shift_in_word + 6)) & packing::utility::MASK<1>) == 1;
227 length_per_link[i_link] =
228 (w >> shift_in_word) & packing::utility::MASK<6>;
241 for (uint32_t i_link{0}; i_link < nlinks; i_link++) {
246 if (length_per_link.at(i_link) < 2) {
255 [[maybe_unused]] uint32_t roc_id =
256 (w >> 16) & packing::utility::MASK<16>;
257 [[maybe_unused]]
bool crc_ok =
258 ((w >> 15) & packing::utility::MASK<1>) == 1;
262 std::bitset<40> ro_map = w & packing::utility::MASK<8>;
274 for (uint32_t i_word{2}; i_word < length_per_link.at(i_link);
279 }
while (j < 40 and not ro_map.test(j));
301 [[maybe_unused]] uint32_t v3_bx_id =
302 (w >> 16) & packing::utility::MASK<12>;
303 [[maybe_unused]] uint32_t short_event =
304 (w >> 10) & packing::utility::MASK<6>;
305 [[maybe_unused]] uint32_t short_orbit =
306 (w >> 7) & packing::utility::MASK<3>;
307 [[maybe_unused]] uint32_t hamming_errs =
308 (w >> 4) & packing::utility::MASK<3>;
309 }
else if (j == common_mode_channel) {
314 }
else if (j == calib_channel) {
317 }
else if (j == 39) {
322 bool good_idle = (w == 0xaccccccc);
325 bool good_crc = (link_crc.
get() == w);
355 j - 1 - 1 * (j > common_mode_channel) -
356 1 * (j > calib_channel));
358 eid_to_samples[eid].emplace_back(w);
366 [[maybe_unused]] uint32_t crc = w;
378 if (eh.
version_ == 2u and length_per_sample.at(i_sample) % 2 == 1) {
387 reader >> head1 >> head2;
390 return eid_to_samples;