Belle II Software  release-08-01-10
MagneticFieldComponentConstant.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/dbobjects/MagneticFieldComponent.h>
12 
13 namespace Belle2 {
20  public:
30  MagneticFieldComponentConstant(const ROOT::Math::XYZVector& field, float minR, float maxR, float minZ,
31  float maxZ): MagneticFieldComponent(false),
32  m_field(field), m_minR(minR), m_maxR(maxR), m_minZ(minZ), m_maxZ(maxZ) {}
34  explicit MagneticFieldComponentConstant(const ROOT::Math::XYZVector& field): MagneticFieldComponentConstant(field, 0,
35  std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity(),
36  std::numeric_limits<float>::infinity()) {}
38  bool inside(const ROOT::Math::XYZVector& pos) const override
39  {
40  const float r = pos.Rho();
41  const float z = pos.Z();
42  return (r >= m_minR && r <= m_maxR && z >= m_minZ && z <= m_maxZ);
43  }
45  ROOT::Math::XYZVector getField(__attribute((unused)) const ROOT::Math::XYZVector& pos) const override { return m_field; }
46  private:
48  ROOT::Math::XYZVector m_field;
50  float m_minR{0};
52  float m_maxR{0};
54  float m_minZ{0};
56  float m_maxZ{0};
59  };
61 }; // Belle2 namespace
Describe one component of the Geometry.
bool inside(const ROOT::Math::XYZVector &pos) const override
return whether we are inside the active region for this component
MagneticFieldComponentConstant(const ROOT::Math::XYZVector &field)
constructor for unlimited field
ROOT::Math::XYZVector getField(__attribute((unused)) const ROOT::Math::XYZVector &pos) const override
return the field assuming we are inside the active region as returned by inside()
ClassDefOverride(MagneticFieldComponentConstant, 2)
ROOT dictionary.
float m_maxR
maximal R=sqrt(x^2+y^2) for which this field is present
float m_maxZ
maximal Z for which this field is present
MagneticFieldComponentConstant()
empty constructor for ROOT
ROOT::Math::XYZVector m_field
magnetic field strength
MagneticFieldComponentConstant(const ROOT::Math::XYZVector &field, float minR, float maxR, float minZ, float maxZ)
full constructor
float m_minZ
minimal Z for which this field is present
float m_minR
minimal R=sqrt(x^2+y^2) for which this field is present
Abstract base class for BField components.
Abstract base class for different kinds of events.