ATLAS Offline Software
Classes | Public Member Functions | Private Attributes | List of all members
HLT::MET::PeriodicGridBase Class Reference

Base class for grids used in some of the pufit algorithms. More...

#include <PeriodicGridBase.h>

Inheritance diagram for HLT::MET::PeriodicGridBase:
Collaboration diagram for HLT::MET::PeriodicGridBase:

Classes

class  Tower
 Base class for towers belonging to the grids. More...
 

Public Member Functions

 PeriodicGridBase (const GridParameters &parameters)
 Construct the grid from its parameters. More...
 
 PeriodicGridBase (double maxEta, std::size_t nEtaTowers, std::size_t nPhiTowers, bool displaceEta=false, bool displacePhi=false)
 Construct the grid from its parameters provided directly. More...
 
std::size_t getIndex (double eta, double phi, bool &outOfRange) const
 Get the index for the given eta, phi values. More...
 
std::size_t getEtaIndex (double eta, bool &outOfRange) const
 Get the eta index for the given value. More...
 
std::size_t getPhiIndex (double phi) const
 Get the phi index for the given value. More...
 
std::size_t globalIndex (std::size_t iEta, std::size_t iPhi) const
 Convert eta and phi to a global index. More...
 
std::pair< std::size_t, std::size_t > etaPhiIndex (std::size_t index) const
 Convert a global index to an eta/phi index pair. More...
 
double centralEta (std::size_t iEta) const
 Central eta coordinate of the given eta index. More...
 
double centralPhi (std::size_t iPhi) const
 Central phi coordinate of the given phi. More...
 
const GridParametersparameters () const
 The grid parameters. More...
 
double maxEta () const
 The maximum eta range for the grid. More...
 
std::size_t nEtaTowers () const
 The number of eta bins. More...
 
std::size_t nPhiTowers () const
 The number of phi bins. More...
 
std::size_t nTowers () const
 The number of bins. More...
 
bool displaceEta () const
 Whether or not this is displaced in eta. More...
 
bool displacePhi () const
 Whether or not this is displaced in phi. More...
 
GridDisplacement displacement () const
 The grid displacement. More...
 
double etaWidth () const
 The bin width in eta. More...
 
double phiWidth () const
 The bin width in phi. More...
 

Private Attributes

const GridParameters m_params
 The grid's parameters. More...
 

Detailed Description

Base class for grids used in some of the pufit algorithms.

Many versions of the pufit technique require breaking the calorimeter into a grid in order to measure the variance of energy deposits across the detector and to identify areas which have a significantly high energy.

These grids must also support being displaced slightly in eta and phi to ensure that high energy deposits are not artificially divided between two towers.

The grids are also periodic in phi - i.e. the tower located at phi is the same one located at phi + 2pi.

Definition at line 75 of file PeriodicGridBase.h.

Constructor & Destructor Documentation

◆ PeriodicGridBase() [1/2]

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

Construct the grid from its parameters.

Definition at line 64 of file PeriodicGridBase.cxx.

66  {
67  }

◆ PeriodicGridBase() [2/2]

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

Construct the grid from its parameters provided directly.

Definition at line 69 of file PeriodicGridBase.cxx.

76  {
77  }

Member Function Documentation

◆ centralEta()

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

Central eta coordinate of the given eta index.

Definition at line 129 of file PeriodicGridBase.cxx.

130  {
131  return -maxEta() + etaWidth() * (iEta + 0.5) + (displaceEta() ? etaWidth() / 2 : 0);
132  }

◆ centralPhi()

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

Central phi coordinate of the given phi.

Definition at line 133 of file PeriodicGridBase.cxx.

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

◆ displaceEta()

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

Whether or not this is displaced in eta.

Definition at line 143 of file PeriodicGridBase.cxx.

143 { return parameters().displaceEta; }

◆ displacement()

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

The grid displacement.

Definition at line 145 of file PeriodicGridBase.cxx.

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

◆ displacePhi()

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

Whether or not this is displaced in phi.

Definition at line 144 of file PeriodicGridBase.cxx.

144 { return parameters().displacePhi; }

◆ etaPhiIndex()

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

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

Definition at line 124 of file PeriodicGridBase.cxx.

125  {
126  return std::make_pair(index / nPhiTowers(), index % nPhiTowers());
127  }

◆ etaWidth()

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

The bin width in eta.

Definition at line 149 of file PeriodicGridBase.cxx.

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

◆ getEtaIndex()

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

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 87 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

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 79 of file PeriodicGridBase.cxx.

80  {
81  std::size_t etaIndex = getEtaIndex(eta, outOfRange);
82  if (outOfRange)
83  return nTowers();
84  return globalIndex(etaIndex, getPhiIndex(phi));
85  }

◆ getPhiIndex()

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

Get the phi index for the given value.

Definition at line 107 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

Convert eta and phi to a global index.

Definition at line 120 of file PeriodicGridBase.cxx.

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

◆ maxEta()

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

The maximum eta range for the grid.

Definition at line 139 of file PeriodicGridBase.cxx.

139 { return parameters().maxEta; }

◆ nEtaTowers()

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

The number of eta bins.

Definition at line 140 of file PeriodicGridBase.cxx.

140 { return parameters().nEtaTowers; }

◆ nPhiTowers()

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

The number of phi bins.

Definition at line 141 of file PeriodicGridBase.cxx.

141 { return parameters().nPhiTowers; }

◆ nTowers()

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

The number of bins.

Definition at line 142 of file PeriodicGridBase.cxx.

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

◆ parameters()

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

The grid parameters.

Definition at line 138 of file PeriodicGridBase.cxx.

138 { return m_params; }

◆ phiWidth()

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

The bin width in phi.

Definition at line 150 of file PeriodicGridBase.cxx.

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

Member Data Documentation

◆ m_params

const GridParameters HLT::MET::PeriodicGridBase::m_params
private

The grid's parameters.

Definition at line 191 of file PeriodicGridBase.h.


The documentation for this class was generated from the following files:
HLT::MET::PeriodicGridBase::displacePhi
bool displacePhi() const
Whether or not this is displaced in phi.
Definition: PeriodicGridBase.cxx:144
test_pyathena.eta
eta
Definition: test_pyathena.py:10
HLT::MET::PeriodicGridBase::nPhiTowers
std::size_t nPhiTowers() const
The number of phi bins.
Definition: PeriodicGridBase.cxx:141
index
Definition: index.py:1
HLT::MET::GridParameters::nEtaTowers
std::size_t nEtaTowers
The number of divisions along the eta axis.
Definition: PeriodicGridBase.h:47
HLT::MET::GridParameters::displacePhi
bool displacePhi
Whether the grid is displaced in phi.
Definition: PeriodicGridBase.h:53
M_PI
#define M_PI
Definition: ActiveFraction.h:11
HLT::MET::PeriodicGridBase::m_params
const GridParameters m_params
The grid's parameters.
Definition: PeriodicGridBase.h:191
HLT::MET::PeriodicGridBase::displaceEta
bool displaceEta() const
Whether or not this is displaced in eta.
Definition: PeriodicGridBase.cxx:143
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
HLT::MET::PeriodicGridBase::phiWidth
double phiWidth() const
The bin width in phi.
Definition: PeriodicGridBase.cxx:150
HLT::MET::PeriodicGridBase::parameters
const GridParameters & parameters() const
The grid parameters.
Definition: PeriodicGridBase.cxx:138
HLT::MET::GridParameters::displacement
GridDisplacement displacement() const
The.
Definition: PeriodicGridBase.cxx:25
HLT::MET::PeriodicGridBase::getEtaIndex
std::size_t getEtaIndex(double eta, bool &outOfRange) const
Get the eta index for the given value.
Definition: PeriodicGridBase.cxx:87
HLT::MET::GridParameters::nPhiTowers
std::size_t nPhiTowers
The number of divisions along the phi axis.
Definition: PeriodicGridBase.h:49
HLT::MET::PeriodicGridBase::PeriodicGridBase
PeriodicGridBase(const GridParameters &parameters)
Construct the grid from its parameters.
Definition: PeriodicGridBase.cxx:64
HLT::MET::GridParameters::displaceEta
bool displaceEta
Whether the grid is displaced in eta.
Definition: PeriodicGridBase.h:51
HLT::MET::PeriodicGridBase::maxEta
double maxEta() const
The maximum eta range for the grid.
Definition: PeriodicGridBase.cxx:139
HLT::MET::PeriodicGridBase::getPhiIndex
std::size_t getPhiIndex(double phi) const
Get the phi index for the given value.
Definition: PeriodicGridBase.cxx:107
HLT::MET::PeriodicGridBase::globalIndex
std::size_t globalIndex(std::size_t iEta, std::size_t iPhi) const
Convert eta and phi to a global index.
Definition: PeriodicGridBase.cxx:120
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
HLT::MET::GridParameters::maxEta
double maxEta
The maximum |eta| value.
Definition: PeriodicGridBase.h:45
HLT::MET::PeriodicGridBase::nTowers
std::size_t nTowers() const
The number of bins.
Definition: PeriodicGridBase.cxx:142
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:77
HLT::MET::PeriodicGridBase::etaWidth
double etaWidth() const
The bin width in eta.
Definition: PeriodicGridBase.cxx:149
HLT::MET::PeriodicGridBase::nEtaTowers
std::size_t nEtaTowers() const
The number of eta bins.
Definition: PeriodicGridBase.cxx:140