-
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.
refactor(Examples): clean up magnetic field handling (#696)
Clean up the magnetic field types and options in the examples: Magnetic field related headers are now consistently located in the ActsExamples/MagneticField include directory and all code is in the ActsExamples namespace. Before, the code still had the old Examples/Plugins/... layout and inconsistent or missing namespacing inherited from the old framework. Move the magnetic field variant type ActsExamples::MagneticField into a separate header. Magnetic field options have a well-documented order of preferrence (constant field overrides field map). If no field options are given, a null field is created, e.g. to support telescope-like detectors without a field. Expected units are clearly communicated as part of the parameter name, similar to what is done in other algorithms. The field map readers are private implementation details and are not publicly available anymore. Detector construction and magnetic field setup are now completely orthogonal: all magnetic fields can be setup for all detectors.
- Loading branch information
Showing
37 changed files
with
877 additions
and
969 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
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
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
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
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
52 changes: 52 additions & 0 deletions
52
Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/MagneticField.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) 2017-2020 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/Definitions/Algebra.hpp" | ||
#include "Acts/MagneticField/ConstantBField.hpp" | ||
#include "Acts/MagneticField/InterpolatedBFieldMap.hpp" | ||
#include "Acts/MagneticField/NullBField.hpp" | ||
#include "ActsExamples/MagneticField/ScalableBField.hpp" | ||
|
||
#include <memory> | ||
#include <variant> | ||
|
||
namespace ActsExamples { | ||
namespace detail { | ||
|
||
using InterpolatedMagneticFieldMapper2 = Acts::InterpolatedBFieldMapper< | ||
Acts::detail::Grid<Acts::Vector2, Acts::detail::EquidistantAxis, | ||
Acts::detail::EquidistantAxis>>; | ||
using InterpolatedMagneticField2 = | ||
Acts::InterpolatedBFieldMap<InterpolatedMagneticFieldMapper2>; | ||
|
||
using InterpolatedMagneticFieldMapper3 = | ||
Acts::InterpolatedBFieldMapper<Acts::detail::Grid< | ||
Acts::Vector3, Acts::detail::EquidistantAxis, | ||
Acts::detail::EquidistantAxis, Acts::detail::EquidistantAxis>>; | ||
using InterpolatedMagneticField3 = | ||
Acts::InterpolatedBFieldMap<InterpolatedMagneticFieldMapper3>; | ||
|
||
} // namespace detail | ||
|
||
/// Magnetic field variant with all supported fields. | ||
/// | ||
/// This is a value-like type, i.e. can be copied and stored by-value, that can | ||
/// be used wherever magnetic field information is needed. The examples support | ||
/// only the finite set of magnetic field type contained in this variant. This | ||
/// enables the use of a single concrete value-like type that can be used in | ||
/// interfaces. | ||
using MagneticField = | ||
std::variant<std::shared_ptr<Acts::NullBField>, | ||
std::shared_ptr<Acts::ConstantBField>, | ||
std::shared_ptr<ScalableBField>, | ||
std::shared_ptr<detail::InterpolatedMagneticField2>, | ||
std::shared_ptr<detail::InterpolatedMagneticField3>>; | ||
|
||
} // namespace ActsExamples |
Oops, something went wrong.