ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MagneticField
MagFieldElements
MagFieldElements
BFieldCond.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
//
6
// BFieldCond.h
7
//
8
// Current conductors used in BFieldZone.
9
// It may be finite : p1 to p2.
10
// It may be infinite : passing p1 and direction parallel to p2.
11
//
12
// Masahiro Morii, Harvard University
13
//
14
#ifndef BFIELDCOND_H
15
#define BFIELDCOND_H
16
17
#include "
EventPrimitives/EventPrimitives.h
"
18
#include "
CxxUtils/restrict.h
"
19
#include <cmath>
20
21
class
BFieldCond
22
{
23
public
:
24
// constructor
25
BFieldCond
(
bool
finite
,
26
const
double
*
p1
,
27
const
double
*
p2
,
28
double
curr
)
29
:
m_finite
(
finite
)
30
,
m_p1
(Eigen::Map<
const
Eigen::Vector3d>(
p1
))
31
,
m_p2
(Eigen::Map<
const
Eigen::Vector3d>(
p2
))
32
,
m_u
(
finite
? (
m_p2
-
m_p1
).normalized() :
m_p2
)
33
,
m_curr
(
curr
)
34
,
m_nomCurr
(
curr
)
35
{}
36
37
// compute magnetic field, plus derivatives if requested, and add
38
void
addBiotSavart
(
double
scaleFactor,
39
const
double
*
ATH_RESTRICT
xyz
,
40
double
*
ATH_RESTRICT
B,
41
double
*
ATH_RESTRICT
deriv =
nullptr
)
const
;
42
// scale the current wrt the nominal current
43
void
scaleCurrent
(
double
factor) {
m_curr
= factor *
m_nomCurr
; }
44
// accessors
45
bool
finite
()
const
{
return
m_finite
; }
46
double
p1
(
int
i)
const
{
return
m_p1
[i]; }
47
double
p2
(
int
i)
const
{
return
m_p2
[i]; }
48
double
curr
()
const
{
return
m_curr
; }
49
50
private
:
51
bool
m_finite
;
// true if the conductor is finite in length
52
53
/*
54
* m_p1: One end of a finite conductor, or one point on an infinite conductor
55
* m_p2: The other end of a finite conductor, or the direction vector of an
56
* infinite conductor m_u : Direction vector (= m_p2 if infinite)
57
*/
58
const
Eigen::Vector3d
m_p1
,
m_p2
,
m_u
;
59
double
m_curr
;
// current (in A) flowing through the conductor
60
double
m_nomCurr
;
// nominal current (in A) read from the map file
61
};
62
#endif
EventPrimitives.h
xyz
#define xyz
BFieldCond::finite
bool finite() const
Definition
BFieldCond.h:45
BFieldCond::BFieldCond
BFieldCond(bool finite, const double *p1, const double *p2, double curr)
Definition
BFieldCond.h:25
BFieldCond::scaleCurrent
void scaleCurrent(double factor)
Definition
BFieldCond.h:43
BFieldCond::m_nomCurr
double m_nomCurr
Definition
BFieldCond.h:60
BFieldCond::curr
double curr() const
Definition
BFieldCond.h:48
BFieldCond::m_u
const Eigen::Vector3d m_u
Definition
BFieldCond.h:58
BFieldCond::p1
double p1(int i) const
Definition
BFieldCond.h:46
BFieldCond::addBiotSavart
void addBiotSavart(double scaleFactor, const double *ATH_RESTRICT xyz, double *ATH_RESTRICT B, double *ATH_RESTRICT deriv=nullptr) const
Definition
BFieldCond.cxx:21
BFieldCond::p2
double p2(int i) const
Definition
BFieldCond.h:47
BFieldCond::m_p1
const Eigen::Vector3d m_p1
Definition
BFieldCond.h:58
BFieldCond::m_curr
double m_curr
Definition
BFieldCond.h:59
BFieldCond::m_finite
bool m_finite
Definition
BFieldCond.h:51
BFieldCond::m_p2
const Eigen::Vector3d m_p2
Definition
BFieldCond.h:58
const
restrict.h
Macro wrapping the nonstandard restrict keyword.
ATH_RESTRICT
#define ATH_RESTRICT
Definition
restrict.h:31
Generated on
for ATLAS Offline Software by
1.17.0