Warning, file /acts/Core/include/Acts/MagneticField/ToroidField.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Units.hpp"
0013 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0014 #include "Acts/MagneticField/MagneticFieldProvider.hpp"
0015 #include "Acts/Utilities/Result.hpp"
0016
0017 #include <array>
0018 #include <vector>
0019
0020 namespace Acts {
0021
0022
0023
0024
0025
0026
0027
0028 class ToroidField final : public MagneticFieldProvider {
0029 public:
0030
0031 struct BarrelConfig {
0032 double R_in = 4.9 * UnitConstants::m;
0033 double R_out = 10.0 * UnitConstants::m;
0034 double c = 25.3 * UnitConstants::m;
0035 double b = 0.16 * UnitConstants::m;
0036 double I = 20500.0;
0037 int Nturns = 120;
0038 };
0039
0040
0041 struct EctConfig {
0042 double R_in = 1.65 * 0.5 * UnitConstants::m;
0043 double R_out = 10.7 * 0.5 * UnitConstants::m;
0044 double c = 5.0 * UnitConstants::m;
0045 double b = 0.12 * UnitConstants::m;
0046 double I = 20500.0;
0047 int Nturns = 116;
0048 double gap = 0.5 * UnitConstants::m;
0049 };
0050
0051
0052 struct LayoutConfig {
0053 double theta0 = 22.5 * UnitConstants::degree;
0054 double thetaStep =
0055 45.0 * UnitConstants::degree;
0056 int nCoils = 8;
0057
0058 int nArc = 200;
0059 int nStraight = 160;
0060 bool closeLoop = true;
0061
0062 double eps = 1e-18;
0063 };
0064
0065
0066 struct Config {
0067 BarrelConfig barrel;
0068 EctConfig ect;
0069 LayoutConfig layout;
0070
0071
0072
0073 std::vector<int> barrelSigns;
0074
0075
0076
0077 std::vector<int> ectSigns;
0078 };
0079
0080
0081 struct Cache {};
0082
0083
0084 ToroidField();
0085
0086
0087
0088 explicit ToroidField(Config cfg);
0089
0090
0091 MagneticFieldProvider::Cache makeCache(
0092 const MagneticFieldContext& mctx) const override;
0093
0094
0095 Result<Vector3> getField(const Vector3& position,
0096 MagneticFieldProvider::Cache& cache) const override;
0097
0098
0099
0100 const Config& config() const { return m_cfg; }
0101
0102 private:
0103
0104 static std::vector<std::array<float, 2>> ectRacetrackRadial(
0105 float Lrho, float Lz, int nArc, int nStraight, bool close);
0106
0107 static std::vector<std::array<double, 2>> racetrackRZ(double a, double b,
0108 double Lz, int nArc,
0109 int nStraight,
0110 bool close);
0111
0112 static void buildSegsMidsRZ(const std::vector<std::array<double, 2>>& rz,
0113 std::vector<std::array<double, 2>>& d_rz,
0114 std::vector<std::array<double, 2>>& m_rz);
0115
0116 static void mapRingToXYZ(double l,
0117 const std::vector<std::array<double, 2>>& m_rz,
0118 const std::vector<std::array<double, 2>>& d_rz,
0119 double phi, int sign, double zShift,
0120 std::vector<std::array<double, 3>>& mids_out,
0121 std::vector<std::array<double, 3>>& segs_out);
0122
0123 void buildGeometry();
0124
0125 Config m_cfg;
0126
0127
0128 std::vector<std::array<double, 3>> m_segs_barrel;
0129 std::vector<std::array<double, 3>> m_mids_barrel;
0130
0131 std::vector<std::array<double, 3>> m_segs_ect;
0132 std::vector<std::array<double, 3>> m_mids_ect;
0133
0134 void accumulateBarrelField(double X, double Y, double Z, double eps,
0135 double pref, double& bx, double& by,
0136 double& bz) const;
0137
0138 void accumulateEndcapField(double X, double Y, double Z, double eps,
0139 double pref, double& bx, double& by,
0140 double& bz) const;
0141 };
0142
0143 }