ATLAS Offline Software
SegmentFittingAlg.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 MUONR4_MUONPATTERNRECOGNTIONALGS_SEGMENTFITTINGALG__H
5 #define MUONR4_MUONPATTERNRECOGNTIONALGS_SEGMENTFITTINGALG__H
6 
8 
12 
17 
19 
23 
24 #include <set>
25 
26 
27 namespace MuonR4{
32  public:
33  using AthReentrantAlgorithm::AthReentrantAlgorithm;
34  virtual ~SegmentFittingAlg();
35  virtual StatusCode initialize() override;
36  virtual StatusCode execute(const EventContext& ctx) const override;
37 
39 
40  private:
50  SegmentFitResult fitSegmentHits(const EventContext& ctx,
51  const ActsGeometryContext& gctx,
52  const Parameters& startPars,
53  SegmentFitResult::HitVec&& calibHits) const;
54 
55 
56  std::vector<std::unique_ptr<Segment>> fitSegmentSeed(const EventContext& ctx,
57  const ActsGeometryContext& gctx,
58  const SegmentSeed* seed) const;
64  bool removeOutliers(const EventContext& ctx,
65  const ActsGeometryContext& gctx,
66  const SegmentSeed& seed,
67  SegmentFitResult& fitResult) const;
68 
77  bool plugHoles(const EventContext& ctx,
78  const ActsGeometryContext& gctx,
79  const SegmentSeed& seed,
80  SegmentFitResult& toRecover) const;
84  void eraseWrongHits(SegmentFitResult& candidate) const;
90  static std::unique_ptr<Segment> convertToSegment(const Amg::Transform3D& locToGlobTrf,
91  const SegmentSeed* parentSeed,
92  SegmentFitResult&& toConvert);
93 
94  void resolveAmbiguities(const ActsGeometryContext& gctx,
95  std::vector<std::unique_ptr<Segment>>& segmentCandidates) const;
96 
98  SG::ReadHandleKey<SegmentSeedContainer> m_seedKey{this, "ReadKey", "MuonHoughStationSegmentSeeds"};
99  // write handle key for the output segment seeds
100  SG::WriteHandleKey<SegmentContainer> m_outSegments{this, "OutSegmentContainer", "R4MuonSegments"};
101  // access to the ACTS geometry context
102  SG::ReadHandleKey<ActsGeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
104  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
106  ToolHandle<ISpacePointCalibrator> m_calibTool{this, "Calibrator", "" };
108  ToolHandle<MuonValR4::IPatternVisualizationTool> m_visionTool{this, "VisualizationTool", ""};
109 
110  Gaudi::Property<bool> m_doT0Fit{this, "fitSegmentT0", true};
111  Gaudi::Property<bool> m_recalibInFit{this, "recalibInFit" , false};
113  Gaudi::Property<bool> m_tryPatternPars{this, "tryPatternPars", false};
115  Gaudi::Property<bool> m_hessianResidual{this, "useHessianResidual", false};
117  Gaudi::Property<bool> m_doBeamspotConstraint{this, "doBeamspotConstraint", false};
118  Gaudi::Property<double> m_beamSpotR{this, "BeamSpotRadius", 30.* Gaudi::Units::cm};
119  Gaudi::Property<double> m_beamSpotL{this, "BeamSpotLength", 20. * Gaudi::Units::m};
120 
121 
123  Gaudi::Property<double> m_seedHitChi2{this, "ResoSeedHitAssoc", 5. };
126  Gaudi::Property<bool> m_recalibSeed{this, "SeedRecalibrate", false};
128  Gaudi::Property<double> m_outlierRemovalCut{this, "OutlierRemoval", 5.};
129  Gaudi::Property<double> m_recoveryPull{this, "RecoveryPull", 5.};
131  Gaudi::Property<unsigned> m_precHitCut{this, "PrecHitCut" , 3};
133  Gaudi::Property<bool> m_useFastFitter{this, "useFastFitter", true};
134  std::unique_ptr<SegmentFit::SegmentAmbiSolver> m_ambiSolver{};
135 
136  };
137 }
138 
139 
140 #endif
MuonR4::SegmentFittingAlg::m_outlierRemovalCut
Gaudi::Property< double > m_outlierRemovalCut
Cut on the segment chi2 / nDoF to launch the outlier removal.
Definition: SegmentFittingAlg.h:128
MuonR4::SegmentFittingAlg::m_outSegments
SG::WriteHandleKey< SegmentContainer > m_outSegments
Definition: SegmentFittingAlg.h:100
MuonR4::SegmentFittingAlg::m_tryPatternPars
Gaudi::Property< bool > m_tryPatternPars
Try first to fit the pattern parameters. Then proceed with the straw line tangents.
Definition: SegmentFittingAlg.h:113
MuonR4::SegmentFittingAlg::convertToSegment
static std::unique_ptr< Segment > convertToSegment(const Amg::Transform3D &locToGlobTrf, const SegmentSeed *parentSeed, SegmentFitResult &&toConvert)
Converts the fit result into a segment object.
Definition: SegmentFittingAlg.cxx:228
IPatternVisualizationTool.h
MuonR4::SegmentFittingAlg::m_recoveryPull
Gaudi::Property< double > m_recoveryPull
Definition: SegmentFittingAlg.h:129
MuonR4::SegmentFittingAlg::m_beamSpotL
Gaudi::Property< double > m_beamSpotL
Definition: SegmentFittingAlg.h:119
MuonR4::SegmentFittingAlg::fitSegmentHits
SegmentFitResult fitSegmentHits(const EventContext &ctx, const ActsGeometryContext &gctx, const Parameters &startPars, SegmentFitResult::HitVec &&calibHits) const
Executes the segment fit with start parameters.
Definition: SegmentFittingAlg.cxx:123
MuonR4::SegmentFittingAlg::m_beamSpotR
Gaudi::Property< double > m_beamSpotR
Definition: SegmentFittingAlg.h:118
MuonR4::SegmentFittingAlg::initialize
virtual StatusCode initialize() override
Definition: SegmentFittingAlg.cxx:53
MuonR4::SegmentFittingAlg::HitVec
SegmentFitResult::HitVec HitVec
Definition: SegmentFittingAlg.h:38
MuonR4::SegmentFittingAlg::m_doT0Fit
Gaudi::Property< bool > m_doT0Fit
Definition: SegmentFittingAlg.h:110
ISpacePointCalibrator.h
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
MuonR4::SegmentFittingAlg::m_ambiSolver
std::unique_ptr< SegmentFit::SegmentAmbiSolver > m_ambiSolver
Definition: SegmentFittingAlg.h:134
MuonR4::SegmentFittingAlg::Parameters
SegmentFit::Parameters Parameters
Definition: SegmentFittingAlg.h:41
MuonR4::SegmentFittingAlg::resolveAmbiguities
void resolveAmbiguities(const ActsGeometryContext &gctx, std::vector< std::unique_ptr< Segment >> &segmentCandidates) const
Definition: SegmentFittingAlg.cxx:457
MuonR4::SegmentFitResult::HitVec
std::vector< HitType > HitVec
Definition: SegmentFitterEventData.h:53
MuonR4::SegmentFittingAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc.
Definition: SegmentFittingAlg.h:104
MuonSegmentContainer.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
MuonR4::SegmentFittingAlg::m_recalibInFit
Gaudi::Property< bool > m_recalibInFit
Definition: SegmentFittingAlg.h:111
CalibratedSpacePoint.h
MuonR4::SegmentFittingAlg::m_calibTool
ToolHandle< ISpacePointCalibrator > m_calibTool
Handle to the space point calibrator.
Definition: SegmentFittingAlg.h:106
MuonR4::SegmentFittingAlg::m_precHitCut
Gaudi::Property< unsigned > m_precHitCut
Minimum number of precision hits to accept the segment.
Definition: SegmentFittingAlg.h:131
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
MuonR4::SegmentFittingAlg::fitSegmentSeed
std::vector< std::unique_ptr< Segment > > fitSegmentSeed(const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed *seed) const
Definition: SegmentFittingAlg.cxx:168
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
MuonR4::SegmentFittingAlg::plugHoles
bool plugHoles(const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &toRecover) const
Recovery of missed hits.
Definition: SegmentFittingAlg.cxx:311
MuonR4::SegmentFittingAlg::m_seedHitChi2
Gaudi::Property< double > m_seedHitChi2
Two mdt seeds are the same if their defining parameters match wihin.
Definition: SegmentFittingAlg.h:123
MuonR4::SegmentFittingAlg::removeOutliers
bool removeOutliers(const EventContext &ctx, const ActsGeometryContext &gctx, const SegmentSeed &seed, SegmentFitResult &fitResult) const
Spot hits with large discrepancy from the estimated parameters and remove them from the list.
Definition: SegmentFittingAlg.cxx:247
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonPatternContainer.h
UncalibratedMeasurementContainer.h
MuonR4::SegmentFittingAlg::m_hessianResidual
Gaudi::Property< bool > m_hessianResidual
Use the expliciit Hessian in the residual calculation.
Definition: SegmentFittingAlg.h:115
MuonR4::SegmentFittingAlg::eraseWrongHits
void eraseWrongHits(SegmentFitResult &candidate) const
Removes all hits from the segment which are obvious outliers.
Definition: SegmentFittingAlg.cxx:437
MuonR4::SegmentFittingAlg::m_recalibSeed
Gaudi::Property< bool > m_recalibSeed
Toggle seed recalibration.
Definition: SegmentFittingAlg.h:126
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
AthReentrantAlgorithm.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
MuonHoughDefs.h
MuonR4::SegmentFittingAlg::m_doBeamspotConstraint
Gaudi::Property< bool > m_doBeamspotConstraint
Add beamline constraint.
Definition: SegmentFittingAlg.h:117
MuonR4::SegmentFittingAlg::m_seedKey
SG::ReadHandleKey< SegmentSeedContainer > m_seedKey
ReadHandle of the seeds.
Definition: SegmentFittingAlg.h:98
MuonR4::SegmentFittingAlg
Algorithm to handle segment fits
Definition: SegmentFittingAlg.h:31
SegmentAmbiSolver.h
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
SegmentFitterEventData.h
MuonR4::SegmentSeed
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Definition: SegmentSeed.h:14
MuonR4::SegmentFittingAlg::m_useFastFitter
Gaudi::Property< bool > m_useFastFitter
Use the fast Mdt fitter where possible.
Definition: SegmentFittingAlg.h:133
MuonR4::SegmentFittingAlg::m_visionTool
ToolHandle< MuonValR4::IPatternVisualizationTool > m_visionTool
Pattern visualization tool.
Definition: SegmentFittingAlg.h:108
MuonR4::SegmentFitResult
Definition: SegmentFitterEventData.h:46
MuonR4::SegmentFittingAlg::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: SegmentFittingAlg.h:102
MuonR4::SegmentFit::Parameters
AmgVector(Acts::toUnderlying(ParamDefs::nPars)) Parameters
Definition: MuonHoughDefs.h:45
MuonR4::SegmentFittingAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: SegmentFittingAlg.cxx:64
ReadDecorHandleKeyArray.h
MuonR4::SegmentFittingAlg::~SegmentFittingAlg
virtual ~SegmentFittingAlg()
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106
ServiceHandle< Muon::IMuonIdHelperSvc >