Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConstantBField.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ConstantBField.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-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
13 
14 namespace Acts {
15 
21 class ConstantBField final : public MagneticFieldProvider {
22  public:
23  struct Cache {
25  Cache(const MagneticFieldContext& /*mcfg*/) {}
26  };
27 
31  explicit ConstantBField(Vector3 B) : m_BField(std::move(B)) {}
32 
34  Vector3 getField() const { return m_BField; }
35 
41  MagneticFieldProvider::Cache& cache) const override {
42  (void)position;
43  (void)cache;
45  }
46 
54  const Vector3& position, ActsMatrix<3, 3>& derivative,
55  MagneticFieldProvider::Cache& cache) const override {
56  (void)position;
57  (void)derivative;
58  (void)cache;
60  }
61 
64  const Acts::MagneticFieldContext& mctx) const override {
65  return Acts::MagneticFieldProvider::Cache::make<Cache>(mctx);
66  }
67 
72  bool isInside(const Vector3& position) const {
73  (void)position;
74  return true;
75  }
76 
80  void setField(const Vector3& B) { m_BField = B; }
81 
82  private:
85 };
86 } // namespace Acts