CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Public Attributes | Static Public Attributes
EgammaTowerIsolationNew< NC > Class Template Reference

#include <EgammaTowerIsolation.h>

Classes

struct  Sum
 

Public Member Functions

template<typename I >
void compute (bool et, Sum &sum, reco::Candidate const &cand, I first, I last) const
 
template<typename I >
void compute (bool et, Sum &sum, reco::SuperCluster const &sc, I first, I last) const
 
 EgammaTowerIsolationNew ()
 
 EgammaTowerIsolationNew (float extRadius[NC], float intRadius[NC], CaloTowerCollection const &towers)
 
void initSoa ()
 
void setRadius (float const extRadius[NC], float const intRadius[NC])
 
 ~EgammaTowerIsolationNew ()
 

Public Attributes

float * eta
 
float extRadius2_ [NCuts]
 
float * h2
 
float * he
 
uint32_t * id
 
float intRadius2_ [NCuts]
 
float maxEta
 
uint32_t * mem = nullptr
 
const uint32_t nt
 
float * phi
 
float * st
 

Static Public Attributes

static constexpr unsigned int NCuts = NC
 

Detailed Description

template<unsigned int NC>
class EgammaTowerIsolationNew< NC >

Definition at line 36 of file EgammaTowerIsolation.h.

Constructor & Destructor Documentation

◆ EgammaTowerIsolationNew() [1/2]

template<unsigned int NC>
EgammaTowerIsolationNew< NC >::EgammaTowerIsolationNew ( )
inline

Definition at line 51 of file EgammaTowerIsolation.h.

51 : nt(0) {}

◆ EgammaTowerIsolationNew() [2/2]

template<unsigned int NC>
EgammaTowerIsolationNew< NC >::EgammaTowerIsolationNew ( float  extRadius[NC],
float  intRadius[NC],
CaloTowerCollection const &  towers 
)
inline

Definition at line 115 of file EgammaTowerIsolation.h.

References submitPVResolutionJobs::count, MillePedeFileConverter_cfg::e, EgammaTowerIsolationNew< NC >::eta, electronEcalRecHitIsolationLcone_cfi::extRadius, EgammaTowerIsolationNew< NC >::extRadius2_, EgammaTowerIsolationNew< NC >::h2, EgammaTowerIsolationNew< NC >::he, mps_fire::i, EgammaTowerIsolationNew< NC >::initSoa(), electronHcalTowerIsolationLcone_cfi::intRadius, EgammaTowerIsolationNew< NC >::intRadius2_, dqmiolumiharvest::j, dqmdumpme::k, EgammaTowerIsolationNew< NC >::NCuts, EgammaTowerIsolationNew< NC >::nt, EgammaTowerIsolationNew< NC >::phi, EgammaTowerIsolationNew< NC >::st, and HLT_2023v12_cff::towers.

118  : maxEta(*std::max_element(extRadius, extRadius + NC)), nt(towers.size()) {
119  if (nt == 0)
120  return;
121  initSoa();
122 
123 #ifdef ETISTATDEBUG
124  etiStat::Count::count.create++;
125 #endif
126 
127  for (std::size_t i = 0; i != NCuts; ++i) {
130  }
131 
132  // sort in eta (kd-tree anoverkill,does not vectorize...)
133  uint32_t index[nt];
134 #ifdef __clang__
135  std::vector<float> e(nt);
136 #else
137  float e[nt];
138 #endif
139  for (std::size_t k = 0; k != nt; ++k) {
140  e[k] = towers[k].eta();
141  index[k] = k;
142  std::push_heap(index, index + k + 1, [&e](uint32_t i, uint32_t j) { return e[i] < e[j]; });
143  }
144  std::sort_heap(index, index + nt, [&e](uint32_t i, uint32_t j) { return e[i] < e[j]; });
145 
146  for (std::size_t i = 0; i != nt; ++i) {
147  auto j = index[i];
148  eta[i] = towers[j].eta();
149  phi[i] = towers[j].phi();
150  id[i] = towers[j].id();
151  st[i] = 1.f / std::cosh(eta[i]); // std::sin(towers[j].theta()); //;
152  he[i] = towers[j].hadEnergy();
153  h2[i] = towers[j].hadEnergyHeOuterLayer();
154  }
155 }
static constexpr unsigned int NCuts

◆ ~EgammaTowerIsolationNew()

template<unsigned int NC>
EgammaTowerIsolationNew< NC >::~EgammaTowerIsolationNew ( )
inline

Definition at line 54 of file EgammaTowerIsolation.h.

References EgammaTowerIsolationNew< NC >::mem.

54 { delete[] mem; }

Member Function Documentation

◆ compute() [1/2]

template<unsigned int NC>
template<typename I >
void EgammaTowerIsolationNew< NC >::compute ( bool  et,
Sum sum,
reco::Candidate const &  cand,
first,
last 
) const
inline

Definition at line 57 of file EgammaTowerIsolation.h.

References EgHLTOffHistBins_cfi::et, dqmdumpme::first, and dqmdumpme::last.

57  {
58  reco::SuperCluster const* sc = cand.get<reco::SuperClusterRef>().get();
59  if (sc) {
60  compute(et, sum, *sc, first, last);
61  }
62  }
void compute(bool et, Sum &sum, reco::Candidate const &cand, I first, I last) const

◆ compute() [2/2]

template<unsigned int NC>
template<typename I >
void EgammaTowerIsolationNew< NC >::compute ( bool  et,
Sum sum,
reco::SuperCluster const &  sc,
first,
last 
) const
inline

Definition at line 159 of file EgammaTowerIsolation.h.

References submitPVResolutionJobs::count, reco::deltaR2(), EgHLTOffHistBins_cfi::et, PVValHelper::eta, reco::CaloCluster::eta(), spr::find(), dqmdumpme::first, EgammaTowerIsolationNew< NC >::Sum::h2, EgammaTowerIsolationNew< NC >::Sum::h2BC, EgammaTowerIsolationNew< NC >::Sum::he, hcalSimParameters_cfi::he, EgammaTowerIsolationNew< NC >::Sum::heBC, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::last, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, razorScouting_cff::maxEta, SiStripPI::min, nt, PVValHelper::phi, reco::CaloCluster::phi(), groupFilesInBlocks::tt, and pfDeepBoostedJetPreprocessParams_cfi::upper_bound.

160  {
161  if (nt == 0)
162  return;
163 
164 #ifdef ETISTATDEBUG
165  etiStat::Count::count.comp++;
166 #endif
167 
168  float candEta = sc.eta();
169  float candPhi = sc.phi();
170 
171  auto lb = std::lower_bound(eta, eta + nt, candEta - maxEta);
172  auto ub = std::upper_bound(lb, eta + nt, candEta + maxEta);
173  uint32_t il = lb - eta;
174  uint32_t iu = std::min(nt, uint32_t(ub - eta + 1));
175 
176 #ifdef ETISTATDEBUG
177  etiStat::Count::count.span += (iu - il);
178 #endif
179 
180  // should be restricted in eta....
181  for (std::size_t i = il; i != iu; ++i) {
182  float dr2 = reco::deltaR2(candEta, candPhi, eta[i], phi[i]);
183  float tt = et ? st[i] : 1.f;
184  for (std::size_t j = 0; j != NCuts; ++j) {
185  if (dr2 < extRadius2_[j]) {
186  if (dr2 >= intRadius2_[j]) {
187  sum.he[j] += he[i] * tt;
188  sum.h2[j] += h2[i] * tt;
189  }
190  if (std::find(first, last, id[i]) == last) {
191  sum.heBC[j] += he[i] * tt;
192  sum.h2BC[j] += h2[i] * tt;
193  }
194  }
195  }
196  }
197 }
static constexpr unsigned int NCuts
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Definition: TTTypes.h:54
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16

◆ initSoa()

template<unsigned int NC>
void EgammaTowerIsolationNew< NC >::initSoa ( )
inline

◆ setRadius()

template<unsigned int NC>
void EgammaTowerIsolationNew< NC >::setRadius ( float const  extRadius[NC],
float const  intRadius[NC] 
)
inline

Member Data Documentation

◆ eta

template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::eta

◆ extRadius2_

template<unsigned int NC>
float EgammaTowerIsolationNew< NC >::extRadius2_[NCuts]

◆ h2

template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::h2

◆ he

template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::he

◆ id

template<unsigned int NC>
uint32_t* EgammaTowerIsolationNew< NC >::id

Definition at line 86 of file EgammaTowerIsolation.h.

◆ intRadius2_

template<unsigned int NC>
float EgammaTowerIsolationNew< NC >::intRadius2_[NCuts]

◆ maxEta

template<unsigned int NC>
float EgammaTowerIsolationNew< NC >::maxEta

Definition at line 78 of file EgammaTowerIsolation.h.

Referenced by EgammaTowerIsolationNew< NC >::setRadius().

◆ mem

template<unsigned int NC>
uint32_t* EgammaTowerIsolationNew< NC >::mem = nullptr

◆ NCuts

template<unsigned int NC>
constexpr unsigned int EgammaTowerIsolationNew< NC >::NCuts = NC
static

◆ nt

template<unsigned int NC>
const uint32_t EgammaTowerIsolationNew< NC >::nt

◆ phi

template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::phi

◆ st

template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::st