ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonNSWCommonDecode
src
NSWTriggerCommonDecoder.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonNSWCommonDecode/NSWTriggerCommonDecoder.h
"
6
#include "
MuonNSWCommonDecode/NSWTriggerElink.h
"
7
#include "
MuonNSWCommonDecode/NSWTriggerMML1AElink.h
"
8
#include "
MuonNSWCommonDecode/NSWTriggerMMMonElink.h
"
9
#include "
MuonNSWCommonDecode/NSWTriggerSTGL1AElink.h
"
10
#include "
MuonNSWCommonDecode/NSWPadTriggerL1a.h
"
11
12
13
Muon::nsw::NSWTriggerCommonDecoder::NSWTriggerCommonDecoder
(
const
eformat::read::ROBFragment &robFrag,
const
std::string& triggerType)
14
:
m_has_error
(false),
15
m_triggerType
(triggerType)
16
{
17
18
static
const
uint32_t min_packet_size = 2;
//2w felix header
19
20
robFrag.check ();
21
22
uint32_t nWords = robFrag.rod_ndata ();
//total number of words (32-bit word)
23
const
uint32_t *bs = robFrag.rod_data ();
//point directly to the first data element
24
const
uint32_t *pp = bs;
//pointer moving
25
uint32_t remaining = nWords;
// data-element (32-bit word) counter; it will decrement according to each elink output
26
27
while
(remaining >= min_packet_size)
28
{
29
try
30
{
31
std::shared_ptr<Muon::nsw::NSWTriggerElink> elink;
32
33
if
(
m_triggerType
==
"MML1A"
){
34
std::shared_ptr<Muon::nsw::NSWTriggerMML1AElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerMML1AElink>(pp, remaining);
35
elink = tmplink;
36
}
else
if
(
m_triggerType
==
"MMMon"
) {
37
std::shared_ptr<Muon::nsw::NSWTriggerMMMonElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerMMMonElink>(pp, remaining);
38
elink = tmplink;
39
}
else
if
(
m_triggerType
==
"PadL1A"
) {
40
std::shared_ptr<Muon::nsw::NSWPadTriggerL1a> tmplink = std::make_shared<Muon::nsw::NSWPadTriggerL1a>(pp, remaining);
41
elink = tmplink;
42
}
else
if
(
m_triggerType
==
"STGL1A"
) {
43
std::shared_ptr<Muon::nsw::NSWTriggerSTGL1AElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerSTGL1AElink>(pp, remaining);
44
elink = tmplink;
45
}
else
{
46
std::shared_ptr<Muon::nsw::NSWTriggerElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerElink>(pp, remaining);
47
elink = std::move(tmplink);
48
}
49
50
m_elinks
.push_back(elink);
51
pp += elink->nwords();
52
remaining -= elink->nwords();;
53
54
}
55
catch
(
Muon::nsw::NSWTriggerException
&e) {
56
//known expections, with ID
57
//could think of an error msg print in case needed
58
m_has_error
=
true
;
59
ERS_DEBUG(1,
"Following exception found"
);
60
ERS_DEBUG(1, e.what());
61
m_error_id
= e.id();
62
break
;
63
}
64
catch
(std::exception &e) {
65
//better to be ready to capture generic ones as well
66
m_has_error
=
true
;
67
ERS_DEBUG(1,
"Following exception found"
);
68
ERS_DEBUG(1, e.what());
69
m_error_id
= -1;
//negative for unknown exceptions
70
break
;
71
}
72
}
73
74
if
( remaining > 0 ) {
75
m_has_error
=
true
;
76
ERS_DEBUG(1,
Muon::nsw::format
(
"There are remaining words ({}) after decoding {} elink(s)"
, remaining,
m_elinks
.size()));
77
m_error_id
= 0;
78
}
79
80
}
81
NSWPadTriggerL1a.h
NSWTriggerCommonDecoder.h
NSWTriggerElink.h
NSWTriggerMML1AElink.h
NSWTriggerMMMonElink.h
NSWTriggerSTGL1AElink.h
Muon::nsw::NSWTriggerCommonDecoder::m_triggerType
std::string m_triggerType
Definition
NSWTriggerCommonDecoder.h:37
Muon::nsw::NSWTriggerCommonDecoder::m_elinks
std::vector< std::shared_ptr< Muon::nsw::NSWTriggerElink > > m_elinks
Definition
NSWTriggerCommonDecoder.h:38
Muon::nsw::NSWTriggerCommonDecoder::m_has_error
bool m_has_error
Definition
NSWTriggerCommonDecoder.h:35
Muon::nsw::NSWTriggerCommonDecoder::m_error_id
int m_error_id
Definition
NSWTriggerCommonDecoder.h:36
Muon::nsw::NSWTriggerCommonDecoder::NSWTriggerCommonDecoder
NSWTriggerCommonDecoder(const eformat::read::ROBFragment &rob, const std::string &triggerType)
Definition
NSWTriggerCommonDecoder.cxx:13
Muon::nsw::NSWTriggerException
Definition
NSWTriggerElink.h:20
Muon::nsw::format
std::string format(const std::string &str, const T &arg)
Definition
NSWDecodeHelper.h:43
Generated on
for ATLAS Offline Software by
1.17.0