ATLAS Offline Software
MagneticFieldProperties.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 inline Trk::MagneticFieldProperties::MagneticFieldProperties(
6  Trk::MagneticFieldMode mode)
7  : m_magneticFieldMode(mode)
8  , m_magneticField(0., 0., 0.)
9 {}
10 
11 inline Trk::MagneticFieldProperties::MagneticFieldProperties(
12  const Amg::Vector3D& field)
13  : m_magneticFieldMode(Trk::ConstantField)
14  , m_magneticField(field)
15 {}
16 
17 inline Trk::MagneticFieldProperties::operator MagneticFieldMode() const
18 {
19  return m_magneticFieldMode;
20 }
21 
22 inline Trk::MagneticFieldMode
23 Trk::MagneticFieldProperties::magneticFieldMode() const
24 {
25  return m_magneticFieldMode;
26 }
27 
28 inline const Amg::Vector3D&
29 Trk::MagneticFieldProperties::magneticField() const
30 {
31  if (m_magneticFieldMode != Trk::ConstantField)
32  throw GaudiException(
33  "Trk::MagneticFieldProperties",
34  "You can only ask for a field value if you have a constant field!",
35  StatusCode::FAILURE);
36  return m_magneticField;
37 }
38