Belle II Software  release-06-02-00
HitDistanceBasedCDCPathPairFilter.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 #pragma once
9 
10 #include <tracking/ckf/cdc/filters/pathPairs/BaseCDCPathPairFilter.h>
11 #include <tracking/ckf/cdc/entities/CDCCKFPath.h>
12 
13 #include <tracking/trackFindingCDC/numerics/Weight.h>
14 
15 namespace Belle2 {
22  public:
24  TrackFindingCDC::Weight operator()(const BaseCDCPathPairFilter::Object& pair) final {
25  const auto& lhs = *pair.first;
26  const auto& rhs = *pair.second;
27 
28  // prefer longer paths
29  if (lhs.size() > rhs.size() + 2)
30  {
31  return true;
32  } else if (lhs.size() + 2 < rhs.size())
33  {
34  return false;
35  }
36 
37  auto sumOfDistances = [](const CDCCKFPath & path)
38  {
39  // compute sum of distances for the two parts:
40  double sum = 0;
41  for (auto const& state : path) {
42  double dist = (state.getHitDistance());
43  sum += dist * dist;
44  }
45  return sum;
46  };
47 
48  const auto lhsDist = sumOfDistances(lhs) / lhs.size();
49  const auto rhsDist = sumOfDistances(rhs) / rhs.size();
50 
51  // Order by bset sum of dist^2
52  return lhsDist < rhsDist;
53  }
54  };
56 }
Prefers path with smallest sum dist^2 / length of path.
TrackFindingCDC::Weight operator()(const BaseCDCPathPairFilter::Object &pair) final
Input: pair of paths, returns 1 if pair.first to be selected, 0 otherwise.
Base class for filters on a generic object type.
Definition: Filter.dcl.h:29
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:33
std::vector< CDCCKFState > CDCCKFPath
Shortcut for the collection of CDC CKF-algorithm states.
Definition: CDCCKFPath.h:19
Abstract base class for different kinds of events.