ATLAS Offline Software
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 
22 namespace 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};
62  double outlierRemovalCut{5.};
64  double recoveryPull{5.};
66  unsigned nPrecHitCut{3u};
68  unsigned nRecoveryLoops{10u};
69  };
71  struct Config : public Fitter_t::Config,
72  public ConfigSwitches {
74  static RangeArray defaultRanges();
76  Config() {
78  }
79 
80  };
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
MuonR4::SegmentFit::SegmentLineFitter::centerAlongWire
void centerAlongWire(Result_t &fitResult) const
Moves the segment to the average x0 position, if the segment does not contain any measurement.
Definition: SegmentLineFitter.cxx:535
MuonR4::SegmentFit::SegmentLineFitter::FitOpts_t
Fitter_t::FitOptions< HitVec_t, ISpacePointCalibrator > FitOpts_t
Abrivation of the fit options.
Definition: SegmentLineFitter.h:43
trigbs_pickEvents.ranges
ranges
Definition: trigbs_pickEvents.py:60
MuonR4::SegmentFit
Definition: MuonHoughDefs.h:34
MuonR4::SegmentFit::SegmentLineFitter::FitPars_t
Fitter_t::FitParameters FitPars_t
Abrivation of the fit parameters
Definition: SegmentLineFitter.h:39
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::nPrecHitCut
unsigned nPrecHitCut
Minimum number of precision hits.
Definition: SegmentLineFitter.h:66
IPatternVisualizationTool.h
MuonR4::SegmentFit::SegmentLineFitter::m_cfg
ConfigSwitches m_cfg
Configuration switches of the ATLAS fitter implementation.
Definition: SegmentLineFitter.h:108
MuonR4::SegmentFit::SegmentLineFitter::m_goodHitSel
Selector_t m_goodHitSel
Selector to identify the valid hits.
Definition: SegmentLineFitter.h:110
SegmentSeed.h
MuonR4::SegmentFit::Result_t
SegmentLineFitter::Result_t Result_t
Definition: SegmentLineFitter.cxx:33
MuonR4::SegmentFit::HitVec_t
SegmentLineFitter::HitVec_t HitVec_t
Definition: SegmentLineFitter.cxx:32
ISpacePointCalibrator.h
MuonR4::SegmentFit::SegmentLineFitter
The SegmentLineFitter is a standalone module to fit a straight line to calibrated muon space points.
Definition: SegmentLineFitter.h:28
MuonR4::SegmentFit::SegmentLineFitter::Config
Full configuration object.
Definition: SegmentLineFitter.h:72
MuonR4::SegmentFit::SegmentLineFitter::Fitter_t
Acts::Experimental::CompositeSpacePointLineFitter Fitter_t
Abrivation of the actual line fitter.
Definition: SegmentLineFitter.h:31
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
CalibratedSpacePoint.h
MuonR4::SegmentFit::SegmentLineFitter::removeOutliers
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.
Definition: SegmentLineFitter.cxx:227
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
GeoPrimitives.h
MuonR4::CalibratedSpacePoint::State
State
State flag to distinguish different space point states.
Definition: CalibratedSpacePoint.h:26
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::outlierRemovalCut
double outlierRemovalCut
Cut on the segment chi2 / nDoF to launch the outlier removal.
Definition: SegmentLineFitter.h:62
MuonR4::SegmentFit::SegmentLineFitter::eraseWrongHits
void eraseWrongHits(Result_t &candidate) const
Removes all hits from the segment which are obvious outliers.
Definition: SegmentLineFitter.cxx:282
MuonR4::SegmentFit::SegmentLineFitter::callLineFit
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.
Definition: SegmentLineFitter.cxx:114
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonR4::SegmentFit::SegmentLineFitter::cleanStripLayers
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...
Definition: SegmentLineFitter.cxx:304
MuonValR4::IPatternVisualizationTool
Helper tool to visualize a pattern recogntion incident or a certain stage of the segment fit.
Definition: IPatternVisualizationTool.h:26
MuonR4::SegmentFit::SegmentLineFitter::Config::defaultRanges
static RangeArray defaultRanges()
Function that returns a set of predefined ranges for testing.
Definition: SegmentLineFitter.cxx:96
MuonR4::SegmentFit::SegmentLineFitter::SegmentLineFitter
SegmentLineFitter(const std::string &name, Config &&config)
Standard constructor.
Definition: SegmentLineFitter.cxx:108
MuonR4::SegmentFit::Parameters
Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t Parameters
Definition: MuonHoughDefs.h:46
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
MuonR4::SegmentFit::SegmentLineFitter::Config::Config
Config()
Standard constructor.
Definition: SegmentLineFitter.h:76
MuonR4::SegmentFit::SegmentLineFitter::plugHoles
bool plugHoles(const Acts::CalibrationContext &cctx, const SegmentSeed &seed, const Amg::Transform3D &localToGlobal, Result_t &toRecover) const
Recovery of missed hits.
Definition: SegmentLineFitter.cxx:363
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::calibrator
const ISpacePointCalibrator * calibrator
Pointer to the calibrator.
Definition: SegmentLineFitter.h:51
Config
Definition: dumpNPs.cxx:47
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches
Configuration object of the ATLAS implementation.
Definition: SegmentLineFitter.h:49
MuonR4::SegmentFit::SegmentLineFitter::Selector_t
Fitter_t::Selector_t< CalibratedSpacePoint > Selector_t
Abrivation of the hit selector to choose valid hits.
Definition: SegmentLineFitter.h:45
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::doBeamSpot
bool doBeamSpot
Switch to insert a beamspot constraint if possible.
Definition: SegmentLineFitter.h:57
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
MuonR4::ISpacePointCalibrator
Interface class to refine the space point calibration with an external seed.
Definition: ISpacePointCalibrator.h:33
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonR4::SegmentFit::SegmentLineFitter::convertToSegment
std::unique_ptr< Segment > convertToSegment(const Amg::Transform3D &locToGlobTrf, const SegmentSeed *parentSeed, Result_t &&toConvert) const
Converts the fit result into a segment object.
Definition: SegmentLineFitter.cxx:195
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc
Pointer to the idHelperSvc.
Definition: SegmentLineFitter.h:55
MuonR4::SegmentFit::SegmentLineFitter::m_fitter
Fitter_t m_fitter
Actual implementation of the straight line fit
Definition: SegmentLineFitter.h:106
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::beamSpotLength
double beamSpotLength
Definition: SegmentLineFitter.h:60
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::nRecoveryLoops
unsigned nRecoveryLoops
Maximum trials to recover outliers.
Definition: SegmentLineFitter.h:68
MuonR4::SegmentSeed
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Definition: SegmentSeed.h:14
AthMessaging.h
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::beamSpotRadius
double beamSpotRadius
Parameters of the beamspot measurement.
Definition: SegmentLineFitter.h:59
MuonR4::SegmentFit::SegmentLineFitter::Result_t
Fitter_t::FitResult< HitVec_t > Result_t
Abrivation of the fit result.
Definition: SegmentLineFitter.h:41
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
Segment.h
MuonR4::SegmentFit::SegmentLineFitter::HitVec_t
std::vector< Hit_t > HitVec_t
Collection of space points.
Definition: SegmentLineFitter.h:37
MuonR4::SegmentFit::SegmentLineFitter::Hit_t
std::unique_ptr< CalibratedSpacePoint > Hit_t
Abrivation of the space point type to use.
Definition: SegmentLineFitter.h:35
MuonR4::SegmentFit::SegmentLineFitter::fitSegment
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.
Definition: SegmentLineFitter.cxx:163
MuonR4::SegmentFit::SegmentLineFitter::LinePar_t
Fitter_t::ParamVec_t LinePar_t
Abrivation of the fitted line parameters.
Definition: SegmentLineFitter.h:33
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::recoveryPull
double recoveryPull
Maximum pull on a measurement to add it back on the line.
Definition: SegmentLineFitter.h:64
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106
MuonR4::SegmentFit::SegmentLineFitter::ConfigSwitches::visionTool
const MuonValR4::IPatternVisualizationTool * visionTool
Pointer to the visualization tool.
Definition: SegmentLineFitter.h:53