 |
Belle II Software
release-05-02-19
|
12 #include "tracking/dataobjects/FullSecID.h"
13 #include <tracking/trackFindingVXD/filterMap/map/SectorsOnSensor.h>
14 #include <framework/core/FrameworkExceptions.h>
15 #include <framework/logging/Logger.h>
71 int addSectors(
const std::vector< double>& normalizedUsup,
72 const std::vector< double>& normalizedVsup,
73 const std::vector< std::vector< FullSecID >>& fullSecIDs)
77 (normalizedVsup.size() + 1))
82 if (fullSecIDs.size() != normalizedUsup.size() + 1 ||
83 fullSecIDs[0].size() != normalizedVsup.size() + 1)
88 auto layer = fullSecIDs[0][0].getLayerID();
89 auto ladder = fullSecIDs[0][0].getLadderID();
90 auto sensor = fullSecIDs[0][0].getVxdID().getSensorNumber();
92 for (
auto fullSecIDrow : fullSecIDs) {
94 if (fullSecIDrow.size() != normalizedVsup.size() + 1)
98 for (
auto fullSecID : fullSecIDrow)
99 if (layer != fullSecID.getLayerID() ||
100 ladder != fullSecID.getLadderID() ||
101 sensor != fullSecID.getVxdID().getSensorNumber())
106 normalizedUsup, normalizedVsup,
108 layer, ladder, sensor);
121 fullID.getLadderID(),
122 fullID.getVxdID().getSensorNumber(),
139 {
return SectorsOnSensor<sectorID_t>(); }
145 "On layer:%1% ladder:%2% sensor:%3% abnormal U=%4$");
149 "On layer:%1% ladder:%2% sensor:%3% abnormal V=%4$");
154 double normalizedU,
double normalizedV)
const
161 auto sectorsOnSensor =
165 if (normalizedU < 0. || 1. < normalizedU)
166 B2WARNING(
"CompactSecIDs: U not normalized! This may lead to undefined behavior!");
167 if (normalizedV < 0. || 1. < normalizedV)
168 B2WARNING(
"CompactSecIDs: V not normalized! This may lead to undefined behavior!");
170 return sectorsOnSensor(normalizedU, normalizedV);
196 return i1 + (i2 << 16);
204 id1 = pair_id & 0xffff;
205 id2 = (pair_id >> 16) & 0xffff;
213 const FullSecID& id3)
const
228 return i1 + (i2 << 16) + (i3 << 32);
236 id1 = triplet_id & 0xffff;
237 id2 = (triplet_id >> 16) & 0xffff;
238 id3 = (triplet_id >> 32) & 0xffff;
244 const FullSecID& id3,
const FullSecID& id4)
264 return i1 + (i2 << 16) + (i3 << 32) + (i4 << 48) ;
328 if (ladder < 0 || ladder >=
nOfLadders(layer))
341 if (compactID == 0)
return false;
345 [sector.getVxdID().getSensorNumber()].updateSubLayerID(sector, sublayer);
359 template<
class TContainer,
362 const std::vector< double >& normalizedUsup,
363 const std::vector< double >& normalizedVsup,
364 const std::vector< std::vector< FullSecID > >& fullSecIDs,
365 short unsigned int index, Indexes ... indexes)
368 if ((
int) container.size() < (
int)index + 1)
369 container.resize(index + 1);
370 }
catch (...) {
return 0; }
372 normalizedUsup, normalizedVsup,
373 fullSecIDs, indexes...);
381 const std::vector< double>& normalizedUsup,
382 const std::vector< double>& normalizedVsup,
383 const std::vector< std::vector< FullSecID > >& fullSecIDs)
385 if (sectors.size() != 0)
389 normalizedVsup, fullSecIDs);
391 int addedSectors = 0;
393 for (
auto sectorRow : fullSecIDs)
394 for (
auto sector : sectorRow) {
395 auto secID = sector.getSecID();
397 if ((
int) sectors.size() < (
int) secID + 1)
398 sectors.resize(secID + 1);
399 }
catch (...) {
return addedSectors; }
412 template<
class TContainer,
415 short unsigned int index, Indexes ... indexes)
const
417 if ((
int) container.size() < (
int) index + 1)
427 template<
class TContainer >
429 short unsigned int index)
const
431 if ((
int) container.size() < (
int) index + 1)
434 return container[ index ];
BELLE2_DEFINE_EXCEPTION(unboundedNormalizedU, "On layer:%1% ladder:%2% sensor:%3% abnormal U=%4$")
Exception for normalized coordinate U out of bound [0,1].
LayersLookUpTable_t m_compactSectorsIDMap
Lookup table containing all sectorIDs.
sectorID_t m_sectorCounter
Counter for sectors.
Class to uniquely identify a any structure of the PXD and SVD.
int nOfSensors(int layer, int ladder) const
get the number of sensors on
int nOfLadders(int layer) const
get the number of ladders on
uint16_t sectorID_t
Typedef of the compact Id for a single sector.
static void extractCompactID(secPairID_t pair_id, sectorID_t &id1, sectorID_t &id2)
Sets the two compact Sector id.
baseType getLadderNumber() const
Get the ladder id.
int nOfLayers(void) const
get the number of layers in this CompactSecIDs
VxdID getVxdID() const
returns VxdID of sensor.
std::vector< SectorsOnSensor< sectorID_t > > SensorsOnLadder_t
Typedef for vector of IDs of sectors on a sensors.
sectorID_t getCompactID(const FullSecID &fullID) const
Returns the compact id of the FullSecID.
~CompactSecIDs()
The destructor is quite trivial: nothing special to delete.
bool setSubLayerID(FullSecID §or, int sublayer)
set the SublayerID of the sector
unsigned int getAvailableSlots() const
Returns the available number of sector that can be defined now.
Class to identify a sector inside of the VXD.
SectorsOnSensor< sectorID_t > getSectorsOnSensor(unsigned layer, unsigned ladder, unsigned sensor) const
Getter for IDs of all sectors on a sensor.
bool areCoordinatesValid(VxdID aSensorID, double normalizedU, double normalizedV) const
JKL: returns true if operator() will not throw an exception.
Abstract base class for different kinds of events.
std::vector< SensorsOnLadder_t > LaddersOnLayer_t
Typedef for vector of vector of IDs of sectors on a Ladder.
uint64_t secTripletID_t
Typedef of the compact Id for a 3 sectors combination.
short int getSecID() const
returns SecID of current FullSecID (only unique for each sensor).
int getSize() const
Returns the number of sectors defined so far.
This class associates to an ordered pairs of normalized local coordinates a compact sector id.
baseType getSensorNumber() const
Get the sensor id.
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.
sectorID_t getCompactIDFastAndDangerous(const FullSecID &fullID) const
Fast (and potentially dangerous) equivalent of getCompactID.
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 co...
const LayersLookUpTable_t & getCompactSectorsIDMap() const
Get access to the whole map.
sectorID_t operator[](const FullSecID &fullID) const
Returns the compact id of the FullSecID.
uint64_t secQuadrupletID_t
Typedef of the compact Id for a 4 sectors combination.
baseType getLayerNumber() const
Get the layer id.
CompactSecIDs()
The constructor have just to set the internal counter to 0.
int getLadderID() const
returns LadderID compatible with basf2 standards
short int getLayerID() const
returns LayerID compatible with basf2 standards.
FullSecID getFullSecID(VxdID aSensorID, double normalizedU, double normalizedV) const
Returns a fullSecID for given sensor and pair of coordinates.
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 undef...
std::vector< LaddersOnLayer_t > LayersLookUpTable_t
Typedef for vector of vector of vector of IDs of sectors on a layer.
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.
uint32_t secPairID_t
Typedef of the compact Id for a 2 sectors combination.