Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
Analysis Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
sPHENIX
Alignment
CI
cmake
Core
docs
Examples
Algorithms
Detectors
ContextualDetector
DD4hepDetector
Geant4Detector
GenericDetector
MagneticField
include
ActsExamples
MagneticField
FieldMapRootIo.hpp
FieldMapTextIo.hpp
MagneticField.hpp
ScalableBField.hpp
ScalableBFieldService.hpp
src
MuonSpectrometerMockupDetector
TelescopeDetector
TGeoDetector
Framework
Io
Python
Run
Scripts
Fatras
Plugins
Tests
acts-fatras
analysis
analysis_tpc_prototype
coresoftware
Doxygen_Assist
g4exampledetector
GenFit
JETSCAPE
KFParticle
macros
online_distribution
OnlMon
prototype
pythia6
rcdaq
RDBC
tutorials
doxygen_mainpage.h
File Members
Examples
External Links
•
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-2020 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/Definitions/Algebra.hpp
"
12
#include "
Acts/MagneticField/MagneticFieldContext.hpp
"
13
#include "
Acts/MagneticField/MagneticFieldProvider.hpp
"
14
15
namespace
ActsExamples {
16
18
struct
ScalableBFieldContext
{
19
Acts::ActsScalar
scalor
= 1.;
20
};
21
23
class
ScalableBField
final :
public
Acts::MagneticFieldProvider
{
24
public
:
25
struct
Cache
{
26
Acts::ActsScalar
scalor
= 1.;
27
29
Cache
(
const
Acts::MagneticFieldContext
& mctx) {
30
scalor
= mctx.get<
const
ScalableBFieldContext
>().
scalor
;
31
}
32
};
33
37
explicit
ScalableBField
(
Acts::Vector3
B) :
m_BField
(std::
move
(B)) {}
38
44
ScalableBField
(
Acts::ActsScalar
Bx = 0,
Acts::ActsScalar
By = 0,
45
Acts::ActsScalar
Bz
= 0)
46
:
m_BField
(Bx, By,
Bz
) {}
47
56
Acts::Result<Acts::Vector3>
getField
(
57
const
Acts::Vector3
&
/*position*/
,
58
MagneticFieldProvider::Cache& gCache)
const override
{
59
Cache
& cache = gCache.get<
Cache
>();
60
return
Acts::Result<Acts::Vector3>::success
(
m_BField
* cache.
scalor
);
61
}
62
75
Acts::Result<Acts::Vector3>
getFieldGradient
(
76
const
Acts::Vector3
&
/*position*/
,
Acts::ActsMatrix<3, 3>
&
/*derivative*/
,
77
MagneticFieldProvider::Cache& gCache)
const override
{
78
Cache
& cache = gCache.get<
Cache
>();
79
return
Acts::Result<Acts::Vector3>::success
(
m_BField
* cache.
scalor
);
80
}
81
82
Acts::MagneticFieldProvider::Cache
makeCache
(
83
const
Acts::MagneticFieldContext
& mctx)
const override
{
84
return
Acts::MagneticFieldProvider::Cache::make<Cache>(mctx);
85
}
86
93
bool
isInside
(
const
Acts::Vector3
&
/*position*/
)
const
{
return
true
; }
94
100
void
setField
(
double
Bx,
double
By,
double
Bz
) {
m_BField
<< Bx, By,
Bz
; }
101
105
void
setField
(
const
Acts::Vector3
& B) {
m_BField
= B; }
106
107
private
:
109
Acts::Vector3
m_BField
;
110
};
// namespace BField
111
112
}
// namespace ActsExamples
acts
blob
sPHENIX
Examples
Detectors
MagneticField
include
ActsExamples
MagneticField
ScalableBField.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:37
using
1.8.2 with
sPHENIX GitHub integration