10#include <tracking/vxdHoughTracking/filters/pathFilters/ThreeHitVariables.h>
11#include <tracking/spacePointCreation/SpacePoint.h>
12#include <tracking/spacePointCreation/SpacePointTrackCand.h>
13#include <framework/geometry/B2Vector3.>
22 namespace vxdHoughTracking {
26 int calculateZiggZaggRZ(
const SpacePointTrackCand& sptc)
28 const unsigned nHits = sptc.size();
29 if (nHits < 4)
return 1;
31 using boost::math::sign;
33 std::vector<B2Vector3D> vecRZ;
35 for (
const auto* hit : sptc) {
36 vecRZ.push_back(
B2Vector3D(hit->Perp(), hit->Z(), 0.));
39 std::vector<int> chargeSigns;
40 chargeSigns.reserve(nHits - 2);
41 for (
unsigned i = 0; i < nHits - 2; ++i) {
42 int signVal = sign((vecRZ.at(i + 1) - vecRZ.at(i + 2)).Orthogonal() * (vecRZ.at(i) - vecRZ.at(i + 1)));
43 chargeSigns.push_back(signVal);
46 std::sort(chargeSigns.begin(), chargeSigns.end());
47 auto newEnd = std::unique(chargeSigns.begin(), chargeSigns.end());
49 return std::distance(chargeSigns.begin(), newEnd);
55 static int calculateZiggZaggXY(
const SpacePointTrackCand& sptc)
57 if (sptc.size() < 4)
return 1;
59 std::vector<int> chargeSigns;
60 chargeSigns.reserve(sptc.size() - 2);
62 auto iterPos = sptc.begin();
63 auto stopPos = sptc.end() - 2;
65 ThreeHitVariables threeHitVariables;
67 for (; iterPos < stopPos; ++iterPos) {
68 int signVal = threeHitVariables.getCurvatureSign(**iterPos, **(iterPos + 1), **(iterPos + 2));
69 chargeSigns.push_back(signVal);
72 std::sort(chargeSigns.begin(), chargeSigns.end());
73 auto newEnd = std::unique(chargeSigns.begin(), chargeSigns.end());
75 return std::distance(chargeSigns.begin(), newEnd);
B2Vector3< double > B2Vector3D
typedef for common usage with double
Abstract base class for different kinds of events.