Belle II Software  release-05-01-25
CalcCurvatureSignum.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jonas Wagner *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 #include <framework/geometry/B2Vector3.h>
13 
14 
15 namespace Belle2 {
24  inline short calcCurvatureSignum(std::vector<SpacePoint const*> const& measurements)
25  {
26  if (measurements.size() < 3) return 0;
27  float sumOfCurvature = 0.;
28  for (unsigned int i = 0; i < measurements.size() - 2; ++i) {
29  B2Vector3<double> ab = measurements.at(i + 1)->getPosition() - measurements.at(i)->getPosition();
30  ab.SetZ(0.);
31  B2Vector3<double> bc = measurements.at(i + 2)->getPosition() - measurements.at(i + 1)->getPosition();
32  bc.SetZ(0.);
33  sumOfCurvature += bc.Orthogonal() * ab; //normal vector of m_vecBC times segment of ba
34  }
35  // signum
36  return (0 < sumOfCurvature) - (sumOfCurvature < 0);
37  }
39 }
Belle2::calcCurvatureSignum
short calcCurvatureSignum(std::vector< SpacePoint const * > const &measurements)
Calculate curvature based on triplets of measurements.
Definition: CalcCurvatureSignum.h:32
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19