ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Muon
L1MuonS1TGCFloatingTools
src
FloatingRdoDecoder.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 "
FloatingRdoDecoder.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
L1Muon::L1TGC::FloatingStation
station(
23
const
Identifier
& identifier,
const
Muon::IMuonIdHelperSvc
& idHelperSvc) {
24
using
L1Muon::L1TGC::FloatingStation
;
25
using
Muon::MuonStationIndex::PhiIndex
;
26
27
switch
(idHelperSvc.
phiIndex
(identifier)) {
28
case
PhiIndex::T1:
29
return
FloatingStation::M1;
30
case
PhiIndex::T2:
31
return
FloatingStation::M2;
32
case
PhiIndex::T3:
33
return
FloatingStation::M3;
34
case
PhiIndex::T4:
35
return
FloatingStation::Inner;
36
default
:
37
return
FloatingStation::Unknown;
38
}
39
}
40
41
std::uint16_t triggerSector(
const
float
phi
) {
42
if
(!std::isfinite(
phi
))
return
0
U
;
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
L1Muon::L1TGC
{
57
58
StatusCode
FloatingRdoDecoder::decode
(
const
TgcRdoContainer
& rdos,
59
const
Muon::TgcCablingMap
& cabling,
60
const
Muon::IMuonIdHelperSvc
& idHelperSvc,
61
const
MuonGM::MuonDetectorManager
& detectorManager,
62
FloatingHitGroups
& hitGroups,
63
FloatingDecodeStatistics
& statistics)
const
{
64
hitGroups.clear();
65
statistics =
FloatingDecodeStatistics
{};
66
67
// Run-3 RDO conversion is isolated here. Hits are routed immediately to the
68
// Phase-II side/Trigger-Sector/BC processing chain, as in the validated
69
// Floating simulation. Chamber identifiers remain hit provenance only.
70
for
(
const
TgcRdo
* rdo : rdos) {
71
for
(
const
TgcRawData
* rawData : *rdo) {
72
++statistics.
nRawData
;
73
if
(rawData->type() !=
TgcRawData::TYPE_HIT
)
continue
;
74
75
Identifier
identifier;
76
const
bool
mapped
= cabling.getOfflineIDfromReadoutID(
77
identifier, rawData->subDetectorId(), rawData->rodId(),
78
rawData->sswId(), rawData->slbId(), rawData->channel());
79
if
(!
mapped
) {
80
++statistics.
nMappingFailures
;
81
continue
;
82
}
83
84
const
FloatingStation
hitStation = station(identifier, idHelperSvc);
85
const
bool
hitIsStrip = idHelperSvc.
tgcIdHelper
().
isStrip
(identifier);
86
float
eta
= 0.F;
87
float
phi
= 0.F;
88
float
r
= 0.F;
89
float
z
= 0.F;
90
const
MuonGM::TgcReadoutElement
* readoutElement =
91
detectorManager.
getTgcReadoutElement
(identifier);
92
if
(readoutElement !=
nullptr
) {
93
const
Amg::Vector3D
globalPosition = readoutElement->
channelPos
(identifier);
94
eta
=
static_cast<
float
>
(globalPosition.eta());
95
phi
=
static_cast<
float
>
(globalPosition.phi());
96
r
=
static_cast<
float
>
(globalPosition.perp());
97
z
=
static_cast<
float
>
(globalPosition.z());
98
}
99
const
std::uint16_t hitTriggerSector = triggerSector(
phi
);
100
if
(hitTriggerSector == 0U) {
101
++statistics.
nMappingFailures
;
102
continue
;
103
}
104
105
const
FloatingHit
hit
{
106
.subDetectorId = rawData->subDetectorId(),
107
.triggerSector = hitTriggerSector,
108
.detectorSector = rawData->rodId(),
109
.bcTag = rawData->bcTag(),
110
.sswId = rawData->sswId(),
111
.slbId = rawData->slbId(),
112
.readoutChannel = rawData->channel(),
113
.stationEta =
static_cast<
std::int16_t
>
(
114
idHelperSvc.
tgcIdHelper
().stationEta(identifier)),
115
.stationPhi =
static_cast<
std::uint16_t
>
(
116
idHelperSvc.
tgcIdHelper
().stationPhi(identifier)),
117
.gasGap =
static_cast<
std::uint8_t
>
(
118
idHelperSvc.
tgcIdHelper
().gasGap(identifier)),
119
.channel =
static_cast<
std::uint16_t
>
(
120
idHelperSvc.
tgcIdHelper
().channel(identifier)),
121
.station = hitStation,
122
.isStrip = hitIsStrip,
123
.eta =
eta
,
124
.phi =
phi
,
125
.r =
r
,
126
.z =
z
,
127
};
128
const
FloatingHitGroupKey
key{.subDetectorId =
hit
.subDetectorId,
129
.triggerSector =
hit
.triggerSector,
130
.bcTag =
hit
.bcTag};
131
hitGroups[key].emplace_back(
hit
);
132
133
++statistics.
nHits
;
134
if
(hitIsStrip) ++statistics.
nStripHits
;
135
else
++statistics.
nWireHits
;
136
switch
(hitStation) {
137
case
FloatingStation::M1
:
138
++statistics.
nM1Hits
;
139
break
;
140
case
FloatingStation::M2
:
141
++statistics.
nM2Hits
;
142
break
;
143
case
FloatingStation::M3
:
144
++statistics.
nM3Hits
;
145
break
;
146
case
FloatingStation::Inner
:
147
++statistics.
nInnerHits
;
148
break
;
149
default
:
150
++statistics.
nUnknownStation
;
151
break
;
152
}
153
}
154
}
155
return
StatusCode::SUCCESS;
156
}
157
158
}
// namespace L1Muon::L1TGC
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
FloatingRdoDecoder.h
IMuonIdHelperSvc.h
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
MuonDetectorManager.h
TgcReadoutElement.h
TgcCablingMap.h
TgcRawData.h
TgcRdoContainer.h
TgcRdo.h
z
#define z
L1Muon::L1TGC::FloatingRdoDecoder::decode
StatusCode decode(const TgcRdoContainer &rdos, const Muon::TgcCablingMap &cabling, const Muon::IMuonIdHelperSvc &idHelperSvc, const MuonGM::MuonDetectorManager &detectorManager, FloatingHitGroups &hitGroups, FloatingDecodeStatistics &statistics) const
Definition
FloatingRdoDecoder.cxx:58
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:260
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
L1Muon::L1MM::LayerType::U
@ U
Definition
L1MMDefinitions.h:28
L1Muon::L1TGC
Definition
SectorLogicWordEncoder.cxx:21
L1Muon::L1TGC::FloatingStation
FloatingStation
Definition
FloatingData.h:15
L1Muon::L1TGC::FloatingStation::M2
@ M2
Definition
FloatingData.h:15
L1Muon::L1TGC::FloatingStation::Inner
@ Inner
Definition
FloatingData.h:15
L1Muon::L1TGC::FloatingStation::M3
@ M3
Definition
FloatingData.h:15
L1Muon::L1TGC::FloatingStation::M1
@ M1
Definition
FloatingData.h:15
L1Muon::L1TGC::FloatingHitGroups
std::map< FloatingHitGroupKey, FloatingHitContainer > FloatingHitGroups
Definition
FloatingData.h:51
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
L1Muon::L1TGC::FloatingDecodeStatistics
Definition
FloatingData.h:53
L1Muon::L1TGC::FloatingDecodeStatistics::nMappingFailures
std::size_t nMappingFailures
Definition
FloatingData.h:58
L1Muon::L1TGC::FloatingDecodeStatistics::nM1Hits
std::size_t nM1Hits
Definition
FloatingData.h:60
L1Muon::L1TGC::FloatingDecodeStatistics::nM2Hits
std::size_t nM2Hits
Definition
FloatingData.h:61
L1Muon::L1TGC::FloatingDecodeStatistics::nStripHits
std::size_t nStripHits
Definition
FloatingData.h:57
L1Muon::L1TGC::FloatingDecodeStatistics::nUnknownStation
std::size_t nUnknownStation
Definition
FloatingData.h:59
L1Muon::L1TGC::FloatingDecodeStatistics::nWireHits
std::size_t nWireHits
Definition
FloatingData.h:56
L1Muon::L1TGC::FloatingDecodeStatistics::nHits
std::size_t nHits
Definition
FloatingData.h:55
L1Muon::L1TGC::FloatingDecodeStatistics::nRawData
std::size_t nRawData
Definition
FloatingData.h:54
L1Muon::L1TGC::FloatingDecodeStatistics::nInnerHits
std::size_t nInnerHits
Definition
FloatingData.h:63
L1Muon::L1TGC::FloatingDecodeStatistics::nM3Hits
std::size_t nM3Hits
Definition
FloatingData.h:62
L1Muon::L1TGC::FloatingHitGroupKey
Event-local hardware processing key.
Definition
FloatingData.h:19
L1Muon::L1TGC::FloatingHit
Definition
FloatingData.h:30
xAODP4Helpers.h
Generated on
for ATLAS Offline Software by
1.17.0