ATLAS Offline Software
Loading...
Searching...
No Matches
SegmentLineFitter.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONPATTERNHELPERS_MDTSEGMENTFITTER_H
5#define MUONPATTERNHELPERS_MDTSEGMENTFITTER_H
6
10
14
15
18
19
20#include <Acts/Seeding/CompositeSpacePointLineFitter.hpp>
21
22namespace MuonR4::SegmentFit {
29 public:
31 using Fitter_t = Acts::Experimental::CompositeSpacePointLineFitter;
33 using LinePar_t = Fitter_t::ParamVec_t;
35 using Hit_t = std::unique_ptr<CalibratedSpacePoint>;
37 using HitVec_t = std::vector<Hit_t>;
39 using FitPars_t = Fitter_t::FitParameters;
41 using Result_t = Fitter_t::FitResult<HitVec_t>;
43 using FitOpts_t = Fitter_t::FitOptions<HitVec_t, ISpacePointCalibrator>;
45 using Selector_t = Fitter_t::Selector_t<CalibratedSpacePoint>;
57 bool doBeamSpot{true};
59 double beamSpotRadius{30.*Gaudi::Units::cm};
60 double beamSpotLength{2.*Gaudi::Units::m};
64 double recoveryPull{5.};
66 unsigned nPrecHitCut{3u};
68 unsigned nRecoveryLoops{10u};
69 };
70
71 struct Config : public Fitter_t::Config,
72 public ConfigSwitches {
74 static RangeArray defaultRanges();
77 ranges = defaultRanges();
78 }
79
80 };
81
84 SegmentLineFitter(const std::string& name,
85 Config&& config);
86
98 std::unique_ptr<Segment> fitSegment(const EventContext& ctx,
99 const SegmentSeed* parent,
100 const LinePar_t& startPars,
101 const Amg::Transform3D& localToGlobal,
102 HitVec_t&& calibHits) const;
103
104 private:
113 void centerAlongWire(Result_t& fitResult) const;
121 Result_t callLineFit(const Acts::CalibrationContext& cctx,
122 const Parameters& startPars,
123 const Amg::Transform3D& localToGlobal,
124 HitVec_t&& calibHits) const;
137 bool removeOutliers(const Acts::CalibrationContext& cctx,
138 const SegmentSeed& seed,
139 const Amg::Transform3D& localToGlobal,
140 Result_t& fitResult) const;
153 bool plugHoles(const Acts::CalibrationContext& cctx,
154 const SegmentSeed& seed,
155 const Amg::Transform3D& localToGlobal,
156 Result_t& toRecover) const;
160 void eraseWrongHits(Result_t& candidate) const;
168 void cleanStripLayers(const Amg::Vector3D& linePos,
169 const Amg::Vector3D& lineDir,
170 HitVec_t& hits) const;
176 std::unique_ptr<Segment> convertToSegment(const Amg::Transform3D& locToGlobTrf,
177 const SegmentSeed* parentSeed,
178 Result_t&& toConvert) const;
179
180 };
181}
182
183
184#endif
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
State
State flag to distinguish different space point states.
Interface class to refine the space point calibration with an external seed.
void centerAlongWire(Result_t &fitResult) const
Moves the segment to the average x0 position, if the segment does not contain any measurement.
bool plugHoles(const Acts::CalibrationContext &cctx, const SegmentSeed &seed, const Amg::Transform3D &localToGlobal, Result_t &toRecover) const
Recovery of missed hits.
std::unique_ptr< CalibratedSpacePoint > Hit_t
Abrivation of the space point type to use.
Fitter_t::Selector_t< CalibratedSpacePoint > Selector_t
Abrivation of the hit selector to choose valid hits.
void cleanStripLayers(const Amg::Vector3D &linePos, const Amg::Vector3D &lineDir, HitVec_t &hits) const
Marks duplicate hits on a strip layer as outliers to avoid competing contributions from the same laye...
Selector_t m_goodHitSel
Selector to identify the valid hits.
Result_t callLineFit(const Acts::CalibrationContext &cctx, const Parameters &startPars, const Amg::Transform3D &localToGlobal, HitVec_t &&calibHits) const
Calls the underlying line fitter to determine the segment parameters.
ConfigSwitches m_cfg
Configuration switches of the ATLAS fitter implementation.
Fitter_t::FitResult< HitVec_t > Result_t
Abrivation of the fit result.
bool removeOutliers(const Acts::CalibrationContext &cctx, const SegmentSeed &seed, const Amg::Transform3D &localToGlobal, Result_t &fitResult) const
Cleans the fitted segment from the most outlier hit and then attempts to refit the segment.
void eraseWrongHits(Result_t &candidate) const
Removes all hits from the segment which are obvious outliers.
CalibratedSpacePoint::State HitState
Abrivation of the fit state flag.
std::unique_ptr< Segment > convertToSegment(const Amg::Transform3D &locToGlobTrf, const SegmentSeed *parentSeed, Result_t &&toConvert) const
Converts the fit result into a segment object.
Fitter_t::FitOptions< HitVec_t, ISpacePointCalibrator > FitOpts_t
Abrivation of the fit options.
Fitter_t::FitParameters FitPars_t
Abrivation of the fit parameters.
std::unique_ptr< Segment > fitSegment(const EventContext &ctx, const SegmentSeed *parent, const LinePar_t &startPars, const Amg::Transform3D &localToGlobal, HitVec_t &&calibHits) const
Fit a set of measurements to a straight segment line.
Fitter_t m_fitter
Actual implementation of the straight line fit.
Fitter_t::ParamVec_t LinePar_t
Abrivation of the fitted line parameters.
std::vector< Hit_t > HitVec_t
Collection of space points.
SegmentLineFitter(const std::string &name, Config &&config)
Standard constructor.
Acts::Experimental::CompositeSpacePointLineFitter Fitter_t
Abrivation of the actual line fitter.
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Definition SegmentSeed.h:14
Helper tool to visualize a pattern recogntion incident or a certain stage of the segment fit.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
SegmentLineFitter::Result_t Result_t
SegmentLineFitter::HitVec_t HitVec_t
Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t Parameters
Configuration object of the ATLAS implementation.
const ISpacePointCalibrator * calibrator
Pointer to the calibrator.
bool doBeamSpot
Switch to insert a beamspot constraint if possible.
const Muon::IMuonIdHelperSvc * idHelperSvc
Pointer to the idHelperSvc.
unsigned nPrecHitCut
Minimum number of precision hits.
unsigned nRecoveryLoops
Maximum trials to recover outliers.
double outlierRemovalCut
Cut on the segment chi2 / nDoF to launch the outlier removal.
const MuonValR4::IPatternVisualizationTool * visionTool
Pointer to the visualization tool.
double recoveryPull
Maximum pull on a measurement to add it back on the line.
double beamSpotRadius
Parameters of the beamspot measurement.
static RangeArray defaultRanges()
Function that returns a set of predefined ranges for testing.