CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

void compute (bool et, Sum &sum, reco::Candidate const &cand, CaloTowerDetId const *first, CaloTowerDetId const *last) const
 
void compute (bool et, Sum &sum, reco::SuperCluster const &sc, CaloTowerDetId const *first, CaloTowerDetId const *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 39 of file EgammaTowerIsolation.h.

Constructor & Destructor Documentation

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

Definition at line 56 of file EgammaTowerIsolation.h.

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

Definition at line 117 of file EgammaTowerIsolation.h.

References etiStat::Count::count, etiStat::Count::create, alignCSCRings::e, EgammaTowerIsolationNew< NC >::eta, EgammaTowerIsolationNew< NC >::extRadius2_, EgammaTowerIsolationNew< NC >::h2, EgammaTowerIsolationNew< NC >::he, i, getHLTprescales::index, EgammaTowerIsolationNew< NC >::initSoa(), EgammaTowerIsolationNew< NC >::intRadius2_, j, gen::k, EgammaTowerIsolationNew< NC >::NCuts, EgammaTowerIsolationNew< NC >::nt, EgammaTowerIsolationNew< NC >::phi, and EgammaTowerIsolationNew< NC >::st.

119  :
120  maxEta(*std::max_element(extRadius,extRadius+NC)),
121  nt(towers.size()) {
122  if (nt==0) return;
123  initSoa();
124 
126 
127 
128  for (std::size_t i=0; i!=NCuts; ++i) {
129  extRadius2_[i]=extRadius[i]*extRadius[i];
130  intRadius2_[i]=intRadius[i]*intRadius[i];
131  }
132 
133  // sort in eta (kd-tree anoverkill,does not vectorize...)
134  uint32_t index[nt];
135  float e[nt];
136  for (std::size_t k=0; k!=nt; ++k) {
137  e[k]=towers[k].eta();
138  index[k]=k;
139  std::push_heap(index,index+k+1,[&e](uint32_t i, uint32_t j){ return e[i]<e[j];});
140  }
141  std::sort_heap(index,index+nt,[&e](uint32_t i, uint32_t j){ return e[i]<e[j];});
142 
143 
144  for (std::size_t i=0;i!=nt; ++i) {
145  auto j = index[i];
146  eta[i]=towers[j].eta();
147  phi[i]=towers[j].phi();
148  id[i]=towers[j].id();
149  st[i] = 1.f/std::cosh(eta[i]); // std::sin(towers[j].theta()); //;
150  he[i] = towers[j].hadEnergy();
151  h2[i] = towers[j].hadEnergyHeOuterLayer();
152  }
153 }
int i
Definition: DBlmapReader.cc:9
static constexpr unsigned int NCuts
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
template<unsigned int NC>
EgammaTowerIsolationNew< NC >::~EgammaTowerIsolationNew ( )
inline

Definition at line 62 of file EgammaTowerIsolation.h.

62 { delete[] mem;}

Member Function Documentation

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

Definition at line 64 of file EgammaTowerIsolation.h.

Referenced by EgammaTowerIsolationNew< 1 >::compute(), and EgammaTowerIsolation::getSum().

64  {
65  reco::SuperCluster const & sc = *cand.get<reco::SuperClusterRef>().get();
66  return compute(et,sum,sc,first,last);
67  }
bool first
Definition: L1TdeRCT.cc:94
void compute(bool et, Sum &sum, reco::Candidate const &cand, CaloTowerDetId const *first, CaloTowerDetId const *last) const
template<unsigned int NC>
void EgammaTowerIsolationNew< NC >::compute ( bool  et,
Sum sum,
reco::SuperCluster const &  sc,
CaloTowerDetId const *  first,
CaloTowerDetId const *  last 
) const
inline

Definition at line 159 of file EgammaTowerIsolation.h.

References etiStat::Count::comp, etiStat::Count::count, reco::deltaR2(), reco::CaloCluster::eta(), eta(), spr::find(), EgammaTowerIsolationNew< NC >::Sum::h2, EgammaTowerIsolationNew< NC >::Sum::h2BC, EgammaTowerIsolationNew< NC >::Sum::he, EgammaTowerIsolationNew< NC >::Sum::heBC, i, j, prof2calltree::last, maxEta, min, nt, convertSQLiteXML::ok, phi, reco::CaloCluster::phi(), etiStat::Count::span, and groupFilesInBlocks::tt.

159  {
160  if (nt==0) return;
161 
163 
164  float candEta = sc.eta();
165  float candPhi = sc.phi();
166 
167 
168  auto lb = std::lower_bound(eta,eta+nt,candEta-maxEta);
169  auto ub = std::upper_bound(lb,eta+nt,candEta+maxEta);
170  uint32_t il = lb-eta;
171  uint32_t iu = std::min(nt,uint32_t(ub-eta+1));
172 
173  etiStat::Count::count.span += (iu-il);
174 
175  bool ok[iu-il];
176  for (std::size_t i=il;i!=iu; ++i)
177  ok[i-il] = (std::find(first,last,id[i])==last);
178 
179 
180 
181  // should be restricted in eta....
182  for (std::size_t i=il;i!=iu; ++i) {
183  float dr2 = reco::deltaR2(candEta,candPhi,eta[i], phi[i]);
184  float tt = et ? st[i] : 1.f;
185  for (std::size_t j=0; j!=NCuts; ++j) {
186  if (dr2<extRadius2_[j]) {
187  if (dr2>=intRadius2_[j]) {
188  sum.he[j] +=he[i]*tt;
189  sum.h2[j] +=h2[i]*tt;
190  }
191  if(ok[i-il]) {
192  sum.heBC[j] +=he[i]*tt;
193  sum.h2BC[j] +=h2[i]*tt;
194  }
195  }
196  }
197  }
198 }
int i
Definition: DBlmapReader.cc:9
#define min(a, b)
Definition: mlp_lapack.h:161
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:7
int j
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:58
template<unsigned int NC>
void EgammaTowerIsolationNew< NC >::initSoa ( )
inline

Definition at line 93 of file EgammaTowerIsolation.h.

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

93  {
94  mem = new uint32_t[nt*6];
95  eta = (float*)(mem); phi = eta+nt; he = phi+nt; h2 = he+nt; st = h2+nt;
96  id = (uint32_t*)(st) + nt;
97  }
template<unsigned int NC>
void EgammaTowerIsolationNew< NC >::setRadius ( float const  extRadius[NC],
float const  intRadius[NC] 
)
inline

Definition at line 70 of file EgammaTowerIsolation.h.

Referenced by EgammaTowerIsolation::getSum().

70  {
71  for (std::size_t i=0; i!=NCuts; ++i) {
72  extRadius2_[i]=extRadius[i]*extRadius[i];
73  intRadius2_[i]=intRadius[i]*intRadius[i];
74  }
75  maxEta = *std::max_element(extRadius,extRadius+NC);
76  }
int i
Definition: DBlmapReader.cc:9
static constexpr unsigned int NCuts

Member Data Documentation

template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::eta
template<unsigned int NC>
float EgammaTowerIsolationNew< NC >::extRadius2_[NCuts]
template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::h2
template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::he
template<unsigned int NC>
uint32_t* EgammaTowerIsolationNew< NC >::id

Definition at line 91 of file EgammaTowerIsolation.h.

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

Definition at line 83 of file EgammaTowerIsolation.h.

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

template<unsigned int NC>
uint32_t* EgammaTowerIsolationNew< NC >::mem =nullptr
template<unsigned int NC>
constexpr unsigned int EgammaTowerIsolationNew< NC >::NCuts = NC
static
template<unsigned int NC>
const uint32_t EgammaTowerIsolationNew< NC >::nt
template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::phi
template<unsigned int NC>
float* EgammaTowerIsolationNew< NC >::st