ATLAS Offline Software
Loading...
Searching...
No Matches
HLT::MET::PufitMultiGrid< N >::Tower Class Reference

Tower in the multi-grid. More...

#include <PufitMultiGrid.h>

Inheritance diagram for HLT::MET::PufitMultiGrid< N >::Tower:
Collaboration diagram for HLT::MET::PufitMultiGrid< N >::Tower:

Public Member Functions

 Tower (PufitMultiGrid *parent, std::size_t index)
 Create a tower with its parent grid.
 Tower (const Tower &)=default
Toweroperator= (const Tower &other)
 Copy assignment operator.
double ex (std::size_t type=All) const
 The x-component of this tower's energy.
double ey (std::size_t type=All) const
 The y-component of this tower's energy.
double ez (std::size_t type=All) const
 The z-component of this tower's energy.
double sumEt (std::size_t type=All) const
 The total sumEt in this tower.
double sumE (std::size_t type=All) const
 The total sumE in this tower.
double phi (std::size_t type=All) const
 This tower's kinematic phi.
double eta (std::size_t type=All) const
 This tower's kinematic eta.
bool masked () const
 Whether or not this tower was masked.
void mask (bool value=true)
 Set the mask on this tower.
const PufitMultiGridgrid () const override
 The parent grid of this tower.
SignedKinematics kinematics (std::size_t type=All) const
 Build a kinematics object from this tower.
 operator SignedKinematics () const
 Conversion operator, returns the value for the sum of all the grids.
Toweroperator+= (const Tower &other)
 Add another tower's energies into this one.
Toweroperator-= (const Tower &other)
 Subtract another tower's energies from this one.
template<std::size_t I, typename = typename std::enable_if<isPow2(I)>::type>
PufitGrid::Towerget ()
 Get one of the underlying towers.
template<std::size_t I, typename = typename std::enable_if<isPow2(I)>::type>
const PufitGrid::Towerget () const
 Get one of the underlying towers.
double towerPhi () const
 The central phi coordinate of this tower.
double towerEta () const
 The central eta coordinate of this tower.
std::size_t index () const
 The global index of this tower.
std::size_t etaIndex () const
 The eta index of this tower.
std::size_t phiIndex () const
 The phi index of this tower.
std::pair< std::size_t, std::size_t > etaPhiIndex () const
 The eta/phi indices of the tower together.

Private Member Functions

PufitGrid::TowersubTower (std::size_t ii)
 Get a subtower by index.
const PufitGrid::TowersubTower (std::size_t ii) const
 Get a subtower by index.
void applyToAll (PufitGrid::Tower &(PufitGrid::Tower::*f)(const PufitGrid::Tower &), const PufitMultiGrid::Tower &other)
 Apply a function to all sub towers.
template<typename T>
std::decay< T >::type sumOver (int type, T(PufitGrid::Tower::*f)() const) const
 Sum over the results of all sub towers whose indices match the 'type' mask.

Private Attributes

PufitMultiGrid *const m_parent
 The parent grid.
bool m_mask {false}
 The mask value.
std::size_t m_index

Friends

class PufitMulitGrid

Detailed Description

template<std::size_t N>
class HLT::MET::PufitMultiGrid< N >::Tower

Tower in the multi-grid.

Each tower is built from N 'normal' PufitGrid::Towers. Kinematic quantities can be read from the tower either from any of the 'subtowers' or from a sum over them, passing in a std::size_t as a bitmask.

Definition at line 82 of file PufitMultiGrid.h.

Constructor & Destructor Documentation

◆ Tower() [1/2]

template<std::size_t N>
HLT::MET::PufitMultiGrid< N >::Tower::Tower ( PufitMultiGrid * parent,
std::size_t index )

Create a tower with its parent grid.

Parameters
parentThe parent grid of this tower
indexThe index of this tower in its parent's grid

◆ Tower() [2/2]

template<std::size_t N>
HLT::MET::PufitMultiGrid< N >::Tower::Tower ( const Tower & )
default

Member Function Documentation

◆ applyToAll()

template<std::size_t N>
void HLT::MET::PufitMultiGrid< N >::Tower::applyToAll ( PufitGrid::Tower &(PufitGrid::Tower::* )(const PufitGrid::Tower &),
const PufitMultiGrid::Tower & other )
inlineprivate

Apply a function to all sub towers.

Definition at line 196 of file PufitMultiGrid.h.

197 {
198 for (std::size_t ii = 0; ii < N; ++ii)
199 (subTower(ii).*f)(other.subTower(ii));
200 }
PufitGrid::Tower & subTower(std::size_t ii)
Get a subtower by index.
Multiple grids combined into one.

◆ eta()

template<std::size_t N>
double HLT::MET::PufitMultiGrid< N >::Tower::eta ( std::size_t type = All) const

This tower's kinematic eta.

◆ etaIndex()

std::size_t HLT::MET::PeriodicGridBase::Tower::etaIndex ( ) const
inherited

The eta index of this tower.

Definition at line 49 of file PeriodicGridBase.cxx.

50 {
51 return etaPhiIndex().first;
52 }
std::pair< std::size_t, std::size_t > etaPhiIndex() const
The eta/phi indices of the tower together.

◆ etaPhiIndex()

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

The eta/phi indices of the tower together.

Definition at line 59 of file PeriodicGridBase.cxx.

60 {
61 return grid()->etaPhiIndex(m_index);
62 }
virtual const PeriodicGridBase * grid() const =0
The grid which owns this tower.
std::pair< std::size_t, std::size_t > etaPhiIndex(std::size_t index) const
Convert a global index to an eta/phi index pair.

◆ ex()

template<std::size_t N>
double HLT::MET::PufitMultiGrid< N >::Tower::ex ( std::size_t type = All) const

The x-component of this tower's energy.

◆ ey()

template<std::size_t N>
double HLT::MET::PufitMultiGrid< N >::Tower::ey ( std::size_t type = All) const

The y-component of this tower's energy.

◆ ez()

template<std::size_t N>
double HLT::MET::PufitMultiGrid< N >::Tower::ez ( std::size_t type = All) const

The z-component of this tower's energy.

◆ get() [1/2]

template<std::size_t N>
template<std::size_t I, typename = typename std::enable_if<isPow2(I)>::type>
PufitGrid::Tower & HLT::MET::PufitMultiGrid< N >::Tower::get ( )
inline

Get one of the underlying towers.

This is only defined where I is a power of 2

Definition at line 159 of file PufitMultiGrid.h.

160 {
161 return subTower(intLog2(I));
162 }
constexpr uint16_t intLog2(std::size_t i, uint16_t tmp=0)
Compile time calculation of the log base 2 of an integer.

◆ get() [2/2]

template<std::size_t N>
template<std::size_t I, typename = typename std::enable_if<isPow2(I)>::type>
const PufitGrid::Tower & HLT::MET::PufitMultiGrid< N >::Tower::get ( ) const
inline

Get one of the underlying towers.

This is only defined where I is a power of 2

Definition at line 172 of file PufitMultiGrid.h.

173 {
174 return subTower(intLog2(I));
175 }

◆ grid()

template<std::size_t N>
const PufitMultiGrid * HLT::MET::PufitMultiGrid< N >::Tower::grid ( ) const
overridevirtual

The parent grid of this tower.

Implements HLT::MET::PeriodicGridBase::Tower.

◆ index()

std::size_t HLT::MET::PeriodicGridBase::Tower::index ( ) const
inherited

The global index of this tower.

Definition at line 44 of file PeriodicGridBase.cxx.

45 {
46 return m_index;
47 }

◆ kinematics()

template<std::size_t N>
SignedKinematics HLT::MET::PufitMultiGrid< N >::Tower::kinematics ( std::size_t type = All) const

Build a kinematics object from this tower.

◆ mask()

template<std::size_t N>
void HLT::MET::PufitMultiGrid< N >::Tower::mask ( bool value = true)

Set the mask on this tower.

◆ masked()

template<std::size_t N>
bool HLT::MET::PufitMultiGrid< N >::Tower::masked ( ) const

Whether or not this tower was masked.

◆ operator SignedKinematics()

template<std::size_t N>
HLT::MET::PufitMultiGrid< N >::Tower::operator SignedKinematics ( ) const

Conversion operator, returns the value for the sum of all the grids.

◆ operator+=()

template<std::size_t N>
Tower & HLT::MET::PufitMultiGrid< N >::Tower::operator+= ( const Tower & other)

Add another tower's energies into this one.

◆ operator-=()

template<std::size_t N>
Tower & HLT::MET::PufitMultiGrid< N >::Tower::operator-= ( const Tower & other)

Subtract another tower's energies from this one.

◆ operator=()

template<std::size_t N>
Tower & HLT::MET::PufitMultiGrid< N >::Tower::operator= ( const Tower & other)

Copy assignment operator.

This will not copy the other tower's parent. Each tower's parent is fixed from construction! This only copies the energy and masking information over.

◆ phi()

template<std::size_t N>
double HLT::MET::PufitMultiGrid< N >::Tower::phi ( std::size_t type = All) const

This tower's kinematic phi.

◆ phiIndex()

std::size_t HLT::MET::PeriodicGridBase::Tower::phiIndex ( ) const
inherited

The phi index of this tower.

Definition at line 54 of file PeriodicGridBase.cxx.

55 {
56 return etaPhiIndex().second;
57 }

◆ subTower() [1/2]

template<std::size_t N>
PufitGrid::Tower & HLT::MET::PufitMultiGrid< N >::Tower::subTower ( std::size_t ii)
inlineprivate

Get a subtower by index.

Definition at line 185 of file PufitMultiGrid.h.

186 {
187 return m_parent->m_grids[ii][index()];
188 }
std::size_t index() const
The global index of this tower.
PufitMultiGrid *const m_parent
The parent grid.

◆ subTower() [2/2]

template<std::size_t N>
const PufitGrid::Tower & HLT::MET::PufitMultiGrid< N >::Tower::subTower ( std::size_t ii) const
inlineprivate

Get a subtower by index.

Definition at line 190 of file PufitMultiGrid.h.

191 {
192 return m_parent->m_grids[ii][index()];
193 }

◆ sumE()

template<std::size_t N>
double HLT::MET::PufitMultiGrid< N >::Tower::sumE ( std::size_t type = All) const

The total sumE in this tower.

◆ sumEt()

template<std::size_t N>
double HLT::MET::PufitMultiGrid< N >::Tower::sumEt ( std::size_t type = All) const

The total sumEt in this tower.

◆ sumOver()

template<std::size_t N>
template<typename T>
std::decay< T >::type HLT::MET::PufitMultiGrid< N >::Tower::sumOver ( int type,
T(PufitGrid::Tower::* )() const ) const
inlineprivate

Sum over the results of all sub towers whose indices match the 'type' mask.

Definition at line 205 of file PufitMultiGrid.h.

206 {
207 typename std::decay<T>::type val{};
208 for (std::size_t ii = 0; ii < N; ++ii)
209 if (1 << ii & type)
210 val += (subTower(ii).*f)();
211 return val;
212 }

◆ towerEta()

double HLT::MET::PeriodicGridBase::Tower::towerEta ( ) const
inherited

The central eta coordinate of this tower.

Definition at line 39 of file PeriodicGridBase.cxx.

40 {
41 return grid()->centralEta(m_index);
42 }
double centralEta(std::size_t iEta) const
Central eta coordinate of the given eta index.

◆ towerPhi()

double HLT::MET::PeriodicGridBase::Tower::towerPhi ( ) const
inherited

The central phi coordinate of this tower.

Definition at line 34 of file PeriodicGridBase.cxx.

35 {
36 return grid()->centralPhi(m_index);
37 }
double centralPhi(std::size_t iPhi) const
Central phi coordinate of the given phi.

◆ PufitMulitGrid

template<std::size_t N>
friend class PufitMulitGrid
friend

Definition at line 84 of file PufitMultiGrid.h.

Member Data Documentation

◆ m_index

std::size_t HLT::MET::PeriodicGridBase::Tower::m_index
privateinherited

Definition at line 109 of file PeriodicGridBase.h.

◆ m_mask

template<std::size_t N>
bool HLT::MET::PufitMultiGrid< N >::Tower::m_mask {false}
private

The mask value.

Definition at line 182 of file PufitMultiGrid.h.

182{false};

◆ m_parent

template<std::size_t N>
PufitMultiGrid* const HLT::MET::PufitMultiGrid< N >::Tower::m_parent
private

The parent grid.

Definition at line 179 of file PufitMultiGrid.h.


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