1 #ifndef EgammaTowerIsolation_h
2 #define EgammaTowerIsolation_h
38 template<
unsigned int NC>
66 return compute(et,sum,sc,first,last);
70 void setRadius(
float const extRadius[NC],
float const intRadius[NC]) {
71 for (std::size_t
i=0;
i!=
NCuts; ++
i) {
75 maxEta = *std::max_element(extRadius,extRadius+NC);
92 uint32_t *
mem=
nullptr;
94 mem =
new uint32_t[
nt*6];
96 id = (uint32_t*)(
st) +
nt;
115 template<
unsigned int NC>
120 maxEta(*std::max_element(extRadius,extRadius+NC)),
128 for (std::size_t
i=0;
i!=
NCuts; ++
i) {
136 for (std::size_t
k=0;
k!=
nt; ++
k) {
137 e[
k]=towers[
k].eta();
139 std::push_heap(index,index+
k+1,[&e](uint32_t
i, uint32_t
j){
return e[
i]<e[
j];});
141 std::sort_heap(index,index+
nt,[&e](uint32_t
i, uint32_t
j){
return e[
i]<e[
j];});
144 for (std::size_t i=0;i!=
nt; ++
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]);
150 he[
i] = towers[
j].hadEnergy();
151 h2[
i] = towers[
j].hadEnergyHeOuterLayer();
156 template<
unsigned int NC>
164 float candEta = sc.
eta();
165 float candPhi = sc.
phi();
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));
176 for (std::size_t
i=il;
i!=iu; ++
i)
182 for (std::size_t i=il;i!=iu; ++
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]) {
214 return getSum(
true,sc,detIdToExclude);
218 return getSum(
false,sc,detIdToExclude);
221 return getSum(
true,*sc,detIdToExclude);
224 return getSum(
false,*sc,detIdToExclude);
double getSum(bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const
EgammaTowerIsolationNew()
static constexpr unsigned int NCuts
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()
static EgammaTowerIsolationNew< 1 > * newAlgo
void setRadius(float const extRadius[NC], float const intRadius[NC])
static const CaloTowerCollection * oldTowers
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