Belle II Software development
ZiggZaggXYWithSigma.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 <tracking/trackFindingVXD/filterMap/threeHitVariables/SignCurvatureXYError.h>
13
14#include <vector>
15#include <algorithm>
16
17#define ZIGGZAGGXYWITHSIGMA_NAME ZiggZaggXYWithSigma
18
19namespace Belle2 {
29 template <typename PointType, typename PointContainerType >
30 class ZIGGZAGGXYWITHSIGMA_NAME : public SelectionVariable< PointContainerType, 0, int > {
31 public:
34
35
37 static int value(const PointContainerType& hitContainer)
38 {
39 if (hitContainer.size() < 4) return 1;
40
41
42 std::vector<int> chargeSigns;
43 chargeSigns.reserve(hitContainer.size() - 2);
44
45 auto iterPos = hitContainer.begin();
46 auto stopPos = hitContainer.end() - 2;
47
48 for (; iterPos < stopPos; ++iterPos) {
49 int signVal = SignCurvatureXYError<PointType>::value(**iterPos, **(iterPos + 1), **(iterPos + 2));
50 chargeSigns.push_back(signVal);
51 }
52
53 std::sort(chargeSigns.begin(), chargeSigns.end());
54 auto endAfterRemove = std::remove(chargeSigns.begin(), chargeSigns.end(), 0);
55 auto finalEnd = std::unique(chargeSigns.begin(), endAfterRemove);
56
57 return std::distance(chargeSigns.begin(), finalEnd);
58 } // return unit: none
59 };
60
62}
Base class of the selection variable objects used for pair filtering.
checks whether chain of segments are zigg-zagging (changing sign of curvature of neighbouring segment...
static int value(const PointContainerType &hitContainer)
checks whether chain of segments are zigg-zagging (changing sign of curvature of neighbouring segment...
PUT_NAME_FUNCTION(ZIGGZAGGXYWITHSIGMA_NAME)
is replaced by "static const std:string name(void)" frunction which returns name of the Class
Abstract base class for different kinds of events.