Belle II Software development
TwoHitVariables Class Reference

Class that allows the calculation of simple variables to check whether a combination of two hits should be used or discarded in tracking. More...

#include <TwoHitVariables.h>

Public Member Functions

 TwoHitVariables (const B2Vector3D &oHit, const B2Vector3D &iHit)
 Constructor.
 
void setHits (const B2Vector3D &oHit, const B2Vector3D &iHit)
 Set hits if not given in constructor of if they need to be changed.
 
double getCosXY ()
 calculate the cosine of the angle between two vectors in x-y
 
double get1DZDistance ()
 get the difference in z between two vectors
 
double get1DZDistanceSquared ()
 get the squared difference in z between two vectors
 
double get2DXYDistanceSquared ()
 get the squared distance between two vectors in x-y
 
double get3DDistanceSquared ()
 get the square of the difference of two vectors
 
double getRZSlope ()
 get an estimate for the slope in R-z, similar to theta
 
double getDistanceInTimeU (const SpacePoint &outerSpacePoint, const SpacePoint &innerSpacePoint)
 get the time difference of two space points for the u-side measurement
 
double getDistanceInTimeV (const SpacePoint &outerSpacePoint, const SpacePoint &innerSpacePoint)
 get the time difference of two space points for the v-side measurement
 
void setBFieldZ (const double bfieldZ=1.5)
 Set the B-Field value used for pT calculations.
 

Private Attributes

double m_BFieldZ = 1.5
 BField along z to estimate pT.
 
B2Vector3D m_oHit
 outermost hit position
 
B2Vector3D m_iHit
 innermost hit position
 

Detailed Description

Class that allows the calculation of simple variables to check whether a combination of two hits should be used or discarded in tracking.

Definition at line 23 of file TwoHitVariables.h.

Constructor & Destructor Documentation

◆ TwoHitVariables()

TwoHitVariables ( const B2Vector3D oHit,
const B2Vector3D iHit 
)
inline

Constructor.

Parameters
oHitB2Vector3D of the outer hit used for calculating the single variables
iHitB2Vector3D of the inner hit used for calculating the single variables

Definition at line 28 of file TwoHitVariables.h.

28 : m_oHit(oHit), m_iHit(iHit)
29 {};
B2Vector3D m_oHit
outermost hit position
B2Vector3D m_iHit
innermost hit position

Member Function Documentation

◆ get1DZDistance()

double get1DZDistance ( )
inline

get the difference in z between two vectors

Definition at line 47 of file TwoHitVariables.h.

48 {
49 return m_oHit.Z() - m_iHit.Z();
50 }
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:435

◆ get1DZDistanceSquared()

double get1DZDistanceSquared ( )
inline

get the squared difference in z between two vectors

Definition at line 53 of file TwoHitVariables.h.

54 {
55 return (m_oHit.Z() - m_iHit.Z()) * (m_oHit.Z() - m_iHit.Z());
56 }

◆ get2DXYDistanceSquared()

double get2DXYDistanceSquared ( )
inline

get the squared distance between two vectors in x-y

Definition at line 59 of file TwoHitVariables.h.

60 {
61 return (m_oHit - m_iHit).Perp2();
62 }

◆ get3DDistanceSquared()

double get3DDistanceSquared ( )
inline

get the square of the difference of two vectors

Definition at line 65 of file TwoHitVariables.h.

66 {
67 return (m_oHit - m_iHit).Mag2();
68 }

◆ getCosXY()

double getCosXY ( )
inline

calculate the cosine of the angle between two vectors in x-y

Definition at line 41 of file TwoHitVariables.h.

42 {
43 return (m_oHit.X() * m_iHit.X() + m_oHit.Y() * m_iHit.Y()) / (m_oHit.Perp() * m_iHit.Perp());
44 }
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:431
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:433
DataType Perp() const
The transverse component (R in cylindrical coordinate system).
Definition: B2Vector3.h:200

◆ getDistanceInTimeU()

double getDistanceInTimeU ( const SpacePoint outerSpacePoint,
const SpacePoint innerSpacePoint 
)
inline

get the time difference of two space points for the u-side measurement

Parameters
outerSpacePointouter space point used for calculating the time difference in u
innerSpacePointinner space point used for calculating the time difference in u

Definition at line 87 of file TwoHitVariables.h.

88 {
89 return outerSpacePoint.TimeU() - innerSpacePoint.TimeU();
90 }

◆ getDistanceInTimeV()

double getDistanceInTimeV ( const SpacePoint outerSpacePoint,
const SpacePoint innerSpacePoint 
)
inline

get the time difference of two space points for the v-side measurement

Parameters
outerSpacePointouter space point used for calculating the time difference in v
innerSpacePointinner space point used for calculating the time difference in v

Definition at line 95 of file TwoHitVariables.h.

96 {
97 return outerSpacePoint.TimeV() - innerSpacePoint.TimeV();
98 }

◆ getRZSlope()

double getRZSlope ( )
inline

get an estimate for the slope in R-z, similar to theta

Definition at line 71 of file TwoHitVariables.h.

72 {
73 double result = atan(
74 sqrt(std::pow(double(m_oHit.X() - m_iHit.X()), 2)
75 + std::pow(double(m_oHit.Y() - m_iHit.Y()), 2)) /
76 double(m_oHit.Z() - m_iHit.Z()));
77 // atan also returns negative angles, so map back to [0,Pi] otherwise one get two peaks at +/-Pi/2 for 90 degree angles
78 if (result < 0.0) result += M_PI;
79
80 // TODO: check if 0 is a good default return value in the case z_i==z_o!
81 return (std::isnan(result) || std::isinf(result)) ? double(0) : result;
82 }
double atan(double a)
atan for double
Definition: beamHelpers.h:34
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ setBFieldZ()

void setBFieldZ ( const double  bfieldZ = 1.5)
inline

Set the B-Field value used for pT calculations.

Parameters
bfieldZB-Field value to be used

Definition at line 102 of file TwoHitVariables.h.

102{ m_BFieldZ = bfieldZ; }
double m_BFieldZ
BField along z to estimate pT.

◆ setHits()

void setHits ( const B2Vector3D oHit,
const B2Vector3D iHit 
)
inline

Set hits if not given in constructor of if they need to be changed.

Parameters
oHitB2Vector3D of the outer hit used for calculating the single variables
iHitB2Vector3D of the inner hit used for calculating the single variables

Definition at line 34 of file TwoHitVariables.h.

35 {
36 m_oHit = oHit;
37 m_iHit = iHit;
38 }

Member Data Documentation

◆ m_BFieldZ

double m_BFieldZ = 1.5
private

BField along z to estimate pT.

Definition at line 106 of file TwoHitVariables.h.

◆ m_iHit

B2Vector3D m_iHit
private

innermost hit position

Definition at line 110 of file TwoHitVariables.h.

◆ m_oHit

B2Vector3D m_oHit
private

outermost hit position

Definition at line 108 of file TwoHitVariables.h.


The documentation for this class was generated from the following file: