Belle II Software  release-08-01-10
Segment.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/dataobjects/FullSecID.h>
11 
12 // C++-std:
13 #include <string>
14 
15 namespace Belle2 {
24  template<class HitType>
25  class Segment {
26  protected:
30  HitType* m_outerHit;
31 
33  HitType* m_innerHit;
34 
37 
40 
42  const std::int64_t m_identifier;
43 
44  public:
49  m_outerHit(nullptr),
50  m_innerHit(nullptr),
53  m_identifier(-1)
54  {}
55 
56 
63  Segment(FullSecID::BaseType outerSector, FullSecID::BaseType innerSector, HitType* outerNode, HitType* innerNode):
64  m_outerHit(outerNode),
65  m_innerHit(innerNode),
66  m_outerSector(outerSector),
67  m_innerSector(innerSector),
68  m_identifier(static_cast<std::int64_t>(outerNode->getID()) << 32 | static_cast<std::int64_t>
69  (innerNode->getID())) // Use int TrackNode IDs to construct int Segment ID
70  {}
71 
75  bool operator==(const Segment& b) const
76  {
77  return (*getInnerHit() == *b.getInnerHit() and * getOuterHit() == *b.getOuterHit());
78  }
79 
82 
84  std::int64_t getID() const { return m_identifier; }
85 
87  std::string getName() const
88  {
89  if (m_identifier >= 0)
90  return "Out: " + m_outerHit->getName() + ")" + ",\nin: " + m_innerHit->getName();
91  else
92  return "Out: missing,\nin: missing";
93  }
94 
96  inline const HitType* getInnerHit() const { return m_innerHit; }
97 
98 
100  inline const HitType* getOuterHit() const { return m_outerHit; }
101 
102 
105 
106 
109  };
111 } //Belle2 namespace
Class to identify a sector inside of the VXD.
Definition: FullSecID.h:33
unsigned int BaseType
defines the base type used for FullSecID
Definition: FullSecID.h:38
The Segment class This class represents segments of track candidates needed for TrackFinderVXD-Module...
Definition: Segment.h:25
HitType * m_innerHit
pointer to hit forming the inner end of the Segment.
Definition: Segment.h:33
FullSecID::BaseType m_outerSector
iD of sector carrying outer hit
Definition: Segment.h:36
FullSecID::BaseType getInnerSecID() const
returns inner secID of current Segment
Definition: Segment.h:104
Segment(FullSecID::BaseType outerSector, FullSecID::BaseType innerSector, HitType *outerNode, HitType *innerNode)
Constructor.
Definition: Segment.h:63
std::int64_t getID() const
************************* PUBLIC MEMBER FUNCTIONS *************************
Definition: Segment.h:84
std::string getName() const
returns longer debugging name of this segment
Definition: Segment.h:87
bool operator==(const Segment &b) const
************************* OPERATORS *************************
Definition: Segment.h:75
const std::int64_t m_identifier
unique identifier
Definition: Segment.h:42
const HitType * getInnerHit() const
returns inner hit of current Segment
Definition: Segment.h:96
FullSecID::BaseType getOuterSecID() const
returns outer secID of current Segment
Definition: Segment.h:108
Segment()
************************* CONSTRUCTORS *************************
Definition: Segment.h:48
FullSecID::BaseType m_innerSector
iD of sector carrying inner hit
Definition: Segment.h:39
const HitType * getOuterHit() const
returns outer hit of current Segment
Definition: Segment.h:100
HitType * m_outerHit
************************* DATA MEMBERS *************************
Definition: Segment.h:30
Abstract base class for different kinds of events.