Belle II Software  release-08-01-10
TrackLinker.cc
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 #include <tracking/trackFindingCDC/findlets/minimal/TrackLinker.h>
9 
10 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
11 
12 #include <tracking/trackFindingCDC/utilities/WeightedRelation.h>
13 #include <tracking/trackFindingCDC/utilities/Algorithms.h>
14 
15 using namespace Belle2;
16 using namespace TrackFindingCDC;
17 
19 {
21 }
22 
24 {
25  return "Links tracks by extraction of track paths in a cellular automaton.";
26 }
27 
28 void TrackLinker::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
29 {
30  m_trackRelationCreator.exposeParameters(moduleParamList, prefix);
31  m_cellularPathFinder.exposeParameters(moduleParamList, prefix);
32 }
33 
34 void TrackLinker::apply(const std::vector<CDCTrack>& inputTracks, std::vector<CDCTrack>& outputTracks)
35 {
36  // Obtain the tracks as pointers
37  std::vector<const CDCTrack*> trackPtrs = as_pointers<const CDCTrack>(inputTracks);
38 
39  // Create linking relations
40  m_trackRelations.clear();
41  m_trackRelationCreator.apply(trackPtrs, m_trackRelations);
42 
43  // Find linking paths
44  m_trackPaths.clear();
46 
47  // Put the linked tracks together
48  outputTracks.reserve(outputTracks.size() + m_trackPaths.size());
49  for (const std::vector<const CDCTrack*>& trackPath : m_trackPaths) {
50  outputTracks.push_back(CDCTrack::condense(trackPath));
51  }
52 }
The Module parameter list class.
static CDCTrack condense(const Path< const CDCTrack > &trackPath)
Concats several tracks from a path.
Definition: CDCTrack.cc:164
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
MultipassCellularPathFinder< const CDCTrack > m_cellularPathFinder
Instance of the cellular automaton path finder.
Definition: TrackLinker.h:56
WeightedRelationCreator< const CDCTrack, ChooseableTrackRelationFilter > m_trackRelationCreator
Creator of the track relations for linking.
Definition: TrackLinker.h:53
std::string getDescription() final
Short description of the findlet.
Definition: TrackLinker.cc:23
std::vector< WeightedRelation< const CDCTrack > > m_trackRelations
Memory for the relations between tracks to be followed on linking.
Definition: TrackLinker.h:59
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: TrackLinker.cc:28
std::vector< Path< const CDCTrack > > m_trackPaths
Memory for the track paths generated from the graph.
Definition: TrackLinker.h:62
TrackLinker()
Constructor adding the filter as a subordinary processing signal listener.
Definition: TrackLinker.cc:18
void apply(const std::vector< CDCTrack > &inputTracks, std::vector< CDCTrack > &outputTracks) final
Main algorithm.
Definition: TrackLinker.cc:34
Abstract base class for different kinds of events.