Belle II Software  release-05-02-19
MagneticFieldComponentConstant.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/dbobjects/MagneticFieldComponent.h>
14 
15 namespace Belle2 {
21  class MagneticFieldComponentConstant final: public MagneticFieldComponent {
22  public:
32  MagneticFieldComponentConstant(const B2Vector3D& field, float minR, float maxR, float minZ,
33  float maxZ): MagneticFieldComponent(false),
34  m_field(field), m_minR(minR), m_maxR(maxR), m_minZ(minZ), m_maxZ(maxZ) {}
37  std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity(),
38  std::numeric_limits<float>::infinity()) {}
40  bool inside(const B2Vector3D& pos) const override
41  {
42  const float r = pos.Perp();
43  const float z = pos.Z();
44  return (r >= m_minR && r <= m_maxR && z >= m_minZ && z <= m_maxZ);
45  }
47  B2Vector3D getField(__attribute((unused)) const B2Vector3D& pos) const override { return m_field; }
48  private:
52  float m_minR{0};
54  float m_maxR{0};
56  float m_minZ{0};
58  float m_maxZ{0};
61  };
63 }; // Belle2 namespace
Belle2::MagneticFieldComponentConstant::m_maxR
float m_maxR
maximal R=sqrt(x^2+y^2) for which this field is present
Definition: MagneticFieldComponentConstant.h:62
Belle2::MagneticFieldComponentConstant::ClassDefOverride
ClassDefOverride(MagneticFieldComponentConstant, 1)
ROOT dictionary.
Belle2::MagneticFieldComponentConstant::getField
B2Vector3D getField(__attribute((unused)) const B2Vector3D &pos) const override
return the field assuming we are inside the active region as returned by inside()
Definition: MagneticFieldComponentConstant.h:55
Belle2::B2Vector3< double >
Belle2::MagneticFieldComponentConstant::MagneticFieldComponentConstant
MagneticFieldComponentConstant()
empty constructor for ROOT
Definition: MagneticFieldComponentConstant.h:32
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MagneticFieldComponentConstant::m_maxZ
float m_maxZ
maximal Z for which this field is present
Definition: MagneticFieldComponentConstant.h:66
Belle2::MagneticFieldComponent
Abstract base class for BField components.
Definition: MagneticFieldComponent.h:38
Belle2::MagneticFieldComponentConstant::m_minR
float m_minR
minimal R=sqrt(x^2+y^2) for which this field is present
Definition: MagneticFieldComponentConstant.h:60
Belle2::MagneticFieldComponentConstant::m_field
B2Vector3D m_field
magnetic field strength
Definition: MagneticFieldComponentConstant.h:58
Belle2::MagneticFieldComponentConstant
Describe one component of the Geometry.
Definition: MagneticFieldComponentConstant.h:29
Belle2::MagneticFieldComponentConstant::inside
bool inside(const B2Vector3D &pos) const override
return whether we are inside the active region for this component
Definition: MagneticFieldComponentConstant.h:48
Belle2::MagneticFieldComponent::MagneticFieldComponent
MagneticFieldComponent(bool exclusive)
Constructor.
Definition: MagneticFieldComponent.h:44
Belle2::MagneticFieldComponentConstant::m_minZ
float m_minZ
minimal Z for which this field is present
Definition: MagneticFieldComponentConstant.h:64