Belle II Software  release-08-01-10
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  {
28  const auto& lhs = *pair.first;
29  const auto& rhs = *pair.second;
30 
31  const CDCCKFPath* shortPath = &lhs;
32  const CDCCKFPath* longPath = &rhs;
33  if (longPath->size() < shortPath->size()) {
34  std::swap(shortPath, longPath);
35  }
36 
37  int match = 0;
38  int total = shortPath->size() - 1;
39  for (const auto& sState : *shortPath) {
40  if (sState.isSeed()) {
41  continue;
42  }
43  if (std::any_of(longPath->begin(), longPath->end(), [&sState](auto & lState)
44  {return !lState.isSeed() && sState.getWireHit() == lState.getWireHit();})) {
45  match++;
46  }
47  }
48 
49  return double(match) / double(total) > m_minFractionSharedHits;
50  }
51 
53  void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override
54  {
55  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minFractionSharedHits"),
57  "Fraction of shared hits to distinguish photon conversion/Bremsstahlung",
59  }
60 
61  private:
64  };
66 }
67 
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.