Belle II Software development
CosAngleXY.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#include <cmath>
14
15#define COSANGLEXY_NAME CosAngleXY
16
17namespace Belle2 {
28 template <typename PointType >
29 class COSANGLEXY_NAME : public SelectionVariable< PointType, 3, double > {
30 public:
33
34
37 static double value(const PointType& outerHit, const PointType& centerHit, const PointType& innerHit)
38 {
39
40 B2Vector3D outerVector(outerHit.X() - centerHit.X(), outerHit.Y() - centerHit.Y(), 0.);
41 B2Vector3D innerVector(centerHit.X() - innerHit.X(), centerHit.Y() - innerHit.Y(), 0.);
42
43 double result = (outerVector.X() * innerVector.X() + outerVector.Y() * innerVector.Y()) / (outerVector.Perp() *
44 innerVector.Perp());
45
46 return (std::isnan(result) || std::isinf(result)) ? double(0) : result;
47 } // return unit: none (calculation for degrees is incomplete, if you want readable numbers, use AngleXYFull instead)
48 };
49
51}
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
calculates the angle between the hits/vectors (XY), returning unit: none (calculation for degrees is ...
Definition: CosAngleXY.h:29
PUT_NAME_FUNCTION(COSANGLEXY_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 (XY), returning unit: none (calculation for degrees is ...
Definition: CosAngleXY.h:37
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.