ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonNSWCommonDecode
src
NSWCommonDecoder.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "ers/ers.h"
5
#include "eformat/eformat.h"
6
7
#include "
MuonNSWCommonDecode/NSWElink.h
"
8
#include "
MuonNSWCommonDecode/VMMChannel.h
"
9
#include "
MuonNSWCommonDecode/NSWCommonDecoder.h
"
10
#include "
MuonNSWCommonDecode/NSWDecodeExceptions.h
"
11
12
Muon::nsw::NSWCommonDecoder::NSWCommonDecoder
(
const
eformat::read::ROBFragment &robFrag)
13
:
m_has_error
(false)
14
{
15
static
const
uint32_t s_min_packet_size = 3;
// felix header + null ROC header
16
17
robFrag.check ();
18
19
uint32_t nw = robFrag.rod_ndata ();
20
const
uint32_t *bs = robFrag.rod_data ();
// point directly to the first data element
21
const
uint32_t *current_data_pointer =
const_cast <
uint32_t *
>
(bs);
22
23
uint32_t wcount(0);
// data-element (32-bit word) counter
24
25
ERS_DEBUG (1,
"NDATA FROM ROB HEADER: "
<< nw);
26
27
uint32_t remaining = nw;
28
29
while
(remaining >= s_min_packet_size)
30
{
31
try
32
{
33
Muon::nsw::NSWElink
*elink =
new
Muon::nsw::NSWElink
(current_data_pointer, remaining);
34
m_elinks
.push_back (elink);
35
36
// Append pointers to elink channels to a local channel vector
37
38
const
std::vector <Muon::nsw::VMMChannel *> vchan = elink->
get_channels
();
39
for
(
auto
i = vchan.begin (); i != vchan.end (); ++i)
40
m_channels
.push_back (*i);
41
42
wcount += elink->
nwords
();
43
current_data_pointer += elink->
nwords
();
44
45
ERS_DEBUG (1,
"NDATA: "
<< nw <<
" WORD COUNTER: "
<< wcount);
46
ERS_DEBUG (1,
"NPACKETS: "
<<
m_elinks
.size ());
47
48
remaining = nw - wcount;
49
}
50
51
catch
(Muon::nsw::MuonNSWCommonDecoder::NSWElinkFelixHeaderException &e)
52
{
53
m_has_error
=
true
;
54
ERS_DEBUG (1, e.what());
55
break
;
56
}
57
58
catch
(Muon::nsw::MuonNSWCommonDecoder::NSWElinkROCHeaderException &e)
59
{
60
m_has_error
=
true
;
61
ERS_DEBUG (1, e.what());
62
63
// Try to move to next link
64
65
wcount += s_min_packet_size;
66
current_data_pointer += s_min_packet_size;
67
remaining = nw - wcount;
68
continue
;
69
}
70
}
71
}
72
73
Muon::nsw::NSWCommonDecoder::~NSWCommonDecoder
()
74
{
75
for
(
auto
i =
m_elinks
.begin (); i !=
m_elinks
.end (); ++i)
76
delete
*i;
77
}
NSWCommonDecoder.h
NSWDecodeExceptions.h
NSWElink.h
VMMChannel.h
Muon::nsw::NSWCommonDecoder::NSWCommonDecoder
NSWCommonDecoder(const eformat::read::ROBFragment &rob)
Definition
NSWCommonDecoder.cxx:12
Muon::nsw::NSWCommonDecoder::m_has_error
bool m_has_error
Definition
NSWCommonDecoder.h:31
Muon::nsw::NSWCommonDecoder::~NSWCommonDecoder
virtual ~NSWCommonDecoder()
Definition
NSWCommonDecoder.cxx:73
Muon::nsw::NSWCommonDecoder::m_elinks
std::vector< Muon::nsw::NSWElink * > m_elinks
Definition
NSWCommonDecoder.h:33
Muon::nsw::NSWCommonDecoder::m_channels
std::vector< Muon::nsw::VMMChannel * > m_channels
Definition
NSWCommonDecoder.h:34
Muon::nsw::NSWElink
Definition
NSWElink.h:21
Muon::nsw::NSWElink::nwords
unsigned int nwords() const
Definition
NSWElink.h:32
Muon::nsw::NSWElink::get_channels
const std::vector< Muon::nsw::VMMChannel * > & get_channels() const
Definition
NSWElink.h:30
Generated on
for ATLAS Offline Software by
1.17.0