ATLAS Offline Software
SegmentFittingAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 
23 
24 #include <set>
25 
26 
27 namespace MuonR4{
32  public:
34  virtual ~SegmentFittingAlg();
35  virtual StatusCode initialize() override;
36  virtual StatusCode execute(const EventContext& ctx) const override;
37 
39 
40  private:
44  template <class ContainerType> StatusCode retrieveContainer(const EventContext& ctx,
46  const ContainerType* & contToPush) const;
55  SegmentFitResult fitSegmentHits(const EventContext& ctx,
56  const ActsGeometryContext& gctx,
57  const Parameters& startPars,
58  SegmentFitResult::HitVec&& calibHits) const;
59 
60 
61  std::vector<std::unique_ptr<Segment>> fitSegmentSeed(const EventContext& ctx,
62  const ActsGeometryContext& gctx,
63  const SegmentSeed* seed) const;
69  bool removeOutliers(const EventContext& ctx,
70  const ActsGeometryContext& gctx,
71  const SegmentSeed& seed,
72  SegmentFitResult& fitResult) const;
73 
82  bool plugHoles(const EventContext& ctx,
83  const ActsGeometryContext& gctx,
84  const SegmentSeed& seed,
85  SegmentFitResult& toRecover) const;
89  void eraseWrongHits(SegmentFitResult& candidate) const;
95  static std::unique_ptr<Segment> convertToSegment(const Amg::Transform3D& locToGlobTrf,
96  const SegmentSeed* parentSeed,
97  SegmentFitResult&& toConvert);
98 
99  void resolveAmbiguities(const ActsGeometryContext& gctx,
100  std::vector<std::unique_ptr<Segment>>& segmentCandidates) const;
101 
103  SG::ReadHandleKey<SegmentSeedContainer> m_seedKey{this, "ReadKey", "MuonHoughStationSegmentSeeds"};
104  // write handle key for the output segment seeds
105  SG::WriteHandleKey<SegmentContainer> m_outSegments{this, "MuonSegmentContainer", "R4MuonSegments"};
106  // access to the ACTS geometry context
107  SG::ReadHandleKey<ActsGeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
109  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
111  ToolHandle<ISpacePointCalibrator> m_calibTool{this, "Calibrator", "" };
113  ToolHandle<MuonValR4::IPatternVisualizationTool> m_visionTool{this, "VisualizationTool", ""};
114 
115  Gaudi::Property<bool> m_doT0Fit{this, "fitSegmentT0", true};
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};
129  Gaudi::Property<bool> m_refineSeed{this, "SeedRefine", false};
131  Gaudi::Property<double> m_outlierRemovalCut{this, "OutlierRemoval", 5.};
132  Gaudi::Property<double> m_recoveryPull{this, "RecoveryPull", 5.};
133 
134  std::unique_ptr<SegmentAmbiSolver> m_ambiSolver{};
135 
136  };
137 }
138 
139 
140 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
MuonR4::SegmentFittingAlg::m_outlierRemovalCut
Gaudi::Property< double > m_outlierRemovalCut
Cut on the segment chi2 / nDoF to launch the outlier removal.
Definition: SegmentFittingAlg.h:131
MuonR4::SegmentFittingAlg::m_outSegments
SG::WriteHandleKey< SegmentContainer > m_outSegments
Definition: SegmentFittingAlg.h:105
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:246
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
MuonR4::SegmentFit::Parameters
AmgVector(toInt(ParamDefs::nPars)) Parameters
Definition: MuonHoughDefs.h:48
IPatternVisualizationTool.h
MuonR4::SegmentFittingAlg::m_recoveryPull
Gaudi::Property< double > m_recoveryPull
Definition: SegmentFittingAlg.h:132
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:142
MuonR4::SegmentFittingAlg::m_beamSpotR
Gaudi::Property< double > m_beamSpotR
Definition: SegmentFittingAlg.h:118
MuonR4::SegmentFittingAlg::initialize
virtual StatusCode initialize() override
Definition: SegmentFittingAlg.cxx:60
MuonR4::SegmentFittingAlg::HitVec
SegmentFitResult::HitVec HitVec
Definition: SegmentFittingAlg.h:38
MuonR4::SegmentFittingAlg::m_doT0Fit
Gaudi::Property< bool > m_doT0Fit
Definition: SegmentFittingAlg.h:115
ISpacePointCalibrator.h
SG::ReadHandleKey< ContainerType >
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:475
MuonR4::SegmentFitResult::HitVec
std::vector< HitType > HitVec
Definition: SegmentFitterEventData.h:53
MuonR4::SegmentFittingAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc.
Definition: SegmentFittingAlg.h:109
MuonSegmentContainer.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
MuonR4::SegmentFittingAlg::m_ambiSolver
std::unique_ptr< SegmentAmbiSolver > m_ambiSolver
Definition: SegmentFittingAlg.h:134
CalibratedSpacePoint.h
MuonR4::SegmentFittingAlg::m_calibTool
ToolHandle< ISpacePointCalibrator > m_calibTool
Handle to the space point calibrator.
Definition: SegmentFittingAlg.h:111
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:187
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
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:327
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:265
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::eraseWrongHits
void eraseWrongHits(SegmentFitResult &candidate) const
Removes all hits from the segment which are obvious outliers.
Definition: SegmentFittingAlg.cxx:455
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:103
MuonR4::SegmentFittingAlg::m_refineSeed
Gaudi::Property< bool > m_refineSeed
Toggle seed refit.
Definition: SegmentFittingAlg.h:129
MuonR4::SegmentFittingAlg::retrieveContainer
StatusCode retrieveContainer(const EventContext &ctx, const SG::ReadHandleKey< ContainerType > &key, const ContainerType *&contToPush) const
Helper method to fetch data from StoreGate.
Definition: SegmentFittingAlg.cxx:128
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_visionTool
ToolHandle< MuonValR4::IPatternVisualizationTool > m_visionTool
Pattern visualization tool.
Definition: SegmentFittingAlg.h:113
MuonR4::SegmentFitResult
Definition: SegmentFitterEventData.h:46
MuonR4::SegmentFittingAlg::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: SegmentFittingAlg.h:107
MuonR4::SegmentFittingAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: SegmentFittingAlg.cxx:71
ReadDecorHandleKeyArray.h
MuonR4::SegmentFittingAlg::~SegmentFittingAlg
virtual ~SegmentFittingAlg()
ServiceHandle< Muon::IMuonIdHelperSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37