ATLAS Offline Software
CaloTowerSeg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id$
14 #include "CaloEvent/CaloTowerSeg.h"
15 
17 
18 
24  double phi, double dphi) const
25 {
26  using index_t = SubSeg::index_t;
27 
28  index_t etamin = this->etaIndex (eta - deta + 0.001);
30  etamin = 1;
31 
32  index_t etamax = this->etaIndex (eta + deta - 0.001);
34  etamax = this->neta();
35 
36  index_t phimin = this->phiIndex (CaloPhiRange::fix (phi - dphi + 0.001));
38  phimin = this->phiIndex (this->phimin());
39 
40  index_t phimax = this->phiIndex (CaloPhiRange::fix (phi + dphi - 0.001));
42  phimax = this->phiIndex (this->phimax() - this->dphi()/2);
43 
44  return SubSeg (*this, etamin, etamax, phimin, phimax);
45 }
46 
47 
58  index_t etamin, index_t etamax,
59  index_t phimin, index_t phimax)
60  : m_parent (parent),
61  m_etamin (etamin),
62  m_etamax (etamax),
63  m_phimin (phimin),
64  m_phimax (phimax)
65 {
66 }
67 
68 
73 {
74  int nphi = m_phimax - m_phimin + 1;
75  // Handle phi wraparound.
76  if (m_phimax < m_phimin)
77  nphi += m_parent.nphi();
78  return nphi;
79 }
80 
81 
86 {
87  const double etamin = m_parent.eta (m_etamin) - m_parent.deta()/2;
88  const double etamax = m_parent.eta (m_etamax) + m_parent.deta()/2;
89 
90  const double phimin = m_parent.phi (m_phimin) - m_parent.dphi()/2;
91  const double phimax = m_parent.phi (m_phimax) + m_parent.dphi()/2;
92 
93  return {neta(), nphi(), etamin, etamax, phimin, phimax};
94 }
95 
96 
CaloPhiRange
This class defines the phi convention for Calorimeters.
Definition: CaloPhiRange.h:28
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CaloTowerSeg::m_etamin
double m_etamin
Lower boundary value range.
Definition: CaloTowerSeg.h:420
CaloTowerSeg::neta
index_t neta() const
Retrieve number of bins.
Definition: CaloTowerSeg.h:423
CaloTowerSeg::m_etamax
double m_etamax
Upper boundary value range.
Definition: CaloTowerSeg.h:422
CaloTowerSeg.h
CaloTowerSeg::SubSeg::index_t
CaloTowerSeg::index_t index_t
Definition: CaloTowerSeg.h:222
CaloTowerSeg::deta
double deta() const
Retrieve bin size .
Definition: CaloTowerSeg.h:433
CaloTowerSeg::nphi
index_t nphi() const
Retrieve number of bins.
Definition: CaloTowerSeg.h:428
CaloTowerSeg::SubSeg
A rectangular window within the segmentation.
Definition: CaloTowerSeg.h:220
CaloTowerSeg::SubSeg::SubSeg
SubSeg(const CaloTowerSeg &parent, index_t etamin, index_t etamax, index_t phimin, index_t phimax)
Constructor.
Definition: CaloTowerSeg.cxx:57
CaloTowerSeg::phimin
double phimin() const
Retrieve lower boundary value range.
Definition: CaloTowerSeg.h:453
CaloTowerSeg::dphi
double dphi() const
Retrieve bin size .
Definition: CaloTowerSeg.h:438
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CaloTowerSeg::index_t
size_t index_t
Type for eta, phi indices.
Definition: CaloTowerSeg.h:59
CaloTowerSeg::phimax
double phimax() const
Retrieve upper boundary value range.
Definition: CaloTowerSeg.h:458
CaloPhiRange::fix
static double fix(double phi)
Definition: CaloPhiRange.cxx:14
CaloTowerSeg::etamax
double etamax() const
Retrieve upper boundary value range.
Definition: CaloTowerSeg.h:448
CaloTowerSeg::phiIndex
index_t phiIndex(double phiVal) const
Returns index for a given value.
Definition: CaloTowerSeg.h:499
CaloTowerSeg::SubSeg::segmentation
CaloTowerSeg segmentation() const
Return a new segmentation object corresponding to this window.
Definition: CaloTowerSeg.cxx:85
CaloTowerSeg::etamin
double etamin() const
Retrieve lower boundary value range.
Definition: CaloTowerSeg.h:443
CaloTowerSeg::s_range
static const CaloPhiRange s_range
Definition: CaloTowerSeg.h:435
CaloTowerSeg::outOfRange
static const index_t outOfRange
Used to flag out-of-range indices.
Definition: CaloTowerSeg.h:62
CaloTowerSeg
Data object stores CaloTower segmentation.
Definition: CaloTowerSeg.h:37
CaloTowerSeg::m_phimax
double m_phimax
Upper boundary value range.
Definition: CaloTowerSeg.h:426
CaloTowerSeg::etaIndex
index_t etaIndex(double etaVal) const
Returns index for a given value.
Definition: CaloTowerSeg.h:489
LArCellBinning.etamin
etamin
Definition: LArCellBinning.py:137
CaloTowerSeg::m_phimin
double m_phimin
Lower boundary value range.
Definition: CaloTowerSeg.h:424
CaloTowerSeg::subseg
SubSeg subseg(double eta, double deta, double phi, double dphi) const
Return a window within the current segmentation.
Definition: CaloTowerSeg.cxx:23
CaloTowerSeg::SubSeg::nphi
size_t nphi() const
The number of towers in the phi direction in this window.
Definition: CaloTowerSeg.cxx:72