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