Belle II Software  release-05-01-25
ZiggZaggXY.h
1 /**************************************************************************
2 * BASF2 (Belle Analysis Framework 2) *
3 * Copyright(C) 2014 - Belle II Collaboration *
4 * *
5 * Author: The Belle II Collaboration *
6 * Contributors: Jakob Lettenbichler (jakob.lettenbichler@oeaw.ac.at) *
7 * *
8 * This software is provided "as is" without any warranty. *
9 **************************************************************************/
10 
11 #pragma once
12 
13 #include <tracking/trackFindingVXD/filterMap/filterFramework/SelectionVariable.h>
14 #include <tracking/trackFindingVXD/filterMap/threeHitVariables/SignCurvatureXY.h>
15 
16 #include <vector>
17 #include <algorithm>
18 
19 #define ZIGGZAGGXY_NAME ZiggZaggXY
20 
21 namespace Belle2 {
31  template <typename PointType, typename PointContainerType >
32  class ZIGGZAGGXY_NAME : public SelectionVariable< PointContainerType , 0, int > {
33  public:
36 
37 
39  static int value(const PointContainerType& hitContainer)
40  {
41  if (hitContainer.size() < 4) return 1;
42 
43  std::vector<int> chargeSigns;
44  chargeSigns.reserve(hitContainer.size() - 2);
45 
46  auto iterPos = hitContainer.begin();
47  auto stopPos = hitContainer.end() - 2;
48 
49  for (; iterPos < stopPos; ++iterPos) {
50  int signVal = SignCurvatureXY<PointType>::value(**iterPos, **(iterPos + 1), **(iterPos + 2));
51  chargeSigns.push_back(signVal);
52  }
53 
54  std::sort(chargeSigns.begin(), chargeSigns.end());
55  auto newEnd = std::unique(chargeSigns.begin(), chargeSigns.end());
56 
57  return std::distance(chargeSigns.begin(), newEnd);
58  } // return unit: none
59  };
60 
62 }
Belle2::ZIGGZAGGXY_NAME
checks whether chain of segments are zigg-zagging (changing sign of curvature of neighbouring segment...
Definition: ZiggZaggXY.h:32
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ZIGGZAGGXY_NAME::value
static int value(const PointContainerType &hitContainer)
checks whether chain of segments are zigg-zagging (changing sign of curvature of neighbouring segment...
Definition: ZiggZaggXY.h:39
Belle2::SelectionVariable
Base class of the selection variable objects used for pair filtering.
Definition: SelectionVariable.h:54
Belle2::ZIGGZAGGXY_NAME::PUT_NAME_FUNCTION
PUT_NAME_FUNCTION(ZIGGZAGGXY_NAME)
is replaced by "static const std:string name(void)" frunction which returns name of the Class