1 #ifndef EgammaTowerIsolation_h
2 #define EgammaTowerIsolation_h
39 template<
unsigned int NC>
67 return compute(et,sum,sc,first,last);
71 void setRadius(
float const extRadius[NC],
float const intRadius[NC]) {
72 for (std::size_t
i=0;
i!=
NCuts; ++
i) {
76 maxEta = *std::max_element(extRadius,extRadius+NC);
93 uint32_t *
mem=
nullptr;
95 mem =
new uint32_t[
nt*6];
97 id = (uint32_t*)(
st) +
nt;
108 std::atomic<uint32_t>
create=0;
109 std::atomic<uint32_t>
comp=0;
110 std::atomic<uint32_t> span=0;
118 template<
unsigned int NC>
123 maxEta(*std::max_element(extRadius,extRadius+NC)),
132 for (std::size_t
i=0;
i!=
NCuts; ++
i) {
140 for (std::size_t
k=0;
k!=
nt; ++
k) {
141 e[
k]=towers[
k].eta();
143 std::push_heap(index,index+
k+1,[&e](uint32_t
i, uint32_t
j){
return e[
i]<e[
j];});
145 std::sort_heap(index,index+
nt,[&e](uint32_t
i, uint32_t
j){
return e[
i]<e[
j];});
148 for (std::size_t i=0;i!=
nt; ++
i) {
150 eta[
i]=towers[
j].eta();
151 phi[
i]=towers[
j].phi();
152 id[
i]=towers[
j].id();
153 st[
i] = 1.f/std::cosh(
eta[i]);
154 he[
i] = towers[
j].hadEnergy();
155 h2[
i] = towers[
j].hadEnergyHeOuterLayer();
160 template<
unsigned int NC>
170 float candEta = sc.
eta();
171 float candPhi = sc.
phi();
175 auto ub = std::upper_bound(lb,
eta+
nt,candEta+
maxEta);
176 uint32_t il = lb-
eta;
177 uint32_t iu =
std::min(
nt,uint32_t(ub-eta+1));
184 for (std::size_t
i=il;
i!=iu; ++
i)
190 for (std::size_t i=il;i!=iu; ++
i) {
192 float tt = et ? st[
i] : 1.f;
193 for (std::size_t
j=0;
j!=NCuts; ++
j) {
194 if (dr2<extRadius2_[
j]) {
195 if (dr2>=intRadius2_[j]) {
222 return getSum(
true,sc,detIdToExclude);
226 return getSum(
false,sc,detIdToExclude);
229 return getSum(
true,*sc,detIdToExclude);
232 return getSum(
false,*sc,detIdToExclude);
241 thread_local
static uint32_t
id15;
double getSum(bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const
static thread_local uint32_t id15
EgammaTowerIsolationNew()
static thread_local EgammaTowerIsolationNew< 1 > * newAlgo
static constexpr unsigned int NCuts
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
static thread_local const CaloTowerCollection * oldTowers
double getTowerESum(reco::SuperCluster const *sc, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
double eta() const
pseudorapidity of cluster centroid
~EgammaTowerIsolationNew()
void setRadius(float const extRadius[NC], float const intRadius[NC])
double getTowerESum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
double getTowerEtSum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
T get() const
get a component
EgammaTowerIsolation(float extRadiusI, float intRadiusI, float etLow, signed int depth, const CaloTowerCollection *towers)
double getTowerEtSum(reco::SuperCluster const *sc, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
double phi() const
azimuthal angle of cluster centroid
tuple size
Write out results.
void compute(bool et, Sum &sum, reco::Candidate const &cand, CaloTowerDetId const *first, CaloTowerDetId const *last) const