Belle II Software development
SlopeRZ.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 <cmath>
13
14#define SLOPERZ_NAME SlopeRZ
15
16namespace Belle2 {
26 template <typename PointType >
27 class SLOPERZ_NAME : public SelectionVariable< PointType, 2, double > {
28 public:
31
32
34 static double value(const PointType& outerHit, const PointType& innerHit)
35 {
36 double result = atan(
37 sqrt(std::pow(double(outerHit.X() - innerHit.X()), 2)
38 + std::pow(double(outerHit.Y() - innerHit.Y()), 2)
39 ) / double(outerHit.Z() - innerHit.Z())
40 );
41 // atan also returns negative angles, so map back to [0,Pi] otherwise one get two peaks at +/-Pi/2 for 90 degree angles
42 if (result < 0.0) result += M_PI;
43
44 // TODO: check if 0 is a good default return value in the case z_i==z_o!
45 return (std::isnan(result) || std::isinf(result)) ? double(0) : result;
46 }
47 };
48
50}
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
This is the specialization for SpacePoints with returning floats, where value calculates the slope in...
Definition: SlopeRZ.h:27
static double value(const PointType &outerHit, const PointType &innerHit)
value calculates the slope in R-Z for a given pair of hits.
Definition: SlopeRZ.h:34
PUT_NAME_FUNCTION(SLOPERZ_NAME)
is replaced by "static const std:string name(void)" frunction which returns name of the Class
Base class of the selection variable objects used for pair filtering.
double atan(double a)
atan for double
Definition: beamHelpers.h:34
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
B2Vector3D outerHit(0, 0, 0)
testing out of range behavior
Abstract base class for different kinds of events.