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;
91  void eraseWrongHits(const ActsGeometryContext& gctx, SegmentFitResult& candidate) const;
97  static std::unique_ptr<Segment> convertToSegment(const Amg::Transform3D& locToGlobTrf,
98  const SegmentSeed* parentSeed,
99  SegmentFitResult&& toConvert);
100 
101  void resolveAmbiguities(const ActsGeometryContext& gctx,
102  std::vector<std::unique_ptr<Segment>>& segmentCandidates) const;
103 
105  SG::ReadHandleKey<SegmentSeedContainer> m_seedKey{this, "ReadKey", "MuonHoughStationSegmentSeeds"};
106  // write handle key for the output segment seeds
107  SG::WriteHandleKey<SegmentContainer> m_outSegments{this, "MuonSegmentContainer", "R4MuonSegments"};
108  // access to the ACTS geometry context
109  SG::ReadHandleKey<ActsGeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
111  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
113  ToolHandle<ISpacePointCalibrator> m_calibTool{this, "Calibrator", "" };
115  ToolHandle<MuonValR4::IPatternVisualizationTool> m_visionTool{this, "VisualizationTool", ""};
116 
118  Gaudi::Property<bool> m_useMinuit{this, "useMinuit", false};
119 
120  Gaudi::Property<bool> m_doT0Fit{this, "fitSegmentT0", true};
122  Gaudi::Property<bool> m_doBeamspotConstraint{this, "doBeamspotConstraint", false};
123  Gaudi::Property<double> m_beamSpotR{this, "BeamSpotRadius", 30.* Gaudi::Units::cm};
124  Gaudi::Property<double> m_beamSpotL{this, "BeamSpotLength", 20. * Gaudi::Units::m};
125 
126 
128  Gaudi::Property<double> m_seedHitChi2{this, "ResoSeedHitAssoc", 5. };
131  Gaudi::Property<bool> m_recalibSeed{this, "SeedRecalibrate", false};
134  Gaudi::Property<bool> m_refineSeed{this, "SeedRefine", false};
136  Gaudi::Property<double> m_outlierRemovalCut{this, "OutlierRemoval", 5.};
137  Gaudi::Property<double> m_recoveryPull{this, "RecoveryPull", 5.};
138 
139  std::unique_ptr<SegmentAmbiSolver> m_ambiSolver{};
140 
141  };
142 }
143 
144 
145 #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:136
MuonR4::SegmentFittingAlg::m_outSegments
SG::WriteHandleKey< SegmentContainer > m_outSegments
Definition: SegmentFittingAlg.h:107
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:325
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:137
MuonR4::SegmentFittingAlg::m_beamSpotL
Gaudi::Property< double > m_beamSpotL
Definition: SegmentFittingAlg.h:124
MuonR4::SegmentFittingAlg::eraseWrongHits
void eraseWrongHits(const ActsGeometryContext &gctx, SegmentFitResult &candidate) const
Removes all hits from the segment which are obvious outliers.
Definition: SegmentFittingAlg.cxx:529
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:145
MuonR4::SegmentFittingAlg::m_useMinuit
Gaudi::Property< bool > m_useMinuit
Toggle the fitter.
Definition: SegmentFittingAlg.h:118
MuonR4::SegmentFittingAlg::m_beamSpotR
Gaudi::Property< double > m_beamSpotR
Definition: SegmentFittingAlg.h:123
MuonR4::SegmentFittingAlg::initialize
virtual StatusCode initialize() override
Definition: SegmentFittingAlg.cxx:63
MuonR4::SegmentFittingAlg::HitVec
SegmentFitResult::HitVec HitVec
Definition: SegmentFittingAlg.h:38
MuonR4::SegmentFittingAlg::m_doT0Fit
Gaudi::Property< bool > m_doT0Fit
Definition: SegmentFittingAlg.h:120
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:558
MuonR4::SegmentFitResult::HitVec
std::vector< HitType > HitVec
Definition: SegmentFitterEventData.h:57
MuonR4::SegmentFittingAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc.
Definition: SegmentFittingAlg.h:111
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:139
CalibratedSpacePoint.h
MuonR4::SegmentFittingAlg::m_calibTool
ToolHandle< ISpacePointCalibrator > m_calibTool
Handle to the space point calibrator.
Definition: SegmentFittingAlg.h:113
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:268
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:409
MuonR4::SegmentFittingAlg::m_seedHitChi2
Gaudi::Property< double > m_seedHitChi2
Two mdt seeds are the same if their defining parameters match wihin.
Definition: SegmentFittingAlg.h:128
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:348
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_recalibSeed
Gaudi::Property< bool > m_recalibSeed
Toggle seed recalibration.
Definition: SegmentFittingAlg.h:131
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:122
MuonR4::SegmentFittingAlg::m_seedKey
SG::ReadHandleKey< SegmentSeedContainer > m_seedKey
ReadHandle of the seeds.
Definition: SegmentFittingAlg.h:105
MuonR4::SegmentFittingAlg::m_refineSeed
Gaudi::Property< bool > m_refineSeed
Toggle seed refit.
Definition: SegmentFittingAlg.h:134
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:131
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:115
MuonR4::SegmentFitResult
Definition: SegmentFitterEventData.h:50
MuonR4::SegmentFittingAlg::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: SegmentFittingAlg.h:109
MuonR4::SegmentFittingAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: SegmentFittingAlg.cxx:74
ReadDecorHandleKeyArray.h
MuonR4::SegmentFittingAlg::~SegmentFittingAlg
virtual ~SegmentFittingAlg()
ServiceHandle< Muon::IMuonIdHelperSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37