CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
HGCalLayerTiles Class 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 >, hgcaltilesconstants::nTilestiles_
 

Detailed Description

Definition at line 15 of file HGCalLayerTiles.h.

Member Function Documentation

void HGCalLayerTiles::clear ( void  )
inline

Definition at line 108 of file HGCalLayerTiles.h.

References OrderedSet::t, and tiles_.

Referenced by HGCalCLUEAlgo::makeClusters().

108  {
109  for (auto& t : tiles_)
110  t.clear();
111  }
std::array< std::vector< int >, hgcaltilesconstants::nTiles > tiles_
void HGCalLayerTiles::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 17 of file HGCalLayerTiles.h.

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

Referenced by HGCalCLUEAlgo::makeClusters().

21  {
22  auto cellsSize = x.size();
23  for (unsigned int i = 0; i < cellsSize; ++i) {
24  tiles_[getGlobalBin(x[i], y[i])].push_back(i);
25  if (!isSi[i]) {
26  tiles_[getGlobalBinEtaPhi(eta[i], phi[i])].push_back(i);
27  // Copy cells in phi=[-3.15,-3.] to the last bin
28  if (getPhiBin(phi[i]) == mPiPhiBin) {
29  tiles_[getGlobalBinEtaPhi(eta[i], phi[i] + 2 * M_PI)].push_back(i);
30  }
31  // Copy cells in phi=[3.,3.15] to the first bin
32  if (getPhiBin(phi[i]) == pPiPhiBin) {
33  tiles_[getGlobalBinEtaPhi(eta[i], phi[i] - 2 * M_PI)].push_back(i);
34  }
35  }
36  }
37  }
std::array< std::vector< int >, hgcaltilesconstants::nTiles > tiles_
int getPhiBin(float phi) const
int getGlobalBin(float x, float y) const
int getGlobalBinEtaPhi(float eta, float phi) const
#define M_PI
int HGCalLayerTiles::getEtaBin ( float  eta) const
inline
int HGCalLayerTiles::getGlobalBin ( float  x,
float  y 
) const
inline

Definition at line 78 of file HGCalLayerTiles.h.

References getXBin(), getYBin(), and hgcaltilesconstants::nColumns.

Referenced by fill().

int getYBin(float y) const
int getXBin(float x) const
int HGCalLayerTiles::getGlobalBinByBin ( int  xBin,
int  yBin 
) const
inline
int HGCalLayerTiles::getGlobalBinByBinEtaPhi ( int  etaBin,
int  phiBin 
) const
inline
int HGCalLayerTiles::getGlobalBinEtaPhi ( float  eta,
float  phi 
) const
inline
int HGCalLayerTiles::getPhiBin ( float  phi) const
inline

Definition at line 66 of file HGCalLayerTiles.h.

References constexpr, hgcaltilesconstants::maxPhi, hgcaltilesconstants::minPhi, hgcaltilesconstants::nRowsPhi, BeamMonitor_cff::phiBin, and alignCSCRings::r.

Referenced by fill(), getGlobalBinEtaPhi(), and searchBoxEtaPhi().

66  {
68  static_assert(phiRange >= 0.);
69  constexpr float r = hgcaltilesconstants::nRowsPhi / phiRange;
71  phiBin = std::clamp(phiBin, 0, hgcaltilesconstants::nRowsPhi - 1);
72  return phiBin;
73  }
constexpr float maxPhi
constexpr float minPhi
#define constexpr
int HGCalLayerTiles::getXBin ( float  x) const
inline
int HGCalLayerTiles::getYBin ( float  y) const
inline
const std::vector<int>& HGCalLayerTiles::operator[] ( int  globalBinId) const
inline

Definition at line 113 of file HGCalLayerTiles.h.

References tiles_.

113 { return tiles_[globalBinId]; }
std::array< std::vector< int >, hgcaltilesconstants::nTiles > tiles_
std::array<int, 4> HGCalLayerTiles::searchBox ( float  xMin,
float  xMax,
float  yMin,
float  yMax 
) const
inline

Definition at line 92 of file HGCalLayerTiles.h.

References getXBin(), and getYBin().

Referenced by HGCalCLUEAlgo::calculateDistanceToHigher(), and HGCalCLUEAlgo::calculateLocalDensity().

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 getYBin(float y) const
int getXBin(float x) const
std::array<int, 4> HGCalLayerTiles::searchBoxEtaPhi ( float  etaMin,
float  etaMax,
float  phiMin,
float  phiMax 
) const
inline

Definition at line 100 of file HGCalLayerTiles.h.

References getEtaBin(), and getPhiBin().

Referenced by HGCalCLUEAlgo::calculateDistanceToHigher(), and HGCalCLUEAlgo::calculateLocalDensity().

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
int getPhiBin(float phi) const

Member Data Documentation

int HGCalLayerTiles::mPiPhiBin = getPhiBin(-M_PI)

Definition at line 75 of file HGCalLayerTiles.h.

Referenced by fill().

int HGCalLayerTiles::pPiPhiBin = getPhiBin(M_PI)

Definition at line 76 of file HGCalLayerTiles.h.

Referenced by fill().

std::array<std::vector<int>, hgcaltilesconstants::nTiles> HGCalLayerTiles::tiles_
private

Definition at line 116 of file HGCalLayerTiles.h.

Referenced by clear(), fill(), and operator[]().