Belle II Software development
TrackNode Struct Reference

Minimal class to store combination of sector and spacePoint, since SpacePoint can not carry sectorConnection. More...

#include <TrackNode.h>

Public Types

using StaticSectorType = VXDTFFilters< SpacePoint >::staticSector_t
 To improve readability of the code, here the definition of the static sector type.
 

Public Member Functions

 TrackNode ()
 Constructor.
 
 TrackNode (SpacePoint *spacePoint)
 Constructor with information from SpacePoint.
 
 ~TrackNode ()
 Destructor.
 
bool operator== (const TrackNode &b) const
 Overloaded '=='-operator TODO JKL: pretty ugly operator overload, should be fixed ASAP! (solution for null-ptr-issue needed) TODO write a test for that one! TODO find good reasons why one would like to create TrackNodes without Hits and ActiveSectors linked to them!
 
bool operator!= (const TrackNode &b) const
 Overloaded '!='-operator.
 
const SpacePointgetHit () const
 returns reference to hit.
 
ActiveSector< StaticSectorType, TrackNode > & getActiveSector ()
 returns reference to hit.
 
std::int32_t getID () const
 Return ID of this node.
 
std::string getName () const
 Returns longer debugging name of this node.
 

Public Attributes

ActiveSector< StaticSectorType, TrackNode > * m_sector
 Pointer to sector.
 
SpacePointm_spacePoint
 Pointer to spacePoint.
 
const std::int32_t m_identifier
 Unique integer identifier.
 

Detailed Description

Minimal class to store combination of sector and spacePoint, since SpacePoint can not carry sectorConnection.

Definition at line 22 of file TrackNode.h.

Member Typedef Documentation

◆ StaticSectorType

using StaticSectorType = VXDTFFilters<SpacePoint>::staticSector_t

To improve readability of the code, here the definition of the static sector type.

Definition at line 24 of file TrackNode.h.

Constructor & Destructor Documentation

◆ TrackNode() [1/2]

TrackNode ( )
inline

Constructor.

Definition at line 27 of file TrackNode.h.

27: m_sector(nullptr), m_spacePoint(nullptr), m_identifier(-1) {}
SpacePoint * m_spacePoint
Pointer to spacePoint.
Definition: TrackNode.h:42
const std::int32_t m_identifier
Unique integer identifier.
Definition: TrackNode.h:45
ActiveSector< StaticSectorType, TrackNode > * m_sector
Pointer to sector.
Definition: TrackNode.h:39

◆ TrackNode() [2/2]

TrackNode ( SpacePoint spacePoint)
inlineexplicit

Constructor with information from SpacePoint.

Definition at line 30 of file TrackNode.h.

30 :
31 m_sector(nullptr), m_spacePoint(spacePoint), m_identifier(spacePoint->getArrayIndex())
32 {}

◆ ~TrackNode()

~TrackNode ( )
inline

Destructor.

Definition at line 35 of file TrackNode.h.

35{}

Member Function Documentation

◆ getActiveSector()

ActiveSector< StaticSectorType, TrackNode > & getActiveSector ( )
inline

returns reference to hit.

Definition at line 102 of file TrackNode.h.

103 {
104 if (m_sector == nullptr) {
105 B2FATAL("TrackNode::getActiveSector: ActiveSector for Tracknode not set - aborting run.");
106 }
107 return *m_sector;
108 }

◆ getHit()

const SpacePoint & getHit ( ) const
inline

returns reference to hit.

Definition at line 92 of file TrackNode.h.

93 {
94 if (m_spacePoint == nullptr) {
95 B2FATAL("TrackNode::getHit: m_spacePoint for Tracknode not set - aborting run.");
96 }
97 return *m_spacePoint;
98 }

◆ getID()

std::int32_t getID ( ) const
inline

Return ID of this node.

Definition at line 112 of file TrackNode.h.

112{ return m_identifier; }

◆ getName()

std::string getName ( ) const
inline

Returns longer debugging name of this node.

Definition at line 116 of file TrackNode.h.

117 {
118 if (m_identifier >= 0)
119 return "SP: " + m_spacePoint->getName();
120 else
121 return "SP: missing";
122 }
std::string getName() const override
Print out some info for this SpacePoint.
Definition: SpacePoint.h:115

◆ operator!=()

bool operator!= ( const TrackNode b) const
inline

Overloaded '!='-operator.

Definition at line 82 of file TrackNode.h.

83 {
84 if (m_spacePoint == nullptr) {
85 B2FATAL("TrackNode::operator !=: m_spacePoint for Tracknode not set - aborting run.");
86 }
87 return !(*this == b);
88 }

◆ operator==()

bool operator== ( const TrackNode b) const
inline

Overloaded '=='-operator TODO JKL: pretty ugly operator overload, should be fixed ASAP! (solution for null-ptr-issue needed) TODO write a test for that one! TODO find good reasons why one would like to create TrackNodes without Hits and ActiveSectors linked to them!

Definition at line 52 of file TrackNode.h.

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 }

Member Data Documentation

◆ m_identifier

const std::int32_t m_identifier

Unique integer identifier.

Definition at line 45 of file TrackNode.h.

◆ m_sector

Pointer to sector.

Definition at line 39 of file TrackNode.h.

◆ m_spacePoint

SpacePoint* m_spacePoint

Pointer to spacePoint.

Definition at line 42 of file TrackNode.h.


The documentation for this struct was generated from the following file: