1 #ifndef EgammaTowerIsolation_h 2 #define EgammaTowerIsolation_h 39 template<
unsigned int NC>
67 return compute(et,sum,sc,first,last);
72 for (std::size_t
i=0;
i!=
NCuts; ++
i) {
93 uint32_t *
mem=
nullptr;
95 mem =
new uint32_t[nt*6];
96 eta = (
float*)(mem); phi = eta+
nt; he = phi+
nt; h2 = he+
nt; st = h2+
nt;
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>
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();
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) {
190 float tt = et ?
st[
i] : 1.f;
191 for (std::size_t j=0; j!=
NCuts; ++j) {
197 if(
std::find(first,last,
id[i]) == last) {
209 enum HcalDepth{AllDepths=-1,Undefined=0,Depth1=1,Depth2=2};
220 return getSum(
true,sc,detIdToExclude);
224 return getSum(
false,sc,detIdToExclude);
227 return getSum(
true,*sc,detIdToExclude);
230 return getSum(
false,*sc,detIdToExclude);
233 double getSum (
bool et,
reco::SuperCluster const &
sc,
const std::vector<CaloTowerDetId> * detIdToExclude)
const;
def create(alignables, pedeDump, additionalData, outputFile, config)
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])
static unsigned int NCuts
double getTowerESum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
et
define resolution functions of each parameter
double getTowerEtSum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
T get() const
get a component
double getTowerEtSum(reco::SuperCluster const *sc, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
double phi() const
azimuthal angle of cluster centroid
void compute(bool et, Sum &sum, reco::Candidate const &cand, CaloTowerDetId const *first, CaloTowerDetId const *last) const