Belle II Software  release-05-01-25
DuplicateCDCPathPairFilter.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 #include <utility>
18 
19 namespace Belle2 {
24  class DuplicateCDCPathPairFilter : public BaseCDCPathPairFilter {
26  public:
28  TrackFindingCDC::Weight operator()(const BaseCDCPathPairFilter::Object& pair) final {
29  const auto& lhs = *pair.first;
30  const auto& rhs = *pair.second;
31 
32  const CDCCKFPath* shortPath = &lhs;
33  const CDCCKFPath* longPath = &rhs;
34  if (longPath->size() < shortPath->size())
35  {
36  std::swap(shortPath, longPath);
37  }
38 
39  int match = 0;
40  int total = shortPath->size() - 1;
41  for (const auto& sState : *shortPath)
42  {
43  if (sState.isSeed()) {
44  continue;
45  }
46  if (std::any_of(longPath->begin(), longPath->end(), [&sState](auto & lState)
47  {return !lState.isSeed() && sState.getWireHit() == lState.getWireHit();})) {
48  match++;
49  }
50  }
51 
52  return double(match) / double(total) > m_minFractionSharedHits;
53  }
54 
56  void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override
57  {
58  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minFractionSharedHits"),
60  "Fraction of shared hits to distinguish photon conversion/Bremsstahlung",
62  }
63 
64  private:
66  double m_minFractionSharedHits = 0.9;
67  };
69 }
70 
Belle2::DuplicateCDCPathPairFilter::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters.
Definition: DuplicateCDCPathPairFilter.h:64
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::DuplicateCDCPathPairFilter::operator()
TrackFindingCDC::Weight operator()(const BaseCDCPathPairFilter::Object &pair) final
Input: pair of paths, returns 1 if too many duplicate hits found.
Definition: DuplicateCDCPathPairFilter.h:36
Belle2::CDCCKFPath
std::vector< CDCCKFState > CDCCKFPath
Shortcut for the collection of CDC CKF-algorithm states.
Definition: CDCCKFPath.h:29
Belle2::DuplicateCDCPathPairFilter::m_minFractionSharedHits
double m_minFractionSharedHits
minimal fraction of shared hits
Definition: DuplicateCDCPathPairFilter.h:74
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