Belle II Software development
VxdID Class Reference

Class to uniquely identify a any structure of the PXD and SVD. More...

#include <VxdID.h>

Public Types

enum  {
  LayerBits = 3 ,
  LadderBits = 5 ,
  SensorBits = 3 ,
  SegmentBits = 5 ,
  Bits = LayerBits + LadderBits + SensorBits + SegmentBits ,
  MaxLayer = (1 << LayerBits) - 1 ,
  MaxLadder = (1 << LadderBits) - 1 ,
  MaxSensor = (1 << SensorBits) - 1 ,
  MaxSegment = (1 << SegmentBits) - 1 ,
  MaxID = (1 << Bits) - 1
}
 
typedef unsigned short baseType
 The base integer type for VxdID.
 

Public Member Functions

 VxdID (baseType id=0)
 Constructor using the unique id.
 
 VxdID (baseType layer, baseType ladder, baseType sensor, baseType segment=0)
 Constructor using layer, ladder and sensor ids.
 
 VxdID (const std::string &sensor)
 Construct ID from string representing the structure.
 
 VxdID (const VxdID &b)
 Copy constructor.
 
VxdIDoperator= (const VxdID &b)
 Assignment operator.
 
VxdIDoperator= (baseType id)
 Assignment from baseType.
 
 operator baseType () const
 Convert to baseType.
 
 operator std::string () const
 Convert to string.
 
bool operator== (const VxdID &b) const
 Check for equality.
 
bool operator< (const VxdID &b) const
 Order by unique id.
 
baseType getID () const
 Get the unique id.
 
baseType getLayerNumber () const
 Get the layer id.
 
baseType getLadderNumber () const
 Get the ladder id.
 
baseType getSensorNumber () const
 Get the sensor id.
 
baseType getSegmentNumber () const
 Get the sensor segment.
 
void setID (baseType id)
 Set the unique id.
 
void setLayerNumber (baseType layer)
 Set the layer id.
 
void setLadderNumber (baseType ladder)
 Set the ladder id.
 
void setSensorNumber (baseType sensor)
 Set the sensor id.
 
void setSegmentNumber (baseType segment)
 Set the sensor segment.
 
std::string __str__ () const
 make this type printable in python with print(vxd_id)
 

Private Attributes

union {
   baseType   id: Bits
 Unique id. More...
 
   struct {
      baseType   segment: SegmentBits
 Segment id. More...
 
      baseType   sensor: SensorBits
 Sensor id. More...
 
      baseType   ladder: LadderBits
 Ladder id. More...
 
      baseType   layer: LayerBits
 Layer id. More...
 
   }   parts
 < Struct to contain all id components
 
m_id
 Union to store the ID and all components in one go.
 

Detailed Description

Class to uniquely identify a any structure of the PXD and SVD.

  • Ladder, Layer and Sensor all start at 1
  • Ladders are numbered with increasing phi
  • Sensors are numbered from front to back
  • Segment ID is used for PXD to encode frame number. Currently no use for SVD.

Internal use of a union gets rid of all the bit shifting which would be neccessary to represent the id as one baseType and get all the components out of it. Disadvantage is that it is not guaranteed to be portable, but neither is bit shifting

Definition at line 33 of file VxdID.h.

Member Typedef Documentation

◆ baseType

typedef unsigned short baseType

The base integer type for VxdID.

Definition at line 36 of file VxdID.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
LayerBits 

Number of bits available to represent a layer.

LadderBits 

Number of bits available to represent a ladder.

SensorBits 

Number of bits available to represent a sensor.

SegmentBits 

Number of bits available to represent segmentation of the sensor.

Bits 

Total bit size of the VxdID.

MaxLayer 

Maximum valid Layer ID.

MaxLadder 

Maximum valid Ladder ID.

MaxSensor 

Maximum valid Sensor ID.

MaxSegment 

Maximum valid Segment ID.

MaxID 

Maximum value for ID.

Definition at line 37 of file VxdID.h.

37 {
39 LayerBits = 3,
41 LadderBits = 5,
43 SensorBits = 3,
45 SegmentBits = 5,
48
50 MaxLayer = (1 << LayerBits) - 1,
52 MaxLadder = (1 << LadderBits) - 1,
54 MaxSensor = (1 << SensorBits) - 1,
56 MaxSegment = (1 << SegmentBits) - 1,
58 MaxID = (1 << Bits) - 1
59 };
@ LadderBits
Number of bits available to represent a ladder.
Definition: VxdID.h:41
@ SensorBits
Number of bits available to represent a sensor.
Definition: VxdID.h:43
@ MaxLayer
Maximum valid Layer ID.
Definition: VxdID.h:50
@ SegmentBits
Number of bits available to represent segmentation of the sensor.
Definition: VxdID.h:45
@ MaxLadder
Maximum valid Ladder ID.
Definition: VxdID.h:52
@ MaxID
Maximum value for ID.
Definition: VxdID.h:58
@ MaxSegment
Maximum valid Segment ID.
Definition: VxdID.h:56
@ LayerBits
Number of bits available to represent a layer.
Definition: VxdID.h:39
@ MaxSensor
Maximum valid Sensor ID.
Definition: VxdID.h:54
@ Bits
Total bit size of the VxdID.
Definition: VxdID.h:47

Constructor & Destructor Documentation

◆ VxdID() [1/3]

VxdID ( baseType  id = 0)
inline

Constructor using the unique id.

Definition at line 63 of file VxdID.h.

64 {
65 m_id.id = id;
66 }
baseType id
Unique id.
Definition: VxdID.h:123
union Belle2::VxdID::@305 m_id
Union to store the ID and all components in one go.

◆ VxdID() [2/3]

VxdID ( baseType  layer,
baseType  ladder,
baseType  sensor,
baseType  segment = 0 
)
inline

Constructor using layer, ladder and sensor ids.

Definition at line 68 of file VxdID.h.

69 {
70 m_id.parts.layer = layer;
71 m_id.parts.ladder = ladder;
72 m_id.parts.sensor = sensor;
73 m_id.parts.segment = segment;
74 }
baseType ladder
Ladder id.
Definition: VxdID.h:130
baseType segment
Segment id.
Definition: VxdID.h:126
baseType sensor
Sensor id.
Definition: VxdID.h:128
baseType layer
Layer id.
Definition: VxdID.h:132

◆ VxdID() [3/3]

VxdID ( const VxdID b)
inline

Copy constructor.

Definition at line 78 of file VxdID.h.

78: m_id(b.m_id) {}

Member Function Documentation

◆ __str__()

std::string __str__ ( ) const
inline

make this type printable in python with print(vxd_id)

Definition at line 116 of file VxdID.h.

116{ return (std::string)(*this); }

◆ getID()

baseType getID ( ) const
inline

Get the unique id.

Definition at line 94 of file VxdID.h.

94{ return m_id.id; }

◆ getLadderNumber()

baseType getLadderNumber ( ) const
inline

Get the ladder id.

Definition at line 98 of file VxdID.h.

98{ return m_id.parts.ladder; }

◆ getLayerNumber()

baseType getLayerNumber ( ) const
inline

Get the layer id.

Definition at line 96 of file VxdID.h.

96{ return m_id.parts.layer; }

◆ getSegmentNumber()

baseType getSegmentNumber ( ) const
inline

Get the sensor segment.

Definition at line 102 of file VxdID.h.

102{ return m_id.parts.segment; }

◆ getSensorNumber()

baseType getSensorNumber ( ) const
inline

Get the sensor id.

Definition at line 100 of file VxdID.h.

100{ return m_id.parts.sensor; }

◆ operator baseType()

operator baseType ( ) const
inline

Convert to baseType.

Definition at line 85 of file VxdID.h.

85{ return getID(); }
baseType getID() const
Get the unique id.
Definition: VxdID.h:94

◆ operator<()

bool operator< ( const VxdID b) const
inline

Order by unique id.

Definition at line 91 of file VxdID.h.

91{ return getID() < b.getID(); }

◆ operator=() [1/2]

VxdID & operator= ( baseType  id)
inline

Assignment from baseType.

Definition at line 83 of file VxdID.h.

83{ m_id.id = id; return *this; }

◆ operator=() [2/2]

VxdID & operator= ( const VxdID b)
inline

Assignment operator.

Definition at line 81 of file VxdID.h.

81{ m_id = b.m_id; return *this; }

◆ operator==()

bool operator== ( const VxdID b) const
inline

Check for equality.

Definition at line 89 of file VxdID.h.

89{ return getID() == b.getID(); }

◆ setID()

void setID ( baseType  id)
inline

Set the unique id.

Definition at line 105 of file VxdID.h.

105{ m_id.id = id; }

◆ setLadderNumber()

void setLadderNumber ( baseType  ladder)
inline

Set the ladder id.

Definition at line 109 of file VxdID.h.

109{ m_id.parts.ladder = ladder; }

◆ setLayerNumber()

void setLayerNumber ( baseType  layer)
inline

Set the layer id.

Definition at line 107 of file VxdID.h.

107{ m_id.parts.layer = layer; }

◆ setSegmentNumber()

void setSegmentNumber ( baseType  segment)
inline

Set the sensor segment.

Definition at line 113 of file VxdID.h.

113{ m_id.parts.segment = segment; }

◆ setSensorNumber()

void setSensorNumber ( baseType  sensor)
inline

Set the sensor id.

Definition at line 111 of file VxdID.h.

111{ m_id.parts.sensor = sensor; }

Member Data Documentation

◆ id

Unique id.

Definition at line 123 of file VxdID.h.

◆ ladder

baseType ladder

Ladder id.

Definition at line 130 of file VxdID.h.

◆ layer

baseType layer

Layer id.

Definition at line 132 of file VxdID.h.

◆ segment

baseType segment

Segment id.

Definition at line 126 of file VxdID.h.

◆ sensor

baseType sensor

Sensor id.

Definition at line 128 of file VxdID.h.


The documentation for this class was generated from the following files: