ATLAS Offline Software
Loading...
Searching...
No Matches
NSWTriggerElink.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4#include <vector>
5#include <sstream>
6
7#include "ers/ers.h"
9
11
12Muon::nsw::NSWTriggerElink::NSWTriggerElink (const uint32_t *bs, const uint32_t remaining) {
13
14 // Felix header (2 words) - remember that main decoder interface is already checking that remaining>2 (so preventing a crash)
15 // redoing it here since this class is supposed to be independent
16
17 static const uint32_t min_packet_size = 2;
18 if ( remaining < min_packet_size ) {
19 Muon::nsw::NSWTriggerException e ( Muon::nsw::format("Bytestream shorter than minimum size: provided {}, expected {}", remaining, min_packet_size) , 1);
20 throw e;
21 }
22
23 std::span<const std::uint32_t> data{bs, 2};
26
27 if ( m_packet_status != 0 ) {
28 //later in commissioning, will decide if one can also accept statuses !=0 and can delegate to user checks (or maybe to the decoder upper level)
29 Muon::nsw::NSWTriggerException e ( Muon::nsw::format("Packet status in FELIX header {}", m_packet_status), 2);
30 throw e;
31 }
32
33 if ( remaining < m_wordCountFlx ) {
34 Muon::nsw::NSWTriggerException e ( Muon::nsw::format("Packet length in FELIX header ({}) is larger than available data ({})", m_wordCountFlx, remaining), 3);
35 throw e;
36 }
37
38 m_elinkWord = data[1];
40
42 //just trusting felix/swrod (TP packets have variables size in general; there's no expected size or prediction that can be done)
43
44 ERS_DEBUG(2, Muon::nsw::format("\n FELIX header: \n"
45 " status {}\n"
46 " size {}\n"
47 " id {}",
49
50}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Target bit_slice(const std::span< const Source > words, const std::size_t start, const std::size_t end)
Decode bits from data of words.
std::string format(const std::string &str, const T &arg)