CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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

Definition at line 108 of file HGCalLayerTiles.h.

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

108  {
109  for (auto& t : tiles_)
110  t.clear();
111  }
std::array< std::vector< int >, T::nTiles > tiles_
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.

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

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  }
int getPhiBin(float phi) const
int getGlobalBinEtaPhi(float eta, float phi) const
int getGlobalBin(float x, float y) const
std::array< std::vector< int >, T::nTiles > tiles_
#define M_PI
template<typename T >
int HGCalLayerTilesT< T >::getEtaBin ( float  eta) const
inline

Definition at line 59 of file HGCalLayerTiles.h.

References etaBin(), generateTowerEtThresholdLUT::etaRange, maxEta, and alignCSCRings::r.

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

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  }
double maxEta
int etaBin(const l1t::HGCalMulticluster *cl)
template<typename T >
int HGCalLayerTilesT< T >::getGlobalBin ( float  x,
float  y 
) const
inline

Definition at line 80 of file HGCalLayerTiles.h.

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

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

80 { return getXBin(x) + getYBin(y) * T::nColumns; }
int getXBin(float x) const
int getYBin(float y) const
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; }
tuple yBin
Definition: cuy.py:892
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  }
int etaBin(const l1t::HGCalMulticluster *cl)
template<typename T >
int HGCalLayerTilesT< T >::getGlobalBinEtaPhi ( float  eta,
float  phi 
) const
inline

Definition at line 84 of file HGCalLayerTiles.h.

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

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

84  {
85  return T::nColumns * T::nRows + getEtaBin(eta) + getPhiBin(phi) * T::nColumnsEta;
86  }
int getEtaBin(float eta) const
int getPhiBin(float phi) const
template<typename T >
int HGCalLayerTilesT< T >::getPhiBin ( float  phi) const
inline

Definition at line 68 of file HGCalLayerTiles.h.

References HLT_FULL_cff::maxPhi, HLT_FULL_cff::minPhi, and alignCSCRings::r.

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

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  }
template<typename T >
int HGCalLayerTilesT< T >::getXBin ( float  x) const
inline

Definition at line 41 of file HGCalLayerTiles.h.

References alignCSCRings::r, and beampixel_dqm_sourceclient-live_cfg::xRange.

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

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  }
template<typename T >
int HGCalLayerTilesT< T >::getYBin ( float  y) const
inline

Definition at line 50 of file HGCalLayerTiles.h.

References alignCSCRings::r, cuy::yBin, and beampixel_dqm_sourceclient-live_cfg::yRange.

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

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  }
tuple yBin
Definition: cuy.py:892
template<typename T >
const std::vector<int>& HGCalLayerTilesT< T >::operator[] ( int  globalBinId) const
inline

Definition at line 113 of file HGCalLayerTiles.h.

References HGCalLayerTilesT< T >::tiles_.

113 { return tiles_[globalBinId]; }
std::array< std::vector< int >, T::nTiles > tiles_
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.

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

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  }
int getXBin(float x) const
int getYBin(float y) const
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.

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

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  }
int getEtaBin(float eta) const
tuple etaMin
Definition: Puppi_cff.py:45
int getPhiBin(float phi) const
tuple etaMax
Definition: Puppi_cff.py:46

Member Data Documentation

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

Definition at line 77 of file HGCalLayerTiles.h.

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

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

Definition at line 78 of file HGCalLayerTiles.h.

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

template<typename T >
std::array<std::vector<int>, T::nTiles> HGCalLayerTilesT< T >::tiles_
private