EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SharedBField.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SharedBField.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 
12 
13 #include <memory>
14 
15 namespace Acts {
16 
22 template <typename BField>
23 class SharedBField {
24  public:
25  // typedef wrapped BField's cache type
26  using Cache = typename BField::Cache;
27 
29  SharedBField() = delete;
30 
34  SharedBField(std::shared_ptr<const BField> bField) : m_bField(bField) {}
35 
42  return m_bField->getField(position);
43  }
44 
49  Vector3D getField(const Vector3D& position, Cache& cache) const {
50  return m_bField->getField(position, cache);
51  }
52 
62  ActsMatrixD<3, 3>& derivative) const {
63  return m_bField->getFieldGradient(position, derivative);
64  }
65 
76  ActsMatrixD<3, 3>& derivative, Cache& cache) const {
77  return m_bField->getFieldGradient(position, derivative, cache);
78  }
79 
80  private:
81  std::shared_ptr<const BField> m_bField;
82 };
83 
84 } // namespace Acts