Belle II Software  release-05-02-19
SelectionVariableHelper.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jakob Lettenbichler (jakob.lettenbichler@oeaw.ac.at *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 namespace Belle2 {
22  template<class PointType, class DataType>
23  struct SelVarHelper {
24 
25 
31  static DataType s_MagneticFieldFactor; // = 1.5 * 0.00299710;
32 
33 
39  static void resetMagneticField(DataType magneticFieldStrength = 1.5) { SelVarHelper::s_MagneticFieldFactor = magneticFieldStrength * 0.00299710; }
40 
41 
43  static DataType calcPerp2(const PointType& aHit)
44  { return (aHit.X() * aHit.X() + aHit.Y() * aHit.Y()); }
45 
46 
48  static DataType calcPerp(const PointType& aHit) { return sqrt(calcPerp2(aHit)); }
49 
50 
52  static DataType calcMag2(const PointType& aHit)
53  { return (aHit.X() * aHit.X() + aHit.Y() * aHit.Y() + aHit.Z() * aHit.Z()); }
54 
55 
57  static DataType calcMag(const PointType& aHit) { return sqrt(calcMag2(aHit)); }
58 
59 
61  static DataType calcDot(const PointType& aHit, const PointType& bHit)
62  { return (aHit.X() * bHit.X() + aHit.Y() * bHit.Y() + aHit.Z() * bHit.Z()); }
63 
65  static DataType calcPt(DataType radius, DataType field = SelVarHelper::s_MagneticFieldFactor)
66  {
67  // TODO WARNING hardcoded value, is there a quasi-global value for such cases (this case, minimal accepted radius)
68  // if (fabs(radius) < 0.0000001) { throw (Circle_too_small() << radius << 0.0000001); }
69 
70  //WARNING: does not care for negative radius!!
71  return field * radius;
72  } // return unit: GeV/c
73 
74  };
75 
76  template<typename PointType, typename DataType> DataType SelVarHelper<PointType, DataType>::s_MagneticFieldFactor = 1.5 *
77  0.00299710;
78 
80 }
Belle2::SelVarHelper::calcMag2
static DataType calcMag2(const PointType &aHit)
returns the magnitude squared of given pointType.
Definition: SelectionVariableHelper.h:60
Belle2::SelVarHelper
contains a collection of functions and related stuff needed for SelectionVariables implementing 2-,...
Definition: SelectionVariableHelper.h:31
Belle2::SelVarHelper::calcPerp2
static DataType calcPerp2(const PointType &aHit)
returns the perpendicular magnitude squared of given pointType.
Definition: SelectionVariableHelper.h:51
Belle2::SelVarHelper::calcPerp
static DataType calcPerp(const PointType &aHit)
returns the perpendicular magnitude of given pointType.
Definition: SelectionVariableHelper.h:56
Belle2::SelVarHelper::s_MagneticFieldFactor
static DataType s_MagneticFieldFactor
is factor containing speed of light (c), the magnetic field (b) and the scaling factor s for conversi...
Definition: SelectionVariableHelper.h:39
Belle2::SelVarHelper::resetMagneticField
static void resetMagneticField(DataType magneticFieldStrength=1.5)
Overrides standard-Setup for magnetic field.
Definition: SelectionVariableHelper.h:47
Belle2::SelVarHelper::calcPt
static DataType calcPt(DataType radius, DataType field=SelVarHelper::s_MagneticFieldFactor)
calculates the estimation of the transverse momentum of given radius using defined strength of magnet...
Definition: SelectionVariableHelper.h:73
Belle2::SelVarHelper::calcMag
static DataType calcMag(const PointType &aHit)
returns the magnitude of given pointType.
Definition: SelectionVariableHelper.h:65
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SelVarHelper::calcDot
static DataType calcDot(const PointType &aHit, const PointType &bHit)
returns scalar product of given two pointTypes.
Definition: SelectionVariableHelper.h:69