-
Notifications
You must be signed in to change notification settings - Fork 243
feat: Demonstrator for MillePede alignment of ACTS Kalman tracks #5256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f799f8f
bd81085
68444bf
5f373fc
311308c
24e4fe8
2eef7e9
d6673d6
8454d10
75fa96f
246fe99
7d088b8
163aa3f
38176e7
b820098
b7f2833
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| acts_add_library( | ||
| ExamplesAlignmentMillePede | ||
| src/MillePedeAlignmentSandbox.cpp | ||
| src/ActsSolverFromMille.cpp | ||
| ) | ||
| target_include_directories( | ||
| ActsExamplesAlignmentMillePede | ||
| PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
| ) | ||
| target_link_libraries( | ||
| ActsExamplesAlignmentMillePede | ||
| PUBLIC | ||
| Acts::Alignment | ||
| Acts::ExamplesFramework | ||
| Acts::ExamplesMagneticField | ||
| ActsPluginMille | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| // This file is part of the ACTS project. | ||
| // | ||
| // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Acts/Geometry/GeometryIdentifier.hpp" | ||
| #include "Acts/Propagator/EigenStepper.hpp" | ||
| #include "Acts/Propagator/Navigator.hpp" | ||
| #include "Acts/Propagator/Propagator.hpp" | ||
| #include "Acts/Propagator/detail/SteppingLogger.hpp" | ||
| #include "Acts/TrackFitting/KalmanFitter.hpp" | ||
| #include "ActsAlignment/Kernel/Alignment.hpp" | ||
| #include "ActsExamples/Framework/DataHandle.hpp" | ||
| #include "ActsExamples/Framework/IAlgorithm.hpp" | ||
|
|
||
| #include <memory> | ||
|
|
||
| namespace Acts { | ||
| class MagneticFieldProvider; | ||
| } | ||
|
|
||
| namespace ActsExamples { | ||
|
|
||
| /// @brief Algorithm for reading Mille binaries into ACTS | ||
| /// and solving using them to run an alignment fit | ||
| /// with the built-in solver. | ||
| class ActsSolverFromMille final : public IAlgorithm { | ||
| public: | ||
| using SteppingLogger = Acts::detail::SteppingLogger; | ||
| using EndOfWorld = Acts::EndOfWorldReached; | ||
| using Stepper = Acts::EigenStepper<>; | ||
| using Propagator = Acts::Propagator<Stepper, Acts::Navigator>; | ||
| using Fitter = Acts::KalmanFitter<Propagator, Acts::VectorMultiTrajectory>; | ||
| using Alignment = ActsAlignment::Alignment<Fitter>; | ||
|
|
||
| using AlignmentParameters = | ||
| std::unordered_map<Acts::SurfacePlacementBase*, Acts::Transform3>; | ||
|
|
||
| /// configuration | ||
| struct Config { | ||
| /// name of the mille input binary. You can choose | ||
| /// between ".root" / ".csv" / ".dat" extensions | ||
| /// to get ROOT tree / plain text / classic Millepede | ||
| /// binary outputs. All three can be read by the interface. | ||
| std::string milleInput; | ||
| // the tracking geometry to use | ||
| std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry; | ||
| // magnetic field | ||
| std::shared_ptr<const Acts::MagneticFieldProvider> magneticField; | ||
| // modules to fix in the alignment to suppress global movements | ||
| std::set<Acts::GeometryIdentifier> fixModules; | ||
| }; | ||
|
|
||
| /// Constructor of the sandbox algorithm | ||
| /// @param cfg is the config struct to configure the algorithm | ||
| /// @param level is the logging level | ||
| explicit ActsSolverFromMille( | ||
| Config cfg, std::unique_ptr<const Acts::Logger> logger = nullptr); | ||
|
|
||
| /// Framework execute method of the sandbox algorithm | ||
| /// | ||
| /// @param ctx is the algorithm context that holds event-wise information | ||
| /// @return a process code to steer the algorithm flow | ||
| ProcessCode execute(const AlgorithmContext& ctx) const override; | ||
| ProcessCode finalize() override; | ||
|
|
||
| /// Get readonly access to the config parameters | ||
| const Config& config() const { return m_cfg; } | ||
|
|
||
| private: | ||
| /// configuration instance | ||
| Config m_cfg; | ||
|
|
||
| /// alignment module instance - reuse as much as possible | ||
| std::shared_ptr<Alignment> m_align; | ||
| /// tracking geometry | ||
| std::shared_ptr<const Acts::TrackingGeometry> m_trackingGeometry; | ||
| }; | ||
|
|
||
| } // namespace ActsExamples |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. naming like above: maybe
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not really an alignment algorithm - given the hack to remove the geometry context, it really is just a sandbox to experiment with writing out information. If you prefer, we could call it |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| // This file is part of the ACTS project. | ||
| // | ||
| // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Acts/Geometry/GeometryIdentifier.hpp" | ||
| #include "Acts/Propagator/EigenStepper.hpp" | ||
| #include "Acts/Propagator/Navigator.hpp" | ||
| #include "Acts/Propagator/Propagator.hpp" | ||
| #include "Acts/Propagator/detail/SteppingLogger.hpp" | ||
| #include "Acts/TrackFitting/KalmanFitter.hpp" | ||
| #include "ActsAlignment/Kernel/Alignment.hpp" | ||
| #include "ActsExamples/EventData/Measurement.hpp" | ||
| #include "ActsExamples/EventData/Track.hpp" | ||
| #include "ActsExamples/Framework/DataHandle.hpp" | ||
| #include "ActsExamples/Framework/IAlgorithm.hpp" | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include "Mille/MilleFactory.h" | ||
andiwand marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| namespace Acts { | ||
| class MagneticFieldProvider; | ||
| } | ||
|
|
||
| namespace ActsExamples { | ||
|
|
||
| /// @brief Sandbox algorithm for experimenting with | ||
| /// writing ACTS Kalman tracks to Millepede | ||
| /// and passing them to the (external) | ||
| /// Millepede alignment fit. | ||
| /// Will consume an input track collection, | ||
| /// pass the tracks through the existing | ||
| /// Kalman alignment module and then | ||
| /// write this information to a user-configured | ||
| /// Mille binary that can be read by the solver. | ||
| /// | ||
| /// You can either pass standard MC tracks and | ||
| /// look for a zero-correction, or pass | ||
| /// deliberately misaligned tracks and fit back | ||
| /// out the injected misalignment. The module | ||
| /// will **ignore** any external geometry context, | ||
| /// so injected alignment corrections in the upstream | ||
| /// job will show up as distortions here. | ||
| class MillePedeAlignmentSandbox final : public IAlgorithm { | ||
| public: | ||
| using SteppingLogger = Acts::detail::SteppingLogger; | ||
| using EndOfWorld = Acts::EndOfWorldReached; | ||
| using Stepper = Acts::EigenStepper<>; | ||
| using Propagator = Acts::Propagator<Stepper, Acts::Navigator>; | ||
| using Fitter = Acts::KalmanFitter<Propagator, Acts::VectorMultiTrajectory>; | ||
| using Alignment = ActsAlignment::Alignment<Fitter>; | ||
|
|
||
| using AlignmentParameters = | ||
| std::unordered_map<Acts::SurfacePlacementBase*, Acts::Transform3>; | ||
|
|
||
| /// configuration | ||
| struct Config { | ||
| /// name of the mille output binary. You can choose | ||
| /// between ".root" / ".csv" / ".dat" extensions | ||
| /// to get ROOT tree / plain text / classic Millepede | ||
| /// binary outputs. All three can be read by the solver. | ||
| std::string milleOutput; | ||
| /// Input measurements collection. | ||
| std::string inputMeasurements; | ||
| /// Input tracks | ||
| std::string inputTracks; | ||
| // the tracking geometry to use | ||
| std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry; | ||
| // magnetic field | ||
| std::shared_ptr<const Acts::MagneticFieldProvider> magneticField; | ||
| // modules to fix in the alignment to suppress global movements | ||
| std::set<Acts::GeometryIdentifier> fixModules; | ||
| }; | ||
|
|
||
| /// Constructor of the sandbox algorithm | ||
| /// @param cfg is the config struct to configure the algorithm | ||
| /// @param level is the logging level | ||
| explicit MillePedeAlignmentSandbox( | ||
| Config cfg, std::unique_ptr<const Acts::Logger> logger = nullptr); | ||
|
|
||
| /// Framework execute method of the sandbox algorithm | ||
| /// | ||
| /// @param ctx is the algorithm context that holds event-wise information | ||
| /// @return a process code to steer the algorithm flow | ||
| ProcessCode execute(const AlgorithmContext& ctx) const override; | ||
| ProcessCode finalize() override; | ||
|
|
||
| /// Get readonly access to the config parameters | ||
| const Config& config() const { return m_cfg; } | ||
|
|
||
| private: | ||
| /// configuration instance | ||
| Config m_cfg; | ||
|
|
||
| /// measurement container containing the measurements on the input tracks | ||
| /// below | ||
| ReadDataHandle<MeasurementContainer> m_inputMeasurements{this, | ||
| "InputMeasurements"}; | ||
| /// tracks to use for the alignment | ||
| ReadDataHandle<ConstTrackContainer> m_inputTracks{this, "InputTracks"}; | ||
|
|
||
| /// alignment module instance - reuse as much as possible | ||
| std::shared_ptr<Alignment> m_align; | ||
| /// tracking geometry | ||
| std::shared_ptr<const Acts::TrackingGeometry> m_trackingGeometry; | ||
| /// the Mille record instance for writing our alignment info. | ||
| std::unique_ptr<Mille::MilleRecord> m_milleOut = nullptr; | ||
| }; | ||
|
|
||
| } // namespace ActsExamples | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could get rid of
Actsin the file and class name. how aboutMillePedeAlignmentAlgorithm?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer to keep - as this algorithm is not running
Millepedebut instead the ACTS-Internal alignment solver, hence theActsSolverprefix. AMillePedeAlignmentSolvercallingpede(the Millepede solver program) can / will be added later :)