Belle II Software  release-06-01-15
Const::DetectorSet Class Reference

The DetectorSet class for sets of detector IDs in the form of EDetector values. More...

#include <Const.h>

Inheritance diagram for Const::DetectorSet:

Public Member Functions

 DetectorSet ()
 Default constructor.
 
 DetectorSet (const DetectorSet &)=default
 Copy constructor.
 
DetectorSetoperator= (const DetectorSet &)=default
 Assignment operator.
 
 DetectorSet (EDetector det)
 Constructor for a set containig one detector ID. More...
 
virtual ~DetectorSet ()
 Destructor.
 
DetectorSetoperator+= (const DetectorSet &set)
 Addition of another set to this one. More...
 
DetectorSetoperator-= (const DetectorSet &set)
 Subtraction of another set from this one. More...
 
bool operator== (const DetectorSet &set) const
 Equality operator. More...
 
bool operator!= (const DetectorSet &set) const
 Inequality operator. More...
 
bool contains (const DetectorSet &set) const
 Check whether this set contains another set. More...
 
int getIndex (EDetector det) const
 Getter for the index of a given detector in this set. More...
 
EDetector operator[] (int index) const
 Accessor for a detector ID in this set. More...
 
size_t size () const
 Getter for number of detector IDs in this set.
 
std::string __repr__ () const
 String for printing in python.
 

Private Member Functions

 DetectorSet (unsigned short bits)
 Constructor. More...
 

Static Private Member Functions

static unsigned short getBit (EDetector det)
 Conversion of detector ID to bit pattern. More...
 
static EDetector getDetector (unsigned short bit)
 Conversion of bit pattern to detector ID. More...
 

Private Attributes

unsigned short m_bits
 The internal representation of the set as bit pattern.
 

Detailed Description

The DetectorSet class for sets of detector IDs in the form of EDetector values.

Only detectors may be included, not subdetectors.

Definition at line 71 of file Const.h.

Constructor & Destructor Documentation

◆ DetectorSet() [1/2]

DetectorSet ( EDetector  det)
inline

Constructor for a set containig one detector ID.

Parameters
detThe ID of the detector.

Definition at line 86 of file Const.h.

◆ DetectorSet() [2/2]

DetectorSet ( unsigned short  bits)
inlineexplicitprivate

Constructor.

Parameters
bitsThe internal representation of the set as bit pattern.

Definition at line 153 of file Const.h.

Member Function Documentation

◆ contains()

bool contains ( const DetectorSet set) const
inline

Check whether this set contains another set.

Parameters
setThe other set of detector IDs.

Definition at line 121 of file Const.h.

◆ getBit()

unsigned short getBit ( Const::EDetector  det)
staticprivate

Conversion of detector ID to bit pattern.

Parameters
detThe detector ID.
Returns
The bit pattern representing the given detector ID.

Definition at line 203 of file UnitConst.cc.

◆ getDetector()

Const::EDetector getDetector ( unsigned short  bit)
staticprivate

Conversion of bit pattern to detector ID.

Parameters
bitThe bit pattern.
Returns
The detector ID corresponding to the given bit pattern.

Definition at line 216 of file UnitConst.cc.

◆ getIndex()

int getIndex ( EDetector  det) const

Getter for the index of a given detector in this set.

Parameters
detThe detector ID.
Returns
Index of the detector ID in this set, or -1 if the detector ID is not in this set.

Definition at line 235 of file UnitConst.cc.

◆ operator!=()

bool operator!= ( const DetectorSet set) const
inline

Inequality operator.

Parameters
setThe other set of detector IDs.

Definition at line 115 of file Const.h.

◆ operator+=()

DetectorSet& operator+= ( const DetectorSet set)
inline

Addition of another set to this one.

Parameters
setThe other set of detector IDs.

Definition at line 97 of file Const.h.

◆ operator-=()

DetectorSet& operator-= ( const DetectorSet set)
inline

Subtraction of another set from this one.

Parameters
setThe other set of detector IDs.

Definition at line 103 of file Const.h.

◆ operator==()

bool operator== ( const DetectorSet set) const
inline

Equality operator.

Parameters
setThe other set of detector IDs.

Definition at line 109 of file Const.h.

◆ operator[]()

Const::EDetector operator[] ( int  index) const

Accessor for a detector ID in this set.

Parameters
indexThe index in the set.
Returns
The detector ID at the given index, or Const::invalidDetector if the index is out of range.

Definition at line 246 of file UnitConst.cc.


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