ATLAS Offline Software
GaussianSumFitterTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ACTSTRACKRECONSTRUCTION_GAUSSIANSUMFITTERTOOL_H
6 #define ACTSTRACKRECONSTRUCTION_GAUSSIANSUMFITTERTOOL_H
7 
8 // ATHENA
10 #include "GaudiKernel/ToolHandle.h"
14 
15 // ACTS
16 #include "Acts/EventData/VectorMultiTrajectory.hpp"
17 #include "Acts/Geometry/GeometryContext.hpp"
18 #include "Acts/Utilities/Result.hpp"
19 #include "Acts/TrackFitting/GaussianSumFitter.hpp"
20 #include "Acts/Propagator/Propagator.hpp"
21 #include "Acts/Propagator/MultiEigenStepperLoop.hpp"
22 #include "Acts/Propagator/Navigator.hpp"
23 #include "Acts/TrackFitting/BetheHeitlerApprox.hpp"
24 #include "Acts/TrackFitting/GsfOptions.hpp"
25 #include "Acts/Utilities/Logger.hpp"
26 
27 // PACKAGE
35 
36 // STL
37 #include <string>
38 #include <memory>
39 
40 
41 
42 namespace ActsTrk {
43 
45  : public extends<AthAlgTool, Trk::ITrackFitter> {
46 public:
47 
48  GaussianSumFitterTool(const std::string&, const std::string&, const IInterface*);
49  virtual ~GaussianSumFitterTool() = default;
50 
51  // standard Athena methods
52  virtual StatusCode initialize() override;
53 
55  virtual std::unique_ptr<Trk::Track> fit(
56  const EventContext& ctx,
57  const Trk::Track&,
58  const Trk::RunOutlierRemoval runOutlier = false,
59  const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override;
60 
62  virtual std::unique_ptr<Trk::Track> fit(
63  const EventContext& ctx,
64  const Trk::PrepRawDataSet&,
65  const Trk::TrackParameters&,
66  const Trk::RunOutlierRemoval runOutlier = false,
67  const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override;
68 
70  virtual std::unique_ptr<Trk::Track> fit(
71  const EventContext& ctx,
72  const Trk::MeasurementSet&,
73  const Trk::TrackParameters&,
74  const Trk::RunOutlierRemoval runOutlier = false,
75  const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override;
76 
78  virtual std::unique_ptr<Trk::Track> fit(
79  const EventContext& ctx,
80  const Trk::Track&,
81  const Trk::PrepRawDataSet&,
82  const Trk::RunOutlierRemoval runOutlier = false,
83  const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override;
84 
86  virtual std::unique_ptr<Trk::Track> fit(
87  const EventContext& ctx,
88  const Trk::Track&,
89  const Trk::MeasurementSet&,
90  const Trk::RunOutlierRemoval runOutlier = false,
91  const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override;
92 
94  virtual std::unique_ptr<Trk::Track> fit(
95  const EventContext& ctx,
96  const Trk::Track& intrk1,
97  const Trk::Track& intrk2,
98  const Trk::RunOutlierRemoval runOutlier = false,
99  const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override;
100 
101 
103  // Private methods:
105 private:
106  Acts::GsfOptions<ActsTrk::MutableTrackStateBackend> prepareOptions(const Acts::GeometryContext& tgContext,
107  const Acts::MagneticFieldContext& mfContext,
108  const Acts::CalibrationContext& calContext,
109  const Acts::PerigeeSurface& surface) const;
110 
111  std::unique_ptr<Trk::Track> performFit(const EventContext& ctx,
112  const Acts::GeometryContext& tgContext,
113  const Acts::GsfOptions<ActsTrk::MutableTrackStateBackend>& gsfOptions,
114  const std::vector<Acts::SourceLink>& trackSourceLinks,
115  const Acts::BoundTrackParameters& initialParams) const;
116 
117  std::unique_ptr<Trk::Track> performDirectFit(const EventContext& ctx,
118  const Acts::GeometryContext& tgContext,
119  const Acts::GsfOptions<ActsTrk::MutableTrackStateBackend>& gsfOptions,
120  const std::vector<Acts::SourceLink>& trackSourceLinks,
121  const Acts::BoundTrackParameters& initialParams,
122  const std::vector<const Acts::Surface*>& surfaces) const;
123 
124  // Create a track from the fitter result
125  std::unique_ptr<Trk::Track> makeTrack(const EventContext& ctx,
126  const Acts::GeometryContext& tgContext,
128  Acts::Result<typename ActsTrk::MutableTrackContainer::TrackProxy, std::error_code>& fitResult) const;
129 
130  const Acts::GsfExtensions<ActsTrk::MutableTrackStateBackend>& getExtensions() const;
131 
133  const Acts::Logger& logger() const;
134 
135  private:
136  ToolHandle<IActsExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool", ""};
137  ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", ""};
138  ToolHandle<ActsTrk::IActsToTrkConverterTool> m_ATLASConverterTool{this, "ATLASConverterTool", ""};
139  ToolHandle<Trk::IExtendedTrackSummaryTool> m_trkSummaryTool {this, "SummaryTool", "", "ToolHandle for track summary tool"};
140  ToolHandle<Trk::IBoundaryCheckTool> m_boundaryCheckTool {this,
141  "BoundaryCheckTool",
142  "",
143  "Boundary checking tool for detector sensitivities"};
144 
145  // the settable job options
146  Gaudi::Property< double > m_option_outlierChi2Cut {this, "OutlierChi2Cut", 12.5,
147  "Chi2 cut used by the outlier finder" };
148  Gaudi::Property< int > m_option_maxPropagationStep {this, "MaxPropagationStep", 5000,
149  "Maximum number of steps for one propagate call"};
150 
151  Gaudi::Property< int > m_maxComponents {this, "MaxComponents", 12,
152  "Maximum number of components in GSF"};
153 
154  Gaudi::Property<bool> m_useDirectNavigation{this, "UseDirectNavigation", false,
155  "GSF with direct navigation when refitting measurements"};
156 
157  Gaudi::Property<bool> m_refitOnly{this, "RefitOnly", false,
158  "Do refit only. Track summary will not be added"};
159 
160  Gaudi::Property< double > m_weightCutOff {this, "WeightCutOff", 1.e-4,
161  "component weight cut off"};
162 
163  Gaudi::Property<std::string> m_option_componentMergeMethod{this, "ComponentMergeMethod", "eMaxWeight"
164  , "method to merge components {eMean, eMaxWeight}"};
165 
166  Acts::ComponentMergeMethod m_componentMergeMethod;
167 
169  using Fitter = Acts::GaussianSumFitter< Acts::Propagator<Acts::MultiEigenStepperLoop<>, Acts::Navigator>,
170  Acts::AtlasBetheHeitlerApprox<6, 5>,
172 
173  std::unique_ptr<ActsTrk::detail::TrkMeasurementCalibrator> m_calibrator {nullptr};
174  std::unique_ptr<Fitter> m_fitter {nullptr};
175 
176  using DirectFitter = Acts::GaussianSumFitter< Acts::Propagator<Acts::MultiEigenStepperLoop<>, Acts::DirectNavigator>,
177  Acts::AtlasBetheHeitlerApprox<6, 5>,
179  std::unique_ptr<DirectFitter> m_directFitter {nullptr};
180 
181 
183  Acts::GsfExtensions<ActsTrk::MutableTrackStateBackend> m_gsfExtensions;
184 
186 
188  std::unique_ptr<const Acts::Logger> m_logger {nullptr};
189 
190 }; // end of namespace
191 
192 }
193 
194 #endif
195 
Trk::PrepRawDataSet
std::vector< const PrepRawData * > PrepRawDataSet
vector of clusters and drift circles
Definition: FitterTypes.h:26
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
ActsTrk::GaussianSumFitterTool::prepareOptions
Acts::GsfOptions< ActsTrk::MutableTrackStateBackend > prepareOptions(const Acts::GeometryContext &tgContext, const Acts::MagneticFieldContext &mfContext, const Acts::CalibrationContext &calContext, const Acts::PerigeeSurface &surface) const
Definition: GaussianSumFitterTool.cxx:564
ActsTrk::GaussianSumFitterTool::m_trkSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
Definition: GaussianSumFitterTool.h:139
ActsTrk::GaussianSumFitterTool::~GaussianSumFitterTool
virtual ~GaussianSumFitterTool()=default
ActsTrk::detail::Navigator
Acts::Navigator Navigator
Definition: Tracking/Acts/ActsTrackReconstruction/src/detail/Definitions.h:31
ActsTrk::GaussianSumFitterTool::m_trackingGeometryTool
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
Definition: GaussianSumFitterTool.h:137
ActsTrk::GaussianSumFitterTool::initialize
virtual StatusCode initialize() override
Definition: GaussianSumFitterTool.cxx:53
ActsTrk::GaussianSumFitterTool::m_componentMergeMethod
Acts::ComponentMergeMethod m_componentMergeMethod
Definition: GaussianSumFitterTool.h:166
ActsTrk::GaussianSumFitterTool::performFit
std::unique_ptr< Trk::Track > performFit(const EventContext &ctx, const Acts::GeometryContext &tgContext, const Acts::GsfOptions< ActsTrk::MutableTrackStateBackend > &gsfOptions, const std::vector< Acts::SourceLink > &trackSourceLinks, const Acts::BoundTrackParameters &initialParams) const
Definition: GaussianSumFitterToolFullFit.cxx:20
ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder
Outlier finder using a Chi2 cut.
Definition: FitterHelperFunctions.h:49
ActsTrk::GaussianSumFitterTool::GaussianSumFitterTool
GaussianSumFitterTool(const std::string &, const std::string &, const IInterface *)
Definition: GaussianSumFitterTool.cxx:47
Trk::RunOutlierRemoval
bool RunOutlierRemoval
switch to toggle quality processing after fit
Definition: FitterTypes.h:22
ActsTrk::GaussianSumFitterTool::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition: GaussianSumFitterTool.h:188
ActsTrk::GaussianSumFitterTool::m_maxComponents
Gaudi::Property< int > m_maxComponents
Definition: GaussianSumFitterTool.h:151
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
ActsTrk::MutableMultiTrajectory
Athena implementation of ACTS::MultiTrajectory (ReadWrite version) The data is stored in 4 external b...
Definition: MultiTrajectory.h:81
ActsTrk::GaussianSumFitterTool::m_boundaryCheckTool
ToolHandle< Trk::IBoundaryCheckTool > m_boundaryCheckTool
Definition: GaussianSumFitterTool.h:140
ActsTrk::GaussianSumFitterTool::performDirectFit
std::unique_ptr< Trk::Track > performDirectFit(const EventContext &ctx, const Acts::GeometryContext &tgContext, const Acts::GsfOptions< ActsTrk::MutableTrackStateBackend > &gsfOptions, const std::vector< Acts::SourceLink > &trackSourceLinks, const Acts::BoundTrackParameters &initialParams, const std::vector< const Acts::Surface * > &surfaces) const
Definition: GaussianSumFitterToolDirectFit.cxx:23
ActsTrk::GaussianSumFitterTool::m_option_componentMergeMethod
Gaudi::Property< std::string > m_option_componentMergeMethod
Definition: GaussianSumFitterTool.h:163
ActsTrk::GaussianSumFitterTool::logger
const Acts::Logger & logger() const
Private access to the logger.
Definition: GaussianSumFitterTool.cxx:558
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
ActsTrk::GaussianSumFitterTool::m_option_maxPropagationStep
Gaudi::Property< int > m_option_maxPropagationStep
Definition: GaussianSumFitterTool.h:148
ActsTrk::GaussianSumFitterTool::m_outlierFinder
ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder m_outlierFinder
Definition: GaussianSumFitterTool.h:185
Trk::ParametersBase
Definition: ParametersBase.h:55
ActsTrk::GaussianSumFitterTool::Fitter
Acts::GaussianSumFitter< Acts::Propagator< Acts::MultiEigenStepperLoop<>, Acts::Navigator >, Acts::AtlasBetheHeitlerApprox< 6, 5 >, ActsTrk::MutableTrackStateBackend > Fitter
Type erased track fitter function.
Definition: GaussianSumFitterTool.h:171
ActsTrk::GaussianSumFitterTool::m_surfaceAccessor
ATLASSourceLinkSurfaceAccessor m_surfaceAccessor
Definition: GaussianSumFitterTool.h:182
ActsTrk::GaussianSumFitterTool::m_gsfExtensions
Acts::GsfExtensions< ActsTrk::MutableTrackStateBackend > m_gsfExtensions
Definition: GaussianSumFitterTool.h:183
ActsTrk::GaussianSumFitterTool::m_useDirectNavigation
Gaudi::Property< bool > m_useDirectNavigation
Definition: GaussianSumFitterTool.h:154
ActsTrk::GaussianSumFitterTool::m_refitOnly
Gaudi::Property< bool > m_refitOnly
Definition: GaussianSumFitterTool.h:157
Trk::MeasurementSet
std::vector< const MeasurementBase * > MeasurementSet
vector of fittable measurements
Definition: FitterTypes.h:30
ActsTrk::GaussianSumFitterTool
Definition: GaussianSumFitterTool.h:45
ActsTrk::GaussianSumFitterTool::m_calibrator
std::unique_ptr< ActsTrk::detail::TrkMeasurementCalibrator > m_calibrator
Definition: GaussianSumFitterTool.h:173
Trk::nonInteracting
@ nonInteracting
Definition: ParticleHypothesis.h:25
ActsTrk::GaussianSumFitterTool::fit
virtual std::unique_ptr< Trk::Track > fit(const EventContext &ctx, const Trk::Track &, const Trk::RunOutlierRemoval runOutlier=false, const Trk::ParticleHypothesis matEffects=Trk::nonInteracting) const override
refit a track
Definition: GaussianSumFitterTool.cxx:122
ActsTrk::GaussianSumFitterTool::m_weightCutOff
Gaudi::Property< double > m_weightCutOff
Definition: GaussianSumFitterTool.h:160
ActsTrk::GaussianSumFitterTool::getExtensions
const Acts::GsfExtensions< ActsTrk::MutableTrackStateBackend > & getExtensions() const
Definition: GaussianSumFitterTool.cxx:551
ActsTrk::GaussianSumFitterTool::m_directFitter
std::unique_ptr< DirectFitter > m_directFitter
Definition: GaussianSumFitterTool.h:179
ActsTrk::ATLASSourceLinkSurfaceAccessor
Definition: ATLASSourceLinkSurfaceAccessor.h:20
FitterHelperFunctions.h
IExtendedTrackSummaryTool.h
ActsTrk::GaussianSumFitterTool::m_ATLASConverterTool
ToolHandle< ActsTrk::IActsToTrkConverterTool > m_ATLASConverterTool
Definition: GaussianSumFitterTool.h:138
IBoundaryCheckTool.h
TrkMeasurementCalibrator.h
ATLASSourceLinkSurfaceAccessor.h
IActsToTrkConverterTool.h
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
ActsTrk::GaussianSumFitterTool::m_fitter
std::unique_ptr< Fitter > m_fitter
Definition: GaussianSumFitterTool.h:174
ActsTrk::GaussianSumFitterTool::m_extrapolationTool
ToolHandle< IActsExtrapolationTool > m_extrapolationTool
Definition: GaussianSumFitterTool.h:136
ActsTrk::GaussianSumFitterTool::m_option_outlierChi2Cut
Gaudi::Property< double > m_option_outlierChi2Cut
Definition: GaussianSumFitterTool.h:146
ActsTrk::GaussianSumFitterTool::DirectFitter
Acts::GaussianSumFitter< Acts::Propagator< Acts::MultiEigenStepperLoop<>, Acts::DirectNavigator >, Acts::AtlasBetheHeitlerApprox< 6, 5 >, ActsTrk::MutableTrackStateBackend > DirectFitter
Definition: GaussianSumFitterTool.h:178
ActsTrk::GaussianSumFitterTool::makeTrack
std::unique_ptr< Trk::Track > makeTrack(const EventContext &ctx, const Acts::GeometryContext &tgContext, ActsTrk::MutableTrackContainer &tracks, Acts::Result< typename ActsTrk::MutableTrackContainer::TrackProxy, std::error_code > &fitResult) const
Definition: GaussianSumFitterTool.cxx:398
ActsTrk::MutableTrackContainer
Definition: TrackContainer.h:122
ITrackFitter.h
TrackContainer.h
IActsTrackingGeometryTool.h
IActsExtrapolationTool.h