ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::FitterTool Class Reference

#include <FitterTool.h>

Inheritance diagram for MuonR4::FitterTool:
Collaboration diagram for MuonR4::FitterTool:

Public Types

using StraightPropagator_t = Acts::Propagator<Acts::StraightLineStepper, Acts::Navigator>
 Abrivation for the straight line propagator.
using CurvedPropagator_t = Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>
 Abrivation for the curved standard propagator.
using StraightFitter_t = MuonExperimental::Gx2Fitter<StraightPropagator_t, ActsTrk::MutableTrackStateBackend>
 Abrivation of the fitter using the straight line propagator.
using CurvedFitter_t = MuonExperimental::Gx2Fitter<CurvedPropagator_t, ActsTrk::MutableTrackStateBackend>
 Abrivation of the fitter using the curved line propagator.
using Gx2FitterOptions_t = MuonExperimental::Gx2FitterOptions<ActsTrk::MutableTrackStateBackend>
 Abbrivation of the configuration to launch the fit.
using Gx2FitterExtension_t = MuonExperimental::Gx2FitterExtensions<ActsTrk::MutableTrackStateBackend>
 Abbrivation of the fitter extensions.

Public Member Functions

virtual StatusCode initialize () override final
virtual std::unique_ptr< ActsTrk::MutableTrackContainer > fit (const ActsTrk::Seed &seed, const Acts::BoundTrackParameters &initialParams, const Acts::GeometryContext &tgContext, const Acts::MagneticFieldContext &mfContext, const Acts::CalibrationContext &calContext, const Acts::Surface &targetSurface) const override final
 Tries to fit a short-line track from an initial ITk/ID seed made up out of three spacepoints.
virtual std::unique_ptr< ActsTrk::MutableTrackContainer > fit (const std::vector< const xAOD::UncalibratedMeasurement * > &measList, const Acts::BoundTrackParameters &initialParams, const Acts::GeometryContext &tgContext, const Acts::MagneticFieldContext &mfContext, const Acts::CalibrationContext &calContext, const Acts::Surface *targetSurface=nullptr) const override final
 Tries to fit a short-line track from an initial ITk/ID seed made up out of three spacepoints.
virtual std::unique_ptr< ActsTrk::MutableTrackContainer > fit (const std::vector< Acts::SourceLink > &sourceLinks, const Acts::BoundTrackParameters &initialParams, const Acts::GeometryContext &tgContext, const Acts::MagneticFieldContext &mfContext, const Acts::CalibrationContext &calContext, const Acts::Surface *targetSurface=nullptr) const override final
 Tries to fit a short-line track from an initial ITk/ID seed made up out of three spacepoints.
virtual StatusCode fit (const EventContext &ctx, const ActsTrk::TrackContainer::ConstTrackProxy &track, ActsTrk::MutableTrackContainer &trackContainer, const Acts::PerigeeSurface &pSurface) const override final
 Tries to fit a short-line track from an initial ITk/ID seed made up out of three spacepoints.

Private Types

using Fitter_t

Private Attributes

Gaudi::Property< bool > m_doStraightLineFit {this, "doStraightLine", false}
 Do the straight line fit.
Gaudi::Property< unsigned > m_doMaxSteps {this, "maxSteps", 1000000 }
 How ,many steps to go.
Gaudi::Property< unsigned > m_maxSurfaces {this, "maxSurfaces", 10000}
 How many surfaces to try.
Gaudi::Property< unsigned > m_maxIter {this, "nIterMax" , 250}
 How many iterations to use in the fit.
Gaudi::Property< bool > m_doEnergyLoss {this, "doEnergyLoss" , false}
 Do energy loss modelling in the fit.
Gaudi::Property< bool > m_doScattering {this, "doScattering" , false}
 Increase the nuissances by introducing scattering angles.
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
 Tracking geometry service.
ToolHandle< MuonR4::ISpacePointCalibrator > m_muonCalibrator {this, "MuonCalibrationTool", ""}
 Tool handle to calibrate the muon measurmeents.
ActsTrk::detail::xAODUncalibMeasSurfAcc m_unalibMeasSurfAcc {}
 Surface accessor delegate for xAOD::UncalibratedMeasurement objects.
ActsTrk::detail::xAODUncalibMeasCalibrator m_uncalibMeasCalibrator {}
 Calibrator for the uncalibrated xAOD::UnCalibratedMeasurement objects.
Gx2FitterExtension_t m_extensions {}
Fitter_t m_fitter {}

Detailed Description

Definition at line 34 of file FitterTool.h.

Member Typedef Documentation

◆ CurvedFitter_t

Abrivation of the fitter using the curved line propagator.

Definition at line 76 of file FitterTool.h.

◆ CurvedPropagator_t

using MuonR4::FitterTool::CurvedPropagator_t = Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>

Abrivation for the curved standard propagator.

Definition at line 72 of file FitterTool.h.

◆ Fitter_t

Initial value:
std::variant<std::monostate,
MuonExperimental::Gx2Fitter< StraightPropagator_t, ActsTrk::MutableTrackStateBackend > StraightFitter_t
Abrivation of the fitter using the straight line propagator.
Definition FitterTool.h:74
MuonExperimental::Gx2Fitter< CurvedPropagator_t, ActsTrk::MutableTrackStateBackend > CurvedFitter_t
Abrivation of the fitter using the curved line propagator.
Definition FitterTool.h:76

Definition at line 108 of file FitterTool.h.

◆ Gx2FitterExtension_t

◆ Gx2FitterOptions_t

Abbrivation of the configuration to launch the fit.

Definition at line 79 of file FitterTool.h.

◆ StraightFitter_t

Abrivation of the fitter using the straight line propagator.

Definition at line 74 of file FitterTool.h.

◆ StraightPropagator_t

using MuonR4::FitterTool::StraightPropagator_t = Acts::Propagator<Acts::StraightLineStepper, Acts::Navigator>

Abrivation for the straight line propagator.

Definition at line 70 of file FitterTool.h.

Member Function Documentation

◆ fit() [1/4]

std::unique_ptr< ActsTrk::MutableTrackContainer > MuonR4::FitterTool::fit ( const ActsTrk::Seed & seed,
const Acts::BoundTrackParameters & initialParams,
const Acts::GeometryContext & tgContext,
const Acts::MagneticFieldContext & mfContext,
const Acts::CalibrationContext & calContext,
const Acts::Surface & targetSurface ) const
finaloverridevirtual

Tries to fit a short-line track from an initial ITk/ID seed made up out of three spacepoints.

For a better fit convergence, this method also takes an external estimate of the track parameters

Parameters
seedReference to the riplet of ITk/ID space points to fit.
initialParamsRough parameter estimate used to start the fit
tgContextGeometry context to fetch the aligned positions of each surface
mfContextReference to the magnetic field context having the ATLAS magnetic field wrapped
calContextReference to the CalibrationContext which is wrapping the pointer to the Gaudi-event context
Returns
: In case of fit-failure, a nullptr otherwise a unique_ptr to the fitted trajectories from the fit

Definition at line 50 of file FitterTool.cxx.

55 {
56 THROW_EXCEPTION("Method is not implemented");
57 return nullptr;
58 }
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ fit() [2/4]

StatusCode MuonR4::FitterTool::fit ( const EventContext & ctx,
const ActsTrk::TrackContainer::ConstTrackProxy & track,
ActsTrk::MutableTrackContainer & trackContainer,
const Acts::PerigeeSurface & pSurface ) const
finaloverridevirtual

Tries to fit a short-line track from an initial ITk/ID seed made up out of three spacepoints.

For a better fit convergence, this method also takes an external estimate of the track parameters

Parameters
seedReference to the riplet of ITk/ID space points to fit.
initialParamsRough parameter estimate used to start the fit
tgContextGeometry context to fetch the aligned positions of each surface
mfContextReference to the magnetic field context having the ATLAS magnetic field wrapped
calContextReference to the CalibrationContext which is wrapping the pointer to the Gaudi-event context
Returns
: In case of fit-failure, a nullptr otherwise a unique_ptr to the fitted trajectories from the fit

Definition at line 42 of file FitterTool.cxx.

45 {
46 ATH_MSG_ERROR(__func__<<"() "<<__LINE__<<" - The method is not implemented");
47 return StatusCode::FAILURE;
48 }
#define ATH_MSG_ERROR(x,...)

◆ fit() [3/4]

std::unique_ptr< ActsTrk::MutableTrackContainer > MuonR4::FitterTool::fit ( const std::vector< Acts::SourceLink > & sourceLinks,
const Acts::BoundTrackParameters & initialParams,
const Acts::GeometryContext & tgContext,
const Acts::MagneticFieldContext & mfContext,
const Acts::CalibrationContext & calContext,
const Acts::Surface * targetSurface = nullptr ) const
finaloverridevirtual

Tries to fit a short-line track from an initial ITk/ID seed made up out of three spacepoints.

For a better fit convergence, this method also takes an external estimate of the track parameters

Parameters
seedReference to the riplet of ITk/ID space points to fit.
initialParamsRough parameter estimate used to start the fit
tgContextGeometry context to fetch the aligned positions of each surface
mfContextReference to the magnetic field context having the ATLAS magnetic field wrapped
calContextReference to the CalibrationContext which is wrapping the pointer to the Gaudi-event context
Returns
: In case of fit-failure, a nullptr otherwise a unique_ptr to the fitted trajectories from the fit

Definition at line 75 of file FitterTool.cxx.

80 {
81
82 Acts::PropagatorPlainOptions propagationOption{tgContext, mfContext};
83 propagationOption.maxSteps = m_doMaxSteps;
84 propagationOption.maxTargetSkipping = m_maxSurfaces;
85
86 Gx2FitterOptions_t options{tgContext, mfContext, calContext,
87 m_extensions, std::move(propagationOption)};
88
89 options.doMultipleScattering = m_doScattering;
90 options.doEnergyLoss = m_doEnergyLoss;
91 options.nUpdateMax = m_maxIter;
92 auto tracks = std::make_unique<ActsTrk::MutableTrackContainer>(ActsTrk::MutableTrackBackend{},
94
95 bool ok{false};
96 std::visit([&](const auto& fitter) {
97 using Fitter_t = std::decay_t<decltype(fitter)>;
98 if constexpr(std::is_same_v<Fitter_t, std::monostate>) {
99 ATH_MSG_WARNING("The fitter is uninitalized. That should not happen");
100 } else {
101 ok = fitter.fit(sourceLinks.begin(), sourceLinks.end(),
102 initialParams, options, *tracks).ok();
103 }
104 }, m_fitter);
105 if (!ok) {
106 ATH_MSG_VERBOSE("Fit failed");
107 return nullptr;
108 }
110 for (auto trkProxy : *tracks) {
112 }
113 return tracks;
114 }
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
bool fit(const LArSamples::AbsShape &data, const AbsShape &reference, double &k, double &deltaT, double &chi2, const ScaledErrorData *sed=0) const
Gaudi::Property< bool > m_doEnergyLoss
Do energy loss modelling in the fit.
Definition FitterTool.h:92
Gaudi::Property< bool > m_doScattering
Increase the nuissances by introducing scattering angles.
Definition FitterTool.h:94
MuonExperimental::Gx2FitterOptions< ActsTrk::MutableTrackStateBackend > Gx2FitterOptions_t
Abbrivation of the configuration to launch the fit.
Definition FitterTool.h:79
Gx2FitterExtension_t m_extensions
Definition FitterTool.h:106
std::variant< std::monostate, StraightFitter_t, CurvedFitter_t > Fitter_t
Definition FitterTool.h:108
Gaudi::Property< unsigned > m_maxSurfaces
How many surfaces to try.
Definition FitterTool.h:88
Gaudi::Property< unsigned > m_doMaxSteps
How ,many steps to go.
Definition FitterTool.h:86
Gaudi::Property< unsigned > m_maxIter
How many iterations to use in the fit.
Definition FitterTool.h:90
Acts::VectorMultiTrajectory MutableTrackStateBackend
Acts::VectorTrackContainer MutableTrackBackend
const ShapeFitter * fitter
@ GlobalChi2Fitter
Track's from Thijs' global chi^2 fitter or the ACTS implementation.
static void addFitterTypeProperty(track_container_t &tracksContainer)
add fitter column to the track container
static void setFitterType(trackproxy_t &trackProxy, xAOD::TrackFitter fitterType)
set fitter type of a track

◆ fit() [4/4]

std::unique_ptr< ActsTrk::MutableTrackContainer > MuonR4::FitterTool::fit ( const std::vector< const xAOD::UncalibratedMeasurement * > & measList,
const Acts::BoundTrackParameters & initialParams,
const Acts::GeometryContext & tgContext,
const Acts::MagneticFieldContext & mfContext,
const Acts::CalibrationContext & calContext,
const Acts::Surface * targetSurface = nullptr ) const
finaloverridevirtual

Tries to fit a short-line track from an initial ITk/ID seed made up out of three spacepoints.

For a better fit convergence, this method also takes an external estimate of the track parameters

Parameters
seedReference to the riplet of ITk/ID space points to fit.
initialParamsRough parameter estimate used to start the fit
tgContextGeometry context to fetch the aligned positions of each surface
mfContextReference to the magnetic field context having the ATLAS magnetic field wrapped
calContextReference to the CalibrationContext which is wrapping the pointer to the Gaudi-event context
Returns
: In case of fit-failure, a nullptr otherwise a unique_ptr to the fitted trajectories from the fit

Definition at line 60 of file FitterTool.cxx.

65 {
66 std::vector<Acts::SourceLink> sourceLinks{};
67 std::ranges::transform(measList, std::back_inserter(sourceLinks),
70 });
71 return fit (sourceLinks, initialParams, tgContext, mfContext, calContext, targetSurface);
72
73 }
static Acts::SourceLink pack(const Ptr_t &measurement)
Pack the measurement type pointer to an Acts::SourceLink including the intermediate conversion into a...
virtual std::unique_ptr< ActsTrk::MutableTrackContainer > fit(const ActsTrk::Seed &seed, const Acts::BoundTrackParameters &initialParams, const Acts::GeometryContext &tgContext, const Acts::MagneticFieldContext &mfContext, const Acts::CalibrationContext &calContext, const Acts::Surface &targetSurface) const override final
Tries to fit a short-line track from an initial ITk/ID seed made up out of three spacepoints.
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.

◆ initialize()

StatusCode MuonR4::FitterTool::initialize ( )
finaloverridevirtual

Definition at line 16 of file FitterTool.cxx.

16 {
18 ATH_CHECK(m_muonCalibrator.retrieve());
19 m_unalibMeasSurfAcc = xAODUncalibMeasSurfAcc{m_trackingGeometrySvc.get()};
22 }
23
24 m_extensions.surfaceAccessor.connect<&ActsTrk::detail::xAODUncalibMeasSurfAcc::operator()>(&m_unalibMeasSurfAcc);
26 auto logger = makeActsAthenaLogger(this, "MuonTrackFit");
27
28 Acts::Navigator::Config navConfig{m_trackingGeometrySvc->trackingGeometry()};
29 Acts::Navigator navigator(std::move(navConfig), logger->cloneWithSuffix("Navigator"));
31 CurvedPropagator_t::Stepper stepper{std::make_shared<ATLASMagneticFieldWrapper>()};
32 CurvedPropagator_t propagator{std::move(stepper),
33 std::move(navigator), logger->cloneWithSuffix("Prop")};
34 m_fitter = CurvedFitter_t{std::move(propagator), logger->cloneWithSuffix("Fitter")};
35 } else {
36 StraightPropagator_t propagator{Acts::StraightLineStepper{},
37 std::move(navigator), logger->cloneWithSuffix("Prop")};
38 m_fitter = StraightFitter_t{std::move(propagator), logger->cloneWithSuffix("Fitter")};
39 }
40 return StatusCode::SUCCESS;
41 }
#define ATH_CHECK
Evaluate an expression and check for errors.
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
Definition Logger.cxx:64
void calibrate(const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &sl, const MutableTrackStateBackend::TrackStateProxy trackState) const
: Interface method for the Acts fitter to calibrate the trajectory track states from the source link ...
ToolHandle< MuonR4::ISpacePointCalibrator > m_muonCalibrator
Tool handle to calibrate the muon measurmeents.
Definition FitterTool.h:99
Acts::Propagator< Acts::EigenStepper<>, Acts::Navigator > CurvedPropagator_t
Abrivation for the curved standard propagator.
Definition FitterTool.h:72
Gaudi::Property< bool > m_doStraightLineFit
Do the straight line fit.
Definition FitterTool.h:84
Acts::Propagator< Acts::StraightLineStepper, Acts::Navigator > StraightPropagator_t
Abrivation for the straight line propagator.
Definition FitterTool.h:70
ActsTrk::detail::xAODUncalibMeasSurfAcc m_unalibMeasSurfAcc
Surface accessor delegate for xAOD::UncalibratedMeasurement objects.
Definition FitterTool.h:102
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
Tracking geometry service.
Definition FitterTool.h:96
ActsTrk::detail::xAODUncalibMeasCalibrator m_uncalibMeasCalibrator
Calibrator for the uncalibrated xAOD::UnCalibratedMeasurement objects.
Definition FitterTool.h:104
virtual void calibrateSourceLink(const Acts::GeometryContext &geoctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &link, ActsTrk::MutableTrackStateBackend::TrackStateProxy state) const =0
Function that's hooked to the calibration delegate of the implemented Acts fitters.
static Root::TMsgLogger logger("iLumiCalc")
UncalibMeasType
Define the type of the uncalibrated measurement.
std::span< const UncalibMeasType > muonMeasurementTypes()
Returns a view on all the defined muon measurement types.

Member Data Documentation

◆ m_doEnergyLoss

Gaudi::Property<bool> MuonR4::FitterTool::m_doEnergyLoss {this, "doEnergyLoss" , false}
private

Do energy loss modelling in the fit.

Definition at line 92 of file FitterTool.h.

92{this, "doEnergyLoss" , false};

◆ m_doMaxSteps

Gaudi::Property<unsigned> MuonR4::FitterTool::m_doMaxSteps {this, "maxSteps", 1000000 }
private

How ,many steps to go.

Definition at line 86 of file FitterTool.h.

86{this, "maxSteps", 1000000 };

◆ m_doScattering

Gaudi::Property<bool> MuonR4::FitterTool::m_doScattering {this, "doScattering" , false}
private

Increase the nuissances by introducing scattering angles.

Definition at line 94 of file FitterTool.h.

94{this, "doScattering" , false};

◆ m_doStraightLineFit

Gaudi::Property<bool> MuonR4::FitterTool::m_doStraightLineFit {this, "doStraightLine", false}
private

Do the straight line fit.

Definition at line 84 of file FitterTool.h.

84{this, "doStraightLine", false};

◆ m_extensions

Gx2FitterExtension_t MuonR4::FitterTool::m_extensions {}
private

Definition at line 106 of file FitterTool.h.

106{};

◆ m_fitter

Fitter_t MuonR4::FitterTool::m_fitter {}
private

Definition at line 111 of file FitterTool.h.

111{};

◆ m_maxIter

Gaudi::Property<unsigned> MuonR4::FitterTool::m_maxIter {this, "nIterMax" , 250}
private

How many iterations to use in the fit.

Definition at line 90 of file FitterTool.h.

90{this, "nIterMax" , 250};

◆ m_maxSurfaces

Gaudi::Property<unsigned> MuonR4::FitterTool::m_maxSurfaces {this, "maxSurfaces", 10000}
private

How many surfaces to try.

Definition at line 88 of file FitterTool.h.

88{this, "maxSurfaces", 10000};

◆ m_muonCalibrator

ToolHandle<MuonR4::ISpacePointCalibrator> MuonR4::FitterTool::m_muonCalibrator {this, "MuonCalibrationTool", ""}
private

Tool handle to calibrate the muon measurmeents.

Definition at line 99 of file FitterTool.h.

99{this, "MuonCalibrationTool", ""};

◆ m_trackingGeometrySvc

ServiceHandle<ActsTrk::ITrackingGeometrySvc> MuonR4::FitterTool::m_trackingGeometrySvc
private
Initial value:
{this, "TrackingGeometrySvc",
"ActsTrackingGeometrySvc"}

Tracking geometry service.

Definition at line 96 of file FitterTool.h.

96 {this, "TrackingGeometrySvc",
97 "ActsTrackingGeometrySvc"};

◆ m_unalibMeasSurfAcc

ActsTrk::detail::xAODUncalibMeasSurfAcc MuonR4::FitterTool::m_unalibMeasSurfAcc {}
private

Surface accessor delegate for xAOD::UncalibratedMeasurement objects.

Definition at line 102 of file FitterTool.h.

102{};

◆ m_uncalibMeasCalibrator

ActsTrk::detail::xAODUncalibMeasCalibrator MuonR4::FitterTool::m_uncalibMeasCalibrator {}
private

Calibrator for the uncalibrated xAOD::UnCalibratedMeasurement objects.

Definition at line 104 of file FitterTool.h.

104{};

The documentation for this class was generated from the following files: