ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
BFieldCond Class Reference

#include <BFieldCond.h>

Collaboration diagram for BFieldCond:

Public Member Functions

 BFieldCond (bool finite, const double *p1, const double *p2, double curr)
 
void addBiotSavart (double scaleFactor, const double *ATH_RESTRICT xyz, double *ATH_RESTRICT B, double *ATH_RESTRICT deriv=nullptr) const
 
void scaleCurrent (double factor)
 
bool finite () const
 
double p1 (int i) const
 
double p2 (int i) const
 
double curr () const
 

Private Attributes

bool m_finite
 
const Eigen::Vector3d m_p1
 
const Eigen::Vector3d m_p2
 
const Eigen::Vector3d m_u
 
double m_curr
 
double m_nomCurr
 

Detailed Description

Definition at line 21 of file BFieldCond.h.

Constructor & Destructor Documentation

◆ BFieldCond()

BFieldCond::BFieldCond ( bool  finite,
const double *  p1,
const double *  p2,
double  curr 
)
inline

Definition at line 25 of file BFieldCond.h.

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  {}

Member Function Documentation

◆ addBiotSavart()

ATH_FLATTEN void BFieldCond::addBiotSavart ( double  scaleFactor,
const double *ATH_RESTRICT  xyz,
double *ATH_RESTRICT  B,
double *ATH_RESTRICT  deriv = nullptr 
) const

Definition at line 21 of file BFieldCond.cxx.

25 {
26  static const double mu04pi = 1.0e-7; // mu_0/4pi
27  static const double minvsq = 10. * 10.; // (1 cm)^2
28 
29  const Eigen::Map<const Eigen::Vector3d> pos(xyz);
30  Eigen::Map<Eigen::Vector3d> B(B_in);
31 
32  const Eigen::Vector3d r1 = pos - m_p1;
33  const Eigen::Vector3d r2 = pos - m_p2;
34  const Eigen::Vector3d v = m_u.cross(r1);
35  const double vsq = std::max(v.squaredNorm(), minvsq);
36 
37  const double r1u = r1.dot(m_u);
38 
39  const double r2u = r2.dot(m_u);
40  const double r1n = r1.norm();
41 
42  const double r2n = r2.norm();
43 
44  const double f0 = mu04pi * m_curr * scaleFactor / vsq;
45  const double f1 = f0 * (m_finite ? r1u / r1n - r2u / r2n : 2.0);
46  const double f2 = 2.0 * f1 / vsq;
47 
48  B += f1 * v;
49 
50  if (deriv) {
51  Eigen::Map<Eigen::Matrix<double, 3, 3, Eigen::RowMajor>> D(deriv);
52 
53  D(0, 1) -= f1 * m_u(2);
54  D(0, 2) += f1 * m_u(1);
55  D(1, 0) += f1 * m_u(2);
56  D(1, 2) -= f1 * m_u(0);
57  D(2, 0) -= f1 * m_u(1);
58  D(2, 1) += f1 * m_u(0);
59 
60  if (vsq > minvsq) {
61  Eigen::Vector3d w = f2 * (m_u * r1u - r1);
62 
63  if (m_finite) {
64  // Finite conductor segment
65  w += f0 * ((m_u - r1 * r1u / (r1n * r1n)) / r1n -
66  (m_u - r2 * r2u / (r2n * r2n)) / r2n);
67  }
68 
69  D += v * w.transpose();
70  }
71  }
72 }

◆ curr()

double BFieldCond::curr ( ) const
inline

Definition at line 48 of file BFieldCond.h.

48 { return m_curr; }

◆ finite()

bool BFieldCond::finite ( ) const
inline

Definition at line 45 of file BFieldCond.h.

45 { return m_finite; }

◆ p1()

double BFieldCond::p1 ( int  i) const
inline

Definition at line 46 of file BFieldCond.h.

46 { return m_p1[i]; }

◆ p2()

double BFieldCond::p2 ( int  i) const
inline

Definition at line 47 of file BFieldCond.h.

47 { return m_p2[i]; }

◆ scaleCurrent()

void BFieldCond::scaleCurrent ( double  factor)
inline

Definition at line 43 of file BFieldCond.h.

43 { m_curr = factor * m_nomCurr; }

Member Data Documentation

◆ m_curr

double BFieldCond::m_curr
private

Definition at line 59 of file BFieldCond.h.

◆ m_finite

bool BFieldCond::m_finite
private

Definition at line 51 of file BFieldCond.h.

◆ m_nomCurr

double BFieldCond::m_nomCurr
private

Definition at line 60 of file BFieldCond.h.

◆ m_p1

const Eigen::Vector3d BFieldCond::m_p1
private

Definition at line 58 of file BFieldCond.h.

◆ m_p2

const Eigen::Vector3d BFieldCond::m_p2
private

Definition at line 58 of file BFieldCond.h.

◆ m_u

const Eigen::Vector3d BFieldCond::m_u
private

Definition at line 58 of file BFieldCond.h.


The documentation for this class was generated from the following files:
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
BFieldCond::p1
double p1(int i) const
Definition: BFieldCond.h:46
BFieldCond::curr
double curr() const
Definition: BFieldCond.h:48
xyz
#define xyz
MCP::ScaleSmearParam::r2
@ r2
BFieldCond::m_nomCurr
double m_nomCurr
Definition: BFieldCond.h:60
read_hist_ntuple.f2
f2
Definition: read_hist_ntuple.py:20
BFieldCond::m_p1
const Eigen::Vector3d m_p1
Definition: BFieldCond.h:58
BFieldCond::m_finite
bool m_finite
Definition: BFieldCond.h:51
lumiFormat.i
int i
Definition: lumiFormat.py:85
BFieldCond::m_u
const Eigen::Vector3d m_u
Definition: BFieldCond.h:58
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.PyAthena.v
v
Definition: PyAthena.py:154
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
MCP::ScaleSmearParam::r1
@ r1
BFieldCond::m_p2
const Eigen::Vector3d m_p2
Definition: BFieldCond.h:58
BFieldCond::p2
double p2(int i) const
Definition: BFieldCond.h:47
BFieldCond::m_curr
double m_curr
Definition: BFieldCond.h:59
BFieldCond::finite
bool finite() const
Definition: BFieldCond.h:45
read_hist_ntuple.f1
f1
Definition: read_hist_ntuple.py:4