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
#include <string>
20
21
namespace
{
22
23
L0Muon::TgcL0Floating::Station
station(
24
const
Identifier
& identifier,
const
Muon::IMuonIdHelperSvc
& idHelperSvc) {
25
using
L0Muon::TgcL0Floating::Station
;
26
const
std::string
stationName
= idHelperSvc.
tgcIdHelper
().
stationNameString
(
27
idHelperSvc.
tgcIdHelper
().
stationName
(identifier));
28
if
(
stationName
.rfind(
"T1"
, 0) == 0)
return
Station::M1;
29
if
(
stationName
.rfind(
"T2"
, 0) == 0)
return
Station::M2;
30
if
(
stationName
.rfind(
"T3"
, 0) == 0)
return
Station::M3;
31
if
(
stationName
.rfind(
"T4"
, 0) == 0)
return
Station::Inner;
32
return
Station::Unknown;
33
}
34
35
std::uint16_t triggerSector(
const
float
phi
) {
36
if
(!std::isfinite(
phi
))
return
0U;
37
constexpr
std::uint16_t nSectors = 24U;
38
const
float
fullTurn = 2.F * std::numbers::pi_v<float>;
39
const
float
sectorWidth = fullTurn /
static_cast<
float
>
(nSectors);
40
float
wrapped =
static_cast<
float
>
(
xAOD::P4Helpers::deltaPhi
(
phi
, 0.));
41
if
(wrapped < 0.F) wrapped += fullTurn;
42
std::uint16_t sector =
static_cast<
std::uint16_t
>
(
43
std::floor(wrapped / sectorWidth)) + 2U;
44
if
(sector > nSectors) sector -= nSectors;
45
return
sector;
46
}
47
48
}
// namespace
49
50
namespace
L0Muon
{
51
namespace
TgcL0Floating
{
52
53
StatusCode
RdoDecoder::decode
(
const
TgcRdoContainer
& rdos,
54
const
Muon::TgcCablingMap
& cabling,
55
const
Muon::IMuonIdHelperSvc
& idHelperSvc,
56
const
MuonGM::MuonDetectorManager
& detectorManager,
57
HitGroups
& hitGroups,
58
DecodeStatistics
& statistics)
const
{
59
hitGroups.clear();
60
statistics =
DecodeStatistics
{};
61
62
// Run-3 RDO conversion is isolated here. Hits are routed immediately to the
63
// Phase-II side/Trigger-Sector/BC processing chain, as in the validated
64
// Floating simulation. Chamber identifiers remain hit provenance only.
65
for
(
const
TgcRdo
* rdo : rdos) {
66
for
(
const
TgcRawData
* rawData : *rdo) {
67
++statistics.
nRawData
;
68
if
(rawData->type() !=
TgcRawData::TYPE_HIT
)
continue
;
69
70
Identifier
identifier;
71
const
bool
mapped
= cabling.getOfflineIDfromReadoutID(
72
identifier, rawData->subDetectorId(), rawData->rodId(),
73
rawData->sswId(), rawData->slbId(), rawData->channel());
74
if
(!
mapped
) {
75
++statistics.
nMappingFailures
;
76
continue
;
77
}
78
79
const
Station
hitStation = station(identifier, idHelperSvc);
80
const
bool
hitIsStrip = idHelperSvc.
tgcIdHelper
().
isStrip
(identifier);
81
float
eta
= 0.F;
82
float
phi
= 0.F;
83
float
r
= 0.F;
84
float
z
= 0.F;
85
const
MuonGM::TgcReadoutElement
* readoutElement =
86
detectorManager.
getTgcReadoutElement
(identifier);
87
if
(readoutElement !=
nullptr
) {
88
const
Amg::Vector3D
globalPosition = readoutElement->
channelPos
(identifier);
89
eta
=
static_cast<
float
>
(globalPosition.eta());
90
phi
=
static_cast<
float
>
(globalPosition.phi());
91
r
=
static_cast<
float
>
(globalPosition.perp());
92
z
=
static_cast<
float
>
(globalPosition.z());
93
}
94
const
std::uint16_t hitTriggerSector = triggerSector(
phi
);
95
if
(hitTriggerSector == 0U) {
96
++statistics.
nMappingFailures
;
97
continue
;
98
}
99
100
const
Hit
hit
{
101
.subDetectorId = rawData->subDetectorId(),
102
.triggerSector = hitTriggerSector,
103
.detectorSector = rawData->rodId(),
104
.bcTag = rawData->bcTag(),
105
.sswId = rawData->sswId(),
106
.slbId = rawData->slbId(),
107
.readoutChannel = rawData->channel(),
108
.stationEta =
static_cast<
std::int16_t
>
(
109
idHelperSvc.
tgcIdHelper
().stationEta(identifier)),
110
.stationPhi =
static_cast<
std::uint16_t
>
(
111
idHelperSvc.
tgcIdHelper
().stationPhi(identifier)),
112
.gasGap =
static_cast<
std::uint8_t
>
(
113
idHelperSvc.
tgcIdHelper
().gasGap(identifier)),
114
.channel =
static_cast<
std::uint16_t
>
(
115
idHelperSvc.
tgcIdHelper
().channel(identifier)),
116
.station = hitStation,
117
.isStrip = hitIsStrip,
118
.eta =
eta
,
119
.phi =
phi
,
120
.r =
r
,
121
.z =
z
,
122
};
123
const
HitGroupKey
key{.subDetectorId =
hit
.subDetectorId,
124
.triggerSector =
hit
.triggerSector,
125
.bcTag =
hit
.bcTag};
126
hitGroups[key].emplace_back(
hit
);
127
128
++statistics.
nHits
;
129
if
(hitIsStrip) ++statistics.
nStripHits
;
130
else
++statistics.
nWireHits
;
131
switch
(hitStation) {
132
case
Station::M1
:
133
++statistics.
nM1Hits
;
134
break
;
135
case
Station::M2
:
136
++statistics.
nM2Hits
;
137
break
;
138
case
Station::M3
:
139
++statistics.
nM3Hits
;
140
break
;
141
case
Station::Inner
:
142
++statistics.
nInnerHits
;
143
break
;
144
default
:
145
++statistics.
nUnknownStation
;
146
break
;
147
}
148
}
149
}
150
return
StatusCode::SUCCESS;
151
}
152
153
}
// namespace TgcL0Floating
154
}
// 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:53
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).
MuonIdHelper::stationNameString
const std::string & stationNameString(const Identifier &id) const
Definition
MuonIdHelper.cxx:839
MuonIdHelper::stationName
int stationName(const Identifier &id) const
Definition
MuonIdHelper.cxx:785
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition
IMuonIdHelperSvc.h:27
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:47
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
dumpTgcDigiDeadChambers.stationName
dict stationName
Definition
dumpTgcDigiDeadChambers.py:30
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