Belle II Software development
ZiggZaggXY.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/SignCurvatureXY.h>
13
14#include <vector>
15#include <algorithm>
16
17#define ZIGGZAGGXY_NAME ZiggZaggXY
18
19namespace Belle2 {
29 template <typename PointType, typename PointContainerType >
30 class ZIGGZAGGXY_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 std::vector<int> chargeSigns;
42 chargeSigns.reserve(hitContainer.size() - 2);
43
44 auto iterPos = hitContainer.begin();
45 auto stopPos = hitContainer.end() - 2;
46
47 for (; iterPos < stopPos; ++iterPos) {
48 int signVal = SignCurvatureXY<PointType>::value(**iterPos, **(iterPos + 1), **(iterPos + 2));
49 chargeSigns.push_back(signVal);
50 }
51
52 std::sort(chargeSigns.begin(), chargeSigns.end());
53 auto newEnd = std::unique(chargeSigns.begin(), chargeSigns.end());
54
55 return std::distance(chargeSigns.begin(), newEnd);
56 } // return unit: none
57 };
58
60}
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...
Definition: ZiggZaggXY.h:30
static int value(const PointContainerType &hitContainer)
checks whether chain of segments are zigg-zagging (changing sign of curvature of neighbouring segment...
Definition: ZiggZaggXY.h:37
PUT_NAME_FUNCTION(ZIGGZAGGXY_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.