Belle II Software  release-05-02-19
geometry
Collaboration diagram for geometry:

Modules

 geometry data objects
 
 geometry modules
 

Namespaces

 Belle2::geometry
 Common code concerning the geometry representation of the detector.
 

Classes

class  BFieldComponent3d
 The BFieldComponent3d class. More...
 
class  BFieldComponentAbs
 The BFieldComponentAbs class. More...
 
class  BFieldComponentBeamline
 The BFieldComponentBeamline class. More...
 
class  BFieldComponentConstant
 The BFieldComponentConstant class. More...
 
class  BFieldComponentKlm1
 The Bfieldcomponentklm1 class. More...
 
class  BFieldComponentQuad
 The BFieldComponentQuad class. More...
 
class  BFieldComponentRadial
 The BFieldComponentRadial class. More...
 
class  BFieldFrameworkInterface
 Simple BFieldComponent to just wrap the existing BFieldMap with the new BFieldManager. More...
 
class  BFieldMap
 This class represents the magnetic field of the Belle II detector. More...
 
class  GeoMagneticField
 The GeoMagneticField class. More...
 
struct  triangle_t
 Triangle structure. More...
 
struct  xy_t
 A simple 2d vector stucture. More...
 
class  TriangularInterpolation
 The TriangularInterpolation class. More...
 
class  BeamlineFieldMapInterpolation
 The BeamlineFieldMapInterpolation class. More...
 
class  GeoComponent
 Describe one component of the Geometry. More...
 
class  GeoConfiguration
 configuration of the geometry More...
 
class  GeoMaterial
 Class to represent a material informaion in the Database. More...
 
class  GeoMaterialComponent
 Component of a material. More...
 
class  GeoMaterialProperty
 Property of a material. More...
 
class  GeoOpticalSurface
 Represent an optical finish of a surface. More...
 
class  MagneticFieldComponent3D
 Describe one component of the Geometry. More...
 
class  MyDBPayloadClass
 Class containing all the parameters needed to create the geometry and suitable to save into a ROOT file to be used from the Database. More...
 
class  MyDBCreator
 Very simple Creator class which actually does not do anything but shows how creators should implement loading the geometry from database. More...
 

Functions

BFieldComponentBeamline ** GetInstancePtr ()
 Static function holding the instance.
 
BFieldComponentRadial::BFieldPoint operator* (const BFieldComponentRadial::BFieldPoint &v, double a)
 multiply a radial bfield point by a real number
 
BFieldComponentRadial::BFieldPoint operator+ (const BFieldComponentRadial::BFieldPoint &u, const BFieldComponentRadial::BFieldPoint &v)
 Add two radial bfield points together.
 
template<class BFIELDCOMP >
BFIELDCOMP & addBFieldComponent ()
 Adds a new BField component to the Belle II magnetic field. More...
 
B2Vector3D getBField (const B2Vector3D &point) const
 Returns the magnetic field of the Belle II detector at the specified space point. More...
 
virtual void initialize () override
 Initializes the magnetic field component. More...
 
virtual ~BFieldComponentBeamline ()
 The BFieldComponentBeamline destructor.
 
bool isInRange (const B2Vector3D &point) const
 Check presence of beamline field at the specific space point in the detector coordinate frame. More...
 
virtual B2Vector3D calculate (const B2Vector3D &point) const override
 Calculates the magnetic field vector at the specified space point. More...
 
virtual void terminate () override
 Terminates the magnetic field component. More...
 
static BFieldComponentBeamlineInstance ()
 BFieldComponentBeamline instance. More...
 
 BFieldComponentBeamline ()
 The BFieldComponentBeamline constructor.
 
B2Vector3D getField (const B2Vector3D &pos) const override
 return the field assuming we are inside the active region as returned by inside() More...
 
B2Vector3D interpolate (unsigned int ir, unsigned int iphi, unsigned int iz, double wr, double wphi, double wz) const
 Linear interpolate the magnetic field inside a bin. More...
 

Detailed Description

Function Documentation

◆ addBFieldComponent()

BFIELDCOMP & addBFieldComponent

Adds a new BField component to the Belle II magnetic field.

The class of the magnetic field component has to inherit from BFieldComponentAbs.

Returns
A reference to the added magnetic field component.

Definition at line 109 of file BFieldMap.h.

110  {
111  B2Vector3D magFieldVec(0.0, 0.0, 0.0);
112  //Check that the point makes sense
113  if (std::isnan(point.X()) || std::isnan(point.Y()) || std::isnan(point.Z())) {
114  B2ERROR("Bfield requested for a position containing NaN, returning field 0");

◆ calculate()

B2Vector3D calculate ( const B2Vector3D point) const
overridevirtual

Calculates the magnetic field vector at the specified space point.

Parameters
pointThe space point in Cartesian coordinates (x,y,z) in [cm] at which the magnetic field vector should be calculated.
Returns
The magnetic field vector at the given space point in [T]. Returns a zero vector TVector(0,0,0) if the space point lies outside the region described by the component.

Implements BFieldComponentAbs.

Definition at line 663 of file BFieldComponentBeamline.cc.

664  {
665  B2Vector3D res;
667  B2Vector3D v = -p; // invert coordinates to match ANSYS one
668  double xc = v.x() * c, zs = v.z() * s, zc = v.z() * c, xs = v.x() * s;
669  B2Vector3D hv{xc - zs, v.y(), zc + xs};
670  B2Vector3D lv{xc + zs, v.y(), zc - xs};
673  B2Vector3D rhb{hb.x()* c + hb.z()* s, hb.y(), hb.z()* c - hb.x()* s};
674  B2Vector3D rlb{lb.x()* c - lb.z()* s, lb.y(), lb.z()* c + lb.x()* s};
675 
676  double mhb = std::abs(rhb.x()) + std::abs(rhb.y()) + std::abs(rhb.z());
677  double mlb = std::abs(rlb.x()) + std::abs(rlb.y()) + std::abs(rlb.z());
678 
679  if (mhb < 1e-10) res = rlb;
680  else if (mlb < 1e-10) res = rhb;
681  else {
682  res = 0.5 * (rlb + rhb);
683  }
684  return res;
685  }

◆ getBField()

B2Vector3D getBField ( const B2Vector3D point) const
inlineprivate

Returns the magnetic field of the Belle II detector at the specified space point.

The space point is given in Cartesian coordinates (x,y,z) in [cm].

Parameters
pointThe space point in Cartesian coordinates.
Returns
A three vector of the magnetic field in [T] at the specified space point.

Definition at line 117 of file BFieldMap.h.

◆ getField()

B2Vector3D getField ( const B2Vector3D pos) const
overridevirtual

return the field assuming we are inside the active region as returned by inside()

small helper function to calculate the bin index and fraction inside the index given a relative coordinate and the coordinate index (0=R, 1=Phi, 2=Z).

Example: If the z grid starts at 5 and goes to 15 with 6 points (pitch size of 2), then calling getIndexWeight(10.5, 2) will return tuple(2, 0.75) since the 10.5 lies in bin "2" and is already 75% to the next bin

It will also cap the index to be inside the valid grid range

Returns a tuple with the bin index as first element and the weight fraction inside the bin as second element

Implements MagneticFieldComponent.

Definition at line 91 of file MagneticFieldComponent3D.cc.

92  {
93  using std::get;
94 
108  auto getIndexWeight = [this](double value, int coordinate) -> std::tuple<unsigned int, double> {
109  double weight = value * m_invgridPitch[coordinate];
110  auto index = static_cast<unsigned int>(weight);
111  index = std::min(index, static_cast<unsigned int>(m_mapSize[coordinate] - 2));
112  weight -= index;
113  return std::make_tuple(index, weight);
114  };
115 
116  const double z = pos.z();
117  const double r2 = pos.Perp2();
118 
119  // Calculate the lower index of the point in the Z grid
120  // Note that z coordinate is inverted to match ANSYS frame
121  const auto iz = getIndexWeight(m_maxZ - z, 2);
122 
123  // directly on z axis: get B-field values from map in cartesian system assuming phi=0, so Bx = Br and By = Bphi
124  if (r2 == 0) return interpolate(0, 0, get<0>(iz), 0, 0, get<1>(iz));
125 
126  const double r = std::sqrt(r2);
127  const auto ir = getIndexWeight(r - m_minR, 0);
128 
129  // Calculate the lower index of the point in the Phi grid
130  const double ay = std::abs(pos.y());
131  const auto iphi = getIndexWeight(fast_atan2_minimax<4>(ay, pos.x()), 1);
132 
133  // Get B-field values from map in cylindrical coordinates
134  B2Vector3D b = interpolate(get<0>(ir), get<0>(iphi), get<0>(iz), get<1>(ir), get<1>(iphi), get<1>(iz));
135  // and convert it to cartesian
136  const double norm = 1 / r;
137  const double s = ay * norm;
138  const double c = pos.x() * norm;
139  // Flip sign of By if y<0
140  const double sgny = (pos.y() >= 0) - (pos.y() < 0);
141  // in cartesian system
142  return B2Vector3D(-(b.x() * c - b.y() * s), -sgny * (b.x() * s + b.y() * c), b.z());
143  }

◆ initialize()

void initialize ( )
overridevirtual

Initializes the magnetic field component.

This method opens the magnetic field map file.

Reimplemented from BFieldComponentAbs.

Definition at line 638 of file BFieldComponentBeamline.cc.

◆ Instance()

BFieldComponentBeamline & Instance ( )
static

BFieldComponentBeamline instance.

static function

Returns
reference to the BFieldComponentBeamline instance

Definition at line 699 of file BFieldComponentBeamline.cc.

◆ interpolate()

B2Vector3D interpolate ( unsigned int  ir,
unsigned int  iphi,
unsigned int  iz,
double  wr,
double  wphi,
double  wz 
) const
private

Linear interpolate the magnetic field inside a bin.

Parameters
irnumber of the bin in r
iphinumber of the bin in phi
iznumber of the bin in z
wrr weight: fraction we are away from the lower r corner relative to the pitch size
wphiphi weight: fraction we are away from the lower phi corner relative to the pitch size
wzphi weight: fraction we are away from the lower z corner relative to the pitch size

Definition at line 145 of file MagneticFieldComponent3D.cc.

◆ isInRange()

bool isInRange ( const B2Vector3D point) const

Check presence of beamline field at the specific space point in the detector coordinate frame.

Parameters
pointThe space point in Cartesian coordinates (x,y,z) in [cm] at which the magnetic field presence is chcked
Returns
true is in case of the magnetic field false – otherwise

Definition at line 652 of file BFieldComponentBeamline.cc.

◆ terminate()

void terminate ( )
overridevirtual

Terminates the magnetic field component.

This method closes the magnetic field map file.

Reimplemented from BFieldComponentAbs.

Definition at line 687 of file BFieldComponentBeamline.cc.

Belle2::MagneticFieldComponent3D::interpolate
B2Vector3D interpolate(unsigned int ir, unsigned int iphi, unsigned int iz, double wr, double wphi, double wz) const
Linear interpolate the magnetic field inside a bin.
Definition: MagneticFieldComponent3D.cc:145
Belle2::MagneticFieldComponent3D::m_maxZ
float m_maxZ
maximal Z for which this field is present
Definition: MagneticFieldComponent3D.h:70
Belle2::B2Vector3::x
DataType x() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:424
Belle2::BeamlineFieldMapInterpolation::interpolateField
B2Vector3D interpolateField(const B2Vector3D &v) const
Interpolate the magnetic field vector at the specified space point.
Definition: BFieldComponentBeamline.cc:546
Belle2::MagneticFieldComponent3D::m_invgridPitch
float m_invgridPitch[3]
inverted grid pitch in r, phi and z
Definition: MagneticFieldComponent3D.h:76
Belle2::BFieldComponentBeamline::m_ler
BeamlineFieldMapInterpolation * m_ler
Actual magnetic field interpolation object for LER.
Definition: BFieldComponentBeamline.h:160
Belle2::MagneticFieldComponent3D::m_minR
float m_minR
minimal R=sqrt(x^2+y^2) for which this field is present
Definition: MagneticFieldComponent3D.h:64
Belle2::BFieldComponentBeamline::m_sinBeamCrossAngle
double m_sinBeamCrossAngle
The sin of the crossing angle of the beams
Definition: BFieldComponentBeamline.h:154
Belle2::B2Vector3D
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:507
Belle2::MagneticFieldComponent3D::m_mapSize
int m_mapSize[3]
number of bins in r, phi and z
Definition: MagneticFieldComponent3D.h:72
Belle2::BFieldComponentBeamline::m_her
BeamlineFieldMapInterpolation * m_her
Actual magnetic field interpolation object for HER.
Definition: BFieldComponentBeamline.h:158
Belle2::BFieldComponentBeamline::m_cosBeamCrossAngle
double m_cosBeamCrossAngle
The cos of the crossing angle of the beams
Definition: BFieldComponentBeamline.h:156