CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
HGCalLayerTilesT< T > Class Template Reference

#include <HGCalLayerTiles.h>

Public Member Functions

void clear ()
 
void fill (const std::vector< float > &x, const std::vector< float > &y, const std::vector< float > &eta, const std::vector< float > &phi, const std::vector< bool > &isSi)
 
int getEtaBin (float eta) const
 
int getGlobalBin (float x, float y) const
 
int getGlobalBinByBin (int xBin, int yBin) const
 
int getGlobalBinByBinEtaPhi (int etaBin, int phiBin) const
 
int getGlobalBinEtaPhi (float eta, float phi) const
 
int getPhiBin (float phi) const
 
int getXBin (float x) const
 
int getYBin (float y) const
 
const std::vector< int > & operator[] (int globalBinId) const
 
std::array< int, 4 > searchBox (float xMin, float xMax, float yMin, float yMax) const
 
std::array< int, 4 > searchBoxEtaPhi (float etaMin, float etaMax, float phiMin, float phiMax) const
 

Public Attributes

int mPiPhiBin = getPhiBin(-M_PI)
 
int pPiPhiBin = getPhiBin(M_PI)
 

Private Attributes

std::array< std::vector< int >, T::nTiles > tiles_
 

Detailed Description

template<typename T>
class HGCalLayerTilesT< T >

Definition at line 17 of file HGCalLayerTiles.h.

Member Function Documentation

◆ clear()

template<typename T >
void HGCalLayerTilesT< T >::clear ( void  )
inline

Definition at line 108 of file HGCalLayerTiles.h.

108  {
109  for (auto& t : tiles_)
110  t.clear();
111  }

References OrderedSet::t, and HGCalLayerTilesT< T >::tiles_.

◆ fill()

template<typename T >
void HGCalLayerTilesT< T >::fill ( const std::vector< float > &  x,
const std::vector< float > &  y,
const std::vector< float > &  eta,
const std::vector< float > &  phi,
const std::vector< bool > &  isSi 
)
inline

Definition at line 19 of file HGCalLayerTiles.h.

23  {
24  auto cellsSize = x.size();
25  for (unsigned int i = 0; i < cellsSize; ++i) {
26  tiles_[getGlobalBin(x[i], y[i])].push_back(i);
27  if (!isSi[i]) {
28  tiles_[getGlobalBinEtaPhi(eta[i], phi[i])].push_back(i);
29  // Copy cells in phi=[-3.15,-3.] to the last bin
30  if (getPhiBin(phi[i]) == mPiPhiBin) {
31  tiles_[getGlobalBinEtaPhi(eta[i], phi[i] + 2 * M_PI)].push_back(i);
32  }
33  // Copy cells in phi=[3.,3.15] to the first bin
34  if (getPhiBin(phi[i]) == pPiPhiBin) {
35  tiles_[getGlobalBinEtaPhi(eta[i], phi[i] - 2 * M_PI)].push_back(i);
36  }
37  }
38  }
39  }

References PVValHelper::eta, HGCalLayerTilesT< T >::getGlobalBin(), HGCalLayerTilesT< T >::getGlobalBinEtaPhi(), HGCalLayerTilesT< T >::getPhiBin(), mps_fire::i, M_PI, HGCalLayerTilesT< T >::mPiPhiBin, phi, HGCalLayerTilesT< T >::pPiPhiBin, HGCalLayerTilesT< T >::tiles_, x, and y.

◆ getEtaBin()

template<typename T >
int HGCalLayerTilesT< T >::getEtaBin ( float  eta) const
inline

Definition at line 59 of file HGCalLayerTiles.h.

59  {
60  constexpr float etaRange = T::maxEta - T::minEta;
61  static_assert(etaRange >= 0.);
62  constexpr float r = T::nColumnsEta / etaRange;
63  int etaBin = (eta - T::minEta) * r;
64  etaBin = std::clamp(etaBin, 0, T::nColumnsEta - 1);
65  return etaBin;
66  }

References PVValHelper::eta, etaBin(), generateTowerEtThresholdLUT::etaRange, maxEta, EgHLTOffEleSelection_cfi::minEta, and alignCSCRings::r.

Referenced by HGCalLayerTilesT< T >::getGlobalBinEtaPhi(), and HGCalLayerTilesT< T >::searchBoxEtaPhi().

◆ getGlobalBin()

template<typename T >
int HGCalLayerTilesT< T >::getGlobalBin ( float  x,
float  y 
) const
inline

Definition at line 80 of file HGCalLayerTiles.h.

80 { return getXBin(x) + getYBin(y) * T::nColumns; }

References HGCalLayerTilesT< T >::getXBin(), HGCalLayerTilesT< T >::getYBin(), x, and y.

Referenced by HGCalLayerTilesT< T >::fill().

◆ getGlobalBinByBin()

template<typename T >
int HGCalLayerTilesT< T >::getGlobalBinByBin ( int  xBin,
int  yBin 
) const
inline

Definition at line 82 of file HGCalLayerTiles.h.

82 { return xBin + yBin * T::nColumns; }

References photonAnalyzer_cfi::xBin, and photonAnalyzer_cfi::yBin.

◆ getGlobalBinByBinEtaPhi()

template<typename T >
int HGCalLayerTilesT< T >::getGlobalBinByBinEtaPhi ( int  etaBin,
int  phiBin 
) const
inline

Definition at line 88 of file HGCalLayerTiles.h.

88  {
89  return T::nColumns * T::nRows + etaBin + phiBin * T::nColumnsEta;
90  }

References etaBin(), and BeamMonitor_cff::phiBin.

◆ getGlobalBinEtaPhi()

template<typename T >
int HGCalLayerTilesT< T >::getGlobalBinEtaPhi ( float  eta,
float  phi 
) const
inline

Definition at line 84 of file HGCalLayerTiles.h.

84  {
85  return T::nColumns * T::nRows + getEtaBin(eta) + getPhiBin(phi) * T::nColumnsEta;
86  }

References PVValHelper::eta, HGCalLayerTilesT< T >::getEtaBin(), HGCalLayerTilesT< T >::getPhiBin(), and phi.

Referenced by HGCalLayerTilesT< T >::fill().

◆ getPhiBin()

template<typename T >
int HGCalLayerTilesT< T >::getPhiBin ( float  phi) const
inline

Definition at line 68 of file HGCalLayerTiles.h.

68  {
69  constexpr float phiRange = T::maxPhi - T::minPhi;
70  static_assert(phiRange >= 0.);
71  constexpr float r = T::nRowsPhi / phiRange;
72  int phiBin = (phi - T::minPhi) * r;
73  phiBin = std::clamp(phiBin, 0, T::nRowsPhi - 1);
74  return phiBin;
75  }

References HLT_2018_cff::maxPhi, HLT_2018_cff::minPhi, phi, BeamMonitor_cff::phiBin, and alignCSCRings::r.

Referenced by HGCalLayerTilesT< T >::fill(), HGCalLayerTilesT< T >::getGlobalBinEtaPhi(), and HGCalLayerTilesT< T >::searchBoxEtaPhi().

◆ getXBin()

template<typename T >
int HGCalLayerTilesT< T >::getXBin ( float  x) const
inline

Definition at line 41 of file HGCalLayerTiles.h.

41  {
42  constexpr float xRange = T::maxX - T::minX;
43  static_assert(xRange >= 0.);
44  constexpr float r = T::nColumns / xRange;
45  int xBin = (x - T::minX) * r;
46  xBin = std::clamp(xBin, 0, T::nColumns - 1);
47  return xBin;
48  }

References HGVHistoProducerAlgoBlock_cfi::maxX, HGVHistoProducerAlgoBlock_cfi::minX, alignCSCRings::r, x, photonAnalyzer_cfi::xBin, and beampixel_dqm_sourceclient-live_cfg::xRange.

Referenced by HGCalLayerTilesT< T >::getGlobalBin(), and HGCalLayerTilesT< T >::searchBox().

◆ getYBin()

template<typename T >
int HGCalLayerTilesT< T >::getYBin ( float  y) const
inline

Definition at line 50 of file HGCalLayerTiles.h.

50  {
51  constexpr float yRange = T::maxY - T::minY;
52  static_assert(yRange >= 0.);
53  constexpr float r = T::nRows / yRange;
54  int yBin = (y - T::minY) * r;
55  yBin = std::clamp(yBin, 0, T::nRows - 1);
56  return yBin;
57  }

References HGVHistoProducerAlgoBlock_cfi::maxY, HGVHistoProducerAlgoBlock_cfi::minY, alignCSCRings::r, y, photonAnalyzer_cfi::yBin, and beampixel_dqm_sourceclient-live_cfg::yRange.

Referenced by HGCalLayerTilesT< T >::getGlobalBin(), and HGCalLayerTilesT< T >::searchBox().

◆ operator[]()

template<typename T >
const std::vector<int>& HGCalLayerTilesT< T >::operator[] ( int  globalBinId) const
inline

Definition at line 113 of file HGCalLayerTiles.h.

113 { return tiles_[globalBinId]; }

References HGCalLayerTilesT< T >::tiles_.

◆ searchBox()

template<typename T >
std::array<int, 4> HGCalLayerTilesT< T >::searchBox ( float  xMin,
float  xMax,
float  yMin,
float  yMax 
) const
inline

Definition at line 92 of file HGCalLayerTiles.h.

92  {
93  int xBinMin = getXBin(xMin);
94  int xBinMax = getXBin(xMax);
95  int yBinMin = getYBin(yMin);
96  int yBinMax = getYBin(yMax);
97  return std::array<int, 4>({{xBinMin, xBinMax, yBinMin, yBinMax}});
98  }

References HGCalLayerTilesT< T >::getXBin(), HGCalLayerTilesT< T >::getYBin(), multiplicitycorr_cfi::xMax, photonAnalyzer_cfi::xMin, multiplicitycorr_cfi::yMax, and photonAnalyzer_cfi::yMin.

◆ searchBoxEtaPhi()

template<typename T >
std::array<int, 4> HGCalLayerTilesT< T >::searchBoxEtaPhi ( float  etaMin,
float  etaMax,
float  phiMin,
float  phiMax 
) const
inline

Definition at line 100 of file HGCalLayerTiles.h.

100  {
101  int etaBinMin = getEtaBin(etaMin);
102  int etaBinMax = getEtaBin(etaMax);
103  int phiBinMin = getPhiBin(phiMin);
104  int phiBinMax = getPhiBin(phiMax);
105  return std::array<int, 4>({{etaBinMin, etaBinMax, phiBinMin, phiBinMax}});
106  }

References ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, HGCalLayerTilesT< T >::getEtaBin(), HGCalLayerTilesT< T >::getPhiBin(), AlignmentTrackSelector_cfi::phiMax, and AlignmentTrackSelector_cfi::phiMin.

Member Data Documentation

◆ mPiPhiBin

template<typename T >
int HGCalLayerTilesT< T >::mPiPhiBin = getPhiBin(-M_PI)

Definition at line 77 of file HGCalLayerTiles.h.

Referenced by HGCalLayerTilesT< T >::fill().

◆ pPiPhiBin

template<typename T >
int HGCalLayerTilesT< T >::pPiPhiBin = getPhiBin(M_PI)

Definition at line 78 of file HGCalLayerTiles.h.

Referenced by HGCalLayerTilesT< T >::fill().

◆ tiles_

template<typename T >
std::array<std::vector<int>, T::nTiles> HGCalLayerTilesT< T >::tiles_
private
beampixel_dqm_sourceclient-live_cfg.xRange
xRange
Definition: beampixel_dqm_sourceclient-live_cfg.py:140
HGCalLayerTilesT::getEtaBin
int getEtaBin(float eta) const
Definition: HGCalLayerTiles.h:59
DDAxes::y
HGCalLayerTilesT::tiles_
std::array< std::vector< int >, T::nTiles > tiles_
Definition: HGCalLayerTiles.h:116
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
mps_fire.i
i
Definition: mps_fire.py:355
photonAnalyzer_cfi.xBin
xBin
Definition: photonAnalyzer_cfi.py:81
generateTowerEtThresholdLUT.etaRange
etaRange
Definition: generateTowerEtThresholdLUT.py:55
etaBin
int etaBin(const l1t::HGCalMulticluster *cl)
Definition: L1EGammaEEProducer.cc:19
BeamMonitor_cff.phiBin
phiBin
Definition: BeamMonitor_cff.py:75
HGCalLayerTilesT::pPiPhiBin
int pPiPhiBin
Definition: HGCalLayerTiles.h:78
photonAnalyzer_cfi.yBin
yBin
Definition: photonAnalyzer_cfi.py:85
photonAnalyzer_cfi.yMin
yMin
Definition: photonAnalyzer_cfi.py:86
DDAxes::x
HGVHistoProducerAlgoBlock_cfi.minX
minX
Definition: HGVHistoProducerAlgoBlock_cfi.py:153
HLT_2018_cff.minPhi
minPhi
Definition: HLT_2018_cff.py:51486
photonAnalyzer_cfi.xMin
xMin
Definition: photonAnalyzer_cfi.py:82
HGCalLayerTilesT::mPiPhiBin
int mPiPhiBin
Definition: HGCalLayerTiles.h:77
HLT_2018_cff.maxPhi
maxPhi
Definition: HLT_2018_cff.py:51498
PVValHelper::eta
Definition: PVValidationHelpers.h:69
AlignmentTrackSelector_cfi.phiMin
phiMin
Definition: AlignmentTrackSelector_cfi.py:18
maxEta
double maxEta
Definition: PFJetBenchmarkAnalyzer.cc:76
HGCalLayerTilesT::getGlobalBin
int getGlobalBin(float x, float y) const
Definition: HGCalLayerTiles.h:80
AlignmentTrackSelector_cfi.phiMax
phiMax
Definition: AlignmentTrackSelector_cfi.py:17
multiplicitycorr_cfi.yMax
yMax
Definition: multiplicitycorr_cfi.py:6
OrderedSet.t
t
Definition: OrderedSet.py:90
beampixel_dqm_sourceclient-live_cfg.yRange
yRange
Definition: beampixel_dqm_sourceclient-live_cfg.py:142
HGVHistoProducerAlgoBlock_cfi.minY
minY
Definition: HGVHistoProducerAlgoBlock_cfi.py:158
HGCalLayerTilesT::getXBin
int getXBin(float x) const
Definition: HGCalLayerTiles.h:41
HGCalLayerTilesT::getGlobalBinEtaPhi
int getGlobalBinEtaPhi(float eta, float phi) const
Definition: HGCalLayerTiles.h:84
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
HGCalLayerTilesT::getPhiBin
int getPhiBin(float phi) const
Definition: HGCalLayerTiles.h:68
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
HGVHistoProducerAlgoBlock_cfi.maxY
maxY
Definition: HGVHistoProducerAlgoBlock_cfi.py:159
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
HGCalLayerTilesT::getYBin
int getYBin(float y) const
Definition: HGCalLayerTiles.h:50
multiplicitycorr_cfi.xMax
xMax
Definition: multiplicitycorr_cfi.py:5
EgHLTOffEleSelection_cfi.minEta
minEta
Definition: EgHLTOffEleSelection_cfi.py:11
HGVHistoProducerAlgoBlock_cfi.maxX
maxX
Definition: HGVHistoProducerAlgoBlock_cfi.py:154