CbmRoot
|
Class for storing 2d objects in a grid. More...
#include <CaGrid.h>
Public Member Functions | |
Grid ()=default | |
Default constructor. | |
~Grid ()=default | |
Destructor. | |
void | BuildBins (fscal xMin, fscal xMax, fscal yMin, fscal yMax, fscal binWidthX, fscal binWidthY) |
Build the grid. | |
void | StoreHits (const ca::Vector< ca::Hit > &hits, ca::HitIndex_t hitStartIndex, ca::HitIndex_t nHits, const ca::Vector< unsigned char > &hitKeyFlags) |
Store objects in the grid. | |
void | RemoveUsedHits (const ca::Vector< ca::Hit > &hits, const ca::Vector< unsigned char > &hitKeyFlags) |
Remove grid entries that correspond to the used hits. | |
int | GetBin (fscal X, fscal Y) const |
Get bin index for (X,Y) point with boundary check. | |
int | GetBinX (fscal X) const |
Get bin X index with boundary check. | |
int | GetBinY (fscal Y) const |
Get bin Y index with boundary check. | |
std::tuple< fscal, fscal > | GetBinBoundsX (int iBin) const |
Get bin bounds along X. | |
std::tuple< fscal, fscal > | GetBinBoundsY (int iBin) const |
Get bin bounds along Y. | |
int | GetNofBins () const |
Get number of bins. | |
int | GetNofBinsX () const |
Get number of bins along X. | |
int | GetNofBinsY () const |
Get number of bins along Y. | |
ca::HitIndex_t | GetFirstBinEntryIndex (int bin) const |
Get index of the first bin entry in fHitsInBin array. | |
const ca::Vector< ca::GridEntry > & | GetEntries () const |
Get number of entries in the bin. | |
fscal | GetMinX () const |
Get minimal X value. | |
fscal | GetMinY () const |
Get minimal Y value. | |
fscal | GetBinWidthX () const |
Get bin width in X. | |
fscal | GetBinWidthY () const |
Get bin width in Y. | |
fscal | GetMaxRangeX () const |
Get maximal entry range in X. | |
fscal | GetMaxRangeY () const |
Get maximal entry range in Y. | |
fscal | GetMaxRangeT () const |
Get maximal entry range in T. | |
Private Attributes | |
int | fN {0} |
— Data members — | |
int | fNx {0} |
N bins in X. | |
int | fNy {0} |
N bins in Y. | |
fscal | fMinX {0.} |
minimal X value | |
fscal | fMinY {0.} |
minimal Y value | |
fscal | fBinWidthX {0.} |
bin width in X | |
fscal | fBinWidthY {0.} |
bin width in Y | |
fscal | fBinWidthXinv {0.} |
inverse bin width in X | |
fscal | fBinWidthYinv {0.} |
inverse bin width in Y | |
fscal | fMaxRangeX {0.} |
maximal entry range in X | |
fscal | fMaxRangeY {0.} |
maximal entry range in Y | |
fscal | fMaxRangeT {0.} |
maximal entry range in T | |
ca::Vector< ca::HitIndex_t > | fFirstBinEntryIndex |
index of the first entry in the bin | |
ca::Vector< ca::HitIndex_t > | fNofBinEntries {"Grid::fNofBinEntries", 1, 0} |
number of hits in the bin | |
ca::Vector< ca::GridEntry > | fEntries |
grid entries with references to the hit index in fWindowHits | |
Class for storing 2d objects in a grid.
It creates 2-dimensional backet-sorted grid of pointers to 2-dimensional objects.
The class provides an access to the objects in selected 2D bin without touching the rest of the data. To loop over the objects in arbitrary XY-area one can use the ca::GridArea class.
The class is used by CaTracker to speed-up the hit search operations The grid axis are named X and Y
|
default |
Default constructor.
|
default |
Destructor.
void cbm::algo::ca::Grid::BuildBins | ( | fscal | xMin, |
fscal | xMax, | ||
fscal | yMin, | ||
fscal | yMax, | ||
fscal | binWidthX, | ||
fscal | binWidthY ) |
Build the grid.
xMin | - minimal X value |
xMax | - maximal X value |
yMin | - minimal Y value |
yMax | - maximal Y value |
binWidthX | - bin width in X |
binWidthY | - bin width in Y |
Definition at line 19 of file CaGrid.cxx.
References fBinWidthX, fBinWidthXinv, fBinWidthY, fBinWidthYinv, fEntries, fFirstBinEntryIndex, fMinX, fMinY, fN, fNofBinEntries, fNx, fNy, and cbm::algo::ca::Vector< T >::reset().
Referenced by cbm::algo::ca::TrackFinderWindow::PrepareGrid().
Get bin bounds along X.
iBin | - bin index |
Definition at line 176 of file CaGrid.h.
References fBinWidthX, fMinX, and fNx.
Get bin bounds along Y.
iBin | - bin index |
Definition at line 182 of file CaGrid.h.
References fBinWidthY, fMinY, and fNx.
|
inline |
|
inline |
|
inline |
Get bin X index with boundary check.
X | - x coordinate |
Definition at line 164 of file CaGrid.h.
References fBinWidthXinv, fMinX, and fNx.
Referenced by GetBin(), and cbm::algo::ca::GridArea::GridArea().
|
inline |
Get bin Y index with boundary check.
Y | - y coordinate |
Definition at line 170 of file CaGrid.h.
References fBinWidthYinv, fMinY, and fNy.
Referenced by GetBin(), and cbm::algo::ca::GridArea::GridArea().
|
inline |
Get number of entries in the bin.
Get entries
Definition at line 106 of file CaGrid.h.
References fEntries.
Referenced by cbm::algo::ca::GridArea::DoLoopOverEntireGrid(), and cbm::algo::ca::GridArea::GetNextObjectId().
|
inline |
Get index of the first bin entry in fHitsInBin array.
Definition at line 100 of file CaGrid.h.
References fFirstBinEntryIndex, and fN.
Referenced by cbm::algo::ca::GridArea::GetNextGridEntry(), and cbm::algo::ca::GridArea::GridArea().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void cbm::algo::ca::Grid::RemoveUsedHits | ( | const ca::Vector< ca::Hit > & | hits, |
const ca::Vector< unsigned char > & | hitKeyFlags ) |
Remove grid entries that correspond to the used hits.
Definition at line 96 of file CaGrid.cxx.
References cbm::algo::ca::Hit::BackKey(), fEntries, fFirstBinEntryIndex, fMaxRangeT, fMaxRangeX, fMaxRangeY, fN, fNofBinEntries, cbm::algo::ca::Hit::FrontKey(), hits, and cbm::algo::ca::Vector< T >::shrink().
Referenced by cbm::algo::ca::TrackFinderWindow::PrepareCAIteration().
void cbm::algo::ca::Grid::StoreHits | ( | const ca::Vector< ca::Hit > & | hits, |
ca::HitIndex_t | hitStartIndex, | ||
ca::HitIndex_t | nHits, | ||
const ca::Vector< unsigned char > & | hitKeyFlags ) |
Store objects in the grid.
void StoreData(...);
Store ca::Hits in the grid
hits | - vector of hits to store |
hitStartIndex | - index of the first hit to store |
nHits | - number of hits to store starting from the hitStartIndex |
hitKeyFlags | - vector of flags to recognise used hits and skip them |
Definition at line 56 of file CaGrid.cxx.
References cbm::algo::ca::Hit::BackKey(), fEntries, fFirstBinEntryIndex, fMaxRangeT, fMaxRangeX, fMaxRangeY, fN, fNofBinEntries, cbm::algo::ca::Hit::FrontKey(), GetBin(), hits, cbm::algo::ca::Hit::RangeT(), cbm::algo::ca::Hit::RangeX(), cbm::algo::ca::Hit::RangeY(), cbm::algo::ca::Vector< T >::reset(), cbm::algo::ca::Hit::X(), and cbm::algo::ca::Hit::Y().
|
private |
bin width in X
Definition at line 138 of file CaGrid.h.
Referenced by BuildBins(), GetBinBoundsX(), and GetBinWidthX().
|
private |
inverse bin width in X
Definition at line 140 of file CaGrid.h.
Referenced by BuildBins(), and GetBinX().
|
private |
bin width in Y
Definition at line 139 of file CaGrid.h.
Referenced by BuildBins(), GetBinBoundsY(), and GetBinWidthY().
|
private |
inverse bin width in Y
Definition at line 141 of file CaGrid.h.
Referenced by BuildBins(), and GetBinY().
|
private |
grid entries with references to the hit index in fWindowHits
Definition at line 152 of file CaGrid.h.
Referenced by BuildBins(), GetEntries(), RemoveUsedHits(), and StoreHits().
|
private |
index of the first entry in the bin
Definition at line 147 of file CaGrid.h.
Referenced by BuildBins(), GetFirstBinEntryIndex(), RemoveUsedHits(), and StoreHits().
|
private |
maximal entry range in T
Definition at line 145 of file CaGrid.h.
Referenced by GetMaxRangeT(), RemoveUsedHits(), and StoreHits().
|
private |
maximal entry range in X
Definition at line 143 of file CaGrid.h.
Referenced by GetMaxRangeX(), RemoveUsedHits(), and StoreHits().
|
private |
maximal entry range in Y
Definition at line 144 of file CaGrid.h.
Referenced by GetMaxRangeY(), RemoveUsedHits(), and StoreHits().
|
private |
minimal X value
Definition at line 136 of file CaGrid.h.
Referenced by BuildBins(), GetBinBoundsX(), GetBinX(), and GetMinX().
|
private |
minimal Y value
Definition at line 137 of file CaGrid.h.
Referenced by BuildBins(), GetBinBoundsY(), GetBinY(), and GetMinY().
|
private |
— Data members —
total N bins
Definition at line 132 of file CaGrid.h.
Referenced by BuildBins(), GetFirstBinEntryIndex(), GetNofBins(), RemoveUsedHits(), and StoreHits().
|
private |
number of hits in the bin
Definition at line 150 of file CaGrid.h.
Referenced by BuildBins(), RemoveUsedHits(), and StoreHits().
|
private |
N bins in X.
Definition at line 133 of file CaGrid.h.
Referenced by BuildBins(), GetBin(), GetBinBoundsX(), GetBinBoundsY(), GetBinX(), and GetNofBinsX().
|
private |
N bins in Y.
Definition at line 134 of file CaGrid.h.
Referenced by BuildBins(), GetBinY(), and GetNofBinsY().