EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ScalableBField.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ScalableBField.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
11
#include "
Acts/MagneticField/MagneticFieldContext.hpp
"
12
#include "
Acts/Utilities/Definitions.hpp
"
13
14
namespace
ActsExamples {
15
16
namespace
BField
{
17
19
struct
ScalableBFieldContext
{
20
double
scalor
= 1.;
21
};
22
29
class
ScalableBField
final {
30
public
:
31
struct
Cache
{
32
double
scalor
= 1.;
33
35
Cache
(
const
Acts::MagneticFieldContext
& mcfg) {
36
scalor
= std::any_cast<
const
ScalableBFieldContext
>(mcfg).
scalor
;
37
}
38
};
39
43
explicit
ScalableBField
(
Acts::Vector3D
B) :
m_BField
(std::move(B)) {}
44
50
ScalableBField
(
double
Bx = 0.,
double
By = 0.,
double
Bz
= 0.)
51
:
m_BField
(Bx, By,
Bz
) {}
52
60
Acts::Vector3D
getField
(
const
Acts::Vector3D
&
/*position*/
)
const
{
61
return
m_BField
;
62
}
63
72
Acts::Vector3D
getField
(
const
Acts::Vector3D
&
/*position*/
,
73
Cache
& cache)
const
{
74
return
m_BField
* cache.
scalor
;
75
}
76
88
Acts::Vector3D
getFieldGradient
(
89
const
Acts::Vector3D
&
/*position*/
,
90
Acts::ActsMatrixD<3, 3>
&
/*derivative*/
)
const
{
91
return
m_BField
;
92
}
93
106
Acts::Vector3D
getFieldGradient
(
const
Acts::Vector3D
&
/*position*/
,
107
Acts::ActsMatrixD<3, 3>
&
/*derivative*/
,
108
Cache
& cache)
const
{
109
return
m_BField
* cache.
scalor
;
110
}
111
118
bool
isInside
(
const
Acts::Vector3D
&
/*position*/
)
const
{
return
true
; }
119
125
void
setField
(
double
Bx,
double
By,
double
Bz
) {
m_BField
<< Bx, By,
Bz
; }
126
130
void
setField
(
const
Acts::Vector3D
& B) {
m_BField
= B; }
131
132
private
:
134
Acts::Vector3D
m_BField
;
135
};
136
137
}
// namespace BField
138
}
// namespace ActsExamples
acts
blob
sPHENIX
Examples
Detectors
MagneticField
include
ActsExamples
Plugins
BField
ScalableBField.hpp
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:25
using
1.8.2 with
EIC GitHub integration