Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
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
10
#include "
Acts/Definitions/Algebra.hpp
"
11
#include "
Acts/MagneticField/MagneticFieldContext.hpp
"
12
#include "
Acts/MagneticField/MagneticFieldProvider.hpp
"
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
40
Result<Vector3>
getField
(
const
Vector3
&
position
,
41
MagneticFieldProvider::Cache
& cache)
const override
{
42
(void)position;
43
(void)cache;
44
return
Result<Vector3>::success
(
m_BField
);
45
}
46
53
Result<Vector3>
getFieldGradient
(
54
const
Vector3
&
position
,
ActsMatrix<3, 3>
& derivative,
55
MagneticFieldProvider::Cache
& cache)
const override
{
56
(void)position;
57
(void)derivative;
58
(void)cache;
59
return
Result<Vector3>::success
(
m_BField
);
60
}
61
63
Acts::MagneticFieldProvider::Cache
makeCache
(
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
:
84
Vector3
m_BField
;
85
};
86
}
// namespace Acts
acts
blob
sPHENIX
Core
include
Acts
MagneticField
ConstantBField.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:33
using
1.8.2 with
sPHENIX GitHub integration