ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonRDO
src
TgcL1Rdo.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 "
MuonRDO/TgcL1Rdo.h
"
6
#include "
AthenaKernel/errorcheck.h
"
7
#include <bit>
8
#include <string.h>
// memset
9
10
// Default constructor
11
TgcL1Rdo::TgcL1Rdo
() :
DataVector
<
TgcL1RawData
>()
12
{
13
m_id
= 9999;
14
clear
();
15
}
16
17
// Creates an empty container ready for writing
18
TgcL1Rdo::TgcL1Rdo
(uint16_t
id
,
IdentifierHash
idHash) :
DataVector
<
TgcL1RawData
>(),
m_id
(id),
m_idHash
(idHash)
19
{
20
clear
();
21
}
22
23
// Full constructor
24
TgcL1Rdo::TgcL1Rdo
(uint16_t
subDetectorId
,
25
uint16_t
srodId
,
26
uint16_t
bcId
,
27
uint16_t
l1Id
) :
DataVector
<
TgcL1RawData
>()
28
{
29
clear
();
30
m_bcId
=
bcId
;
31
m_l1Id
=
l1Id
;
32
33
setOnlineId
(
subDetectorId
,
srodId
);
34
}
35
36
// set Online ID
37
void
TgcL1Rdo::setOnlineId
(uint16_t
subDetectorId
, uint16_t
srodId
)
38
{
39
m_subDetectorId
=
subDetectorId
;
40
m_srodId
=
srodId
;
41
42
// set my ID
43
m_id
=
calculateOnlineId
(
m_subDetectorId
,
m_srodId
);
44
}
45
46
// class method for RawData identification
47
uint16_t
TgcL1Rdo::identifyRawData
(
const
TgcL1RawData
&rawData)
48
{
49
return
calculateOnlineId
(rawData.
subDetectorId
(), rawData.
srodId
());
50
}
51
52
std::pair<int, int>
TgcL1Rdo::initOnlineId
() {
53
static
constexpr
int
offset = -1;
// 0 start
54
static
constexpr
int
MAX_N_SROD = 3;
55
return
std::make_pair(offset, MAX_N_SROD);
56
}
57
58
// online ID calculator
59
uint16_t
TgcL1Rdo::calculateOnlineId
(uint16_t
subDetectorId
, uint16_t
srodId
)
60
{
61
static
const
std::pair<int, int> offset_max =
initOnlineId
();
62
int
offset = offset_max.first;
63
int
MAX_N_SROD = offset_max.second;
64
if
(MAX_N_SROD < 0) {
65
return
9999;
66
}
67
68
// A-side or C-side ?
69
uint16_t is = (
subDetectorId
== 0x67) ? 0 : 1;
70
71
return
is * MAX_N_SROD +
srodId
+ offset;
72
}
73
74
template
<
class
stream>
75
stream&
dump
(stream& sl,
const
TgcL1Rdo
& coll)
76
{
77
sl <<
"TgcL1Rdo: "
78
<<
" version="
<< coll.
version
()
79
<<
", id="
<< std::hex << coll.
identify
() << std::dec
80
<<
", srodId="
<< coll.
srodId
()
81
<<
", subDetectorId="
<< std::hex << coll.
subDetectorId
() << std::dec
82
<<
", triggerType="
<< (int16_t)coll.
triggerType
()
83
<<
", bcId="
<< coll.
bcId
()
84
<<
", l1Id="
<< coll.
l1Id
()
85
<<
", errors="
<< std::hex << std::bit_cast<unsigned>(coll.
errors
())
86
<<
", srodStatus="
<< std::bit_cast<unsigned>(coll.
srodStatus
())
87
<<
", localStatus="
<< std::bit_cast<unsigned>(coll.
localStatus
()) << std::dec
88
<<
", orbit="
<< coll.
orbit
()
89
<< std::endl <<
"TgcL1RawData: ["
<< std::endl;
90
int
iRaw = 0;
91
for
(
const
TgcL1RawData
* tgc : coll)
92
{
93
sl << ++iRaw
94
<<
": "
<< *tgc << std::endl;
95
}
96
sl <<
"]"
;
97
return
sl;
98
}
99
100
std::ostream&
operator<<
(std::ostream& sl,
const
TgcL1Rdo
& coll)
101
{
102
dump
(sl, coll) << std::endl;
103
return
sl;
104
}
105
106
void
TgcL1Rdo::clear
()
107
{
108
m_version
= 300;
109
m_subDetectorId
=
m_srodId
=
m_triggerType
=
m_bcId
=
m_l1Id
= 0;
110
memset(&
m_errors
, 0,
sizeof
(
Errors
));
111
memset(&
m_srodStatus
, 0,
sizeof
(
SRodStatus
));
112
memset(&
m_localStatus
, 0,
sizeof
(
LocalStatus
));
113
m_orbit
= 0;
114
}
115
errorcheck.h
Helpers for checking error return status codes and reporting errors.
operator<<
std::ostream & operator<<(std::ostream &sl, const TgcL1Rdo &coll)
Overload of << operator for std::ostream for debug output.
Definition
TgcL1Rdo.cxx:100
TgcL1Rdo.h
DataVector< TgcL1RawData >::DataVector
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
TgcL1RawData
An unit object of TGC SROD output.
Definition
TgcL1RawData.h:21
TgcL1RawData::subDetectorId
uint16_t subDetectorId() const
Definition
TgcL1RawData.h:194
TgcL1RawData::srodId
uint16_t srodId() const
Definition
TgcL1RawData.h:210
TgcL1Rdo
Definition
TgcL1Rdo.h:22
TgcL1Rdo::version
uint16_t version() const
Definition
TgcL1Rdo.h:215
TgcL1Rdo::m_triggerType
uint16_t m_triggerType
Definition
TgcL1Rdo.h:247
TgcL1Rdo::triggerType
uint16_t triggerType() const
Definition
TgcL1Rdo.h:142
TgcL1Rdo::m_bcId
uint16_t m_bcId
Definition
TgcL1Rdo.h:250
TgcL1Rdo::m_id
uint16_t m_id
ID of this instance.
Definition
TgcL1Rdo.h:237
TgcL1Rdo::m_idHash
IdentifierHash m_idHash
OFFLINE hash of this collection.
Definition
TgcL1Rdo.h:240
TgcL1Rdo::identify
uint16_t identify() const
Definition
TgcL1Rdo.h:107
TgcL1Rdo::l1Id
uint16_t l1Id() const
Definition
TgcL1Rdo.h:150
TgcL1Rdo::errors
const Errors & errors() const
Definition
TgcL1Rdo.h:158
TgcL1Rdo::TgcL1Rdo
TgcL1Rdo()
Default constructor.
Definition
TgcL1Rdo.cxx:11
TgcL1Rdo::srodStatus
const SRodStatus & srodStatus() const
Definition
TgcL1Rdo.h:174
TgcL1Rdo::localStatus
const LocalStatus & localStatus() const
Definition
TgcL1Rdo.h:190
TgcL1Rdo::srodId
uint16_t srodId() const
Definition
TgcL1Rdo.h:138
TgcL1Rdo::m_version
uint16_t m_version
Definition
TgcL1Rdo.h:234
TgcL1Rdo::m_srodId
uint16_t m_srodId
Definition
TgcL1Rdo.h:244
TgcL1Rdo::setOnlineId
void setOnlineId(uint16_t subDetectorId, uint16_t srodId)
Definition
TgcL1Rdo.cxx:37
TgcL1Rdo::m_l1Id
uint16_t m_l1Id
Definition
TgcL1Rdo.h:251
TgcL1Rdo::bcId
uint16_t bcId() const
Definition
TgcL1Rdo.h:146
TgcL1Rdo::m_subDetectorId
uint16_t m_subDetectorId
Definition
TgcL1Rdo.h:243
TgcL1Rdo::m_orbit
uint32_t m_orbit
Definition
TgcL1Rdo.h:256
TgcL1Rdo::clear
void clear()
Definition
TgcL1Rdo.cxx:106
TgcL1Rdo::identifyRawData
static uint16_t identifyRawData(const TgcL1RawData &rawData)
Definition
TgcL1Rdo.cxx:47
TgcL1Rdo::calculateOnlineId
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition
TgcL1Rdo.cxx:59
TgcL1Rdo::initOnlineId
static std::pair< int, int > initOnlineId()
Definition
TgcL1Rdo.cxx:52
TgcL1Rdo::orbit
uint32_t orbit() const
Definition
TgcL1Rdo.h:206
TgcL1Rdo::subDetectorId
uint16_t subDetectorId() const
Definition
TgcL1Rdo.h:134
dump
-event-from-file
TgcL1Rdo::Errors
Definition
TgcL1Rdo.h:36
TgcL1Rdo::LocalStatus
Definition
TgcL1Rdo.h:77
TgcL1Rdo::SRodStatus
Definition
TgcL1Rdo.h:45
TgcL1Rdo::m_errors
Definition
TgcL1Rdo.h:253
TgcL1Rdo::m_localStatus
Definition
TgcL1Rdo.h:255
TgcL1Rdo::m_srodStatus
Definition
TgcL1Rdo.h:254
Generated on
for ATLAS Offline Software by
1.17.0