Belle II Software development
DistanceBasedCDCPathPairFilter.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
15namespace 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 auto sumOfDistances = [](const CDCCKFPath & path) {
30 // compute sum of distances for the two pats:
31 double sum = 0;
32 for (auto const& state : path) {
33 double dist = (state.getHitDistance());
34 sum += dist * dist;
35 }
36 return sum;
37 };
38
39 const auto lhsDistSum = sumOfDistances(lhs);
40 const auto rhsDistSum = sumOfDistances(rhs);
41
42 // priority is most hits
43 if (lhs.size() != rhs.size()) {
44 return lhs.size() > rhs.size();
45 }
46
47 // Otherwise order by bset sum of dist^2
48 return lhsDistSum < rhsDistSum;
49 }
50 };
52}
For the two paths with the same number of hits prefers one with smallest sum dist^2.
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:31
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:35
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.