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 std::vector<float>
e(
nt);
144 for (std::size_t
k=0;
k!=
nt; ++
k) {
145 e[
k]=towers[
k].eta();
147 std::push_heap(index,index+
k+1,[&e](uint32_t
i, uint32_t
j){
return e[
i]<e[
j];});
149 std::sort_heap(index,index+
nt,[&e](uint32_t
i, uint32_t
j){
return e[
i]<e[
j];});
152 for (std::size_t i=0;i!=
nt; ++
i) {
154 eta[
i]=towers[
j].eta();
155 phi[
i]=towers[
j].phi();
156 id[
i]=towers[
j].id();
157 st[
i] = 1.f/std::cosh(
eta[i]);
158 he[
i] = towers[
j].hadEnergy();
159 h2[
i] = towers[
j].hadEnergyHeOuterLayer();
164 template<
unsigned int NC>
174 float candEta = sc.
eta();
175 float candPhi = sc.
phi();
179 auto ub = std::upper_bound(lb,
eta+
nt,candEta+
maxEta);
180 uint32_t il = lb-
eta;
181 uint32_t iu =
std::min(
nt,uint32_t(ub-eta+1));
188 for (std::size_t
i=il;
i!=iu; ++
i)
194 for (std::size_t i=il;i!=iu; ++
i) {
196 float tt = et ? st[
i] : 1.f;
197 for (std::size_t
j=0;
j!=NCuts; ++
j) {
198 if (dr2<extRadius2_[
j]) {
199 if (dr2>=intRadius2_[j]) {
226 return getSum(
true,sc,detIdToExclude);
230 return getSum(
false,sc,detIdToExclude);
233 return getSum(
true,*sc,detIdToExclude);
236 return getSum(
false,*sc,detIdToExclude);
double getSum(bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const
EgammaTowerIsolationNew()
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
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 deltaR2(const T1 &t1, const T2 &t2)
static unsigned int NCuts
double getTowerESum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
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