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