ATLAS Offline Software
MuonSpectrometer
MuonCnv
MuonNSWCommonDecode
src
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"
8
#include <
MuonNSWCommonDecode/NSWDecodeHelper.h
>
9
10
#include "
MuonNSWCommonDecode/NSWTriggerElink.h
"
11
12
Muon::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};
24
m_packet_status
= Muon::nsw::bit_slice<uint64_t>(
data
,0,15);
25
m_wordCountFlx
= Muon::nsw::bit_slice<uint64_t>(
data
,16,31);
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];
39
m_elinkId
.reset(
new
Muon::nsw::NSWResourceId
(
m_elinkWord
));
40
41
m_wordCount
=
m_wordCountFlx
;
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 {}"
,
48
m_packet_status
,
m_wordCountFlx
,
m_elinkWord
));
49
50
}
Muon::nsw::NSWTriggerElink::m_wordCount
unsigned int m_wordCount
Definition:
NSWTriggerElink.h:66
AllowedVariables::e
e
Definition:
AsgElectronSelectorTool.cxx:37
data
char data[hepevt_bytes_allocation_ATLAS]
Definition:
HepEvt.cxx:11
Muon::nsw::NSWTriggerElink::m_elinkId
std::shared_ptr< Muon::nsw::NSWResourceId > m_elinkId
Definition:
NSWTriggerElink.h:73
xAOD::uint32_t
setEventNumber uint32_t
Definition:
EventInfo_v1.cxx:127
Muon::nsw::NSWTriggerElink::m_packet_status
unsigned int m_packet_status
Definition:
NSWTriggerElink.h:68
NSWTriggerElink.h
Muon::nsw::NSWTriggerElink::NSWTriggerElink
NSWTriggerElink(const uint32_t *bs, uint32_t remaining)
Definition:
NSWTriggerElink.cxx:12
Muon::nsw::NSWResourceId
Definition:
NSWResourceId.h:42
Muon::nsw::NSWTriggerElink::m_wordCountFlx
unsigned int m_wordCountFlx
Definition:
NSWTriggerElink.h:67
Muon::nsw::format
std::string format(const std::string &str, const T &arg)
Definition:
NSWDecodeHelper.h:43
NSWDecodeHelper.h
Muon::nsw::NSWTriggerElink::m_elinkWord
uint32_t m_elinkWord
Definition:
NSWTriggerElink.h:72
Muon::nsw::NSWTriggerException
Definition:
NSWTriggerElink.h:20
Generated on Mon Dec 23 2024 21:15:54 for ATLAS Offline Software by
1.8.18