Belle II Software development
Angle3DSimple.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <tracking/trackFindingVXD/filterMap/filterFramework/SelectionVariable.h>
12#include <framework/geometry/B2Vector3.h>
13
14#include <cmath>
15
16#define ANGLE3DSIMPLE_NAME Angle3DSimple
17
18namespace Belle2 {
28 template <typename PointType >
29 class ANGLE3DSIMPLE_NAME : public SelectionVariable< PointType, 3, double > {
30 public:
33
35 static double value(const PointType& outerHit, const PointType& centerHit, const PointType& innerHit)
36 {
37
38 B2Vector3D outerVector(outerHit.X() - centerHit.X(), outerHit.Y() - centerHit.Y(), outerHit.Z() - centerHit.Z());
39 B2Vector3D innerVector(centerHit.X() - innerHit.X(), centerHit.Y() - innerHit.Y(), centerHit.Z() - innerHit.Z());
40
41 // fullCalc would be acos(m_vecAB.Dot(m_vecBC) / m_vecAB.Mag()*m_vecBC.Mag()), but here time-consuming parts have been neglected
42 double result = outerVector.Dot(innerVector) / (outerVector.Mag2() * innerVector.Mag2());
43 return (std::isnan(result) || std::isinf(result)) ? double(0) : result;
44 }
45 };
46
48}
calculates the angle between the hits/vectors (3D), returning unit: none (calculation for degrees is ...
Definition: Angle3DSimple.h:29
PUT_NAME_FUNCTION(ANGLE3DSIMPLE_NAME)
is replaced by "static const std:string name(void)" frunction which returns name of the Class
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:35
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:435
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 Mag2() const
The magnitude squared (rho^2 in spherical coordinate system).
Definition: B2Vector3.h:157
DataType Dot(const B2Vector3< DataType > &p) const
Scalar product.
Definition: B2Vector3.h:290
Base class of the selection variable objects used for pair filtering.
B2Vector3D outerHit(0, 0, 0)
testing out of range behavior
Abstract base class for different kinds of events.