-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
So far, real refitting of tracks was not possible in the examples framework. The direct-fitter option of the `ActsExamples::TrackFittingAlgorithm` was broken due to the fact, that only measurement surfaces were added to the surface sequence, and thus e.g. the traversed material could differ. This adds `ActsExamples::RefittingAlgorithm`, that uses the new `Acts::TrackContainer` infrastructure to enable a very simple interface: Just a input container and a output container. Furthermore, the `TrackFittingAlgorithm` looses the `directFit` option. To make this work, also the `TrackFitterFunction` had to be refactored and was pulled out of the `TrackFittingAlgorithm`.
- Loading branch information
1 parent
f5644a7
commit 08ef3cc
Showing
20 changed files
with
500 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/GsfFitterFunction.hpp
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/KalmanFitterFunction.hpp
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/RefittingAlgorithm.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2019-2021 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "ActsExamples/Framework/DataHandle.hpp" | ||
#include "ActsExamples/Framework/IAlgorithm.hpp" | ||
#include "ActsExamples/TrackFitting/TrackFitterFunction.hpp" | ||
|
||
namespace ActsExamples { | ||
|
||
class RefittingAlgorithm final : public IAlgorithm { | ||
public: | ||
struct Config { | ||
/// The intput track collection | ||
std::string inputTracks; | ||
/// Output fitted tracks collection. | ||
std::string outputTracks; | ||
/// Type erased fitter function. | ||
std::shared_ptr<TrackFitterFunction> fit; | ||
/// Pick a single track for debugging (-1 process all tracks) | ||
int pickTrack = -1; | ||
}; | ||
|
||
/// Constructor of the fitting algorithm | ||
/// | ||
/// @param config is the config struct to configure the algorihtm | ||
/// @param level is the logging level | ||
RefittingAlgorithm(Config config, Acts::Logging::Level level); | ||
|
||
/// Framework execute method of the fitting algorithm | ||
/// | ||
/// @param ctx is the algorithm context that holds event-wise information | ||
/// @return a process code to steer the algporithm flow | ||
ActsExamples::ProcessCode execute(const AlgorithmContext& ctx) const final; | ||
|
||
/// Get readonly access to the config parameters | ||
const Config& config() const { return m_cfg; } | ||
|
||
private: | ||
Config m_cfg; | ||
|
||
ReadDataHandle<ConstTrackContainer> m_inputTracks{this, "InputTracks"}; | ||
WriteDataHandle<ConstTrackContainer> m_outputTracks{this, "OutputTracks"}; | ||
}; | ||
|
||
} // namespace ActsExamples |
33 changes: 33 additions & 0 deletions
33
Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/RefittingCalibrator.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2023 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/EventData/VectorMultiTrajectory.hpp" | ||
#include "Acts/Surfaces/Surface.hpp" | ||
|
||
namespace ActsExamples { | ||
|
||
struct RefittingCalibrator { | ||
using Proxy = | ||
Acts::MultiTrajectory<Acts::VectorMultiTrajectory>::TrackStateProxy; | ||
using ConstProxy = Acts::MultiTrajectory< | ||
Acts::ConstVectorMultiTrajectory>::ConstTrackStateProxy; | ||
|
||
struct RefittingSourceLink { | ||
ConstProxy state; | ||
|
||
Acts::GeometryIdentifier geometryId() const { | ||
return state.referenceSurface().geometryId(); | ||
} | ||
}; | ||
|
||
void calibrate(const Acts::GeometryContext& /*gctx*/, Proxy trackState) const; | ||
}; | ||
|
||
} // namespace ActsExamples |
94 changes: 94 additions & 0 deletions
94
Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/TrackFitterFunction.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2019-2021 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/EventData/SourceLink.hpp" | ||
#include "Acts/EventData/TrackParameters.hpp" | ||
#include "Acts/EventData/VectorMultiTrajectory.hpp" | ||
#include "Acts/EventData/VectorTrackContainer.hpp" | ||
#include "Acts/Geometry/GeometryContext.hpp" | ||
#include "Acts/Geometry/TrackingGeometry.hpp" | ||
#include "Acts/MagneticField/MagneticFieldContext.hpp" | ||
#include "Acts/MagneticField/MagneticFieldProvider.hpp" | ||
#include "Acts/Propagator/MultiEigenStepperLoop.hpp" | ||
#include "Acts/Propagator/Propagator.hpp" | ||
#include "Acts/TrackFitting/BetheHeitlerApprox.hpp" | ||
#include "Acts/Utilities/CalibrationContext.hpp" | ||
#include "ActsExamples/EventData/Measurement.hpp" | ||
#include "ActsExamples/EventData/Track.hpp" | ||
#include "ActsExamples/TrackFitting/RefittingCalibrator.hpp" | ||
|
||
namespace ActsExamples { | ||
|
||
/// Fit function that takes the above parameters and runs a fit | ||
/// @note This is separated into a virtual interface to keep compilation units | ||
/// small. | ||
class TrackFitterFunction { | ||
public: | ||
using TrackFitterResult = Acts::Result<TrackContainer::TrackProxy>; | ||
|
||
struct GeneralFitterOptions { | ||
std::reference_wrapper<const Acts::GeometryContext> geoContext; | ||
std::reference_wrapper<const Acts::MagneticFieldContext> magFieldContext; | ||
std::reference_wrapper<const Acts::CalibrationContext> calibrationContext; | ||
const Acts::Surface* referenceSurface = nullptr; | ||
Acts::PropagatorPlainOptions propOptions; | ||
}; | ||
|
||
virtual ~TrackFitterFunction() = default; | ||
|
||
virtual TrackFitterResult operator()(const std::vector<Acts::SourceLink>&, | ||
const TrackParameters&, | ||
const GeneralFitterOptions&, | ||
const MeasurementCalibrator&, | ||
TrackContainer&) const = 0; | ||
|
||
virtual TrackFitterResult operator()(const std::vector<Acts::SourceLink>&, | ||
const TrackParameters&, | ||
const GeneralFitterOptions&, | ||
const RefittingCalibrator&, | ||
const std::vector<const Acts::Surface*>&, | ||
TrackContainer&) const = 0; | ||
}; | ||
|
||
/// Makes a fitter function object for the Kalman Filter | ||
/// | ||
std::shared_ptr<TrackFitterFunction> makeKalmanFitterFunction( | ||
std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry, | ||
std::shared_ptr<const Acts::MagneticFieldProvider> magneticField, | ||
bool multipleScattering = true, bool energyLoss = true, | ||
double reverseFilteringMomThreshold = 0.0, | ||
Acts::FreeToBoundCorrection freeToBoundCorrection = | ||
Acts::FreeToBoundCorrection(), | ||
const Acts::Logger& logger = *Acts::getDefaultLogger("Kalman", | ||
Acts::Logging::INFO)); | ||
|
||
/// This type is used in the Examples framework for the Bethe-Heitler | ||
/// approximation | ||
using BetheHeitlerApprox = Acts::Experimental::AtlasBetheHeitlerApprox<6, 5>; | ||
|
||
/// Makes a fitter function object for the GSF | ||
/// | ||
/// @param trackingGeometry the trackingGeometry for the propagator | ||
/// @param magneticField the magnetic field for the propagator | ||
/// @param betheHeitlerApprox The object that encapsulates the approximation. | ||
/// @param maxComponents number of maximum components in the track state | ||
/// @param abortOnError wether to call std::abort on an error | ||
/// @param disableAllMaterialHandling run the GSF like a KF (no energy loss, | ||
/// always 1 component, ...) | ||
/// @param logger a logger instance | ||
std::shared_ptr<TrackFitterFunction> makeGsfFitterFunction( | ||
std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry, | ||
std::shared_ptr<const Acts::MagneticFieldProvider> magneticField, | ||
BetheHeitlerApprox betheHeitlerApprox, std::size_t maxComponents, | ||
double weightCutoff, Acts::FinalReductionMethod finalReductionMethod, | ||
bool abortOnError, bool disableAllMaterialHandling, | ||
const Acts::Logger& logger); | ||
|
||
} // namespace ActsExamples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.