Belle II Software  release-05-01-25
HitDistanceBasedCDCPathPairFilter.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun, Simon Kurz *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/ckf/cdc/filters/pathPairs/BaseCDCPathPairFilter.h>
13 #include <tracking/ckf/cdc/entities/CDCCKFPath.h>
14 
15 #include <tracking/trackFindingCDC/numerics/Weight.h>
16 
17 namespace Belle2 {
22  class HitDistanceBasedCDCPathPairFilter : public BaseCDCPathPairFilter {
24  public:
26  TrackFindingCDC::Weight operator()(const BaseCDCPathPairFilter::Object& pair) final {
27  const auto& lhs = *pair.first;
28  const auto& rhs = *pair.second;
29 
30  // prefer longer paths
31  if (lhs.size() > rhs.size() + 2)
32  {
33  return true;
34  } else if (lhs.size() + 2 < rhs.size())
35  {
36  return false;
37  }
38 
39  auto sumOfDistances = [](const CDCCKFPath & path)
40  {
41  // compute sum of distances for the two parts:
42  double sum = 0;
43  for (auto const& state : path) {
44  double dist = (state.getHitDistance());
45  sum += dist * dist;
46  }
47  return sum;
48  };
49 
50  const auto lhsDist = sumOfDistances(lhs) / lhs.size();
51  const auto rhsDist = sumOfDistances(rhs) / rhs.size();
52 
53  // Order by bset sum of dist^2
54  return lhsDist < rhsDist;
55  }
56  };
58 }
Belle2::HitDistanceBasedCDCPathPairFilter::operator()
TrackFindingCDC::Weight operator()(const BaseCDCPathPairFilter::Object &pair) final
Input: pair of paths, returns 1 if pair.first to be selected, 0 otherwise.
Definition: HitDistanceBasedCDCPathPairFilter.h:34
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CDCCKFPath
std::vector< CDCCKFState > CDCCKFPath
Shortcut for the collection of CDC CKF-algorithm states.
Definition: CDCCKFPath.h:29
Belle2::BaseCDCPathPairFilter
TrackFindingCDC::Filter< std::pair< const CDCCKFPath *, const CDCCKFPath * > > BaseCDCPathPairFilter
Base filter for CKF CDC paths.
Definition: BaseCDCPathPairFilter.h:31
Belle2::TrackFindingCDC::Filter::Object
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:43