Belle II Software development
CalcCurvatureSignum.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#include <framework/geometry/B2Vector3.h>
11
12
13namespace Belle2 {
22 inline short calcCurvatureSignum(std::vector<SpacePoint const*> const& measurements)
23 {
24 if (measurements.size() < 3) return 0;
25 float sumOfCurvature = 0.;
26 for (unsigned int i = 0; i < measurements.size() - 2; ++i) {
27 B2Vector3D ab = measurements.at(i + 1)->getPosition() - measurements.at(i)->getPosition();
28 ab.SetZ(0.);
29 B2Vector3D bc = measurements.at(i + 2)->getPosition() - measurements.at(i + 1)->getPosition();
30 bc.SetZ(0.);
31 sumOfCurvature += bc.Orthogonal() * ab; //normal vector of m_vecBC times segment of ba
32 }
33 // signum
34 return (0 < sumOfCurvature) - (sumOfCurvature < 0);
35 }
37}
B2Vector3< DataType > Orthogonal() const
Vector orthogonal to this one.
Definition: B2Vector3.h:277
void SetZ(DataType z)
set Z/3rd-coordinate
Definition: B2Vector3.h:461
DataType at(unsigned i) const
safe member access (with boundary check!)
Definition: B2Vector3.h:751
short calcCurvatureSignum(std::vector< SpacePoint const * > const &measurements)
Calculate curvature based on triplets of measurements.
Abstract base class for different kinds of events.