CMS 3D CMS Logo

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

#include <HGCalLayerTiles.h>

Public Types

typedef T type
 

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 18 of file HGCalLayerTiles.h.

Member Typedef Documentation

◆ type

template<typename T >
typedef T HGCalLayerTilesT< T >::type

Definition at line 20 of file HGCalLayerTiles.h.

Member Function Documentation

◆ clear()

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

Definition at line 109 of file HGCalLayerTiles.h.

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

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

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

25  {
26  auto cellsSize = x.size();
27  for (unsigned int i = 0; i < cellsSize; ++i) {
28  tiles_[getGlobalBin(x[i], y[i])].push_back(i);
29  if (!isSi[i]) {
30  tiles_[getGlobalBinEtaPhi(eta[i], phi[i])].push_back(i);
31  }
32  }
33  }
std::array< std::vector< int >, T::nTiles > tiles_
int getGlobalBin(float x, float y) const
int getGlobalBinEtaPhi(float eta, float phi) const

◆ getEtaBin()

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

◆ getGlobalBin()

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

Definition at line 72 of file HGCalLayerTiles.h.

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

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

72 { return getXBin(x) + getYBin(y) * T::nColumns; }
int getXBin(float x) const
int getYBin(float y) const

◆ getGlobalBinByBin()

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

Definition at line 74 of file HGCalLayerTiles.h.

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

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

◆ getGlobalBinByBinEtaPhi()

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

Definition at line 80 of file HGCalLayerTiles.h.

References muonRecoAnalyzer_cfi::etaBin, and BeamMonitor_cff::phiBin.

80  {
81  return T::nColumns * T::nRows + etaBin + phiBin * T::nColumnsEta;
82  }

◆ getGlobalBinEtaPhi()

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

Definition at line 76 of file HGCalLayerTiles.h.

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

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

76  {
77  return T::nColumns * T::nRows + getEtaBin(eta) + getPhiBin(phi) * T::nColumnsEta;
78  }
int getEtaBin(float eta) const
int getPhiBin(float phi) const

◆ getPhiBin()

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

Definition at line 62 of file HGCalLayerTiles.h.

References M_PI, normalizedPhi(), phi, BeamMonitor_cff::phiBin, and alignCSCRings::r.

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

62  {
63  auto normPhi = normalizedPhi(phi);
64  constexpr float r = T::nRowsPhi * M_1_PI * 0.5f;
65  int phiBin = (normPhi + M_PI) * r;
66  return phiBin;
67  }
constexpr T normalizedPhi(T phi)
Definition: normalizedPhi.h:8
#define M_PI

◆ getXBin()

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

◆ getYBin()

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

◆ operator[]()

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

Definition at line 114 of file HGCalLayerTiles.h.

References HGCalLayerTilesT< T >::tiles_.

114 { return tiles_[globalBinId]; }
std::array< std::vector< int >, T::nTiles > 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 84 of file HGCalLayerTiles.h.

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

84  {
85  int xBinMin = getXBin(xMin);
86  int xBinMax = getXBin(xMax);
87  int yBinMin = getYBin(yMin);
88  int yBinMax = getYBin(yMax);
89  return std::array<int, 4>({{xBinMin, xBinMax, yBinMin, yBinMax}});
90  }
int getXBin(float x) const
int getYBin(float y) const

◆ searchBoxEtaPhi()

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

Definition at line 92 of file HGCalLayerTiles.h.

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

92  {
93  int etaBinMin = getEtaBin(etaMin);
94  int etaBinMax = getEtaBin(etaMax);
95  int phiBinMin = getPhiBin(phiMin);
96  int phiBinMax = getPhiBin(phiMax);
97  // If the search window cross the phi-bin boundary, add T::nPhiBins to the
98  // MAx value. This guarantees that the caller can perform a valid doule
99  // loop on eta and phi. It is the caller responsibility to perform a module
100  // operation on the phiBin values returned by this function, to explore the
101  // correct bins.
102  if (phiBinMax < phiBinMin) {
103  phiBinMax += T::nRowsPhi;
104  }
105 
106  return std::array<int, 4>({{etaBinMin, etaBinMax, phiBinMin, phiBinMax}});
107  }
int getEtaBin(float eta) const
int getPhiBin(float phi) const

Member Data Documentation

◆ mPiPhiBin

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

Definition at line 69 of file HGCalLayerTiles.h.

◆ pPiPhiBin

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

Definition at line 70 of file HGCalLayerTiles.h.

◆ tiles_

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