forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
928 additions
and
210 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// 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/Definitions/Algebra.hpp" | ||
#include "Acts/MagneticField/MagneticFieldContext.hpp" | ||
#include "Acts/MagneticField/MagneticFieldError.hpp" | ||
#include "Acts/MagneticField/MagneticFieldProvider.hpp" | ||
#include "Acts/Utilities/RangeXD.hpp" | ||
|
||
namespace Acts { | ||
|
||
/// @ingroup MagneticField | ||
/// | ||
/// @brief Magnetic field provider modelling a magnetic field consisting of | ||
/// several (potentially overlapping) regions of constant values. | ||
class MultiRangeBField final : public MagneticFieldProvider { | ||
private: | ||
struct Cache { | ||
explicit Cache(const MagneticFieldContext& /*unused*/); | ||
|
||
std::optional<std::size_t> index = {}; | ||
}; | ||
|
||
using BFieldRange = std::pair<RangeXD<3, double>, Vector3>; | ||
|
||
// The different ranges and their corresponding field vectors. Note that | ||
// regions positioned _later_ in this vector take priority over earlier | ||
// regions. | ||
std::vector<BFieldRange> fieldRanges; | ||
|
||
public: | ||
/// @brief Construct a magnetic field from a vector of ranges. | ||
/// | ||
/// @warning These ranges are listed in increasing order of precedence, | ||
/// i.e. ranges further along the vector have higher priority. | ||
explicit MultiRangeBField(const std::vector<BFieldRange>& ranges); | ||
|
||
explicit MultiRangeBField(std::vector<BFieldRange>&& ranges); | ||
|
||
/// @brief Construct a cache object. | ||
MagneticFieldProvider::Cache makeCache( | ||
const MagneticFieldContext& mctx) const override; | ||
|
||
/// @brief Request the value of the magnetic field at a given position. | ||
/// | ||
/// @param [in] position Global 3D position for the lookup. | ||
/// @param [in, out] cache Cache object. | ||
/// @returns A successful value containing a field vector if the given | ||
/// location is contained inside any of the regions, or a failure value | ||
/// otherwise. | ||
Result<Vector3> getField(const Vector3& position, | ||
MagneticFieldProvider::Cache& cache) const override; | ||
|
||
/// @brief Get the field gradient at a given position. | ||
/// | ||
/// @warning This is not currently implemented. | ||
Result<Vector3> getFieldGradient( | ||
const Vector3& position, ActsMatrix<3, 3>& /*unused*/, | ||
MagneticFieldProvider::Cache& cache) const override; | ||
}; | ||
} // namespace Acts |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
target_sources( | ||
ActsCore | ||
PRIVATE BFieldMapUtils.cpp SolenoidBField.cpp MagneticFieldError.cpp | ||
PRIVATE | ||
BFieldMapUtils.cpp | ||
SolenoidBField.cpp | ||
MagneticFieldError.cpp | ||
MultiRangeBField.cpp | ||
) |
Oops, something went wrong.