Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:53

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0013 #include "Acts/MagneticField/MagneticFieldProvider.hpp"
0014 
0015 namespace Acts {
0016 
0017 /// @ingroup MagneticField
0018 /// @brief Null bfield which returns 0 always
0019 class NullBField final : public MagneticFieldProvider {
0020  public:
0021   struct Cache {
0022     /// @brief constructor with context
0023     Cache(const MagneticFieldContext& /*mcfg*/) {}
0024   };
0025 
0026   /// @brief Default constructor
0027   NullBField() = default;
0028 
0029   /// @copydoc MagneticFieldProvider::getField(const Vector3&,MagneticFieldProvider::Cache&) const
0030   ///
0031   /// @note The @p position is ignored and only kept as argument to provide
0032   ///       a consistent interface with other magnetic field services.
0033   Result<Vector3> getField(const Vector3& position,
0034                            MagneticFieldProvider::Cache& cache) const override {
0035     (void)position;
0036     (void)cache;
0037     return Result<Vector3>::success(Vector3::Zero());
0038   }
0039 
0040   /// @copydoc MagneticFieldProvider::makeCache(const MagneticFieldContext&) const
0041   Acts::MagneticFieldProvider::Cache makeCache(
0042       const Acts::MagneticFieldContext& mctx) const override {
0043     return Acts::MagneticFieldProvider::Cache(std::in_place_type<Cache>, mctx);
0044   }
0045 
0046   /// @brief check whether given 3D position is inside look-up domain
0047   ///
0048   /// @return @c true if position is inside the defined look-up grid,
0049   ///         otherwise @c false
0050   /// @note The method will always return true for the null B-Field
0051   bool isInside(const Vector3& /*position*/) const { return true; }
0052 };
0053 
0054 }  // namespace Acts