ATLAS Offline Software
Loading...
Searching...
No Matches
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
18#include "CxxUtils/restrict.h"
19#include <cmath>
20
22{
23public:
24 // constructor
26 const double* p1,
27 const double* p2,
28 double curr)
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)
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
50private:
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
#define xyz
bool finite() const
Definition BFieldCond.h:45
BFieldCond(bool finite, const double *p1, const double *p2, double curr)
Definition BFieldCond.h:25
void scaleCurrent(double factor)
Definition BFieldCond.h:43
double m_nomCurr
Definition BFieldCond.h:60
double curr() const
Definition BFieldCond.h:48
const Eigen::Vector3d m_u
Definition BFieldCond.h:58
double p1(int i) const
Definition BFieldCond.h:46
void addBiotSavart(double scaleFactor, const double *ATH_RESTRICT xyz, double *ATH_RESTRICT B, double *ATH_RESTRICT deriv=nullptr) const
double p2(int i) const
Definition BFieldCond.h:47
const Eigen::Vector3d m_p1
Definition BFieldCond.h:58
double m_curr
Definition BFieldCond.h:59
bool m_finite
Definition BFieldCond.h:51
const Eigen::Vector3d m_p2
Definition BFieldCond.h:58
Macro wrapping the nonstandard restrict keyword.
#define ATH_RESTRICT
Definition restrict.h:31