ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::FastReco::GlobalPatternFinder::HitPayload Struct Reference

Base class for hit struct containing hit information. More...

#include <GlobalPatternFinderDefs.h>

Collaboration diagram for MuonR4::FastReco::GlobalPatternFinder::HitPayload:

Public Member Functions

 HitPayload (const Acts::GeometryContext &gctx, const SpacePoint *sp, const SpacePointBucket *bucket, const Amg::Transform3D &localToGlobal)
 Constructor with parameters.
Amg::Vector3D sensorDir (const Acts::GeometryContext &gctx) const
 Sensor direction.
double residualVariance (const Acts::GeometryContext &gctx, const Amg::Vector3D &contractionVector, const bool isProjected) const
 Hit contribution contribution to the residual variance due to its intrinsic position uncertainty.
bool operator== (const HitPayload &other) const
 Equal operator: it compares the underlying hit.
const SpacePointoperator-> () const
 Arrow operator: it allows to access the underlying hit.
const SpacePointoperator* () const
 Dereference operator: it allows to access the underlying hit.

Public Attributes

Amg::Vector3D position {Amg::Vector3D::Zero()}
 Global position.
const SpacePointspacePoint {nullptr}
 Pointer to the underlying hit.
const SpacePointBucketbucket {nullptr}
 Pointer to the parent bucket.
double phiCov {0.}
 Cached angular covariance [rad^2] of the hit in the phi angle.
double stripAngle {0.}
 Strip angle when the strips are non-orthogonal.
StIndex station {toStationIndex(spacePoint->msSector()->chamberIndex())}
 Station index.
uint8_t locLayer {static_cast<uint8_t>(s_spSorter.sectorLayerNum(*spacePoint))}
 Layer number in the sector frame.
bool isPrecision {isPrecisionHit(*spacePoint)}
 Is precision hit.
bool nonOrthogonalStrips {false}
 Are the strips non-orthogonal.

Detailed Description

Base class for hit struct containing hit information.

Definition at line 19 of file GlobalPatternFinderDefs.h.

Constructor & Destructor Documentation

◆ HitPayload()

MuonR4::FastReco::GlobalPatternFinder::HitPayload::HitPayload ( const Acts::GeometryContext & gctx,
const SpacePoint * sp,
const SpacePointBucket * bucket,
const Amg::Transform3D & localToGlobal )
explicit

Constructor with parameters.

Parameters
spThe space point
bucketThe space point bucket
localToGlobalThe transformation from local to global coordinates
locLayerThe layer number in the sector frame
stationThe station index

Helper method to compute the contribution of a 1D measurement to the residual variance

Definition at line 32 of file GlobalPatternFinderDefs.cxx.

36 : position{localToGlobal * sp->localPosition()},
38
39 using CovIdx = SpacePoint::CovIdx;
40
41 if (!sp->measuresEta()) {
42 // Phi-only measurements
43 const Amg::Vector3D phiMeasDir {localToGlobal.rotation() * sp->toNextSensor()};
44
45 phiCov = sp->covariance()[Acts::toUnderlying(CovIdx::phiCov)] *
46 Acts::square(phiMeasDir.dot(phiGradient(position)));
47 return;
48 }
49 const auto& surfLinearTrf = xAOD::muonSurface(sp->primaryMeasurement()).localToGlobalTransform(gctx).linear();
50
51 if (sp->isStraw()) {
52 // Remember that for straw hits, the x component of secondaryMeasDir is repurposed
53 // to store the transverse covariance of the drift radius
54 double& discCov = stripAngle;
55 discCov = Acts::square(sp->driftRadius()) +
56 sp->covariance()[Acts::toUnderlying(CovIdx::etaCov)];
57
58 if (sp->measuresPhi()) {
59 phiCov = discCov / Acts::square(position.perp()) +
60 Acts::square(sensorDir(gctx).dot(phiGradient(position))) *
61 (sp->covariance()[Acts::toUnderlying(CovIdx::phiCov)] - discCov);
62 }
63 } else if (sp->measuresPhi()) {
64 const Amg::Vector3D phiMeasDir = surfLinearTrf.col(Amg::y);
65 const Amg::Vector3D gradPhi {phiGradient(position)};
67 auto oneDimContribution = [&](CovIdx idx, const Amg::Vector3D& measDir) -> double {
68 return sp->covariance()[Acts::toUnderlying(idx)] *
69 Acts::square(measDir.dot(gradPhi));
70 };
71
72 // Handle the case of TGC separately
74 const Amg::Vector3D etaMeasDir = localToGlobal.rotation() * sp->toNextSensor();
75 const Amg::Vector3D phiSensorDir = surfLinearTrf.col(Amg::x);
76
77 const double c {etaMeasDir.dot(phiMeasDir)};
78 if (std::abs(c) > Acts::s_epsilon) {
79 stripAngle = std::atan2(etaMeasDir.dot(phiSensorDir), c);
81 }
82 phiCov = oneDimContribution(CovIdx::etaCov, etaMeasDir) +
83 oneDimContribution(CovIdx::phiCov, phiMeasDir);
84 } else {
85 const Amg::Vector3D etaMeasDir = surfLinearTrf.col(Amg::x);
86 phiCov = oneDimContribution(CovIdx::etaCov, etaMeasDir) +
87 oneDimContribution(CovIdx::phiCov, phiMeasDir);
88 }
89 }
90 }
static Double_t sp
Eigen::Matrix< double, 3, 1 > Vector3D
dot(G, fn, nodesToHighlight=[])
Definition dot.py:5
const Acts::Surface & muonSurface(const UncalibratedMeasurement *meas)
Returns the associated Acts surface to the measurement.
double phiCov
Cached angular covariance [rad^2] of the hit in the phi angle.
const SpacePoint * spacePoint
Pointer to the underlying hit.
const SpacePointBucket * bucket
Pointer to the parent bucket.
Amg::Vector3D sensorDir(const Acts::GeometryContext &gctx) const
Sensor direction.
double stripAngle
Strip angle when the strips are non-orthogonal.

Member Function Documentation

◆ operator*()

const SpacePoint & MuonR4::FastReco::GlobalPatternFinder::HitPayload::operator* ( ) const
inline

Dereference operator: it allows to access the underlying hit.

Definition at line 65 of file GlobalPatternFinderDefs.h.

65{ return *spacePoint; }

◆ operator->()

const SpacePoint * MuonR4::FastReco::GlobalPatternFinder::HitPayload::operator-> ( ) const
inline

Arrow operator: it allows to access the underlying hit.

Definition at line 63 of file GlobalPatternFinderDefs.h.

63{ return spacePoint; }

◆ operator==()

bool MuonR4::FastReco::GlobalPatternFinder::HitPayload::operator== ( const HitPayload & other) const

Equal operator: it compares the underlying hit.

Definition at line 148 of file GlobalPatternFinderDefs.cxx.

148 {
149 return spacePoint == other.spacePoint;
150 }

◆ residualVariance()

double MuonR4::FastReco::GlobalPatternFinder::HitPayload::residualVariance ( const Acts::GeometryContext & gctx,
const Amg::Vector3D & contractionVector,
const bool isProjected ) const

Hit contribution contribution to the residual variance due to its intrinsic position uncertainty.

Parameters
contractionVectorThe contraction vector to compute the residual variance
isProjectedWhether the hit has been projected
Returns
Residual variance contribution

If the hit is not projected, the contraction vector is the residual direction

If the hit is projected, the contraction vector is J^T * residualDirection, where J is the Jacobian of the projection. The phi measurement if available is cancelled by the projection.

Helper method to compute the contribution of a 1D measurement to the residual variance

Definition at line 106 of file GlobalPatternFinderDefs.cxx.

108 {
109 using CovIdx = SpacePoint::CovIdx;
110
112 assert(isProjected || std::abs(contractionVector.mag() - 1.0) < Acts::s_epsilon);
113
114 if (spacePoint->isStraw()) {
115 const double discCov {stripAngle};
116 if (!isProjected) {
117 assert(sp->measuresPhi());
118 const double vDotRsq {Acts::square(sensorDir(gctx).dot(contractionVector))};
119 return discCov * (1 - vDotRsq) +
120 vDotRsq * spacePoint->covariance()[Acts::toUnderlying(CovIdx::phiCov)];
121 }
125 return discCov * contractionVector.mag2();
126
127 } else if (spacePoint->measuresEta()) {
128 const auto& surfLinearTrf = xAOD::muonSurface(spacePoint->primaryMeasurement()).localToGlobalTransform(gctx).linear();
130 auto oneDimContribution = [&](CovIdx idx, const Amg::Vector3D& measDir) -> double {
131 return spacePoint->covariance()[Acts::toUnderlying(idx)] *
132 Acts::square(measDir.dot(contractionVector));
133 };
134 if (spacePoint->measuresPhi()) {
135 const Amg::Vector3D etaMeasDir {nonOrthogonalStrips
136 ? sensorDir(gctx).cross(surfLinearTrf.col(Amg::z))
137 : surfLinearTrf.col(Amg::x)};
138 const Amg::Vector3D phiMeasDir {surfLinearTrf.col(Amg::y)};
139 return oneDimContribution(CovIdx::etaCov, etaMeasDir) +
140 oneDimContribution(CovIdx::phiCov, phiMeasDir);
141 }
142 const Amg::Vector3D etaMeasDir {surfLinearTrf.col(Amg::x)};
143 return oneDimContribution(CovIdx::etaCov, etaMeasDir);
144 } else {
145 throw std::runtime_error("Phi only hits are not meant to be used for residual computation.");
146 }
147 }

◆ sensorDir()

Amg::Vector3D MuonR4::FastReco::GlobalPatternFinder::HitPayload::sensorDir ( const Acts::GeometryContext & gctx) const

Sensor direction.

Definition at line 91 of file GlobalPatternFinderDefs.cxx.

91 {
92 const auto& surfLinearTrf =
93 xAOD::muonSurface(spacePoint->primaryMeasurement()).localToGlobalTransform(gctx).linear();
94
95 if (spacePoint->isStraw()) {
96 return surfLinearTrf.col(Amg::z);
97 } else {
99 return - std::sin(stripAngle) * surfLinearTrf.col(Amg::y)
100 + std::cos(stripAngle) * surfLinearTrf.col(Amg::x);
101 }
102 return surfLinearTrf.col(Amg::y);
103 }
104 }

Member Data Documentation

◆ bucket

const SpacePointBucket* MuonR4::FastReco::GlobalPatternFinder::HitPayload::bucket {nullptr}

Pointer to the parent bucket.

Definition at line 47 of file GlobalPatternFinderDefs.h.

47{nullptr};

◆ isPrecision

bool MuonR4::FastReco::GlobalPatternFinder::HitPayload::isPrecision {isPrecisionHit(*spacePoint)}

Is precision hit.

Definition at line 57 of file GlobalPatternFinderDefs.h.

bool isPrecisionHit(const SpacePoint &hit)
Returns whether the uncalibrated spacepoint is a precision hit (Mdt, micromegas, stgc strips).

◆ locLayer

uint8_t MuonR4::FastReco::GlobalPatternFinder::HitPayload::locLayer {static_cast<uint8_t>(s_spSorter.sectorLayerNum(*spacePoint))}

Layer number in the sector frame.

Definition at line 55 of file GlobalPatternFinderDefs.h.

unsigned int sectorLayerNum(const SpacePoint &sp) const
method returning the logic layer number
static const SpacePointPerLayerSorter s_spSorter

◆ nonOrthogonalStrips

bool MuonR4::FastReco::GlobalPatternFinder::HitPayload::nonOrthogonalStrips {false}

Are the strips non-orthogonal.

Definition at line 59 of file GlobalPatternFinderDefs.h.

59{false};

◆ phiCov

double MuonR4::FastReco::GlobalPatternFinder::HitPayload::phiCov {0.}

Cached angular covariance [rad^2] of the hit in the phi angle.

Definition at line 49 of file GlobalPatternFinderDefs.h.

49{0.};

◆ position

Amg::Vector3D MuonR4::FastReco::GlobalPatternFinder::HitPayload::position {Amg::Vector3D::Zero()}

Global position.

Definition at line 43 of file GlobalPatternFinderDefs.h.

43{Amg::Vector3D::Zero()};

◆ spacePoint

const SpacePoint* MuonR4::FastReco::GlobalPatternFinder::HitPayload::spacePoint {nullptr}

Pointer to the underlying hit.

Definition at line 45 of file GlobalPatternFinderDefs.h.

45{nullptr};

◆ station

StIndex MuonR4::FastReco::GlobalPatternFinder::HitPayload::station {toStationIndex(spacePoint->msSector()->chamberIndex())}

Station index.

Definition at line 53 of file GlobalPatternFinderDefs.h.

53{toStationIndex(spacePoint->msSector()->chamberIndex())};
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex

◆ stripAngle

double MuonR4::FastReco::GlobalPatternFinder::HitPayload::stripAngle {0.}

Strip angle when the strips are non-orthogonal.

Definition at line 51 of file GlobalPatternFinderDefs.h.

51{0.};

The documentation for this struct was generated from the following files: