ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Muon
L0MuonMDTTools
src
PtEstimationTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
22
23
#include "
PtEstimationTool.h
"
24
25
#include <algorithm>
26
#include <cmath>
27
28
namespace
{
29
30
// Convert a segment slope m into an angle in the (z, R) plane
31
float
thetaFromSlope(
float
m) {
32
return
std::atan(m);
33
}
34
35
// Compute the signed distance of point (z, r) from the line through (z1, r1) and (z2, r2)
36
float
pointToLineDistance(
float
z
,
float
r
,
37
float
z1,
float
r1,
38
float
z2,
float
r2) {
39
const
float
dz = z2 - z1;
40
const
float
dr
=
r2
-
r1
;
41
const
float
den = std::hypot(dz, dr);
42
43
// Protect against degenerate input geometry
44
if
(den < 1.e-6f) {
45
return
0.f;
46
}
47
48
return
((
z
- z1) * dr - (
r
- r1) * dz) / den;
49
}
50
51
}
// namespace
52
53
namespace
L0MDT
{
54
55
StatusCode
PtEstimationTool::initialize
() {
56
ATH_MSG_DEBUG
(
"Initializing "
<< name());
57
58
return
StatusCode::SUCCESS;
59
}
60
61
std::optional<PtEstimate>
PtEstimationTool::estimatePt
(
const
Segment
* biSeg,
62
const
Segment
* bmSeg,
63
const
Segment
* boSeg)
const
{
64
const
bool
hasBI = (biSeg !=
nullptr
);
65
const
bool
hasBM = (bmSeg !=
nullptr
);
66
const
bool
hasBO = (boSeg !=
nullptr
);
67
68
const
unsigned
int
nStations =
static_cast<
unsigned
int
>
(hasBI) +
69
static_cast<
unsigned
int
>
(hasBM) +
70
static_cast<
unsigned
int
>
(hasBO);
71
72
// A meaningful geometric proxy needs at least two stations
73
if
(nStations < 2) {
74
ATH_MSG_DEBUG
(
"PtEstimationTool: fewer than 2 stations available, no pT proxy computed"
);
75
return
std::nullopt;
76
}
77
78
PtEstimate
result{};
79
result.nStations = nStations;
80
81
// --------------------------------------------------------------------------
82
// Two-station mode
83
//
84
// This branch estimates a toy pT proxy from the change in segment angle.
85
// This is only a bending proxy and is not a calibrated momentum estimate.
86
// --------------------------------------------------------------------------
87
if
(nStations == 2) {
88
const
Segment
* inner =
nullptr
;
89
const
Segment
* outer =
nullptr
;
90
91
if
(hasBI && hasBM) {
92
inner = biSeg;
93
outer = bmSeg;
94
}
else
if
(hasBI && hasBO) {
95
inner = biSeg;
96
outer = boSeg;
97
}
else
if
(hasBM && hasBO) {
98
inner = bmSeg;
99
outer = boSeg;
100
}
101
102
if
(!inner || !outer) {
103
ATH_MSG_WARNING
(
"PtEstimationTool: invalid 2-station configuration"
);
104
return
std::nullopt;
105
}
106
107
const
float
thetaInner = thetaFromSlope(inner->
m
());
108
const
float
thetaOuter = thetaFromSlope(outer->
m
());
109
110
result.deltaBeta = thetaOuter - thetaInner;
111
result.pt =
estimateTwoStationPt
(result.deltaBeta);
112
113
ATH_MSG_DEBUG
(
"Temporary 2-station pT proxy | "
114
<<
"deltaBeta="
<< result.deltaBeta
115
<<
" ptProxy="
<< result.pt);
116
117
return
result;
118
}
119
120
// --------------------------------------------------------------------------
121
// Three-station mode
122
//
123
// This branch estimates a toy pT proxy from sagitta and lever arm.
124
// The result is purely geometric and ignores magnetic field and calibration.
125
// --------------------------------------------------------------------------
126
const
float
sagitta = pointToLineDistance(
127
bmSeg->
zRef
(), bmSeg->
rRef
(),
128
biSeg->
zRef
(), biSeg->
rRef
(),
129
boSeg->
zRef
(), boSeg->
rRef
());
130
131
const
float
leverArm = std::hypot(
132
boSeg->
zRef
() - biSeg->
zRef
(),
133
boSeg->
rRef
() - biSeg->
rRef
());
134
135
result.sagitta = sagitta;
136
result.leverArm = leverArm;
137
result.pt =
estimateThreeStationPt
(result.sagitta, result.leverArm);
138
139
ATH_MSG_DEBUG
(
"Temporary 3-station pT proxy | "
140
<<
"sagitta="
<< result.sagitta
141
<<
" leverArm="
<< result.leverArm
142
<<
" ptProxy="
<< result.pt);
143
144
return
result;
145
}
146
147
// Convert a 2-station angular deflection into a toy pT proxy
148
float
PtEstimationTool::estimateTwoStationPt
(
float
deltaBeta)
const
{
149
// Protection against vanishing angular difference
150
constexpr
float
minAbsDeltaBeta = 1.e-4f;
151
152
// Purely ad hoc scale factor for a temporary proxy
153
constexpr
float
kToyPtScale = 1000.f;
154
155
const
float
absDeltaBeta = std::max(std::abs(deltaBeta), minAbsDeltaBeta);
156
157
// Temporary proxy: larger bending -> lower pT proxy
158
return
kToyPtScale / absDeltaBeta;
159
}
160
161
// Convert a 3-station sagitta into a toy pT proxy
162
float
PtEstimationTool::estimateThreeStationPt
(
float
sagitta,
float
leverArm)
const
{
163
// Protection against vanishing sagitta
164
constexpr
float
minAbsSagitta = 1.e-3f;
165
166
// Purely ad hoc scale factor for a temporary proxy
167
constexpr
float
kToyPtScale = 1.e-3f;
168
169
const
float
absSagitta = std::max(std::abs(sagitta), minAbsSagitta);
170
171
// Temporary proxy: pT ~ L^2 / sagitta
172
return
kToyPtScale * leverArm * leverArm / absSagitta;
173
}
174
175
}
// namespace L0MDT
176
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
PtEstimationTool.h
z
#define z
L0MDT::PtEstimationTool::estimateTwoStationPt
float estimateTwoStationPt(float deltaBeta) const
Compute a toy pT proxy from the angular deflection between two stations.
Definition
PtEstimationTool.cxx:148
L0MDT::PtEstimationTool::initialize
virtual StatusCode initialize() override
Definition
PtEstimationTool.cxx:55
L0MDT::PtEstimationTool::estimateThreeStationPt
float estimateThreeStationPt(float sagitta, float leverArm) const
Compute a toy pT proxy from the sagitta and lever arm of a three-station track.
Definition
PtEstimationTool.cxx:162
L0MDT::PtEstimationTool::estimatePt
virtual std::optional< PtEstimate > estimatePt(const Segment *biSeg, const Segment *bmSeg, const Segment *boSeg) const override
Estimate the transverse momentum from up to three MDT segment references.
Definition
PtEstimationTool.cxx:61
L0MDT::Segment
Class describing a reconstructed MDT segment used by the L0Muon trigger.
Definition
L0MDTSegment.h:17
L0MDT::Segment::rRef
float rRef() const
Definition
L0MDTSegment.h:43
L0MDT::Segment::zRef
float zRef() const
Definition
L0MDTSegment.h:42
L0MDT::Segment::m
float m() const
Definition
L0MDTSegment.h:35
r
int r
Definition
globals.cxx:22
L0MDT
Compact Segment Finder algorithm overview.
Definition
IL0MDTSegmentFinderTool.h:13
MCP::ScaleSmearParam::r1
@ r1
Definition
EnumDef.h:22
MCP::ScaleSmearParam::r2
@ r2
Definition
EnumDef.h:22
python.TurnDataReader.dr
dr
Definition
TurnDataReader.py:111
L0MDT::PtEstimate
Output struct holding the result of a pT estimation.
Definition
IPtEstimationTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0