Belle II Software  release-05-01-25
FullSecID Class Reference

Class to identify a sector inside of the VXD. More...

#include <FullSecID.h>

Public Types

typedef unsigned int BaseType
 defines the base type used for FullSecID
 

Public Member Functions

bool operator< (const FullSecID &secID) const
 overloaded '<'-operator for sorting algorithms
 
bool operator== (const FullSecID &secID) const
 overloaded '=='-operator for sorting algorithms
 
bool equalIgnoreSubLayerID (const FullSecID &secID)
 comparison which ignores the sublayer ID
 
FullSecIDoperator= (const FullSecID &secID)
 overloaded assignment operator
 
 operator unsigned int () const
 overloaded int cast
 
 operator std::string (void) const
 overloaded string cast
 
 FullSecID (const FullSecID &secID)
 Copy constructor.
 
 FullSecID (unsigned int id=0)
 Constructor taking the encoded full Sec ID (int). More...
 
 FullSecID (std::string sid)
 Constructor taking the encoded full Sec ID (string). More...
 
 FullSecID (VxdID vxdID, bool subLayerID=false, unsigned int sectorNumber=0)
 Constructor. More...
 
 FullSecID (unsigned int layerID, bool subLayerID, unsigned int sensorID, unsigned int sectorNumber)
 Another contstructor which does not need a VxdID nor another coded valid FullSecID. More...
 
 ~FullSecID ()
 Destructor.
 
short int getLayerID () const
 returns LayerID compatible with basf2 standards.
 
short int getLayerNumber () const
 returns LayerID compatible with basf2 standards.
 
int getLadderID () const
 returns LadderID compatible with basf2 standards
 
int getLadderNumber () const
 returns LadderID compatible with basf2 standards
 
bool getSubLayerID () const
 returns SubLayerID which tells you whether it is useful to search for compatible sectors in the same layer as well.
 
VxdID getVxdID () const
 returns VxdID of sensor.
 
unsigned short int getUniID () const
 returns uniID of sensor (basically the same as VxdID (can simply converted to vxdID(uniID)) but a trifle faster when only the short int value storing the VxdID information is wanted).
 
short int getSecID () const
 returns SecID of current FullSecID (only unique for each sensor).
 
unsigned int getFullSecID () const
 returns the FullSecID coded as integer for further use (can be reconverted to FullSecID by using FullSecID(value))
 
std::string getFullSecString () const
 returns the FullSecID coded as string compatible to secIDs stored in the xml-sectormaps
 

Protected Attributes

BaseType m_fullSecID
 contains full info of current SecID. More...
 

Static Protected Attributes

const static int LayerBits = 4
 Number of bits available to represent a layer.
 
const static int SubLayerBits = 1
 Number of bits available to represent a subLayer (a sublayer is 1 if current sector on sensor is in an overlapping region, where it is possible that an inner hit of the same track could be on the same layer)
 
const static int VxdIDBits = 16
 Number of bits available to store a full vxdID.
 
const static int SectorBits = 11
 Number of bits available to represent a sector.
 
const static int Bits = LayerBits + SubLayerBits + VxdIDBits + SectorBits
 Total bit size of the VxdID.
 
const static int MaxLayer = (1 << LayerBits) - 1
 Maximum valid Layer ID.
 
const static int MaxSubLayer = (1 << SubLayerBits) - 1
 Maximum valid Ladder ID.
 
const static int MaxVxdID = (1 << VxdIDBits) - 1
 Maximum valid Sensor ID.
 
const static int MaxSector = (1 << SectorBits) - 1
 Maximum valid Segment ID.
 
const static int MaxID = std::numeric_limits<unsigned int>::max()
 Maximum value for ID.
 
const static int LayerBitShift = SubLayerBits + VxdIDBits + SectorBits
 Number of bits to shift for storing a LayerID.
 
const static int SubLayerBitShift = VxdIDBits + SectorBits
 Number of bits to shift for storing a SubLayerID.
 
const static int VxdIDBitShift = SectorBits
 Number of bits shift for storing a full vxdID.
 
const static int SubLayerMask = MaxSubLayer << SubLayerBitShift
 mask to get subLayerID from fullSecID
 
const static int VxdIDMask = MaxVxdID << VxdIDBitShift
 mask to get VxdID from fullSecID
 
const static int SectorMask = MaxSector
 mask to get SectorID from fullSecID
 

Friends

std::ostream & operator<< (std::ostream &out, const FullSecID &secID)
 overloaded '<<' stream operator. More...
 

Detailed Description

Class to identify a sector inside of the VXD.

It allows to uniquely identify a SecID within the Vxd-SectorMap: The following information is coded into the FullSecID: Layer: bits 0 - 3 (Values 0-15, calculated using shift: 28) SubLayer: bits 4 (Values 0,1, calculated using: 27) VxdID: bits 5 - 21 (Values: whole range of VxdIDs, calculated using: 11) SecID: bits 22 - 32 ( Values: 0 up to 2047)

Definition at line 43 of file FullSecID.h.

Constructor & Destructor Documentation

◆ FullSecID() [1/4]

FullSecID ( unsigned int  id = 0)
inlineexplicit

Constructor taking the encoded full Sec ID (int).

use this one if you have got an already existing integer storing the FullSecID information and you want the possibility to extract its entries (layer, sublayer, vxdID, secID)

Parameters
idNumber of the SecID using the encoded format. Careful - SecIDs are not continuously within the encoded number. The default is set to zero which represents the secID of the IP

Definition at line 92 of file FullSecID.h.

116  {}

◆ FullSecID() [2/4]

FullSecID ( std::string  sid)
explicit

Constructor taking the encoded full Sec ID (string).

use this one if you want to convert a string-encoded sector into the internal version (e.g. provided by the xml-files storing a sectormap) into the internal version. This constructor should be dispensable after changing from xml-based data storage to sql-storage

Parameters
sidglobal secID encoded in a string file eg "41_12345_3" 41 means layer 4, sublayer 1, 12345 is a dummy for the integer-version of the VxdID and the last digit is the local secID on the sensor

Definition at line 46 of file FullSecID.cc.

47 {
48  vector<string> stringSegments;
49  boost::split(stringSegments, sid, boost::is_any_of("_"));
50 
51  unsigned int LayerID = stringSegments[0][0] -
52  '0'; // since chars are (compared to strings) very problematic to convert to ints, this solution is very dirty but at least it's short and easy to read.
53  unsigned int SubLayerID = 0;
54  if (stringSegments[0].size() > 1) {
55  SubLayerID = stringSegments[0][1] - '0';
56  }
57 // unsigned int SubLayerID = stringSegments[0][1] - '0';
58  unsigned int UniID = std::stoi(stringSegments[1]); // C++03: atoi(stringSegments[1].c_str());
59  unsigned int sectorNumber = std::stoi(stringSegments[2]); // atoi(stringSegments[2].c_str());
60  B2DEBUG(1000, "FullSecID-constructor: Value before converting: " << sid << ", after converting: layerID " << LayerID <<
61  ", subLayerID " << SubLayerID << ", UniID " << UniID << ", secID " << sectorNumber);
62  assert(LayerID < MaxLayer + 1);
63  assert(SubLayerID < MaxSubLayer + 1);
64  assert(UniID < MaxVxdID + 1);
65  assert(sectorNumber < MaxSector + 1);
66 
67  LayerID <<= LayerBitShift;
68  SubLayerID <<= SubLayerBitShift;
69  UniID <<= VxdIDBitShift;
70  m_fullSecID = LayerID | SubLayerID | UniID | sectorNumber;
71 }

◆ FullSecID() [3/4]

FullSecID ( VxdID  vxdID,
bool  subLayerID = false,
unsigned int  sectorNumber = 0 
)
explicit

Constructor.

If you want to create a new Full Sec ID using the information which shall be stored there (e.g. layer, sublayer, vxdID, secID)

Parameters
vxdIDfull VxdID of sensor of current sector.
subLayerID0 if not in overlapping area of sensor, 1 if within overlap.
sectorNumbernumber of sector at current sensor/vxdID.

Definition at line 75 of file FullSecID.cc.

◆ FullSecID() [4/4]

FullSecID ( unsigned int  layerID,
bool  subLayerID,
unsigned int  sensorID,
unsigned int  sectorNumber 
)

Another contstructor which does not need a VxdID nor another coded valid FullSecID.

Parameters
layerIDset here the layer number as an ID...
subLayerID0 if not in overlapping area of sensor, 1 if within overlap.
sensorIDan ID representing the sensorID (e.g. uniID/vxdID).
sectorNumbernumber of sector at current sensor/vxdID.

Definition at line 99 of file FullSecID.cc.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const FullSecID secID 
)
friend

overloaded '<<' stream operator.

Print secID to stream by converting it to string

Definition at line 78 of file FullSecID.h.

Member Data Documentation

◆ m_fullSecID

BaseType m_fullSecID
protected

contains full info of current SecID.

Check class definition for detailed description

Definition at line 231 of file FullSecID.h.


The documentation for this class was generated from the following files:
Belle2::FullSecID::MaxSubLayer
const static int MaxSubLayer
Maximum valid Ladder ID.
Definition: FullSecID.h:192
Belle2::FullSecID::LayerBitShift
const static int LayerBitShift
Number of bits to shift for storing a LayerID.
Definition: FullSecID.h:208
Belle2::FullSecID::m_fullSecID
BaseType m_fullSecID
contains full info of current SecID.
Definition: FullSecID.h:231
Belle2::FullSecID::VxdIDBitShift
const static int VxdIDBitShift
Number of bits shift for storing a full vxdID.
Definition: FullSecID.h:216
Belle2::FullSecID::SubLayerBitShift
const static int SubLayerBitShift
Number of bits to shift for storing a SubLayerID.
Definition: FullSecID.h:212
Belle2::FullSecID::MaxSector
const static int MaxSector
Maximum valid Segment ID.
Definition: FullSecID.h:200
Belle2::FullSecID::MaxVxdID
const static int MaxVxdID
Maximum valid Sensor ID.
Definition: FullSecID.h:196
Belle2::FullSecID::MaxLayer
const static int MaxLayer
Maximum valid Layer ID.
Definition: FullSecID.h:188