ATLAS Offline Software
BFieldVector.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //
6 // BFieldVector.h
7 // Magnetic field value stored in the map.
8 // We allow short (usual case) double (special case)
9 //
10 // Masahiro Morii, Harvard University
11 //
12 // Athena MT RD Schaffer , C Anastopoulos
13 //
14 #ifndef BFIELDVECTOR_H
15 #define BFIELDVECTOR_H
16 
17 #include <array>
18 #include <cstdlib>
19 
20 template<class T>
22 {
23 public:
24  static_assert(
26  "Type for the BField Vector must be one of short or double");
27 
28  // Default
29  BFieldVector() = default; // cppcheck-suppress uninitMemberVar; m_B uninit on purpose
30  BFieldVector(const BFieldVector&) = default;
31  BFieldVector(BFieldVector&&) = default;
32  BFieldVector& operator=(const BFieldVector&) = default;
34  ~BFieldVector() = default;
35 
36  BFieldVector(T Bz, T Br, T Bphi)
37  : m_B{ Bz, Br, Bphi }
38  {}
39  // setter
40  void set(T Bz, T Br, T Bphi) { m_B = { Bz, Br, Bphi }; }
41 
42  // accessors
43  T z() const { return m_B[0]; }
44  T r() const { return m_B[1]; }
45  T phi() const { return m_B[2]; }
46  // array-like accessor
47  T operator[](size_t i) const { return m_B[i]; }
48 
49 private:
50  std::array<T, 3> m_B;
51 };
52 
53 #endif
BFieldVector::z
T z() const
Definition: BFieldVector.h:43
BFieldVector::BFieldVector
BFieldVector(const BFieldVector &)=default
BFieldVector::phi
T phi() const
Definition: BFieldVector.h:45
BFieldVector::set
void set(T Bz, T Br, T Bphi)
Definition: BFieldVector.h:40
BFieldVector::BFieldVector
BFieldVector()=default
athena.value
value
Definition: athena.py:124
BFieldVector::operator=
BFieldVector & operator=(const BFieldVector &)=default
BFieldVector::BFieldVector
BFieldVector(T Bz, T Br, T Bphi)
Definition: BFieldVector.h:36
Br
Definition: VP1BPhysConvertor.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:85
BFieldVector::~BFieldVector
~BFieldVector()=default
BFieldVector::r
T r() const
Definition: BFieldVector.h:44
BFieldVector::operator=
BFieldVector & operator=(BFieldVector &&)=default
BFieldVector::m_B
std::array< T, 3 > m_B
Definition: BFieldVector.h:50
BFieldVector
Definition: BFieldVector.h:22
BFieldVector::BFieldVector
BFieldVector(BFieldVector &&)=default
BFieldVector::operator[]
T operator[](size_t i) const
Definition: BFieldVector.h:47
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35