ATLAS Offline Software
PufitGrid.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 /******************************************************************************
6  * @package Trigger/TrigAlgorithms/TrigEFMissingET
7  * @class PufitGrid
8  *
9  * @brief Grid to use in the pufit calculation
10  * @author Bob Kowalewski, Jon Burr
11  *****************************************************************************/
12 
13 #ifndef TRIGEFMISSINGET_PUFITGRID_H
14 #define TRIGEFMISSINGET_PUFITGRID_H
15 
16 #include <vector>
17 #include <utility>
18 #include <array>
21 
22 namespace HLT
23 {
24  namespace MET
25  {
26  // Forward declare
27  class METComponent;
28 
37  class PufitGrid : public PeriodicGridBase
38  {
39  public:
47  class Tower : public PeriodicGridBase::Tower
48  {
49  public:
55  Tower(const PufitGrid *parent, std::size_t index);
56 
57  Tower(const Tower &) = default;
58 
66  Tower &operator=(const Tower &other);
67 
69  double ex() const;
70 
72  double ey() const;
73 
75  double ez() const;
76 
78  double sumEt() const;
79 
81  double sumE() const;
82 
84  double phi() const;
85 
87  double eta() const;
88 
90  bool masked() const;
91 
93  void mask(bool value = true);
94 
96  virtual const PufitGrid *grid() const override;
97 
101  operator SignedKinematics() const;
102 
111  Tower &operator+=(const SignedKinematics &kin);
120  Tower &operator-=(const SignedKinematics &kin);
121 
125  Tower &operator+=(const Tower &other);
129  Tower &operator-=(const Tower &other);
130 
131  private:
133  const PufitGrid *const m_parent;
134 
137  double m_sumEt{0.};
139  double m_sumE{0.};
141  bool m_mask{false};
142  }; //> end class Tower
143 
152  PufitGrid(
153  double maxEta,
154  std::size_t nEtaTowers,
155  std::size_t nPhiTowers,
156  bool displaceEta = false,
157  bool displacePhi = false);
158 
161 
163  PufitGrid(const PufitGrid &other);
164 
174 
176  void reset();
177 
198 
200  Tower &operator[](const std::pair<std::size_t, std::size_t> &indices);
202  const Tower &operator[](
203  const std::pair<std::size_t, std::size_t> &indices) const;
204 
206  Tower &operator[](std::size_t index);
208  const Tower &operator[](std::size_t index) const;
209 
213  std::vector<Tower>::const_iterator begin() const;
217  std::vector<Tower>::const_iterator end() const;
218 
220  enum class SumStrategy
221  {
222  All, //> Sum all towers, regardless of masks
223  Masked, //> Only sum masked towers
224  Unmasked //> Only sum unmasked towers
225  };
227 
228  // All of these fail if the grid parameters do not match!
233 
234  private:
235  std::vector<Tower> m_towers;
236  }; //> end class PufitGrid
237 
239  struct PufitGridSet
240  {
241  PufitGridSet(double maxEta, std::size_t nEta, std::size_t nPhi);
242  std::array<PufitGrid, 4> grids;
248  PufitGrid &operator[](GridDisplacement displacement);
249  const PufitGrid &operator[](GridDisplacement displacement) const;
250  };
251 
253  PufitGrid operator+(const PufitGrid &lhs, const PufitGrid &rhs);
255  PufitGrid operator-(const PufitGrid &lhs, const PufitGrid &rhs);
256  } // namespace MET
257 } // namespace HLT
258 
259 #endif //> !TRIGEFMISSINGET_PUFITGRID_H
HLT::MET::PeriodicGridBase::displacePhi
bool displacePhi() const
Whether or not this is displaced in phi.
Definition: PeriodicGridBase.cxx:144
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::strategy
strategy
Definition: L2CombinedMuon_v1.cxx:107
HLT::MET::PufitGrid
Bins energy deposits into a grid.
Definition: PufitGrid.h:50
HLT::MET::PufitGrid::Tower::operator-=
Tower & operator-=(const SignedKinematics &kin)
Remove the energy of a signed object from this tower.
Definition: PufitGrid.cxx:54
HLT::MET::PufitGrid::Tower::m_mask
bool m_mask
The mask value.
Definition: PufitGrid.h:153
HLT::MET::PufitGrid::Tower::m_sumE
double m_sumE
The summed energy.
Definition: PufitGrid.h:151
HLT::MET::PufitGrid::Tower::operator=
Tower & operator=(const Tower &other)
Copy assignment operator.
Definition: PufitGrid.cxx:20
HLT::MET::PeriodicGridBase::nPhiTowers
std::size_t nPhiTowers() const
The number of phi bins.
Definition: PeriodicGridBase.cxx:141
HLT::MET::PufitGrid::Tower::masked
bool masked() const
Whether or not this tower was masked.
Definition: PufitGrid.cxx:36
HLT::MET::PufitGrid::reset
void reset()
Reset the internal storage.
Definition: PufitGrid.cxx:107
HLT::MET::PufitGrid::sum
METComponent sum(SumStrategy strategy=SumStrategy::All) const
Definition: PufitGrid.cxx:171
index
Definition: index.py:1
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
HLT::MET::PufitGridSet
Helper struct to contain a full set of grids.
Definition: PufitGrid.h:252
HLT::MET::PufitGrid::SumStrategy::All
@ All
HLT::MET::PufitGrid::operator-=
PufitGrid & operator-=(const SignedKinematics &kin)
Remove the energy of a signed object from this grid.
Definition: PufitGrid.cxx:124
athena.value
value
Definition: athena.py:124
TrigVSI::AlgConsts::nPhi
constexpr int nPhi
Default bin number of phi for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:27
HLT::MET::PufitGrid::operator+=
PufitGrid & operator+=(const SignedKinematics &kin)
Add a signed object to this grid.
Definition: PufitGrid.cxx:115
PUfitVar::maxEta
constexpr float maxEta
Definition: GepMETPufitAlg.cxx:13
HLT::MET::PufitGridSet::PufitGridSet
PufitGridSet(double maxEta, std::size_t nEta, std::size_t nPhi)
Definition: PufitGrid.cxx:215
HLT::MET::PeriodicGridBase::displaceEta
bool displaceEta() const
Whether or not this is displaced in eta.
Definition: PeriodicGridBase.cxx:143
HLT::MET::GridDisplacement
GridDisplacement
Enum to describe the positioning of the grid.
Definition: PeriodicGridBase.h:23
HLT::MET::PufitGrid::operator=
PufitGrid & operator=(const PufitGrid &other)
Assignment operator.
Definition: PufitGrid.cxx:99
SignedKinematics.h
HLT::MET::PufitGrid::SumStrategy::Unmasked
@ Unmasked
HLT::MET::SignedKinematics
Class to describe the kinematics of an object that can have negative energies.
Definition: SignedKinematics.h:42
HLT::MET::PufitGrid::Tower::operator+=
Tower & operator+=(const SignedKinematics &kin)
Add a signed object to this tower.
Definition: PufitGrid.cxx:47
HLT::MET::PeriodicGridBase::parameters
const GridParameters & parameters() const
The grid parameters.
Definition: PeriodicGridBase.cxx:138
HLT::MET::PufitGrid::Tower::ey
double ey() const
The y-component of this tower's energy.
Definition: PufitGrid.cxx:30
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
HLT::MET::PufitGrid::end
std::vector< Tower >::iterator end()
Iterator end point.
Definition: PufitGrid.cxx:162
HLT::MET::PufitGrid::SumStrategy::Masked
@ Masked
HLT::MET::PufitGridSet::grids
std::array< PufitGrid, 4 > grids
Definition: PufitGrid.h:254
HLT::MET::PufitGridSet::operator-=
PufitGridSet & operator-=(const SignedKinematics &kin)
Subtract kinematics.
Definition: PufitGrid.cxx:229
HLT::MET::PufitGrid::Tower::sumEt
double sumEt() const
The total sumEt in this tower.
Definition: PufitGrid.cxx:32
HLT::MET::PufitGrid::Tower
Describes a single element of the grid.
Definition: PufitGrid.h:60
test_pyathena.parent
parent
Definition: test_pyathena.py:15
HLT::MET::PufitGrid::m_towers
std::vector< Tower > m_towers
Definition: PufitGrid.h:247
HLT::MET::PufitGrid::Tower::eta
double eta() const
This tower's kinematic eta.
Definition: PufitGrid.cxx:35
HLT::MET::PufitGrid::Tower::m_sumEt
double m_sumEt
The summed et.
Definition: PufitGrid.h:149
HLT::MET::PufitGrid::begin
std::vector< Tower >::iterator begin()
Access by iterator.
Definition: PufitGrid.cxx:154
HLT::MET::PufitGridSet::operator[]
PufitGrid & operator[](GridDisplacement displacement)
Select a grid.
Definition: PufitGrid.cxx:235
HLT::MET::PeriodicGridBase::maxEta
double maxEta() const
The maximum eta range for the grid.
Definition: PeriodicGridBase.cxx:139
HLT::MET::METComponent
Helper struct to build up MET values before moving them into the EDM.
Definition: METComponent.h:40
PeriodicGridBase.h
Provide a base class for the grids used in some pufit algorithms.
MET
Definition: MET.py:1
HLT::MET::PufitGrid::PufitGrid
PufitGrid(double maxEta, std::size_t nEtaTowers, std::size_t nPhiTowers, bool displaceEta=false, bool displacePhi=false)
Create a new tower grid.
Definition: PufitGrid.cxx:76
HLT::MET::PufitGrid::Tower::grid
virtual const PufitGrid * grid() const override
The parent grid of this tower.
Definition: PufitGrid.cxx:39
HLT::MET::PufitGrid::Tower::sumE
double sumE() const
The total sumE in this tower.
Definition: PufitGrid.cxx:33
HLT::MET::PufitGrid::operator[]
Tower & operator[](const std::pair< std::size_t, std::size_t > &indices)
Access stored value by eta/phi index (access is bounds-checked)
Definition: PufitGrid.cxx:134
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
HLT::MET::PufitGrid::Tower::ez
double ez() const
The z-component of this tower's energy.
Definition: PufitGrid.cxx:31
HLT::MET::PufitGrid::Tower::kinematics
SignedKinematics kinematics() const
Build a kinematics object from this tower.
Definition: PufitGrid.cxx:41
HLT::MET::PufitGrid::Tower::ex
double ex() const
The x-component of this tower's energy.
Definition: PufitGrid.cxx:29
HLT::MET::PufitGrid::Tower::m_kin
SignedKinematics m_kin
Definition: PufitGrid.h:147
HLT::MET::GridParameters
Parameters describing a grid.
Definition: PeriodicGridBase.h:43
HLT::MET::PufitGrid::Tower::Tower
Tower(const PufitGrid *parent, std::size_t index)
Create a tower with its parent.
Definition: PufitGrid.cxx:15
HLT::MET::operator-
PufitGrid operator-(const PufitGrid &lhs, const PufitGrid &rhs)
Elementwise subtraction.
Definition: PufitGrid.cxx:250
HLT::MET::PufitGridSet::operator+=
PufitGridSet & operator+=(const SignedKinematics &kin)
Add kinematics.
Definition: PufitGrid.cxx:223
TrigVSI::AlgConsts::nEta
constexpr int nEta
Default bin number of eta for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:26
HLT::MET::PufitGrid::Tower::mask
void mask(bool value=true)
Set the mask on this tower.
Definition: PufitGrid.cxx:37
xAOD::JetInput::Tower
@ Tower
Definition: JetContainerInfo.h:58
HLT::MET::PufitGrid::SumStrategy
SumStrategy
Helper enum to describe how to sum over towers.
Definition: PufitGrid.h:233
HLT::MET::PufitGrid::Tower::m_parent
const PufitGrid *const m_parent
The parent grid.
Definition: PufitGrid.h:145
HLT::MET::PufitGrid::Tower::phi
double phi() const
This tower's kinematic phi.
Definition: PufitGrid.cxx:34
HLT::MET::operator+
METComponent operator+(const METComponent &lhs, const METComponent &rhs)
Definition: METComponent.cxx:48
HLT::MET::PeriodicGridBase::nEtaTowers
std::size_t nEtaTowers() const
The number of eta bins.
Definition: PeriodicGridBase.cxx:140