34 static const unsigned int common_mode_channel =
roc_version_ == 2 ? 19 : 1;
36 static uint32_t head1, head2, w;
48 std::vector<ldmx::HgcrocDigiCollection::Sample>>
50 while (reader >> head1 >> head2) {
52 if (head1 == 0x11111111 and head2 == 0xbeef2021) {
57 uint32_t whole_event_header;
58 reader >> whole_event_header;
66 (whole_event_header >> 16) & packing::utility::mask<4>;
68 std::vector<uint32_t> length_per_sample(nsamples, 0);
69 for (uint32_t i_sample{0}; i_sample < nsamples; i_sample++) {
70 if (i_sample % 2 == 0) {
73 uint32_t shift_in_word = 16 * (i_sample % 2);
74 length_per_sample[i_sample] =
75 (w >> shift_in_word) & packing::utility::mask<12>;
79 reader >> head1 >> head2;
80 }
else if (head1 == 0xd07e2021 and head2 == 0x12345678) {
103 std::cout <<
hex(head1) <<
" : ";
104 uint32_t version = (head1 >> 28) & packing::utility::mask<4>;
108 EXCEPTION_RAISE(
"VersMis",
109 "EcalRawDecoder only knows version 1 of DAQ format.");
111 uint32_t fpga = (head1 >> 20) & packing::utility::mask<8>;
112 uint32_t nlinks = (head1 >> 14) & packing::utility::mask<6>;
130 std::vector<uint32_t> length_per_link(nlinks, 0);
131 for (uint32_t i_link{0}; i_link < nlinks; i_link++) {
132 if (i_link % 4 == 0) {
137 uint32_t shift_in_word = 8 * (i_link % 4);
143 length_per_link[i_link] =
144 (w >> shift_in_word) & packing::utility::mask<6>;
158 for (uint32_t i_link{0}; i_link < nlinks; i_link++) {
165 uint32_t roc_id = (w >> 16) & packing::utility::mask<16>;
173 std::bitset<40> ro_map = w & packing::utility::mask<8>;
186 for (uint32_t j{0}; j < length_per_link.at(i_link) - 2; j++) {
190 }
while (channel_id < 40 and not ro_map.test(channel_id));
197 if (channel_id == 0) {
218 }
else if (channel_id == common_mode_channel) {
224 }
else if (channel_id == 39) {
269 eid_to_samples[eid].emplace_back(w);
309 for (
auto const& [eid, digi] : eid_to_samples) {
314 if (detmap.exists(eid)) {
315 uint32_t did_raw = detmap.get(eid).raw();
337 for (
auto const& [eid, digi] : eid_to_samples) {
338 digis.
addDigi(eid.raw(), digi);