ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Muon
L0MuonS1TGCFloatingTools
src
TgcL0RdoDecoder.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TgcL0RdoDecoder.h
"
6
7
#include "
FourMomUtils/xAODP4Helpers.h
"
8
#include "Identifier/Identifier.h"
9
#include "
MuonIdHelpers/IMuonIdHelperSvc.h
"
10
#include "
MuonRDO/TgcRawData.h
"
11
#include "
MuonRDO/TgcRdo.h
"
12
#include "
MuonRDO/TgcRdoContainer.h
"
13
#include "
MuonTGC_Cabling/TgcCablingMap.h
"
14
#include "
MuonReadoutGeometry/MuonDetectorManager.h
"
15
#include "
MuonReadoutGeometry/TgcReadoutElement.h
"
16
17
#include <cmath>
18
#include <numbers>
19
20
namespace
{
21
22
L0Muon::TgcL0Floating::Station
station(
23
const
Identifier
& identifier,
const
Muon::IMuonIdHelperSvc
& idHelperSvc) {
24
using
L0Muon::TgcL0Floating::Station
;
25
using
Muon::MuonStationIndex::PhiIndex
;
26
27
switch
(idHelperSvc.
phiIndex
(identifier)) {
28
case
PhiIndex::T1:
29
return
Station::M1;
30
case
PhiIndex::T2:
31
return
Station::M2;
32
case
PhiIndex::T3:
33
return
Station::M3;
34
case
PhiIndex::T4:
35
return
Station::Inner;
36
default
:
37
return
Station::Unknown;
38
}
39
}
40
41
std::uint16_t triggerSector(
const
float
phi
) {
42
if
(!std::isfinite(
phi
))
return
0U;
43
constexpr
std::uint16_t nSectors = 24U;
44
const
float
fullTurn = 2.F * std::numbers::pi_v<float>;
45
const
float
sectorWidth = fullTurn /
static_cast<
float
>
(nSectors);
46
float
wrapped =
static_cast<
float
>
(
xAOD::P4Helpers::deltaPhi
(
phi
, 0.));
47
if
(wrapped < 0.F) wrapped += fullTurn;
48
std::uint16_t sector =
static_cast<
std::uint16_t
>
(
49
std::floor(wrapped / sectorWidth)) + 2U;
50
if
(sector > nSectors) sector -= nSectors;
51
return
sector;
52
}
53
54
}
// namespace
55
56
namespace
L0Muon
{
57
namespace
TgcL0Floating
{
58
59
StatusCode
RdoDecoder::decode
(
const
TgcRdoContainer
& rdos,
60
const
Muon::TgcCablingMap
& cabling,
61
const
Muon::IMuonIdHelperSvc
& idHelperSvc,
62
const
MuonGM::MuonDetectorManager
& detectorManager,
63
HitGroups
& hitGroups,
64
DecodeStatistics
& statistics)
const
{
65
hitGroups.clear();
66
statistics =
DecodeStatistics
{};
67
68
// Run-3 RDO conversion is isolated here. Hits are routed immediately to the
69
// Phase-II side/Trigger-Sector/BC processing chain, as in the validated
70
// Floating simulation. Chamber identifiers remain hit provenance only.
71
for
(
const
TgcRdo
* rdo : rdos) {
72
for
(
const
TgcRawData
* rawData : *rdo) {
73
++statistics.
nRawData
;
74
if
(rawData->type() !=
TgcRawData::TYPE_HIT
)
continue
;
75
76
Identifier
identifier;
77
const
bool
mapped
= cabling.getOfflineIDfromReadoutID(
78
identifier, rawData->subDetectorId(), rawData->rodId(),
79
rawData->sswId(), rawData->slbId(), rawData->channel());
80
if
(!
mapped
) {
81
++statistics.
nMappingFailures
;
82
continue
;
83
}
84
85
const
Station
hitStation = station(identifier, idHelperSvc);
86
const
bool
hitIsStrip = idHelperSvc.
tgcIdHelper
().
isStrip
(identifier);
87
float
eta
= 0.F;
88
float
phi
= 0.F;
89
float
r
= 0.F;
90
float
z
= 0.F;
91
const
MuonGM::TgcReadoutElement
* readoutElement =
92
detectorManager.
getTgcReadoutElement
(identifier);
93
if
(readoutElement !=
nullptr
) {
94
const
Amg::Vector3D
globalPosition = readoutElement->
channelPos
(identifier);
95
eta
=
static_cast<
float
>
(globalPosition.eta());
96
phi
=
static_cast<
float
>
(globalPosition.phi());
97
r
=
static_cast<
float
>
(globalPosition.perp());
98
z
=
static_cast<
float
>
(globalPosition.z());
99
}
100
const
std::uint16_t hitTriggerSector = triggerSector(
phi
);
101
if
(hitTriggerSector == 0U) {
102
++statistics.
nMappingFailures
;
103
continue
;
104
}
105
106
const
Hit
hit
{
107
.subDetectorId = rawData->subDetectorId(),
108
.triggerSector = hitTriggerSector,
109
.detectorSector = rawData->rodId(),
110
.bcTag = rawData->bcTag(),
111
.sswId = rawData->sswId(),
112
.slbId = rawData->slbId(),
113
.readoutChannel = rawData->channel(),
114
.stationEta =
static_cast<
std::int16_t
>
(
115
idHelperSvc.
tgcIdHelper
().stationEta(identifier)),
116
.stationPhi =
static_cast<
std::uint16_t
>
(
117
idHelperSvc.
tgcIdHelper
().stationPhi(identifier)),
118
.gasGap =
static_cast<
std::uint8_t
>
(
119
idHelperSvc.
tgcIdHelper
().gasGap(identifier)),
120
.channel =
static_cast<
std::uint16_t
>
(
121
idHelperSvc.
tgcIdHelper
().channel(identifier)),
122
.station = hitStation,
123
.isStrip = hitIsStrip,
124
.eta =
eta
,
125
.phi =
phi
,
126
.r =
r
,
127
.z =
z
,
128
};
129
const
HitGroupKey
key{.subDetectorId =
hit
.subDetectorId,
130
.triggerSector =
hit
.triggerSector,
131
.bcTag =
hit
.bcTag};
132
hitGroups[key].emplace_back(
hit
);
133
134
++statistics.
nHits
;
135
if
(hitIsStrip) ++statistics.
nStripHits
;
136
else
++statistics.
nWireHits
;
137
switch
(hitStation) {
138
case
Station::M1
:
139
++statistics.
nM1Hits
;
140
break
;
141
case
Station::M2
:
142
++statistics.
nM2Hits
;
143
break
;
144
case
Station::M3
:
145
++statistics.
nM3Hits
;
146
break
;
147
case
Station::Inner
:
148
++statistics.
nInnerHits
;
149
break
;
150
default
:
151
++statistics.
nUnknownStation
;
152
break
;
153
}
154
}
155
}
156
return
StatusCode::SUCCESS;
157
}
158
159
}
// namespace TgcL0Floating
160
}
// namespace L0Muon
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
IMuonIdHelperSvc.h
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
MuonDetectorManager.h
TgcReadoutElement.h
TgcCablingMap.h
TgcL0RdoDecoder.h
TgcRawData.h
TgcRdoContainer.h
TgcRdo.h
z
#define z
L0Muon::TgcL0Floating::RdoDecoder::decode
StatusCode decode(const TgcRdoContainer &rdos, const Muon::TgcCablingMap &cabling, const Muon::IMuonIdHelperSvc &idHelperSvc, const MuonGM::MuonDetectorManager &detectorManager, HitGroups &hitGroups, DecodeStatistics &statistics) const
Definition
TgcL0RdoDecoder.cxx:59
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:51
MuonGM::MuonDetectorManager::getTgcReadoutElement
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition
MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:259
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
MuonGM::TgcReadoutElement::channelPos
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip).
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition
IMuonIdHelperSvc.h:27
Muon::IMuonIdHelperSvc::phiIndex
virtual MuonStationIndex::PhiIndex phiIndex(const Identifier &id) const =0
calculate phi index from Identifier (not supported for MDT hits)
Muon::IMuonIdHelperSvc::tgcIdHelper
virtual const TgcIdHelper & tgcIdHelper() const =0
access to TgcIdHelper
Muon::TgcCablingMap
Definition
TgcCablingMap.h:21
TgcIdHelper::isStrip
int isStrip(const Identifier &id) const
isStrip corresponds to measuresPhi
Definition
TgcIdHelper.cxx:654
TgcRawData
An unit object of TGC ROD output.
Definition
TgcRawData.h:23
TgcRawData::TYPE_HIT
@ TYPE_HIT
Definition
TgcRawData.h:43
TgcRdoContainer
Definition
TgcRdoContainer.h:25
TgcRdo
Definition
TgcRdo.h:22
r
int r
Definition
globals.cxx:22
mapped
std::vector< std::string > mapped
Definition
hcg.cxx:56
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:48
Identifier
Definition
IdentifierFieldParser.cxx:14
L0Muon::TgcL0Floating
Definition
TgcL0FloatingData.cxx:8
L0Muon::TgcL0Floating::HitGroups
std::map< HitGroupKey, HitContainer > HitGroups
Definition
TgcL0FloatingData.h:52
L0Muon::TgcL0Floating::Station
Station
Definition
TgcL0FloatingData.h:16
L0Muon::TgcL0Floating::Station::M2
@ M2
Definition
TgcL0FloatingData.h:16
L0Muon::TgcL0Floating::Station::Inner
@ Inner
Definition
TgcL0FloatingData.h:16
L0Muon::TgcL0Floating::Station::M3
@ M3
Definition
TgcL0FloatingData.h:16
L0Muon::TgcL0Floating::Station::M1
@ M1
Definition
TgcL0FloatingData.h:16
L0Muon
Definition
NSWTPBits.h:7
Muon::MuonStationIndex::PhiIndex
PhiIndex
enum to classify the different phi layers in the muon spectrometer
Definition
MuonStationIndex.h:32
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition
xAODP4Helpers.h:69
L0Muon::TgcL0Floating::DecodeStatistics
Definition
TgcL0FloatingData.h:54
L0Muon::TgcL0Floating::DecodeStatistics::nUnknownStation
std::size_t nUnknownStation
Definition
TgcL0FloatingData.h:60
L0Muon::TgcL0Floating::DecodeStatistics::nM3Hits
std::size_t nM3Hits
Definition
TgcL0FloatingData.h:63
L0Muon::TgcL0Floating::DecodeStatistics::nInnerHits
std::size_t nInnerHits
Definition
TgcL0FloatingData.h:64
L0Muon::TgcL0Floating::DecodeStatistics::nMappingFailures
std::size_t nMappingFailures
Definition
TgcL0FloatingData.h:59
L0Muon::TgcL0Floating::DecodeStatistics::nRawData
std::size_t nRawData
Definition
TgcL0FloatingData.h:55
L0Muon::TgcL0Floating::DecodeStatistics::nWireHits
std::size_t nWireHits
Definition
TgcL0FloatingData.h:57
L0Muon::TgcL0Floating::DecodeStatistics::nHits
std::size_t nHits
Definition
TgcL0FloatingData.h:56
L0Muon::TgcL0Floating::DecodeStatistics::nM2Hits
std::size_t nM2Hits
Definition
TgcL0FloatingData.h:62
L0Muon::TgcL0Floating::DecodeStatistics::nStripHits
std::size_t nStripHits
Definition
TgcL0FloatingData.h:58
L0Muon::TgcL0Floating::DecodeStatistics::nM1Hits
std::size_t nM1Hits
Definition
TgcL0FloatingData.h:61
L0Muon::TgcL0Floating::HitGroupKey
Event-local hardware processing key.
Definition
TgcL0FloatingData.h:20
L0Muon::TgcL0Floating::Hit
Definition
TgcL0FloatingData.h:31
xAODP4Helpers.h
Generated on
for ATLAS Offline Software by
1.17.0