Belle II Software development
BFieldComponentConstant.cc
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#include <geometry/bfieldmap/BFieldComponentConstant.h>
10
11using namespace std;
12using namespace Belle2;
13
14ROOT::Math::XYZVector BFieldComponentConstant::calculate(const ROOT::Math::XYZVector& point) const
15{
16 if ((maxRadius4BField > 0.0 && maxRadius4BField < point.Rho()) ||
17 (point.Z() < minZ4BField || point.Z() > maxZ4BField)) return ROOT::Math::XYZVector(0, 0, 0);
18 return ROOT::Math::XYZVector(m_magneticField[0], m_magneticField[1], m_magneticField[2]);
19}
20
21
22void BFieldComponentConstant::setMagneticFieldValues(double x, double y, double z, double rmax, double zmin, double zmax)
23{
24 m_magneticField[0] = x;
25 m_magneticField[1] = y;
26 m_magneticField[2] = z;
27 maxRadius4BField = rmax; // unit [cm]
28 minZ4BField = zmin; // unit [cm]
29 maxZ4BField = zmax; // unit [cm]
30}
double maxZ4BField
The values for the maximum z position for the homogeneous field.
double maxRadius4BField
The values for the maximum radius for the homogeneous field.
virtual ROOT::Math::XYZVector calculate(const ROOT::Math::XYZVector &point) const override
Calculates the magnetic field vector at the specified space point.
void setMagneticFieldValues(double x, double y, double z, double rmax, double zmin, double zmax)
Sets the values for the homogeneous magnetic field vector.
double m_magneticField[3]
The values for the homogeneous magnetic field vector.
double minZ4BField
The values for the minimum z position for the homogeneous field.
Abstract base class for different kinds of events.
STL namespace.