ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::SegmentFit Namespace Reference

Classes

struct  SeederStateBase
 Helper struct to delegate the EDM interactions with the space point container during the seeding. More...
class  MdtSegmentSeedGenerator
 Helper class to generate valid seeds for the segment fit. More...
class  SegmentAmbiSolver
 The SegmentAmbiSolver removes ambiguities between segment candidates from the fit. More...
class  SegmentLineFitter
 The SegmentLineFitter is a standalone module to fit a straight line to calibrated muon space points. More...

Typedefs

using SeedingAux = SpacePoint::SeedingAux
 Abrivation of the CompSpacePointAuxiliaries.
using ParamDefs = SeedingAux::FitParIndex
 Use the same parameter indices as used by the CompSpacePointAuxiliaries.
using Line_t = SeedingAux::Line_t
 Abrivation of the line with partial derivatives.
using AxisDefs = SpacePoint::CovIdx
 Use the same mapping of the covariance space indicies as used by the SpacePoint.
using Parameters = Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t
using Covariance = Acts::Experimental::CompositeSpacePointLineFitter::CovMat_t
using HitVec = SpacePointPerLayerSplitter::HitVec
using HitLayerVec = SpacePointPerLayerSplitter::HitLayVec
using SegmentVec = SegmentAmbiSolver::SegmentVec
using Hit_t = SegmentLineFitter::Hit_t
using HitVec_t = SegmentLineFitter::HitVec_t
using Result_t = SegmentLineFitter::Result_t

Functions

std::pair< Amg::Vector3D, Amg::Vector3DmakeLine (const Parameters &pars)
 Returns the parsed parameters into an Eigen line parametrization.
std::string makeLabel (const Parameters &pars)
 Dumps the parameters into a string in the form of TLatex.
std::string toString (const Parameters &pars)
 Dumps the parameters into a string with labels in front of each number.
std::string toString (const ParamDefs par)
 Returns the parameter label.
Parameters localSegmentPars (const xAOD::MuonSegment &seg)
 Returns the localSegPars decoration from a xAODMuon::Segment.
std::optional< CovariancelocalSegmentCov (const xAOD::MuonSegment &seg)
 Returns the localCovariance decoration from a xAOD::MuonSegment.
Parameters localSegmentPars (const ActsTrk::GeometryContext &gctx, const Segment &segment)
 Returns the local segment parameters from a segment object.
Parameters localSegmentPars (const Acts::GeometryContext &tgContext, const Segment &segment)
 Returns the localSegPars decoration from a xAODMuon::Segment.
Acts::BoundTrackParameters boundSegmentPars (const ActsTrk::GeometryContext &gctx, const MuonGMR4::MuonDetectorManager &detMgr, const xAOD::MuonSegment &segment, const Acts::ParticleHypothesis hypot=Acts::ParticleHypothesis::muon())
 Returns the segment parameters as boundTrackParameters.
Acts::BoundTrackParameters boundSegmentPars (const Acts::GeometryContext &tgContext, const MuonGMR4::MuonDetectorManager &detMgr, const xAOD::MuonSegment &segment, const Acts::ParticleHypothesis hypot=Acts::ParticleHypothesis::muon())
 Returns the segment parameters as boundTrackParameters.
Acts::BoundTrackParameters boundSegmentPars (const ActsTrk::GeometryContext &gctx, const Segment &segment, const Acts::ParticleHypothesis hypot=Acts::ParticleHypothesis::muon())
 Returns the segment parameters as boundTrackParameters.
Acts::BoundTrackParameters boundSegmentPars (const Acts::GeometryContext &tgContext, const Segment &segment, const Acts::ParticleHypothesis hypot=Acts::ParticleHypothesis::muon())
 Returns the segment parameters as boundTrackParameters.
std::optional< Acts::BoundMatrix > translateCovariance (const Parameters &locSegPars, std::optional< Covariance > &&localCov, const Amg::Transform3D &localToGlobal)

Variables

constexpr std::size_t N = Acts::toUnderlying(ParamDefs::nPars)

Typedef Documentation

◆ AxisDefs

Use the same mapping of the covariance space indicies as used by the SpacePoint.

Definition at line 43 of file MuonHoughDefs.h.

◆ Covariance

using MuonR4::SegmentFit::Covariance = Acts::Experimental::CompositeSpacePointLineFitter::CovMat_t

Definition at line 47 of file MuonHoughDefs.h.

◆ Hit_t

◆ HitLayerVec

◆ HitVec

◆ HitVec_t

◆ Line_t

using MuonR4::SegmentFit::Line_t = SeedingAux::Line_t

Abrivation of the line with partial derivatives.

Definition at line 40 of file MuonHoughDefs.h.

◆ ParamDefs

using MuonR4::SegmentFit::ParamDefs = SeedingAux::FitParIndex

Use the same parameter indices as used by the CompSpacePointAuxiliaries.

Definition at line 38 of file MuonHoughDefs.h.

◆ Parameters

using MuonR4::SegmentFit::Parameters = Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t

Definition at line 46 of file MuonHoughDefs.h.

◆ Result_t

◆ SeedingAux

Abrivation of the CompSpacePointAuxiliaries.

Definition at line 36 of file MuonHoughDefs.h.

◆ SegmentVec

Function Documentation

◆ boundSegmentPars() [1/4]

Acts::BoundTrackParameters MuonR4::SegmentFit::boundSegmentPars ( const Acts::GeometryContext & tgContext,
const MuonGMR4::MuonDetectorManager & detMgr,
const xAOD::MuonSegment & segment,
const Acts::ParticleHypothesis hypot = Acts::ParticleHypothesis::muon() )

Returns the segment parameters as boundTrackParameters.

The position is expressed locally on the sector surface & the direction in the global frame

Parameters
gctxThe Geometrycontext to translate the angular jacobian of theta & phi
detMgrDetector manager to pick up the proper sector object
segmentReference to the segment of interest
covUncertainty on the parsed parameters
hypotThe particle hypothesis to plugin (Muon by default)

Definition at line 139 of file SegmentFitterEventData.cxx.

142 {
143 return boundSegmentPars(*tgContext.get<const ActsTrk::GeometryContext*>(),
144 detMgr, segment, hypot);
145 }
Acts::BoundTrackParameters boundSegmentPars(const ActsTrk::GeometryContext &gctx, const MuonGMR4::MuonDetectorManager &detMgr, const xAOD::MuonSegment &segment, const Acts::ParticleHypothesis hypot=Acts::ParticleHypothesis::muon())
Returns the segment parameters as boundTrackParameters.

◆ boundSegmentPars() [2/4]

Acts::BoundTrackParameters MuonR4::SegmentFit::boundSegmentPars ( const Acts::GeometryContext & tgContext,
const Segment & segment,
const Acts::ParticleHypothesis hypot = Acts::ParticleHypothesis::muon() )

Returns the segment parameters as boundTrackParameters.

The position is expressed locally on the sector surface & the direction in the global frame

Parameters
gctxThe Geometrycontext to translate the angular jacobian of theta & phi
detMgrDetector manager to pick up the proper sector object
segmentReference to the segment of interest
covUncertainty on the parsed parameters
hypotThe particle hypothesis to plugin (Muon by default)

◆ boundSegmentPars() [3/4]

Acts::BoundTrackParameters MuonR4::SegmentFit::boundSegmentPars ( const ActsTrk::GeometryContext & gctx,
const MuonGMR4::MuonDetectorManager & detMgr,
const xAOD::MuonSegment & segment,
const Acts::ParticleHypothesis hypot = Acts::ParticleHypothesis::muon() )

Returns the segment parameters as boundTrackParameters.

The position is expressed locally on the sector surface & the direction in the global frame

Parameters
gctxThe Geometrycontext to translate the angular jacobian of theta & phi
detMgrDetector manager to pick up the proper sector object
segmentReference to the segment of interest
covUncertainty on the parsed parameters
hypotThe particle hypothesis to plugin (Muon by default)

Definition at line 146 of file SegmentFitterEventData.cxx.

149 {
150
151 const auto* msSector = detMgr.getSectorEnvelope(segment.chamberIndex(),
152 segment.sector(),
153 segment.etaIndex());
154
155 const Parameters locSegPars = localSegmentPars(segment);
156 const Amg::Vector3D globDir = segment.direction();
157
158 Acts::BoundVector boundPars{};
159 boundPars[Acts::eBoundLoc0] = locSegPars[Acts::toUnderlying(ParamDefs::x0)];
160 boundPars[Acts::eBoundLoc1] = locSegPars[Acts::toUnderlying(ParamDefs::y0)];
161 boundPars[Acts::eBoundPhi] = globDir.phi();
162 boundPars[Acts::eBoundTheta] = globDir.theta();
163 boundPars[Acts::eBoundQOverP] = straightQoverP;
164 boundPars[Acts::eBoundTime] = ActsTrk::timeToActs(segment.position().mag() / Gaudi::Units::c_light + segment.t0());
165
166 // std::optional<Acts::BoundMatrix> cov = translateCovariance(localSegmentPars()
167 return Acts::BoundTrackParameters{msSector->surface().getSharedPtr(),
168 std::move(boundPars),
169 translateCovariance(locSegPars, localSegmentCov(segment),
170 msSector->localToGlobalTransform(gctx)), hypot};
171 }
const SpectrometerSector * getSectorEnvelope(const Identifier &channelId) const
Retrieves the spectrometer envelope enclosing the channel's readout element.
float t0() const
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
int etaIndex() const
Returns the eta index, which corresponds to stationEta in the offline identifiers (and the ).
constexpr auto timeToActs(T athenaT)
Converts a time unit from Athena to Acts units.
Eigen::Matrix< double, 3, 1 > Vector3D
std::optional< Covariance > localSegmentCov(const xAOD::MuonSegment &seg)
Returns the localCovariance decoration from a xAOD::MuonSegment.
Parameters localSegmentPars(const xAOD::MuonSegment &seg)
Returns the localSegPars decoration from a xAODMuon::Segment.
Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t Parameters
std::optional< Acts::BoundMatrix > translateCovariance(const Parameters &locSegPars, std::optional< Covariance > &&localCov, const Amg::Transform3D &localToGlobal)

◆ boundSegmentPars() [4/4]

Acts::BoundTrackParameters MuonR4::SegmentFit::boundSegmentPars ( const ActsTrk::GeometryContext & gctx,
const Segment & segment,
const Acts::ParticleHypothesis hypot = Acts::ParticleHypothesis::muon() )

Returns the segment parameters as boundTrackParameters.

The position is expressed locally on the sector surface & the direction in the global frame.

Parameters
gctxThe geometry context needed to transform the global -> local parameters
segmentThe segment for which the bound paramters shall be created
hypotThe particle hypothesis to plugin (Muon by default)

Definition at line 172 of file SegmentFitterEventData.cxx.

174 {
175
176 const Amg::Vector3D locPos = segment.msSector()->globalToLocalTransform(gctx) * segment.position();
177 Acts::BoundVector boundPars{};
178 boundPars[Acts::eBoundLoc0] = locPos.x();
179 boundPars[Acts::eBoundLoc1] = locPos.y();
180 boundPars[Acts::eBoundPhi] = segment.direction().phi();
181 boundPars[Acts::eBoundTheta] = segment.direction().theta();
182 boundPars[Acts::eBoundQOverP] = straightQoverP;
183 boundPars[Acts::eBoundTime] = ActsTrk::timeToActs(segment.position().mag() / Gaudi::Units::c_light +
184 segment.segementT0());
185
186 return Acts::BoundTrackParameters{segment.msSector()->surface().getSharedPtr(),
187 std::move(boundPars),
189 segment.covariance(),
190 segment.msSector()->localToGlobalTransform(gctx)), hypot};
191 }
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the local -> global tarnsformation from the sector.
Amg::Transform3D globalToLocalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the global -> local transformation from the ATLAS global.
const Acts::PlaneSurface & surface() const
Returns the associated surface.
double segementT0() const
Returns the fitted segment time, if there's any.
const SegmentFit::Covariance & covariance() const
Returns the uncertainties of the defining parameters.
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
const Amg::Vector3D & position() const
Returns the global segment position.
const Amg::Vector3D & direction() const
Returns the global segment direction.

◆ localSegmentCov()

std::optional< Covariance > MuonR4::SegmentFit::localSegmentCov ( const xAOD::MuonSegment & seg)

Returns the localCovariance decoration from a xAOD::MuonSegment.

Definition at line 84 of file SegmentFitterEventData.cxx.

84 {
85 static const xAOD::PosAccessor<Acts::sumUpToN(N)> acc{"localSegCov"};
86 if (!acc.isAvailable(seg)) {
87 return std::nullopt;
88 }
89 Covariance cov{Covariance::Zero()};
90 const auto& covVec{acc(seg)};
91 for (std::size_t i = 0 ; i < covVec.size(); ++i) {
92 const auto [p, p1] = Acts::symMatIndices<N>(i);
93 cov(p,p1) = cov(p1,p) = covVec[i];
94 }
95 return cov;
96 }
std::vector< float > covVec(const U &p)
Acts::Experimental::CompositeSpacePointLineFitter::CovMat_t Covariance
constexpr std::size_t N
SG::AuxElement::Accessor< std::array< float, N > > PosAccessor
xAOD Accessor to the position

◆ localSegmentPars() [1/3]

Parameters MuonR4::SegmentFit::localSegmentPars ( const Acts::GeometryContext & tgContext,
const Segment & segment )

Returns the localSegPars decoration from a xAODMuon::Segment.

Definition at line 98 of file SegmentFitterEventData.cxx.

99 {
100 return localSegmentPars(*tgContext.get<const ActsTrk::GeometryContext*>(), segment);
101 }

◆ localSegmentPars() [2/3]

Parameters MuonR4::SegmentFit::localSegmentPars ( const ActsTrk::GeometryContext & gctx,
const Segment & segment )

Returns the local segment parameters from a segment object.

Parameters
gctxGeometry context storing the local -> global transformation
segmentReference to the segment

Definition at line 103 of file SegmentFitterEventData.cxx.

104 {
105 Parameters pars{};
106 const Amg::Transform3D globToLoc = segment.msSector()->globalToLocalTransform(gctx);
107 const Amg::Vector3D locPos = globToLoc * segment.position();
108 const Amg::Vector3D locDir = globToLoc.linear() * segment.direction();
109 pars[Acts::toUnderlying(ParamDefs::x0)] = locPos.x();
110 pars[Acts::toUnderlying(ParamDefs::y0)] = locPos.y();
111 pars[Acts::toUnderlying(ParamDefs::theta)] = locDir.theta();
112 pars[Acts::toUnderlying(ParamDefs::phi)] = locDir.phi();
113 pars[Acts::toUnderlying(ParamDefs::t0)] = segment.segementT0();
114 return pars;
115 }
Eigen::Affine3d Transform3D

◆ localSegmentPars() [3/3]

Parameters MuonR4::SegmentFit::localSegmentPars ( const xAOD::MuonSegment & seg)

Returns the localSegPars decoration from a xAODMuon::Segment.

Definition at line 76 of file SegmentFitterEventData.cxx.

76 {
77 static const xAOD::PosAccessor<N> acc{"localSegPars"};
78 Parameters segPars{};
79 for (std::size_t p =0 ; p < N; ++p) {
80 segPars[p] = acc(seg)[p];
81 }
82 return segPars;
83 }

◆ makeLabel()

std::string MuonR4::SegmentFit::makeLabel ( const Parameters & pars)

Dumps the parameters into a string in the form of TLatex.

Distances are expressed in [mm], angles in [deg] and time in [ns]

Parameters
parsReference to the parameters to dump

Definition at line 117 of file SegmentFitterEventData.cxx.

117 {
118 std::stringstream sstr{};
119 sstr<<std::format("x_{{0}}={:.2f}", pars[Acts::toUnderlying(ParamDefs::x0)])<<", ";
120 sstr<<std::format("y_{{0}}={:.2f}", pars[Acts::toUnderlying(ParamDefs::y0)])<<", ";
121 sstr<<std::format("#theta={:.2f}^{{#circ}}",inDeg(pars[Acts::toUnderlying(ParamDefs::theta)]))<<", ";
122 sstr<<std::format("#phi={:.2f}^{{#circ}}", inDeg(pars[Acts::toUnderlying(ParamDefs::phi)]))<<", ";
123 sstr<<std::format("t_{{0}}={:.1f}", pars[Acts::toUnderlying(ParamDefs::t0)]);
124 return sstr.str();
125 }
constexpr float inDeg(const float rad)

◆ makeLine()

std::pair< Amg::Vector3D, Amg::Vector3D > MuonR4::SegmentFit::makeLine ( const Parameters & pars)

Returns the parsed parameters into an Eigen line parametrization.

The first operand is the position. The other is the direction.

Definition at line 69 of file SegmentFitterEventData.cxx.

69 {
70 using enum ParamDefs;
71 return std::make_pair(Amg::Vector3D{pars[Acts::toUnderlying(x0)],
72 pars[Acts::toUnderlying(y0)],0.},
73 Acts::makeDirectionFromPhiTheta(pars[Acts::toUnderlying(phi)],
74 pars[Acts::toUnderlying(theta)]));
75 }
Scalar phi() const
phi method
Scalar theta() const
theta method
SeedingAux::FitParIndex ParamDefs
Use the same parameter indices as used by the CompSpacePointAuxiliaries.

◆ toString() [1/2]

std::string MuonR4::SegmentFit::toString ( const ParamDefs par)

Returns the parameter label.

Parameters
parParameter of interest

Definition at line 135 of file SegmentFitterEventData.cxx.

135 {
136 return SeedingAux::parName(a);
137 }
static Double_t a

◆ toString() [2/2]

std::string MuonR4::SegmentFit::toString ( const Parameters & pars)

Dumps the parameters into a string with labels in front of each number.

Distances are expressed in [mm], angles in [deg] and time in [ns]

Parameters
parsReference to the parameters to dump

Definition at line 126 of file SegmentFitterEventData.cxx.

126 {
127 std::stringstream sstr{};
128 sstr<< std::format("{}={:.2f}, ",toString(ParamDefs::x0), pars[Acts::toUnderlying(ParamDefs::x0)]);
129 sstr<< std::format("{}={:.2f}, ",toString(ParamDefs::y0), pars[Acts::toUnderlying(ParamDefs::y0)]);
130 sstr<< std::format("{}={:.2f}, ",toString(ParamDefs::theta), inDeg(pars[Acts::toUnderlying(ParamDefs::theta)]));
131 sstr<< std::format("{}={:.2f}, ",toString(ParamDefs::phi), inDeg(pars[Acts::toUnderlying(ParamDefs::phi)]));
132 sstr<< std::format("{}={:.2f}",toString(ParamDefs::t0), pars[Acts::toUnderlying(ParamDefs::t0)]);
133 return sstr.str();
134 }
std::string toString(const Parameters &pars)
Dumps the parameters into a string with labels in front of each number.

◆ translateCovariance()

std::optional< Acts::BoundMatrix > MuonR4::SegmentFit::translateCovariance ( const Parameters & locSegPars,
std::optional< Covariance > && localCov,
const Amg::Transform3D & localToGlobal )
inline

Definition at line 40 of file SegmentFitterEventData.cxx.

42 {
43 if (!localCov) {
44 return std::nullopt;
45 }
46 const SeedingAux::Line_t line{locSegPars};
47
48 Acts::Matrix<3,2> basisTrf{};
49 basisTrf.block<3,1>(0,1) = line.gradient(SeedingAux::Line_t::ParIndex::theta);
50 basisTrf.block<3,1>(0,0) = line.gradient(SeedingAux::Line_t::ParIndex::phi);
51
52 BoundMatrix jacobian{BoundMatrix::Identity()};
53 jacobian.block<2,2>(Acts::eBoundPhi, Acts::eBoundPhi) = basisTrf.transpose() *
54 localToGlobal.linear() *
55 basisTrf;
56 BoundMatrix cov{BoundMatrix::Identity()};
57 cov.block<N,N>(0,0) = std::move(*localCov);
58 BoundMatrix translator{BoundMatrix::Zero()};
59 translator( Acts::toUnderlying(ParamDefs::x0), Acts::eBoundLoc0) =
60 translator( Acts::toUnderlying(ParamDefs::y0), Acts::eBoundLoc1) =
61 translator( Acts::toUnderlying(ParamDefs::theta), Acts::eBoundTheta) =
62 translator( Acts::toUnderlying(ParamDefs::phi), Acts::eBoundPhi) =
63 translator( Acts::toUnderlying(ParamDefs::t0), Acts::eBoundTime) =
64 translator( Acts::toUnderlying(ParamDefs::nPars), Acts::eBoundQOverP) = 1.;
65 translator = jacobian * translator;
66 return translator.transpose() * cov * translator;
67 }

Variable Documentation

◆ N

std::size_t MuonR4::SegmentFit::N = Acts::toUnderlying(ParamDefs::nPars)
constexpr

Definition at line 37 of file SegmentFitterEventData.cxx.