Belle II Software  release-08-01-10
TrackCreatorSegmentTripleAutomaton.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/TrackCreatorSegmentTripleAutomaton.h>
9 
10 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
11 #include <tracking/trackFindingCDC/eventdata/tracks/CDCSegmentTriple.h>
12 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
13 
14 #include <tracking/trackFindingCDC/ca/Path.h>
15 
16 #include <tracking/trackFindingCDC/utilities/WeightedRelation.h>
17 
18 using namespace Belle2;
19 using namespace TrackFindingCDC;
20 
22 {
23  return "Constructs tracks by extraction of segment triple paths in a cellular automaton.";
24 }
25 
26 void TrackCreatorSegmentTripleAutomaton::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
27 {
28  m_cellularPathFinder.exposeParameters(moduleParamList, prefix);
29 }
30 
31 void TrackCreatorSegmentTripleAutomaton::apply(const std::vector<CDCSegmentTriple>& inputSegmentTriples,
32  const std::vector<WeightedRelation<const CDCSegmentTriple>>& inputSegmentTripleRelations,
33  std::vector<CDCTrack>& outputTracks)
34 {
35  // Obtain the segment triples as pointers
36  std::vector<const CDCSegmentTriple*> segmentTriplePtrs =
37  as_pointers<const CDCSegmentTriple>(inputSegmentTriples);
38 
39  m_segmentTriplePaths.clear();
40  m_cellularPathFinder.apply(segmentTriplePtrs, inputSegmentTripleRelations, m_segmentTriplePaths);
41 
42  // Reduce to plain tracks
43  for (const Path<const CDCSegmentTriple>& segmentTriplePath : m_segmentTriplePaths) {
44  outputTracks.push_back(CDCTrack::condense(segmentTriplePath));
45  for (const CDCSegmentTriple* segmentTriple : segmentTriplePath) {
46  segmentTriple->getStartSegment()->getAutomatonCell().setTakenFlag();
47  segmentTriple->getMiddleSegment()->getAutomatonCell().setTakenFlag();
48  segmentTriple->getEndSegment()->getAutomatonCell().setTakenFlag();
49  }
50  }
51 }
The Module parameter list class.
Class representing a triple of reconstructed segements in adjacent superlayer.
static CDCTrack condense(const Path< const CDCTrack > &trackPath)
Concats several tracks from a path.
Definition: CDCTrack.cc:164
std::vector< Path< const CDCSegmentTriple > > m_segmentTriplePaths
Memory for the segment triple paths generated from the graph.
void apply(const std::vector< CDCSegmentTriple > &inputSegmentTriples, const std::vector< WeightedRelation< const CDCSegmentTriple >> &inputSegmentTripleRelations, std::vector< CDCTrack > &outputTracks) final
Main function of the segment finding by the cellular automaton.
std::string getDescription() final
Short description of the findlet.
MultipassCellularPathFinder< const CDCSegmentTriple > m_cellularPathFinder
Instance of the cellular automaton path finder.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Type for two related objects with a weight.
Abstract base class for different kinds of events.