CMS 3D CMS Logo

TICLLayerTile.h
Go to the documentation of this file.
1 // Authors: Marco Rovere, Felice Pantaleo - marco.rovere@cern.ch, felice.pantaleo@cern.ch
2 // Date: 05/2019
3 
4 #ifndef DataFormats_HGCalReco_TICLLayerTile_h
5 #define DataFormats_HGCalReco_TICLLayerTile_h
6 
9 
11 public:
12  void fill(double eta, double phi, unsigned int layerClusterId) {
13  tile_[globalBin(eta, phi)].push_back(layerClusterId);
14  }
15 
16  int etaBin(float eta) const {
18  static_assert(etaRange >= 0.f);
20  int etaBin = (std::abs(eta) - ticl::constants::minEta) * r;
21  etaBin = std::clamp(etaBin, 0, ticl::constants::nEtaBins - 1);
22  return etaBin;
23  }
24 
25  int phiBin(float phi) const {
26  auto normPhi = normalizedPhi(phi);
27  float r = ticl::constants::nPhiBins * M_1_PI * 0.5f;
28  int phiBin = (normPhi + M_PI) * r;
29 
30  return phiBin;
31  }
32 
33  int globalBin(int etaBin, int phiBin) const { return phiBin + etaBin * ticl::constants::nPhiBins; }
34 
35  int globalBin(double eta, double phi) const { return phiBin(phi) + etaBin(eta) * ticl::constants::nPhiBins; }
36 
37  void clear() {
39  for (int j = 0; j < nBins; ++j)
40  tile_[j].clear();
41  }
42 
43  const std::vector<unsigned int>& operator[](int globalBinId) const { return tile_[globalBinId]; }
44 
45 private:
47 };
48 
50 public:
51  // This class represents a collection of Tiles, one for each layer in
52  // HGCAL. The layer numbering should account for both sides of HGCAL and is
53  // not handled internally. It is the user's responsibility to properly
54  // number the layers and consistently access them here.
55  const TICLLayerTile& operator[](int layer) const { return tiles_[layer]; }
56  void fill(int layer, double eta, double phi, unsigned int layerClusterId) {
57  tiles_[layer].fill(eta, phi, layerClusterId);
58  }
59 
60 private:
62 };
63 
64 #endif
std::array< std::vector< unsigned int >, constants::nEtaBins *constants::nPhiBins > Tile
Definition: Common.h:19
void fill(double eta, double phi, unsigned int layerClusterId)
Definition: TICLLayerTile.h:12
constexpr float minEta
Definition: Common.h:9
ticl::Tile tile_
Definition: TICLLayerTile.h:46
constexpr T normalizedPhi(T phi)
Definition: normalizedPhi.h:8
constexpr int nPhiBins
Definition: Common.h:12
constexpr int nEtaBins
Definition: Common.h:11
int globalBin(int etaBin, int phiBin) const
Definition: TICLLayerTile.h:33
std::array< TICLLayerTile, ticl::constants::nLayers > Tiles
Definition: Common.h:20
const std::vector< unsigned int > & operator[](int globalBinId) const
Definition: TICLLayerTile.h:43
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
int globalBin(double eta, double phi) const
Definition: TICLLayerTile.h:35
const TICLLayerTile & operator[](int layer) const
Definition: TICLLayerTile.h:55
#define M_PI
void fill(int layer, double eta, double phi, unsigned int layerClusterId)
Definition: TICLLayerTile.h:56
ticl::Tiles tiles_
Definition: TICLLayerTile.h:61
constexpr float maxEta
Definition: Common.h:10
int etaBin(float eta) const
Definition: TICLLayerTile.h:16
#define constexpr
int phiBin(float phi) const
Definition: TICLLayerTile.h:25