4#ifndef MUONR4_MUONFASTRECOALGS_MUONFASTSEGMENTFITTINGALG__H
5#define MUONR4_MUONFASTRECOALGS_MUONFASTSEGMENTFITTINGALG__H
32 using AthReentrantAlgorithm::AthReentrantAlgorithm;
36 virtual StatusCode
execute(
const EventContext& ctx)
const override;
47 using Seed_t = std::unique_ptr<SegmentSeed>;
69 std::vector<SegmentSeedPair_t>
processPattern(
const EventContext& ctx,
127 const std::optional<Beamspot>& beamspot = std::nullopt)
const;
165 ToolHandle<ISpacePointCalibrator>
m_calibTool{
this,
"Calibrator",
"" };
169 ToolHandle<MuonValR4::IPatternVisualizationTool>
m_segVisionTool{
this,
"VisualizationTool",
""};
197 UnsignedIntegerProperty
m_maxIter{
this,
"maxIterations", 50};
Property holding a SG store/key/clid from which a WriteHandle is made.
An algorithm that can be simultaneously executed in multiple threads.
Data class to represent an eta maximum in hough space.
Algorithm handling fast segment fitting starting from global patterns.
std::unique_ptr< LineFitter > m_fitter
Pointer to the actual segment fitter.
BooleanProperty m_fastPreFitter
The fast fitter is treated as a pre fitter.
SG::WriteHandleKey< xAOD::MuonSegmentContainer > m_outSegments
Write handle key for the output segments.
BooleanProperty m_useFastFitter
Use the fast Mdt fitter where possible.
Muon::MuonStationIndex::StIndex StIndex
Type alias for the station index.
SegmentFit::Parameters Parameters
Type alias for the segment fitting parameters.
MuonR4::SegmentFit::SegmentLineFitter LineFitter
Type alias for the line fitter.
std::vector< Hit_t > HitVec_t
virtual StatusCode initialize() override
const SpacePointBucket * Bucket_t
Type alias for the bucket type.
virtual ~MuonFastSegmentFittingAlg()=default
const Segment * findSegmentToAddPhi(std::vector< SegmentSeedPair_t > &segs) const
Find the segment to which increase the phi measurement count.
CoordPlane
Define the coordinate planes.
BooleanProperty m_recalibInFit
Toggle the recalibration of hits during the segment fit.
DoubleProperty m_outlierRemovalCut
Cut on the segment chi2 / nDoF to launch the outlier removal.
DoubleProperty m_recoveryPull
Pull value for hit recovery.
Acts::SquareMatrix< 3 > m_beamspotCov
Covariance matrix of the beam spot.
DoubleProperty m_seedHitChi2
Two mdt seeds are the same if their defining parameters match wihin.
MuonR4::SegmentFit::MdtSegmentSeedGenerator MdtSegmentSeeder
Type alias for the L-R segment seeder.
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainer > DecorKey_t
Abrivation of the extra declared auxVariables.
std::unique_ptr< LineFitter > m_nswFitter
Pointer to the NSW segment fitter.
std::pair< HitVec_t, std::optional< Line2D_t > > RegressionRes_t
Type alias for the result of the linear regression, consisting of the valid hits and line parameters.
std::pair< Seed_t, Segment_t > SegmentSeedPair_t
Struct to hold the segment and the seed for the needed lifetime.
SG::ReadHandleKey< GlobalPatternContainer > m_inPatterns
Write handle key for the output global patterns.
BooleanProperty m_ignoreFailedPreFit
Switch to try the full fit when the fast pre-fitter fails.
BooleanProperty m_beamSpotLength
Beam spot length.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Handle to the MuonIdHelper service.
virtual StatusCode execute(const EventContext &ctx) const override
ToolHandle< ISpacePointCalibrator > m_calibTool
Handle to the space point calibrator tool.
SG::WriteHandleKey< xAOD::CombinedMuonStripContainer > m_combMeasKey
Auxiliary container to model two measurements in the same gas gap as a single track state.
std::unique_ptr< Segment > Segment_t
Type alias for the segment type.
std::pair< HitVec_t, Parameters > initializePars(const Amg::Transform3D &localToGlobal, const HitVec_t &hits) const
Estimate the initial parameters for the segment fitting.
UnsignedIntegerProperty m_precHitCut
Minimum number of precision hits to accept the segment.
std::unique_ptr< SegmentSeed > Seed_t
Type alias for the segment seed type.
DecorKey_t m_prdStateKey
Decoration to the PrdLink state (I.e.
DecorKey_t m_localSegCovKey
Decoration of the local fit covariance parameters.
friend std::ostream & operator<<(std::ostream &os, CoordPlane plane)
const SpacePoint * Hit_t
Type alias for the hit type & associated vector.
BooleanProperty m_beamSpotRadius
Beam spot radius.
DecorKey_t m_patternKey
Parent global pattern decoration of the segments.
BooleanProperty m_recalibSeed
Toggle seed recalibration.
ParamDefs2D
Define the line parameters.
@ slope
Tangent of the angle, defined as dy/dz or dx/dz according to the plane.
@ nParams
Number of parameters.
@ intercept
Intercept at z=0 (i.e.
ToolHandle< MuonValR4::IPatternVisualizationTool > m_segVisionTool
Handle to the visualization tool for segments.
std::optional< SegmentSeedPair_t > SegmentSeedOpt_t
Type alias for the segment-seed optional.
UnsignedIntegerProperty m_maxIter
Tune the number of iterations.
SpacePointPerLayerSorter m_spSorter
Spacepoint sorter per logical measurement layer.
double beamspotCov(const CoordPlane Plane, const Amg::Transform3D &localToGlobal) const
Helper method to compute the beamspot covariance in one local coordinate.
std::array< double, Acts::toUnderlying(ParamDefs2D::nParams)> Line2D_t
Type alias for the line representation.
BooleanProperty m_hessianResidual
Use the expliciit Hessian in the residual calculation.
DecorKey_t m_prdLinkKey
Decoration to the links to the associated Uncalibrated measurements.
ActsTrk::GeoContextReadKey_t m_geoCtxKey
Geometry context key.
std::vector< SegmentSeedPair_t > processPattern(const EventContext &ctx, const ActsTrk::GeometryContext &gctx, const GlobalPattern &pattern) const
Main methods steering the segment fitting.
std::unique_ptr< MdtSegmentSeeder > m_mdtSeeder
Pointer to the L-R segment seeder.
SegmentSeedOpt_t fitSegment(const EventContext &ctx, const Amg::Transform3D &localToGlobal, Bucket_t parentBucket, HitVec_t &&hits) const
Fit a segment in a station given the hits & their parent bucket.
DecorKey_t m_localSegParKey
Decoration of the local segment parameters.
DoubleProperty m_goodSegmentCut
Reduced chi2 defining a good segment, stopping the fit of other segments in the same station.
ToolHandle< IxAODSegmentCnvTool > m_segmentCnvTool
Segment converter tool.
RegressionRes_t linearRegression(const CoordPlane Plane, const HitVec_t &hits, const std::optional< Beamspot > &beamspot=std::nullopt) const
Estimate the segment parameters in the plane defined by the CoordPlane template parameter using a wei...
UnsignedIntegerProperty m_goodSegmentDoF
Number of degrees of freedom defining a good segment, stopping the fit of other segments in the same ...
Helper class to generate valid seeds for the segment fit.
The SegmentLineFitter is a standalone module to fit a straight line to calibrated muon space points.
Placeholder for what will later be the muon segment EDM representation.
: The muon space point bucket represents a collection of points that will bre processed together in t...
The SpacePointPerLayerSorter sort two given space points by their layer Identifier.
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
SG::ReadHandleKey< GeometryContext > GeoContextReadKey_t
Abrivate the ReadHandleKey to declare the data dependency on the Geometry context.
Eigen::Affine3d Transform3D
Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t Parameters
This header ties the generic definitions in this package.
StIndex
enum to classify the different station layers in the muon spectrometer
double coord
Coordinate of the beamspot in the selected plane, either y or x depending on the plane.
double cov_coordCoord
Variance of the beamspot coordinate in the selected plane.
double z
z-coordinate of the beamspot