Belle II Software development
TrackNode.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/spacePointCreation/SpacePoint.h>
11#include <tracking/trackFindingVXD/environment/VXDTFFilters.h>
12#include <tracking/trackFindingVXD/segmentNetwork/ActiveSector.h>
13
14#include <string>
15
16namespace Belle2 {
22 struct TrackNode {
25
27 TrackNode() : m_sector(nullptr), m_spacePoint(nullptr), m_identifier(-1) {}
28
30 explicit TrackNode(SpacePoint* spacePoint) :
31 m_sector(nullptr), m_spacePoint(spacePoint), m_identifier(spacePoint->getArrayIndex())
32 {}
33
36
37
40
43
45 const std::int32_t m_identifier;
46
47
52 bool operator==(const TrackNode& b) const
53 {
54 // simple case: no null-ptrs interfering:
55 if (m_spacePoint != nullptr and b.m_spacePoint != nullptr and m_sector != nullptr and b.m_sector != nullptr) {
56 // compares objects:
57 return (*m_spacePoint == *(b.m_spacePoint)) and (*m_sector == *(b.m_sector));
58 }
59
60 // case: at least one of the 2 nodes has no null-ptrs:
61 if (m_spacePoint != nullptr and m_sector != nullptr) return false; // means: this Node has no null-Ptrs -> the other one has
62 if (b.m_spacePoint != nullptr and b.m_sector != nullptr) return false; // means: the other Node has no null-Ptrs -> this one has
63
64 // case: both nodes have got at least one null-ptr:
65 bool spacePointsAreEqual = false;
66 if (m_spacePoint != nullptr and b.m_spacePoint != nullptr) {
67 spacePointsAreEqual = (*m_spacePoint == *(b.m_spacePoint));
68 } else {
69 spacePointsAreEqual = (m_spacePoint == b.m_spacePoint);
70 }
71 bool sectorsAreEqual = false;
72 if (m_sector != nullptr and b.m_sector != nullptr) {
73 sectorsAreEqual = (*m_sector == *(b.m_sector));
74 } else {
75 sectorsAreEqual = (m_sector == b.m_sector);
76 }
77 return (spacePointsAreEqual == true and sectorsAreEqual == true);
78 }
79
80
82 bool operator!=(const TrackNode& b) const
83 {
84 if (m_spacePoint == nullptr) {
85 B2FATAL("TrackNode::operator !=: m_spacePoint for Tracknode not set - aborting run.");
86 }
87 return !(*this == b);
88 }
89
90
92 const SpacePoint& getHit() const
93 {
94 if (m_spacePoint == nullptr) {
95 B2FATAL("TrackNode::getHit: m_spacePoint for Tracknode not set - aborting run.");
96 }
97 return *m_spacePoint;
98 }
99
100
103 {
104 if (m_sector == nullptr) {
105 B2FATAL("TrackNode::getActiveSector: ActiveSector for Tracknode not set - aborting run.");
106 }
107 return *m_sector;
108 }
109
110
112 std::int32_t getID() const { return m_identifier; }
113
114
116 std::string getName() const
117 {
118 if (m_identifier >= 0)
119 return "SP: " + m_spacePoint->getName();
120 else
121 return "SP: missing";
122 }
123 };
125}
The ActiveSector Class.
Definition: ActiveSector.h:29
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42
std::string getName() const override
Print out some info for this SpacePoint.
Definition: SpacePoint.h:115
class to describe a static sector of the sector map.
Definition: StaticSector.h:29
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
bool operator==(const TrackNode &b) const
Overloaded '=='-operator TODO JKL: pretty ugly operator overload, should be fixed ASAP!...
Definition: TrackNode.h:52
const SpacePoint & getHit() const
returns reference to hit.
Definition: TrackNode.h:92
SpacePoint * m_spacePoint
Pointer to spacePoint.
Definition: TrackNode.h:42
bool operator!=(const TrackNode &b) const
Overloaded '!='-operator.
Definition: TrackNode.h:82
const std::int32_t m_identifier
Unique integer identifier.
Definition: TrackNode.h:45
ActiveSector< StaticSectorType, TrackNode > & getActiveSector()
returns reference to hit.
Definition: TrackNode.h:102
~TrackNode()
Destructor.
Definition: TrackNode.h:35
std::string getName() const
Returns longer debugging name of this node.
Definition: TrackNode.h:116
TrackNode(SpacePoint *spacePoint)
Constructor with information from SpacePoint.
Definition: TrackNode.h:30
ActiveSector< StaticSectorType, TrackNode > * m_sector
Pointer to sector.
Definition: TrackNode.h:39
std::int32_t getID() const
Return ID of this node.
Definition: TrackNode.h:112
TrackNode()
Constructor.
Definition: TrackNode.h:27