Belle II Software  release-08-01-10
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  {
26  const auto& lhs = *pair.first;
27  const auto& rhs = *pair.second;
28 
29  // prefer longer paths
30  if (lhs.size() > rhs.size() + 2) {
31  return true;
32  } else if (lhs.size() + 2 < rhs.size()) {
33  return false;
34  }
35 
36  auto sumOfDistances = [](const CDCCKFPath & path) {
37  // compute sum of distances for the two parts:
38  double sum = 0;
39  for (auto const& state : path) {
40  double dist = (state.getHitDistance());
41  sum += dist * dist;
42  }
43  return sum;
44  };
45 
46  const auto lhsDist = sumOfDistances(lhs) / lhs.size();
47  const auto rhsDist = sumOfDistances(rhs) / rhs.size();
48 
49  // Order by bset sum of dist^2
50  return lhsDist < rhsDist;
51  }
52  };
54 }
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.