Belle II Software  release-05-02-19
CompactSecIDs Class Reference

This class provides a computer convenient numbering scheme for the sectors in the sector map and for the N sectors combinations. More...

#include <CompactSecIDs.h>

Collaboration diagram for CompactSecIDs:

Public Types

typedef uint16_t sectorID_t
 Typedef of the compact Id for a single sector.
 
typedef uint32_t secPairID_t
 Typedef of the compact Id for a 2 sectors combination.
 
typedef uint64_t secTripletID_t
 Typedef of the compact Id for a 3 sectors combination.
 
typedef uint64_t secQuadrupletID_t
 Typedef of the compact Id for a 4 sectors combination.
 
typedef std::vector< SectorsOnSensor< sectorID_t > > SensorsOnLadder_t
 Typedef for vector of IDs of sectors on a sensors.
 
typedef std::vector< SensorsOnLadder_tLaddersOnLayer_t
 Typedef for vector of vector of IDs of sectors on a Ladder.
 
typedef std::vector< LaddersOnLayer_tLayersLookUpTable_t
 Typedef for vector of vector of vector of IDs of sectors on a layer.
 

Public Member Functions

 CompactSecIDs ()
 The constructor have just to set the internal counter to 0.
 
 ~CompactSecIDs ()
 The destructor is quite trivial: nothing special to delete.
 
int getSize () const
 Returns the number of sectors defined so far.
 
unsigned int getAvailableSlots () const
 Returns the available number of sector that can be defined now.
 
int addSectors (const std::vector< double > &normalizedUsup, const std::vector< double > &normalizedVsup, const std::vector< std::vector< FullSecID >> &fullSecIDs)
 This method defines all the sectors on a given sensor. More...
 
sectorID_t getCompactID (const FullSecID &fullID) const
 Returns the compact id of the FullSecID. More...
 
SectorsOnSensor< sectorID_tgetSectorsOnSensor (unsigned layer, unsigned ladder, unsigned sensor) const
 Getter for IDs of all sectors on a sensor. More...
 
 BELLE2_DEFINE_EXCEPTION (unboundedNormalizedU, "On layer:%1% ladder:%2% sensor:%3% abnormal U=%4$")
 Exception for normalized coordinate U out of bound [0,1].
 
 BELLE2_DEFINE_EXCEPTION (unboundedNormalizedV, "On layer:%1% ladder:%2% sensor:%3% abnormal V=%4$")
 Exception for normalized coordinate V out of bound [0,1].
 
FullSecID getFullSecID (VxdID aSensorID, double normalizedU, double normalizedV) const
 Returns a fullSecID for given sensor and pair of coordinates. More...
 
sectorID_t operator[] (const FullSecID &fullID) const
 Returns the compact id of the FullSecID. More...
 
secPairID_t getCompactID (const FullSecID &id1, const FullSecID &id2) const
 Returns the compact id of the pair of FullSecID id1 id2. More...
 
secTripletID_t getCompactID (const FullSecID &id1, const FullSecID &id2, const FullSecID &id3) const
 Returns the compact id of the triplet of FullSecID id1 id2 id3 If any of the id1, id2 or id3 is undefined 0 is returned.
 
secQuadrupletID_t getCompactID (const FullSecID &id1, const FullSecID &id2, const FullSecID &id3, const FullSecID &id4) const
 Returns the compact id of the quadruplet of FullSecID id1 id2 id3 id4 If any of the id1, id2, id3 or id4 is undefined 0 is returned.
 
sectorID_t getCompactIDFastAndDangerous (const FullSecID &fullID) const
 Fast (and potentially dangerous) equivalent of getCompactID. More...
 
bool areCoordinatesValid (VxdID aSensorID, double normalizedU, double normalizedV) const
 JKL: returns true if operator() will not throw an exception.
 
const LayersLookUpTable_tgetCompactSectorsIDMap () const
 Get access to the whole map.
 
int nOfLayers (void) const
 get the number of layers in this CompactSecIDs
 
int nOfLadders (int layer) const
 get the number of ladders on More...
 
int nOfSensors (int layer, int ladder) const
 get the number of sensors on More...
 
bool setSubLayerID (FullSecID &sector, int sublayer)
 set the SublayerID of the sector More...
 

Static Public Member Functions

static void extractCompactID (secPairID_t pair_id, sectorID_t &id1, sectorID_t &id2)
 Sets the two compact Sector id. More...
 
static void extractCompactID (secTripletID_t triplet_id, sectorID_t &id1, sectorID_t &id2, sectorID_t &id3)
 Sets the three compact Sector id. More...
 

Private Member Functions

template<class TContainer , class ... Indexes>
int privateAddSectors (TContainer &container, const std::vector< double > &normalizedUsup, const std::vector< double > &normalizedVsup, const std::vector< std::vector< FullSecID > > &fullSecIDs, short unsigned int index, Indexes ... indexes)
 The hidden private method that recursively manage the size of everything. More...
 
int privateAddSectors (SectorsOnSensor< sectorID_t > &sectors, const std::vector< double > &normalizedUsup, const std::vector< double > &normalizedVsup, const std::vector< std::vector< FullSecID > > &fullSecIDs)
 The hidden private method that end the recursion. More...
 
template<class TContainer , class ... Indexes>
sectorID_t privateGetCompactID (const TContainer &container, short unsigned int index, Indexes ... indexes) const
 The hidden private method that recursively descend the layer, ladder, sensor stack and returns the compactID of a given fullSecID. More...
 
template<class TContainer >
sectorID_t privateGetCompactID (const TContainer &container, short unsigned int index) const
 The hidden private method that close the recursion. More...
 

Private Attributes

sectorID_t m_sectorCounter
 Counter for sectors.
 
LayersLookUpTable_t m_compactSectorsIDMap
 Lookup table containing all sectorIDs.
 

Detailed Description

This class provides a computer convenient numbering scheme for the sectors in the sector map and for the N sectors combinations.

Sectors are labeled with consecutives numbers starting from 1. Methods are provided to convert the fullSecIds (human readable) to compactSecIDs (computer convenient) back and forth.

Definition at line 38 of file CompactSecIDs.h.

Member Function Documentation

◆ addSectors()

int addSectors ( const std::vector< double > &  normalizedUsup,
const std::vector< double > &  normalizedVsup,
const std::vector< std::vector< FullSecID >> &  fullSecIDs 
)
inline

This method defines all the sectors on a given sensor.

The two vectors normalizedUsup and normalizedVsup define the sector boundaries in normalized coordinates. (e.g.: if normalizesUsup = { a, 1} two sectors boundary are defined [0,a) and [a,1). ) The returned value is the number of fullSecIDs actually added to this CompacSecIDs.

Definition at line 79 of file CompactSecIDs.h.

92  : fullSecIDs) {
93  // Check that the fullSecIDs vector of vector is rectangular
94  if (fullSecIDrow.size() != normalizedVsup.size() + 1)
95  return 0;
96 
97  // Check that all the fullSectorIDs are on the same physical sensor
98  for (auto fullSecID : fullSecIDrow)
99  if (layer != fullSecID.getLayerID() ||
100  ladder != fullSecID.getLadderID() ||
101  sensor != fullSecID.getVxdID().getSensorNumber())
102  return 0;
103  }
104 
106  normalizedUsup, normalizedVsup,
107  fullSecIDs,
108  layer, ladder, sensor);
109 
110  }
111 
112 
116  sectorID_t getCompactID(const FullSecID& fullID) const
117  {
118 

◆ extractCompactID() [1/2]

static void extractCompactID ( secPairID_t  pair_id,
sectorID_t id1,
sectorID_t id2 
)
inlinestatic

Sets the two compact Sector id.

Parameters
id1and

Definition at line 210 of file CompactSecIDs.h.

◆ extractCompactID() [2/2]

static void extractCompactID ( secTripletID_t  triplet_id,
sectorID_t id1,
sectorID_t id2,
sectorID_t id3 
)
inlinestatic

Sets the three compact Sector id.

Parameters
id1

Definition at line 242 of file CompactSecIDs.h.

◆ getCompactID() [1/2]

sectorID_t getCompactID ( const FullSecID fullID) const
inline

Returns the compact id of the FullSecID.

Parameters
fullID.It return 0 if @paam fullID is unknown. It does not throw exceptions (at least it should not).

Definition at line 124 of file CompactSecIDs.h.

◆ getCompactID() [2/2]

secPairID_t getCompactID ( const FullSecID id1,
const FullSecID id2 
) const
inline

Returns the compact id of the pair of FullSecID id1 id2.

If

Parameters
id1or
id2is undefined 0 is returned.

Definition at line 193 of file CompactSecIDs.h.

◆ getCompactIDFastAndDangerous()

sectorID_t getCompactIDFastAndDangerous ( const FullSecID fullID) const
inline

Fast (and potentially dangerous) equivalent of getCompactID.

It will not check for out of boundaries fullID / ill defined

Parameters
fullID

Definition at line 278 of file CompactSecIDs.h.

◆ getFullSecID()

FullSecID getFullSecID ( VxdID  aSensorID,
double  normalizedU,
double  normalizedV 
) const
inline

Returns a fullSecID for given sensor and pair of coordinates.

An exception is thrown in case of errors (index/coordinate out of range).

Definition at line 161 of file CompactSecIDs.h.

◆ getSectorsOnSensor()

SectorsOnSensor<sectorID_t> getSectorsOnSensor ( unsigned  layer,
unsigned  ladder,
unsigned  sensor 
) const
inline

Getter for IDs of all sectors on a sensor.

Parameters
layer: layer number of the sensor
ladder: ladder number of the sensor
sensor: sensor number
Returns
vector containing the IDs of the sectors on the sensor

Definition at line 141 of file CompactSecIDs.h.

◆ nOfLadders()

int nOfLadders ( int  layer) const
inline

get the number of ladders on

Parameters
layer.0 if the the layer is out of bounds

Definition at line 325 of file CompactSecIDs.h.

◆ nOfSensors()

int nOfSensors ( int  layer,
int  ladder 
) const
inline

get the number of sensors on

Parameters
layer

Definition at line 334 of file CompactSecIDs.h.

◆ operator[]()

sectorID_t operator[] ( const FullSecID fullID) const
inline

Returns the compact id of the FullSecID.

Parameters
fullID.If
fullIDis unknown 0 is returned. It will not throw exceptions

Definition at line 186 of file CompactSecIDs.h.

◆ privateAddSectors() [1/2]

int privateAddSectors ( SectorsOnSensor< sectorID_t > &  sectors,
const std::vector< double > &  normalizedUsup,
const std::vector< double > &  normalizedVsup,
const std::vector< std::vector< FullSecID > > &  fullSecIDs 
)
inlineprivate

The hidden private method that end the recursion.

It returns the number of added sectors. In particular it return 0 if sectors are already defined on the sensor.

Definition at line 388 of file CompactSecIDs.h.

◆ privateAddSectors() [2/2]

int privateAddSectors ( TContainer &  container,
const std::vector< double > &  normalizedUsup,
const std::vector< double > &  normalizedVsup,
const std::vector< std::vector< FullSecID > > &  fullSecIDs,
short unsigned int  index,
Indexes ...  indexes 
)
inlineprivate

The hidden private method that recursively manage the size of everything.

It returns the number of added sectors. It returns 0 in case of errors (memory exausted, or sector redefinition.)

Definition at line 369 of file CompactSecIDs.h.

◆ privateGetCompactID() [1/2]

sectorID_t privateGetCompactID ( const TContainer &  container,
short unsigned int  index 
) const
inlineprivate

The hidden private method that close the recursion.

Sanity checks are performed on the last index. 0 is returned in case of errors (i.e. indexes out of bound).

Definition at line 436 of file CompactSecIDs.h.

◆ privateGetCompactID() [2/2]

sectorID_t privateGetCompactID ( const TContainer &  container,
short unsigned int  index,
Indexes ...  indexes 
) const
inlineprivate

The hidden private method that recursively descend the layer, ladder, sensor stack and returns the compactID of a given fullSecID.

Sanity checks are performed at each step. 0 is returned in case of errors (i.e. indexes out of bound).

Definition at line 422 of file CompactSecIDs.h.

◆ setSubLayerID()

bool setSubLayerID ( FullSecID sector,
int  sublayer 
)
inline

set the SublayerID of the sector

Parameters
sectorthe FullSectorID of the sector, the sublayer id will be ignored during searching for the sector
sublayerthe new sublayer id

Definition at line 345 of file CompactSecIDs.h.


The documentation for this class was generated from the following file:
Belle2::CompactSecIDs::m_compactSectorsIDMap
LayersLookUpTable_t m_compactSectorsIDMap
Lookup table containing all sectorIDs.
Definition: CompactSecIDs.h:362
Belle2::CompactSecIDs::sectorID_t
uint16_t sectorID_t
Typedef of the compact Id for a single sector.
Definition: CompactSecIDs.h:45
Belle2::CompactSecIDs::getCompactID
sectorID_t getCompactID(const FullSecID &fullID) const
Returns the compact id of the FullSecID.
Definition: CompactSecIDs.h:124
Belle2::CompactSecIDs::privateAddSectors
int privateAddSectors(TContainer &container, const std::vector< double > &normalizedUsup, const std::vector< double > &normalizedVsup, const std::vector< std::vector< FullSecID > > &fullSecIDs, short unsigned int index, Indexes ... indexes)
The hidden private method that recursively manage the size of everything.
Definition: CompactSecIDs.h:369