Belle II Software  release-08-01-10
NetworkPathConversion.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 
9 #pragma once
10 #include <vector>
11 
12 #include <tracking/spacePointCreation/SpacePointTrackCand.h>
13 #include <tracking/trackFindingVXD/segmentNetwork/Segment.h>
14 #include <tracking/trackFindingVXD/segmentNetwork/TrackNode.h>
15 
16 namespace Belle2 {
23  template<class NetworkPath>
24  inline SpacePointTrackCand convertNetworkPath(NetworkPath networkPath)
25  {
26  std::vector <const SpacePoint*> spVector;
27  spVector.reserve(networkPath.size());
28  if (networkPath.empty()) {
29  return SpacePointTrackCand();
30  }
31 
32  auto family = networkPath[0]->getFamily();
33  for (auto aNodeIt = networkPath.rbegin(); aNodeIt != networkPath.rend(); ++aNodeIt) {
34  insertSpacePoints(spVector, (*aNodeIt)->getEntry());
35  }
36 
37  auto sptc = SpacePointTrackCand(spVector);
38  sptc.setFamily(family);
39  return sptc;
40  }
41 
42 
44  inline void insertSpacePoint(std::vector<const SpacePoint*>& target, TrackNode source)
45  {
46  target.push_back(source.m_spacePoint);
47  }
48 
49 
51  inline void insertSpacePoints(std::vector<const SpacePoint*>& target, const Segment<TrackNode>& source)
52  {
53  if (target.empty()) {
54  insertSpacePoint(target, *(source.getInnerHit()));
55  insertSpacePoint(target, *(source.getOuterHit()));
56  } else {
57  insertSpacePoint(target, *(source.getOuterHit()));
58  }
59  }
61 }
The Segment class This class represents segments of track candidates needed for TrackFinderVXD-Module...
Definition: Segment.h:25
Storage for (VXD) SpacePoint-based track candidates.
void insertSpacePoints(std::vector< const SpacePoint * > &target, const Segment< TrackNode > &source)
Insert of inner and outer TrackNodes of a Segment as SpacePoints into path of SpacePoints.
SpacePointTrackCand convertNetworkPath(NetworkPath networkPath)
Create new SPTC from network path.
void insertSpacePoint(std::vector< const SpacePoint * > &target, TrackNode source)
Convert TrackNode to SpaePoint an add to a SpacePoint path.
Abstract base class for different kinds of events.
Minimal class to store combination of sector and spacePoint, since SpacePoint can not carry sectorCon...
Definition: TrackNode.h:22