Belle II Software  release-05-02-19
CDCCKFPathSelector.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/trackFindingCDC/findlets/base/Findlet.h>
13 #include <tracking/trackFindingCDC/utilities/Algorithms.h>
14 #include <tracking/ckf/cdc/entities/CDCCKFPath.h>
15 
16 #include <tracking/ckf/cdc/filters/pathPairs/CDCPathPairFilterFactory.h>
17 #include <tracking/trackFindingCDC/filters/base/ChooseableFilter.icc.h>
18 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
19 #include <framework/core/ModuleParamList.h>
20 
21 namespace Belle2 {
26  class CDCCKFPathSelector : public TrackFindingCDC::Findlet<CDCCKFPath> {
28  public:
29  CDCCKFPathSelector()
30  {
32  }
33 
35  void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override
36  {
37  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "maximalCandidatesInFlight"),
39  "Maximal candidates in flight", m_maximalCandidatesInFlight);
40  m_filter.exposeParameters(moduleParamList, prefix);
41  }
42 
44  void apply(std::vector<CDCCKFPath>& newPaths) override
45  {
46  const auto pathComparison = [&](const CDCCKFPath & lhs, const CDCCKFPath & rhs) {
47  return m_filter({&lhs, &rhs}) > 0;
48  };
49  std::sort(newPaths.begin(), newPaths.end(), pathComparison);
50 
51  TrackFindingCDC::only_best_N(newPaths, m_maximalCandidatesInFlight);
52  }
53 
54  private:
56  size_t m_maximalCandidatesInFlight = 3;
59  };
61 }
Belle2::CDCCKFPathSelector::apply
void apply(std::vector< CDCCKFPath > &newPaths) override
main method of the findlet, out of all paths "newPaths" select the best N=m_maximalCandidatesInFlight
Definition: CDCCKFPathSelector.h:52
Belle2::TrackFindingCDC::ChooseableFilter
Convenvience wrapper to setup a Chooseable filter from a specific factory object.
Definition: ChooseableFilter.dcl.h:107
Belle2::TrackFindingCDC::CompositeProcessingSignalListener::addProcessingSignalListener
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
Definition: CompositeProcessingSignalListener.cc:57
Belle2::ModuleParamList::addParameter
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Definition: ModuleParamList.templateDetails.h:38
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::CDCCKFPathSelector::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
Definition: CDCCKFPathSelector.h:43
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46
Belle2::CDCCKFPathSelector::m_filter
TrackFindingCDC::ChooseableFilter< CDCPathPairFilterFactory > m_filter
Filter to order paths.
Definition: CDCCKFPathSelector.h:66
Belle2::CDCCKFPathSelector::m_maximalCandidatesInFlight
size_t m_maximalCandidatesInFlight
Maximum number of paths to select.
Definition: CDCCKFPathSelector.h:64