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 
10 template <typename T>
12 public:
13  void fill(double eta, double phi, unsigned int layerClusterId) {
14  tile_[globalBin(eta, phi)].push_back(layerClusterId);
15  }
16 
17  int etaBin(float eta) const {
18  constexpr float etaRange = T::maxEta - T::minEta;
19  static_assert(etaRange >= 0.f);
20  float r = T::nEtaBins / etaRange;
21  int etaBin = (std::abs(eta) - T::minEta) * r;
22  etaBin = std::clamp(etaBin, 0, T::nEtaBins - 1);
23  return etaBin;
24  }
25 
26  int phiBin(float phi) const {
27  auto normPhi = normalizedPhi(phi);
28  float r = T::nPhiBins * M_1_PI * 0.5f;
29  int phiBin = (normPhi + M_PI) * r;
30 
31  return phiBin;
32  }
33 
34  int globalBin(int etaBin, int phiBin) const { return phiBin + etaBin * T::nPhiBins; }
35 
36  int globalBin(double eta, double phi) const { return phiBin(phi) + etaBin(eta) * T::nPhiBins; }
37 
38  void clear() {
39  auto nBins = T::nEtaBins * T::nPhiBins;
40  for (int j = 0; j < nBins; ++j)
41  tile_[j].clear();
42  }
43 
44  const std::vector<unsigned int>& operator[](int globalBinId) const { return tile_[globalBinId]; }
45 
46 private:
47  std::array<std::vector<unsigned int>, T::nBins> tile_;
48 };
49 
50 namespace ticl {
52  using Tiles = std::array<TICLLayerTile, TileConstants::nLayers>;
53  using TracksterTiles = std::array<TICLLayerTile, TileConstants::iterations>;
54 } // namespace ticl
55 
56 template <typename T>
58 public:
59  // This class represents a generic collection of Tiles. The additional index
60  // numbering is not handled internally. It is the user's responsibility to
61  // properly use and consistently access it here.
62  const auto& operator[](int index) const { return tiles_[index]; }
63  void fill(int index, double eta, double phi, unsigned int objectId) { tiles_[index].fill(eta, phi, objectId); }
64 
65 private:
67 };
68 
71 
72 #endif
TICLLayerTileT
Definition: TICLLayerTile.h:11
ticl::Tiles
std::array< TICLLayerTile, TileConstants::nLayers > Tiles
Definition: TICLLayerTile.h:52
TICLLayerTileT::globalBin
int globalBin(int etaBin, int phiBin) const
Definition: TICLLayerTile.h:34
Common.h
generateTowerEtThresholdLUT.etaRange
etaRange
Definition: generateTowerEtThresholdLUT.py:55
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
TICLGenericTile
Definition: TICLLayerTile.h:57
ticl
Definition: Common.h:8
PVValHelper::eta
Definition: PVValidationHelpers.h:69
maxEta
double maxEta
Definition: PFJetBenchmarkAnalyzer.cc:76
normalizedPhi
constexpr T normalizedPhi(T phi)
Definition: normalizedPhi.h:8
TICLLayerTileT::phiBin
int phiBin(float phi) const
Definition: TICLLayerTile.h:26
seedmultiplicitymonitor_newtracking_cfi.nBins
nBins
Definition: seedmultiplicitymonitor_newtracking_cfi.py:8
ticl::TracksterTiles
std::array< TICLLayerTile, TileConstants::iterations > TracksterTiles
Definition: TICLLayerTile.h:53
TICLLayerTileT::globalBin
int globalBin(double eta, double phi) const
Definition: TICLLayerTile.h:36
normalizedPhi.h
TICLLayerTileT::etaBin
int etaBin(float eta) const
Definition: TICLLayerTile.h:17
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
alignCSCRings.r
r
Definition: alignCSCRings.py:93
TICLLayerTileT::tile_
std::array< std::vector< unsigned int >, T::nBins > tile_
Definition: TICLLayerTile.h:47
DDAxes::phi
TICLLayerTileT::fill
void fill(double eta, double phi, unsigned int layerClusterId)
Definition: TICLLayerTile.h:13
T
long double T
Definition: Basic3DVectorLD.h:48
L1TMuonDQMOffline_cfi.nEtaBins
nEtaBins
Definition: L1TMuonDQMOffline_cfi.py:21
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TICLGenericTile::tiles_
T tiles_
Definition: TICLLayerTile.h:66
ecaldqm::binning::nPhiBins
Definition: MESetBinningUtils.h:69
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TICLGenericTile::operator[]
const auto & operator[](int index) const
Definition: TICLLayerTile.h:62
EgHLTOffEleSelection_cfi.minEta
minEta
Definition: EgHLTOffEleSelection_cfi.py:11
TICLLayerTileT::clear
void clear()
Definition: TICLLayerTile.h:38
TICLLayerTileT::operator[]
const std::vector< unsigned int > & operator[](int globalBinId) const
Definition: TICLLayerTile.h:44
TICLGenericTile::fill
void fill(int index, double eta, double phi, unsigned int objectId)
Definition: TICLLayerTile.h:63