Belle II Software  release-08-01-10
StackTreeSearcher.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 
12 #include <tracking/ckf/cdc/findlets/CDCCKFStateCreator.h>
13 #include <tracking/ckf/cdc/findlets/CDCCKFStateFilter.h>
14 #include <tracking/ckf/cdc/findlets/CDCCKFPathMerger.h>
15 #include <tracking/ckf/cdc/findlets/CDCCKFPathSelector.h>
16 
17 #include <tracking/ckf/cdc/entities/CDCCKFState.h>
18 #include <tracking/ckf/cdc/entities/CDCCKFPath.h>
19 
20 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
21 #include <framework/core/ModuleParamList.h>
22 
23 
24 namespace Belle2 {
30  class StackTreeSearcher : public
31  TrackFindingCDC::Findlet<CDCCKFPath, const TrackFindingCDC::CDCWireHit* const> {
32  public:
34  {
39  }
40 
42  void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override
43  {
44  m_stateCreator.exposeParameters(moduleParamList, prefix);
45  m_stateFilter.exposeParameters(moduleParamList, TrackFindingCDC::prefixed("state", prefix));
46  m_pathMerger.exposeParameters(moduleParamList, prefix);
47  m_pathSelector.exposeParameters(moduleParamList, TrackFindingCDC::prefixed("path", prefix));
48  }
49 
51  void apply(std::vector<CDCCKFPath>& paths,
52  const std::vector<const TrackFindingCDC::CDCWireHit*>& wireHits) override
53  {
54 
55  if (paths.empty()) {
56  return;
57  }
58 
59  std::vector<CDCCKFPath> newPaths;
60  std::vector<CDCCKFState> nextStates;
61 
62  for (CDCCKFPath& path : paths) {
63  B2DEBUG(29, "Testing one path from " << path.back());
64  m_stateCreator.apply(nextStates, path, wireHits);
65  m_stateFilter.apply(path, nextStates);
66 
67  // TODO: Attention: if there is no hit anymore, the path will not be added to the final set!
68  for (const auto& nextState : nextStates) {
69  path.push_back(nextState);
70 
71  B2DEBUG(29, "will go to " << nextState);
72  newPaths.push_back(path);
73  path.pop_back();
74  }
75  B2DEBUG(29, "Now having " << newPaths.size() << " in flight");
76  nextStates.clear();
77  }
78 
79  B2DEBUG(29, "Having found " << newPaths.size() << " new paths");
80  for (const auto& path : newPaths) {
81  B2DEBUG(29, path);
82  }
83 
84  m_pathMerger.apply(newPaths);
85  B2DEBUG(29, "Having found " << newPaths.size() << " new paths after merging");
86  for (const auto& path : newPaths) {
87  B2DEBUG(29, path);
88  }
89 
90  m_pathSelector.apply(newPaths);
91  B2DEBUG(29, "Having found " << newPaths.size() << " new paths after selection");
92  for (const auto& path : newPaths) {
93  B2DEBUG(29, path);
94  }
95 
96  if (newPaths.empty()) {
97  return;
98  }
99 
100  paths.swap(newPaths);
101  newPaths.clear();
102 
103  apply(paths, wireHits);
104  }
105 
106  private:
115  };
117 }
Merge similar paths.
void apply(std::vector< CDCCKFPath > &newPaths) override
main method of the findlet, reads/returns merged paths
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
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
Create CKF states, based on the current path. Perform some basic selection at this stage (based on ph...
void apply(std::vector< CDCCKFState > &nextStates, const CDCCKFPath &path, const std::vector< const TrackFindingCDC::CDCWireHit * > &wireHits) override
Main method of the findlet. Select + create states (output parameter nextStates) suitable for the inp...
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
A stack of pre-, helix-extrapolation- , Kalman-extrapolation- and Kalman-update-filters.
void apply(const CDCCKFPath &path, std::vector< CDCCKFState > &nextStates) override
Apply the findlet and do the state selection.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
The Module parameter list class.
CKF tree searcher which traces several best paths.
void apply(std::vector< CDCCKFPath > &paths, const std::vector< const TrackFindingCDC::CDCWireHit * > &wireHits) override
Main method to update the paths. Input: vector of the selected paths and a vector of CDC wirehits to ...
CDCCKFStateCreator m_stateCreator
algorthim to create CDC-CDF states while traversing the path
CDCCKFStateFilter m_stateFilter
algorithm to perform state filtering
CDCCKFPathSelector m_pathSelector
algorithm to select N best paths, for further processing.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
CDCCKFPathMerger m_pathMerger
algorithm to merge similar paths
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
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
Definition: Findlet.h:69
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.