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