Belle II Software  release-08-01-10
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 
11 using namespace std;
12 using namespace Belle2;
13 
14 ROOT::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 
22 void 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 }
Abstract base class for different kinds of events.