Belle II Software  release-08-01-10
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

static const int LayerBits = 4
 Number of bits available to represent a layer.
 
static const 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)
 
static const int VxdIDBits = 16
 Number of bits available to store a full vxdID.
 
static const int SectorBits = 11
 Number of bits available to represent a sector.
 
static const int Bits = LayerBits + SubLayerBits + VxdIDBits + SectorBits
 Total bit size of the VxdID.
 
static const int MaxLayer = (1 << LayerBits) - 1
 Maximum valid Layer ID.
 
static const int MaxSubLayer = (1 << SubLayerBits) - 1
 Maximum valid Ladder ID.
 
static const int MaxVxdID = (1 << VxdIDBits) - 1
 Maximum valid Sensor ID.
 
static const int MaxSector = (1 << SectorBits) - 1
 Maximum valid Segment ID.
 
static const int MaxID = std::numeric_limits<unsigned int>::max()
 Maximum value for ID.
 
static const int LayerBitShift = SubLayerBits + VxdIDBits + SectorBits
 Number of bits to shift for storing a LayerID.
 
static const int SubLayerBitShift = VxdIDBits + SectorBits
 Number of bits to shift for storing a SubLayerID.
 
static const int VxdIDBitShift = SectorBits
 Number of bits shift for storing a full vxdID.
 
static const int SubLayerMask = MaxSubLayer << SubLayerBitShift
 mask to get subLayerID from fullSecID
 
static const int VxdIDMask = MaxVxdID << VxdIDBitShift
 mask to get VxdID from fullSecID
 
static const 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 33 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 82 of file FullSecID.h.

82  :
83  m_fullSecID(id) {}
BaseType m_fullSecID
contains full info of current SecID.
Definition: FullSecID.h:221

◆ 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 43 of file FullSecID.cc.

44 {
45  std::vector<std::string> stringSegments;
46  boost::split(stringSegments, sid, boost::is_any_of("_"));
47 
48  unsigned int LayerID = stringSegments[0][0] -
49  '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.
50  unsigned int SubLayerID = 0;
51  if (stringSegments[0].size() > 1) {
52  SubLayerID = stringSegments[0][1] - '0';
53  }
54 // unsigned int SubLayerID = stringSegments[0][1] - '0';
55  unsigned int UniID = std::stoi(stringSegments[1]); // C++03: atoi(stringSegments[1].c_str());
56  unsigned int sectorNumber = std::stoi(stringSegments[2]); // atoi(stringSegments[2].c_str());
57  B2DEBUG(29, "FullSecID-constructor: Value before converting: " << sid << ", after converting: layerID " << LayerID <<
58  ", subLayerID " << SubLayerID << ", UniID " << UniID << ", secID " << sectorNumber);
59  assert(LayerID < MaxLayer + 1);
60  assert(SubLayerID < MaxSubLayer + 1);
61  assert(UniID < MaxVxdID + 1);
62  assert(sectorNumber < MaxSector + 1);
63 
64  LayerID <<= LayerBitShift;
65  SubLayerID <<= SubLayerBitShift;
66  UniID <<= VxdIDBitShift;
67  m_fullSecID = LayerID | SubLayerID | UniID | sectorNumber;
68 }
static const int MaxVxdID
Maximum valid Sensor ID.
Definition: FullSecID.h:186
static const int MaxSubLayer
Maximum valid Ladder ID.
Definition: FullSecID.h:182
static const int MaxSector
Maximum valid Segment ID.
Definition: FullSecID.h:190
static const int LayerBitShift
Number of bits to shift for storing a LayerID.
Definition: FullSecID.h:198
static const int SubLayerBitShift
Number of bits to shift for storing a SubLayerID.
Definition: FullSecID.h:202
static const int MaxLayer
Maximum valid Layer ID.
Definition: FullSecID.h:178
static const int VxdIDBitShift
Number of bits shift for storing a full vxdID.
Definition: FullSecID.h:206

◆ 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 72 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 96 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 68 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 221 of file FullSecID.h.


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