Belle II Software  release-05-01-25
BFieldComponentConstant.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2011 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Andreas Moll *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <geometry/bfieldmap/BFieldComponentConstant.h>
12 
13 using namespace std;
14 using namespace Belle2;
15 
16 B2Vector3D BFieldComponentConstant::calculate(const B2Vector3D& point) const
17 {
18  if ((maxRadius4BField > 0.0 && maxRadius4BField < point.Perp()) ||
19  (point.z() < minZ4BField || point.z() > maxZ4BField)) return B2Vector3D(0, 0, 0);
20  return B2Vector3D(m_magneticField);
21 }
22 
23 
24 void BFieldComponentConstant::setMagneticFieldValues(double x, double y, double z, double rmax, double zmin, double zmax)
25 {
26  m_magneticField[0] = x;
27  m_magneticField[1] = y;
28  m_magneticField[2] = z;
29  maxRadius4BField = rmax; // unit [cm]
30  minZ4BField = zmin; // unit [cm]
31  maxZ4BField = zmax; // unit [cm]
32 }
Belle2::B2Vector3::Perp
DataType Perp() const
The transverse component (R in cylindrical coordinate system).
Definition: B2Vector3.h:199
Belle2::B2Vector3< double >
Belle2::B2Vector3D
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:507
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::B2Vector3::z
DataType z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:428