ATLAS Offline Software
Classes | Typedefs | Functions | Variables
MuonR4::SegmentFit Namespace Reference

Classes

class  MdtSegmentSeedGenerator
 Helper class to generate valid seeds for the segment fit. More...
 
class  SegmentAmbiSolver
 
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. More...
 
using ParamDefs = SeedingAux::FitParIndex
 Use the same parameter indices as used by the CompSpacePointAuxiliaries. More...
 
using Line_t = SeedingAux::Line_t
 Abrivation of the line with partial derivatives. More...
 
using AxisDefs = SpacePoint::CovIdx
 Use the same mapping of the covariance space indicies as used by the SpacePoint. More...
 
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. More...
 
std::string makeLabel (const Parameters &pars)
 Dumps the parameters into a string in the form of TLatex. More...
 
std::string toString (const Parameters &pars)
 Dumps the parameters into a string with labels in front of each number. More...
 
std::string toString (const ParamDefs par)
 Returns the parameter label. More...
 
Parameters localSegmentPars (const xAOD::MuonSegment &seg)
 Returns the localSegPars decoration from a xAODMuon::Segment. More...
 
Parameters localSegmentPars (const ActsTrk::GeometryContext &gctx, const Segment &segment)
 Returns the local segment parameters from a segment object. More...
 
Acts::BoundTrackParameters boundSegmentPars (const MuonGMR4::MuonDetectorManager &detMgr, const xAOD::MuonSegment &segment, std::optional< Acts::BoundMatrix > cov=std::nullopt, Acts::ParticleHypothesis hypot=Acts::ParticleHypothesis::muon())
 Returns the segment parameters as boundTrackParameters. More...
 
Acts::BoundTrackParameters boundSegmentPars (const ActsTrk::GeometryContext &gctx, const Segment &segment, const Acts::ParticleHypothesis hypot=Acts::ParticleHypothesis::muon())
 Returns the segment parameters as boundTrackParameters. More...
 
Muon::MdtDriftCircleStatus dcStatus (const SpacePoint &dc)
 
bool isGoodDC (const SpacePoint &dc)
 Returns whether the Mdt measurement has a valid space point. More...
 
bool moveToNextHit (const HitVec &hits, std::size_t &hitIdx)
 Move to the next space point with valid drift radius. More...
 
bool firstGoodHit (const HitVec &hits, std::size_t &hitIdx)
 Find the first good hit in a layer. More...
 

Variables

constexpr auto covIdx = Acts::toUnderlying(AxisDefs::etaCov)
 

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 = typedef Acts::Experimental::CompositeSpacePointLineFitter::CovMat_t

Definition at line 47 of file MuonHoughDefs.h.

◆ Hit_t

Definition at line 31 of file SegmentLineFitter.cxx.

◆ HitLayerVec

Definition at line 21 of file MdtSegmentSeedGenerator.cxx.

◆ HitVec

Definition at line 20 of file MdtSegmentSeedGenerator.cxx.

◆ HitVec_t

Definition at line 32 of file SegmentLineFitter.cxx.

◆ Line_t

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

Abrivation of the line with partial derivatives.

Definition at line 40 of file MuonHoughDefs.h.

◆ ParamDefs

using MuonR4::SegmentFit::ParamDefs = typedef 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 = typedef Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t

Definition at line 46 of file MuonHoughDefs.h.

◆ Result_t

Definition at line 33 of file SegmentLineFitter.cxx.

◆ SeedingAux

Abrivation of the CompSpacePointAuxiliaries.

Definition at line 36 of file MuonHoughDefs.h.

◆ SegmentVec

Definition at line 8 of file SegmentAmbiSolver.cxx.

Function Documentation

◆ boundSegmentPars() [1/2]

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

Definition at line 112 of file SegmentFitterEventData.cxx.

114  {
115  const auto& surface = segment.msSector()->surface();
116 
117  const Amg::Vector3D locPos = surface.transform(gctx.context()).inverse() *
118  segment.position();
119  Acts::BoundVector boundPars{};
120  boundPars[Acts::eBoundLoc0] = locPos.x();
121  boundPars[Acts::eBoundLoc1] = locPos.y();
122  boundPars[Acts::eBoundPhi] = segment.direction().phi();
123  boundPars[Acts::eBoundTheta] = segment.direction().theta();
124  boundPars[Acts::eBoundQOverP] = straightQoverP;
125  boundPars[Acts::eBoundTime] = ActsTrk::timeToActs(segment.position().mag() / Gaudi::Units::c_light +
126  segment.segementT0());
127  Acts::BoundMatrix cov{Acts::BoundMatrix::Identity()};
128 
129  return Acts::BoundTrackParameters{surface.getSharedPtr(), std::move(boundPars),
130  cov, hypot};
131  }

◆ boundSegmentPars() [2/2]

Acts::BoundTrackParameters MuonR4::SegmentFit::boundSegmentPars ( const MuonGMR4::MuonDetectorManager detMgr,
const xAOD::MuonSegment segment,
std::optional< Acts::BoundMatrix >  cov = std::nullopt,
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
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 85 of file SegmentFitterEventData.cxx.

88  {
89 
90  const auto* msSector = detMgr.getSectorEnvelope(segment.chamberIndex(),
91  segment.sector(),
92  segment.etaIndex());
93  const Acts::Surface& surface = msSector->surface();
94 
95  const auto locSegPars = localSegmentPars(segment);
96 
97  const Amg::Vector3D globDir = segment.direction();
98 
99 
100  Acts::BoundVector boundPars{};
101  boundPars[Acts::eBoundLoc0] = locSegPars[toUnderlying(ParamDefs::x0)];
102  boundPars[Acts::eBoundLoc1] = locSegPars[toUnderlying(ParamDefs::y0)];
103  boundPars[Acts::eBoundPhi] = globDir.phi();
104  boundPars[Acts::eBoundTheta] = globDir.theta();
105  boundPars[Acts::eBoundQOverP] = straightQoverP;
106  boundPars[Acts::eBoundTime] = ActsTrk::timeToActs(segment.position().mag() / Gaudi::Units::c_light +
107  segment.t0());
108 
109  return Acts::BoundTrackParameters{surface.getSharedPtr(), std::move(boundPars),
110  cov, hypot};
111  }

◆ dcStatus()

Muon::MdtDriftCircleStatus MuonR4::SegmentFit::dcStatus ( const SpacePoint dc)
inline

Definition at line 25 of file MdtSegmentSeedGenerator.cxx.

25  {
26  const xAOD::UncalibratedMeasurement* prd = dc.primaryMeasurement();
28  return static_cast<const xAOD::MdtDriftCircle*>(prd)->status();
29  }
31  }

◆ firstGoodHit()

bool MuonR4::SegmentFit::firstGoodHit ( const HitVec hits,
std::size_t &  hitIdx 
)
inline

Find the first good hit in a layer.

Parameters
hitsList of hits in a particular tube layer
hitIdxIndex of the current hit inside this list

Definition at line 47 of file MdtSegmentSeedGenerator.cxx.

47  {
48  hitIdx = 0;
49  return isGoodDC(*hits[hitIdx]) || moveToNextHit(hits, hitIdx);
50  }

◆ isGoodDC()

bool MuonR4::SegmentFit::isGoodDC ( const SpacePoint dc)
inline

Returns whether the Mdt measurement has a valid space point.

Definition at line 33 of file MdtSegmentSeedGenerator.cxx.

33  {
35  }

◆ localSegmentPars() [1/2]

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 50 of file SegmentFitterEventData.cxx.

51  {
52  Parameters pars{};
53  const Amg::Transform3D globToLoc = segment.msSector()->globalToLocalTrans(gctx);
54  const Amg::Vector3D locPos = globToLoc * segment.position();
55  const Amg::Vector3D locDir = globToLoc.linear() * segment.direction();
56  pars[toUnderlying(ParamDefs::x0)] = locPos.x();
57  pars[toUnderlying(ParamDefs::y0)] = locPos.y();
58  pars[toUnderlying(ParamDefs::theta)] = locDir.theta();
59  pars[toUnderlying(ParamDefs::phi)] = locDir.phi();
60  pars[toUnderlying(ParamDefs::t0)] = segment.segementT0();
61  return pars;
62  }

◆ localSegmentPars() [2/2]

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

Returns the localSegPars decoration from a xAODMuon::Segment.

Definition at line 42 of file SegmentFitterEventData.cxx.

42  {
43  static const SG::Accessor<xAOD::MeasVector<toUnderlying(ParamDefs::nPars)>> acc{"localSegPars"};
44  Parameters segPars{};
45  for (std::size_t p =0 ; p < segPars.size(); ++p) {
46  segPars[p] = acc(seg)[p];
47  }
48  return segPars;
49  }

◆ 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 64 of file SegmentFitterEventData.cxx.

64  {
65  std::stringstream sstr{};
66  sstr<<std::format("x_{{0}}={:.2f}", pars[toUnderlying(ParamDefs::x0)])<<", ";
67  sstr<<std::format("y_{{0}}={:.2f}", pars[toUnderlying(ParamDefs::y0)])<<", ";
68  sstr<<std::format("#theta={:.2f}^{{#circ}}", pars[toUnderlying(ParamDefs::theta)] / Gaudi::Units::deg )<<", ";
69  sstr<<std::format("#phi={:.2f}^{{#circ}}", pars[toUnderlying(ParamDefs::phi)] / Gaudi::Units::deg)<<", ";
70  sstr<<std::format("t_{{0}}={:.1f}", pars[toUnderlying(ParamDefs::t0)]);
71  return sstr.str();
72  }

◆ 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 35 of file SegmentFitterEventData.cxx.

35  {
36  using enum ParamDefs;
37  return std::make_pair(Amg::Vector3D(pars[toUnderlying(x0)],
38  pars[toUnderlying(y0)],0.),
39  Amg::dirFromAngles(pars[toUnderlying(phi)],
40  pars[toUnderlying(theta)]));
41  }

◆ moveToNextHit()

bool MuonR4::SegmentFit::moveToNextHit ( const HitVec hits,
std::size_t &  hitIdx 
)
inline

Move to the next space point with valid drift radius.

Parameters
hitsList of hits in a particular tube layer
hitIdxIndex of the current hit inside this list

Definition at line 39 of file MdtSegmentSeedGenerator.cxx.

39  {
40  while(++hitIdx < hits.size() && !isGoodDC(*hits[hitIdx])) {
41  }
42  return hitIdx < hits.size() && isGoodDC(*hits[hitIdx]);
43  }

◆ toString() [1/2]

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

Returns the parameter label.

Parameters
parParameter of interest

Definition at line 82 of file SegmentFitterEventData.cxx.

82  {
83  return SeedingAux::parName(a);
84  }

◆ 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 73 of file SegmentFitterEventData.cxx.

73  {
74  std::stringstream sstr{};
75  sstr<< std::format("{}={:.2f}, ",toString(ParamDefs::x0), pars[toUnderlying(ParamDefs::x0)]);
76  sstr<< std::format("{}={:.2f}, ",toString(ParamDefs::y0), pars[toUnderlying(ParamDefs::y0)]);
77  sstr<< std::format("{}={:.2f}, ",toString(ParamDefs::theta), pars[toUnderlying(ParamDefs::theta)]/Gaudi::Units::deg);
78  sstr<< std::format("{}={:.2f}, ",toString(ParamDefs::phi), pars[toUnderlying(ParamDefs::phi)]/Gaudi::Units::deg);
79  sstr<< std::format("{}={:.2f}",toString(ParamDefs::t0), pars[toUnderlying(ParamDefs::t0)]);
80  return sstr.str();
81  }

Variable Documentation

◆ covIdx

constexpr auto MuonR4::SegmentFit::covIdx = Acts::toUnderlying(AxisDefs::etaCov)
constexpr

Definition at line 22 of file MdtSegmentSeedGenerator.cxx.

make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
xAOD::MuonSegment_v1::direction
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
Definition: MuonSegment_v1.cxx:18
vtune_athena.format
format
Definition: vtune_athena.py:14
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:200
deg
#define deg
Definition: SbPolyhedron.cxx:17
Muon::MdtStatusDriftTime
@ MdtStatusDriftTime
The tube produced a vaild measurement.
Definition: MdtDriftCircleStatus.h:34
xAOD::MuonSegment_v1::t0
float t0() const
ActsTrk::timeToActs
constexpr double timeToActs(const double athenaT)
Converts a time unit from Athena to Acts units.
Definition: UnitConverters.h:49
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
xAOD::UncalibratedMeasurement_v1
Definition: UncalibratedMeasurement_v1.h:13
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
xAOD::UncalibratedMeasurement_v1::type
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonR4::SegmentFit::Parameters
Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t Parameters
Definition: MuonHoughDefs.h:46
beamspotnt.parName
list parName
Definition: bin/beamspotnt.py:1286
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
MuonGMR4::SpectrometerSector::surface
const Acts::PlaneSurface & surface() const
Returns the associated surface.
Definition: SpectrometerSector.cxx:72
xAOD::MeasVector
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
Definition: MeasurementDefs.h:53
MuonR4::SegmentFit::isGoodDC
bool isGoodDC(const SpacePoint &dc)
Returns whether the Mdt measurement has a valid space point.
Definition: MdtSegmentSeedGenerator.cxx:33
xAOD::MuonSegment_v1::position
Amg::Vector3D position() const
Returns the position as Amg::Vector.
Definition: MuonSegment_v1.cxx:15
MuonR4::SegmentFit::dcStatus
Muon::MdtDriftCircleStatus dcStatus(const SpacePoint &dc)
Definition: MdtSegmentSeedGenerator.cxx:25
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:73
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.copyTCTOutput.locDir
locDir
Definition: copyTCTOutput.py:110
Amg::dirFromAngles
Amg::Vector3D dirFromAngles(const double phi, const double theta)
Constructs a direction vector from the azimuthal & polar angles.
Definition: GeoPrimitivesHelpers.h:299
MuonR4::SegmentFit::moveToNextHit
bool moveToNextHit(const HitVec &hits, std::size_t &hitIdx)
Move to the next space point with valid drift radius.
Definition: MdtSegmentSeedGenerator.cxx:39
a
TList * a
Definition: liststreamerinfos.cxx:10
xAOD::MuonSegment_v1::sector
int sector() const
xAOD::MuonSegment_v1::etaIndex
int etaIndex() const
Returns the eta index, which corresponds to stationEta in the offline identifiers (and the ).
Muon::MdtStatusUnDefined
@ MdtStatusUnDefined
Undefined.
Definition: MdtDriftCircleStatus.h:43
MuonR4::SegmentFit::localSegmentPars
Parameters localSegmentPars(const xAOD::MuonSegment &seg)
Returns the localSegPars decoration from a xAODMuon::Segment.
Definition: SegmentFitterEventData.cxx:42
merge.status
status
Definition: merge.py:16
Pmt::ParamDefs
ParamDefs
This file defines the parameter enums in the Trk namespace.
Definition: PoorMansIpAugmenterAlg.cxx:26
xAOD::MdtDriftCircle_v1
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
Definition: MdtDriftCircle_v1.h:21
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
xAOD::MuonSegment_v1::chamberIndex
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
MuonGMR4::MuonDetectorManager::getSectorEnvelope
const SpectrometerSector * getSectorEnvelope(const Identifier &channelId) const
Retrieves the spectrometer envelope enclosing the channel's readout element.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx:198
ActsTrk::GeometryContext::context
Acts::GeometryContext context() const
Definition: GeometryContext.h:46