Belle II Software  release-08-01-10
SignCurvatureXYError.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 <math.h>
15 
16 #define SIGNCURVATUREXYERROR_NAME SignCurvatureXYError
17 
18 namespace Belle2 {
27  template <typename PointType >
28  class SIGNCURVATUREXYERROR_NAME : public SelectionVariable< PointType, 3, int > {
29  public:
30 
33 
38  static int value(const PointType& a, const PointType& b, const PointType& c)
39  {
40  B2Vector3<double> sigma_a = a.getPositionError();
41  B2Vector3<double> sigma_b = b.getPositionError();
42  B2Vector3<double> sigma_c = c.getPositionError();
43 
44  B2Vector3<double> c2b(b.X() - c.X(), b.Y() - c.Y(), 0.0);
45  B2Vector3<double> b2a(a.X() - b.X(), a.Y() - b.Y(), 0.0);
46  //TODO: check if acos of the dot product is better (faster)
47  double angle = atan2(b2a[0], b2a[1]) - atan2(c2b[0], c2b[1]);
48  //TODO 1/3...mean of the sigmas. Possible improvement: Use a parameter instead, and determine with simulated events.
49  double sigmaan = (sigma_a.Mag() + sigma_b.Mag() + sigma_c.Mag()) / (3.*(c2b.Mag() + b2a.Mag()));
50  if (angle < (-sigmaan)) { return -1; }
51  else if (angle > sigmaan) {return 1; }
52  else { return 0; }
53  }
54 
55  };
56 
58 }
DataType Mag() const
The magnitude (rho in spherical coordinate system).
Definition: B2Vector3.h:159
calculates the sign of the curvature for three hits
static int value(const PointType &a, const PointType &b, const PointType &c)
calculates calculates the sign of the curvature of given 3-hit-tracklet.
PUT_NAME_FUNCTION(SIGNCURVATUREXYERROR_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.
Abstract base class for different kinds of events.