Belle II Software  release-05-01-25
Angle3DSimple.h
1 /**************************************************************************
2 * BASF2 (Belle Analysis Framework 2) *
3 * Copyright(C) 2014 - 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 #include <tracking/trackFindingVXD/filterMap/filterFramework/SelectionVariable.h>
14 #include <framework/geometry/B2Vector3.h>
15 
16 #include <cmath>
17 
18 #define ANGLE3DSIMPLE_NAME Angle3DSimple
19 
20 namespace Belle2 {
30  template <typename PointType >
31  class ANGLE3DSIMPLE_NAME : public SelectionVariable< PointType , 3, double > {
32  public:
35 
37  static double value(const PointType& outerHit, const PointType& centerHit, const PointType& innerHit)
38  {
39 
40  B2Vector3<double> outerVector(outerHit.X() - centerHit.X(), outerHit.Y() - centerHit.Y(), outerHit.Z() - centerHit.Z());
41  B2Vector3<double> innerVector(centerHit.X() - innerHit.X(), centerHit.Y() - innerHit.Y(), centerHit.Z() - innerHit.Z());
42 
43  // fullCalc would be acos(m_vecAB.Dot(m_vecBC) / m_vecAB.Mag()*m_vecBC.Mag()), but here time-consuming parts have been neglected
44  double result = outerVector.Dot(innerVector) / (outerVector.Mag2() * innerVector.Mag2());
45  return (std::isnan(result) || std::isinf(result)) ? double(0) : result;
46  }
47  };
48 
50 }
Belle2::ANGLE3DSIMPLE_NAME
calculates the angle between the hits/vectors (3D), returning unit: none (calculation for degrees is ...
Definition: Angle3DSimple.h:31
Belle2::B2Vector3< double >
Belle2::B2Vector3::Dot
DataType Dot(const B2Vector3< DataType > &p) const
Scalar product.
Definition: B2Vector3.h:289
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SelectionVariable
Base class of the selection variable objects used for pair filtering.
Definition: SelectionVariable.h:54
Belle2::ANGLE3DSIMPLE_NAME::PUT_NAME_FUNCTION
PUT_NAME_FUNCTION(ANGLE3DSIMPLE_NAME)
is replaced by "static const std:string name(void)" frunction which returns name of the Class
Belle2::B2Vector3::Mag2
DataType Mag2() const
The magnitude squared (rho^2 in spherical coordinate system).
Definition: B2Vector3.h:156
Belle2::ANGLE3DSIMPLE_NAME::value
static double value(const PointType &outerHit, const PointType &centerHit, const PointType &innerHit)
calculates the angle between the hits/vectors (3D), returning unit: none (calculation for degrees is ...
Definition: Angle3DSimple.h:37