Belle II Software  release-06-01-15
DuplicateCDCPathPairFilter.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 #include <utility>
16 
17 namespace Belle2 {
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  const CDCCKFPath* shortPath = &lhs;
31  const CDCCKFPath* longPath = &rhs;
32  if (longPath->size() < shortPath->size())
33  {
34  std::swap(shortPath, longPath);
35  }
36 
37  int match = 0;
38  int total = shortPath->size() - 1;
39  for (const auto& sState : *shortPath)
40  {
41  if (sState.isSeed()) {
42  continue;
43  }
44  if (std::any_of(longPath->begin(), longPath->end(), [&sState](auto & lState)
45  {return !lState.isSeed() && sState.getWireHit() == lState.getWireHit();})) {
46  match++;
47  }
48  }
49 
50  return double(match) / double(total) > m_minFractionSharedHits;
51  }
52 
54  void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override
55  {
56  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minFractionSharedHits"),
58  "Fraction of shared hits to distinguish photon conversion/Bremsstahlung",
60  }
61 
62  private:
65  };
67 }
68 
Simple filter to distinguish between photon conversion and Bremsstrahlung.
TrackFindingCDC::Weight operator()(const BaseCDCPathPairFilter::Object &pair) final
Input: pair of paths, returns 1 if too many duplicate hits found.
double m_minFractionSharedHits
minimal fraction of shared hits
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters.
The Module parameter list class.
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
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
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.