ATLAS Offline Software
Loading...
Searching...
No Matches
HLT::MET::PUSplitGrid Class Reference

#include <PUSplitGrid.h>

Inheritance diagram for HLT::MET::PUSplitGrid:
Collaboration diagram for HLT::MET::PUSplitGrid:

Public Member Functions

 PUSplitGrid (double maxEta, std::size_t nEtaTowers, std::size_t nPhiTowers, bool displaceEta=false, bool displacePhi=false)
 Create a new tower grid.
 PUSplitGrid (const GridParameters &parameters)
 Construct a grid from the provided parameters.
 PUSplitGrid (const PUSplitGrid &other)
 Copy constructor.
void reset ()
 Reset the internal storage.
Toweroperator[] (const std::pair< std::size_t, std::size_t > &indices)
 Access stored value by eta/phi index (access is bounds checked)
std::vector< Tower >::iterator begin ()
 Access by iterator.
std::vector< Tower >::iterator end ()
 Iterator end point.
PufitMultiGridoperator+= (const PufitMultiGrid &other)
 Add a whole grid into this.
PufitMultiGridoperator-= (const PufitMultiGrid &other)
 Subtract a whole grid from this.
PufitGridget ()
 Get one of the underlying grids.
std::size_t getIndex (double eta, double phi, bool &outOfRange) const
 Get the index for the given eta, phi values.
std::size_t getEtaIndex (double eta, bool &outOfRange) const
 Get the eta index for the given value.
std::size_t getPhiIndex (double phi) const
 Get the phi index for the given value.
std::size_t globalIndex (std::size_t iEta, std::size_t iPhi) const
 Convert eta and phi to a global index.
std::pair< std::size_t, std::size_t > etaPhiIndex (std::size_t index) const
 Convert a global index to an eta/phi index pair.
double centralEta (std::size_t iEta) const
 Central eta coordinate of the given eta index.
double centralPhi (std::size_t iPhi) const
 Central phi coordinate of the given phi.
const GridParametersparameters () const
 The grid parameters.
double maxEta () const
 The maximum eta range for the grid.
std::size_t nEtaTowers () const
 The number of eta bins.
std::size_t nPhiTowers () const
 The number of phi bins.
std::size_t nTowers () const
 The number of bins.
bool displaceEta () const
 Whether or not this is displaced in eta.
bool displacePhi () const
 Whether or not this is displaced in phi.
GridDisplacement displacement () const
 The grid displacement.
double etaWidth () const
 The bin width in eta.
double phiWidth () const
 The bin width in phi.

Static Public Attributes

static constexpr std::size_t All
 Maximum value representable by N bits.
static constexpr std::size_t NCategories
 The number of separate categories in the grid.

Private Attributes

std::array< PufitGrid, N > m_grids
std::vector< Towerm_towers
const GridParameters m_params
 The grid's parameters.

Detailed Description

Definition at line 14 of file PUSplitGrid.h.

Constructor & Destructor Documentation

◆ PUSplitGrid() [1/3]

HLT::MET::PUSplitGrid::PUSplitGrid ( double maxEta,
std::size_t nEtaTowers,
std::size_t nPhiTowers,
bool displaceEta = false,
bool displacePhi = false )

Create a new tower grid.

Parameters
maxEtaThe maximum eta range for the grid
nEtaTowersThe number of eta towers
nPhiTowersThe number of phi towers
displaceEtaWhether to displace eta
displacePhiWhether to displace phi

Definition at line 11 of file PUSplitGrid.cxx.

17 {
18 }
PUSplitGrid(double maxEta, std::size_t nEtaTowers, std::size_t nPhiTowers, bool displaceEta=false, bool displacePhi=false)
Create a new tower grid.
std::size_t nPhiTowers() const
The number of phi bins.
double maxEta() const
The maximum eta range for the grid.
std::size_t nEtaTowers() const
The number of eta bins.
bool displacePhi() const
Whether or not this is displaced in phi.
bool displaceEta() const
Whether or not this is displaced in eta.

◆ PUSplitGrid() [2/3]

HLT::MET::PUSplitGrid::PUSplitGrid ( const GridParameters & parameters)

Construct a grid from the provided parameters.

Definition at line 20 of file PUSplitGrid.cxx.

21 {
22 }
const GridParameters & parameters() const
The grid parameters.
PufitMultiGrid(double maxEta, std::size_t nEtaTowers, std::size_t nPhiTowers, bool displaceEta=false, bool displacePhi=false)

◆ PUSplitGrid() [3/3]

HLT::MET::PUSplitGrid::PUSplitGrid ( const PUSplitGrid & other)

Copy constructor.

Definition at line 24 of file PUSplitGrid.cxx.

24 : PufitMultiGrid<3>(other)
25 {
26 }

Member Function Documentation

◆ begin()

std::vector< Tower >::iterator HLT::MET::PufitMultiGrid< N >::begin ( )
inherited

Access by iterator.

◆ centralEta()

double HLT::MET::PeriodicGridBase::centralEta ( std::size_t iEta) const
inherited

Central eta coordinate of the given eta index.

Definition at line 155 of file PeriodicGridBase.cxx.

130 {
131 return -maxEta() + etaWidth() * (iEta + 0.5) + (displaceEta() ? etaWidth() / 2 : 0);
132 }
Multiple grids combined into one.

◆ centralPhi()

double HLT::MET::PeriodicGridBase::centralPhi ( std::size_t iPhi) const
inherited

Central phi coordinate of the given phi.

Definition at line 157 of file PeriodicGridBase.cxx.

134 {
135 return phiWidth() * (iPhi + 0.5) + (displacePhi() ? phiWidth() / 2 : 0);
136 }

◆ displaceEta()

bool HLT::MET::PeriodicGridBase::displaceEta ( ) const
inherited

Whether or not this is displaced in eta.

Definition at line 175 of file PeriodicGridBase.cxx.

143{ return parameters().displaceEta; }
bool displaceEta
Whether the grid is displaced in eta.

◆ displacement()

GridDisplacement HLT::MET::PeriodicGridBase::displacement ( ) const
inherited

The grid displacement.

Definition at line 181 of file PeriodicGridBase.cxx.

146 {
147 return parameters().displacement();
148 }
GridDisplacement displacement() const
The.

◆ displacePhi()

bool HLT::MET::PeriodicGridBase::displacePhi ( ) const
inherited

Whether or not this is displaced in phi.

Definition at line 178 of file PeriodicGridBase.cxx.

144{ return parameters().displacePhi; }
bool displacePhi
Whether the grid is displaced in phi.

◆ end()

std::vector< Tower >::iterator HLT::MET::PufitMultiGrid< N >::end ( )
inherited

Iterator end point.

◆ etaPhiIndex()

std::pair< std::size_t, std::size_t > HLT::MET::PeriodicGridBase::etaPhiIndex ( std::size_t index) const
inherited

Convert a global index to an eta/phi index pair.

Definition at line 152 of file PeriodicGridBase.cxx.

125 {
127 }

◆ etaWidth()

double HLT::MET::PeriodicGridBase::etaWidth ( ) const
inherited

The bin width in eta.

Definition at line 184 of file PeriodicGridBase.cxx.

149{ return 2 * maxEta() / nEtaTowers(); }

◆ get()

PufitGrid & HLT::MET::PufitMultiGrid< N >::get ( )
inlineinherited

Get one of the underlying grids.

This is only defined where I is a power of 2

Definition at line 281 of file PufitMultiGrid.h.

282 {
283 return m_grids[intLog2(I)];
284 }
constexpr uint16_t intLog2(std::size_t i, uint16_t tmp=0)
Compile time calculation of the log base 2 of an integer.

◆ getEtaIndex()

std::size_t HLT::MET::PeriodicGridBase::getEtaIndex ( double eta,
bool & outOfRange ) const
inherited

Get the eta index for the given value.

Parameters
etaThe eta value
[out]outOfRangeSet to true if outside of the eta range

If it's out of range the returned index will be nEta

Definition at line 143 of file PeriodicGridBase.cxx.

88 {
89 if (std::abs(eta) >= maxEta())
90 {
91 outOfRange = true;
92 return nEtaTowers();
93 }
94 outOfRange = false;
95 if (displaceEta())
96 {
97 // Apply the displacement by adding the displacement to the input
98 // coordinate. This shifts the grid in the negative direction
99 eta += etaWidth() / 2;
100 // If necessary apply eta periodicity here
101 if (eta >= maxEta())
102 eta -= 2 * maxEta();
103 }
104 return (eta + maxEta()) / etaWidth();
105 }

◆ getIndex()

std::size_t HLT::MET::PeriodicGridBase::getIndex ( double eta,
double phi,
bool & outOfRange ) const
inherited

Get the index for the given eta, phi values.

Parameters
etaThe eta value
phiThe phi value
[out]outOfRangeSet to true if outside of the eta range

If it's out of range the returned index will be nTowers

Definition at line 131 of file PeriodicGridBase.cxx.

80 {
82 if (outOfRange)
83 return nTowers();
85 }
std::size_t getPhiIndex(double phi) const
std::size_t globalIndex(std::size_t iEta, std::size_t iPhi) const
std::size_t getEtaIndex(double eta, bool &outOfRange) const

◆ getPhiIndex()

std::size_t HLT::MET::PeriodicGridBase::getPhiIndex ( double phi) const
inherited

Get the phi index for the given value.

Definition at line 146 of file PeriodicGridBase.cxx.

108 {
109 if (displacePhi())
110 // Apply the displacement by adding the displacement to the input
111 // coordinate. This shifts the grid in the negative direction
112 phi += phiWidth() / 2;
113 // Apply periodicity
114 phi = std::fmod(phi, 2 * M_PI);
115 if (phi < 0)
116 phi += 2 * M_PI;
117 return phi / phiWidth();
118 }

◆ globalIndex()

std::size_t HLT::MET::PeriodicGridBase::globalIndex ( std::size_t iEta,
std::size_t iPhi ) const
inherited

Convert eta and phi to a global index.

Definition at line 149 of file PeriodicGridBase.cxx.

121 {
122 return iEta * nPhiTowers() + iPhi;
123 }

◆ maxEta()

double HLT::MET::PeriodicGridBase::maxEta ( ) const
inherited

The maximum eta range for the grid.

Definition at line 163 of file PeriodicGridBase.cxx.

139{ return parameters().maxEta; }
double maxEta
The maximum |eta| value.

◆ nEtaTowers()

std::size_t HLT::MET::PeriodicGridBase::nEtaTowers ( ) const
inherited

The number of eta bins.

Definition at line 166 of file PeriodicGridBase.cxx.

140{ return parameters().nEtaTowers; }
std::size_t nEtaTowers
The number of divisions along the eta axis.

◆ nPhiTowers()

std::size_t HLT::MET::PeriodicGridBase::nPhiTowers ( ) const
inherited

The number of phi bins.

Definition at line 169 of file PeriodicGridBase.cxx.

141{ return parameters().nPhiTowers; }
std::size_t nPhiTowers
The number of divisions along the phi axis.

◆ nTowers()

std::size_t HLT::MET::PeriodicGridBase::nTowers ( ) const
inherited

The number of bins.

Definition at line 172 of file PeriodicGridBase.cxx.

142{ return nEtaTowers() * nPhiTowers(); }

◆ operator+=()

PufitMultiGrid & HLT::MET::PufitMultiGrid< N >::operator+= ( const PufitMultiGrid< 3 > & other)
inherited

Add a whole grid into this.

◆ operator-=()

PufitMultiGrid & HLT::MET::PufitMultiGrid< N >::operator-= ( const PufitMultiGrid< 3 > & other)
inherited

Subtract a whole grid from this.

◆ operator[]()

Tower & HLT::MET::PufitMultiGrid< N >::operator[] ( const std::pair< std::size_t, std::size_t > & indices)
inherited

Access stored value by eta/phi index (access is bounds checked)

◆ parameters()

const GridParameters & HLT::MET::PeriodicGridBase::parameters ( ) const
inherited

The grid parameters.

Definition at line 160 of file PeriodicGridBase.cxx.

138{ return m_params; }

◆ phiWidth()

double HLT::MET::PeriodicGridBase::phiWidth ( ) const
inherited

The bin width in phi.

Definition at line 187 of file PeriodicGridBase.cxx.

150{ return 2 * M_PI / nPhiTowers(); }

◆ reset()

void HLT::MET::PufitMultiGrid< N >::reset ( )
inherited

Reset the internal storage.

Member Data Documentation

◆ All

std::size_t HLT::MET::PufitMultiGrid< N >::All
staticconstexprinherited

Maximum value representable by N bits.

Definition at line 71 of file PufitMultiGrid.h.

◆ m_grids

std::array<PufitGrid, N> HLT::MET::PufitMultiGrid< N >::m_grids
privateinherited

Definition at line 309 of file PufitMultiGrid.h.

◆ m_params

const GridParameters HLT::MET::PeriodicGridBase::m_params
privateinherited

The grid's parameters.

Definition at line 191 of file PeriodicGridBase.h.

◆ m_towers

std::vector<Tower> HLT::MET::PufitMultiGrid< N >::m_towers
privateinherited

Definition at line 310 of file PufitMultiGrid.h.

◆ NCategories

std::size_t HLT::MET::PufitMultiGrid< N >::NCategories
staticconstexprinherited

The number of separate categories in the grid.

Definition at line 73 of file PufitMultiGrid.h.


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