Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SolenoidBField.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SolenoidBField.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
15 
16 #include <cstddef>
17 #include <functional>
18 
19 namespace Acts {
20 
22 //
70 class SolenoidBField final : public MagneticFieldProvider {
71  public:
72  struct Cache {
76  Cache(const MagneticFieldContext& mctx) { (void)mctx; }
77  };
78 
80  struct Config {
82  double radius;
85  double length;
87  size_t nCoils;
90  double bMagCenter;
91  };
92 
97 
101  Vector2 getField(const Vector2& position) const;
102 
105  const MagneticFieldContext& mctx) const override;
106 
110  Vector3 getField(const Vector3& position) const;
111 
114  MagneticFieldProvider::Cache& cache) const override;
115 
121  const Vector3& position, ActsMatrix<3, 3>& derivative,
122  MagneticFieldProvider::Cache& cache) const override;
123 
124  private:
126  double m_scale;
127  double m_dz;
128  double m_R2;
129 
130  Vector2 multiCoilField(const Vector2& pos, double scale) const;
131 
132  Vector2 singleCoilField(const Vector2& pos, double scale) const;
133 
134  double B_r(const Vector2& pos, double scale) const;
135 
136  double B_z(const Vector2& pos, double scale) const;
137 
138  double k2(double r, double z) const;
139 };
140 
141 } // namespace Acts