17#ifndef JETUTIL_TILEDETAPHIMAP_H
18#define JETUTIL_TILEDETAPHIMAP_H
32 static constexpr double DR2(
double eta1,
double phi1,
double eta2,
double phi2) {
33 double deta = eta1 - eta2;
34 constexpr double pi =
M_PI;
35 constexpr double twopi = 2.0*
pi;
36 double dphi = phi1 - phi2;
37 while ( dphi >
pi ) dphi -=
twopi;
38 while ( dphi <= -
pi ) dphi +=
twopi;
39 return dphi*dphi + deta*deta;
52 template<
class POINT,
class DIST2>
53 class Tile :
public std::list<POINT> {
56 typedef typename tilecontainerbase_t::iterator
iterator;
70 static const DIST2
dr2;
84 template<
class POINT,
class DIST2 =
typename POINT::DR2>
123 if(indx>=
static_cast<int>(
m_ndivX)) indx=
static_cast<int>(
m_ndivX)-1;
125 if(indy>=
static_cast<int>(
m_ndivY)) indy=
static_cast<int>(
m_ndivY)-1;
static const Tile voidTile
the void tile never contains any point.
tilecontainerbase_t::iterator iterator
tilecontainerbase_t::const_iterator const_iterator
std::vector< POINT > pointvec_t
std::list< POINT > tilecontainerbase_t
const Tile< POINT, DIST2 > * m_neighbour[8]
void fillPointsInDr2(POINT &p, double r2, pointvec_t &points) const
Fill a vector of all points from this tile within deltaR of POINT p. (r2 is R squared)
std::vector< POINT > pointsInDr(POINT &p, double r) const
retrieve all points within deltaR of p. WARNING !! wrong results if r>rmax !
virtual ~TiledEtaPhiMap()
std::vector< tile_t > m_tiles
void setEtaRange(double r)
Tile< POINT, DIST2 > tile_t
size_t tileIndex(POINT &p) const
index of the tile containing p
unsigned int size() const
size_t tileIndex_i(int ix, int iy) const
retrieve the tile index from its integer coordinates.
static constexpr double DR2(double eta1, double phi1, double eta2, double phi2)