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