Belle II Software  release-05-01-25
DistanceBasedCDCPathPairFilter.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
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 DistanceBasedCDCPathPairFilter : 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  auto sumOfDistances = [](const CDCCKFPath & path)
31  {
32  // compute sum of distances for the two pats:
33  double sum = 0;
34  for (auto const& state : path) {
35  double dist = (state.getHitDistance());
36  sum += dist * dist;
37  }
38  return sum;
39  };
40 
41  const auto lhsDistSum = sumOfDistances(lhs);
42  const auto rhsDistSum = sumOfDistances(rhs);
43 
44  // priority is most hits
45  if (lhs.size() != rhs.size())
46  {
47  return lhs.size() > rhs.size();
48  }
49 
50  // Otherwise order by bset sum of dist^2
51  return lhsDistSum < rhsDistSum;
52  }
53  };
55 }
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::DistanceBasedCDCPathPairFilter::operator()
TrackFindingCDC::Weight operator()(const BaseCDCPathPairFilter::Object &pair) final
Input: pair of paths, returns 1 if pair.first to be selected, 0 otherwise.
Definition: DistanceBasedCDCPathPairFilter.h:34
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