Belle II Software  release-08-01-10
CDCCKFPathSelector.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/trackFindingCDC/findlets/base/Findlet.h>
11 #include <tracking/trackFindingCDC/utilities/Algorithms.h>
12 #include <tracking/ckf/cdc/entities/CDCCKFPath.h>
13 
14 #include <tracking/ckf/cdc/filters/pathPairs/CDCPathPairFilterFactory.h>
15 #include <tracking/trackFindingCDC/filters/base/ChooseableFilter.icc.h>
16 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
17 #include <framework/core/ModuleParamList.h>
18 
19 namespace Belle2 {
25  class CDCCKFPathSelector : public TrackFindingCDC::Findlet<CDCCKFPath> {
26  public:
28  {
30  }
31 
33  void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override
34  {
35  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "maximalCandidatesInFlight"),
37  "Maximal candidates in flight", m_maximalCandidatesInFlight);
38  m_filter.exposeParameters(moduleParamList, prefix);
39  }
40 
42  void apply(std::vector<CDCCKFPath>& newPaths) override
43  {
44  const auto pathComparison = [&](const CDCCKFPath & lhs, const CDCCKFPath & rhs) {
45  return m_filter({&lhs, &rhs}) > 0;
46  };
47  std::sort(newPaths.begin(), newPaths.end(), pathComparison);
48 
49  TrackFindingCDC::only_best_N(newPaths, m_maximalCandidatesInFlight);
50  }
51 
52  private:
57  };
59 }
Select the m_maximalCandidatesInFlight paths for further processing.
void apply(std::vector< CDCCKFPath > &newPaths) override
main method of the findlet, out of all paths "newPaths" select the best N=m_maximalCandidatesInFlight
TrackFindingCDC::ChooseableFilter< CDCPathPairFilterFactory > m_filter
Filter to order paths.
size_t m_maximalCandidatesInFlight
Maximum number of paths to select.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
The Module parameter list class.
Convenvience wrapper to setup a Chooseable filter from a specific factory object.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition: Findlet.h:26
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.