8 return c1->
eta() < c2->
eta();
11 return c1eta < c2->
eta();
14 return c1->
eta() < c2eta;
24 if (
p.charge() == 0) {
28 if ( (
abs(
p.pdgId()) == 211 ) || ( also_leptons && ((
abs(
p.pdgId()) == 11 ) || (
abs(
p.pdgId()) == 13 )) ) ) {
30 if (
p.fromPV() > fromPV_thresh && fabs(
p.dz()) < dz_thresh ) {
63 return isoSumRaw(charged_, cand, dR, innerR, threshold, selfVeto);
68 return isoSumRaw(pileup_, cand, dR, innerR, threshold, selfVeto);
72 return isoSumRaw(neutral_, cand, dR, innerR, threshold, selfVeto);
76 return isoSumNeutralsWeighted(cand, dR, innerR, threshold, selfVeto);
80 return isoSumRaw(neutral_, cand, dR, innerR, threshold, selfVeto, 130);
84 return isoSumNeutralsWeighted(cand, dR, innerR, threshold, selfVeto, 130);
88 return isoSumRaw(neutral_, cand, dR, innerR, threshold, selfVeto, 22);
92 return isoSumNeutralsWeighted(cand, dR, innerR, threshold, selfVeto, 22);
97 float dR2 = dR*
dR, innerR2 = innerR*innerR;
99 std::vector<const reco::Candidate *> vetos(vetos_);
101 if (selfVeto == selfVetoNone)
break;
104 vetos.push_back(&*cp);
105 if (selfVeto == selfVetoFirst)
break;
109 typedef std::vector<const pat::PackedCandidate *>::const_iterator
IT;
110 IT candsbegin = std::lower_bound(cands.begin(), cands.end(), cand.
eta() -
dR, ByEta());
111 IT candsend = std::upper_bound(candsbegin, cands.end(), cand.
eta() +
dR, ByEta());
114 for (IT icharged = candsbegin; icharged < candsend; ++icharged) {
116 if (pdgId > 0 &&
abs((*icharged)->pdgId()) != pdgId)
continue;
118 if (threshold > 0 && (*icharged)->pt() <
threshold)
continue;
121 if (mydr2 >= dR2 || mydr2 < innerR2)
continue;
123 if (
std::find(vetos.begin(), vetos.end(), *icharged) != vetos.end()) {
127 isosum += (*icharged)->pt();
134 if (weightCone_ <= 0)
throw cms::Exception(
"LogicError",
"you must set a valid weight cone to use this method");
135 float dR2 = dR*
dR, innerR2 = innerR*innerR, weightCone2 = weightCone_*weightCone_;
137 std::vector<const reco::Candidate *> vetos(vetos_);
139 if (selfVeto == selfVetoNone)
break;
142 vetos.push_back(&*cp);
143 if (selfVeto == selfVetoFirst)
break;
147 typedef std::vector<const pat::PackedCandidate *>::const_iterator
IT;
148 IT charged_begin = std::lower_bound(charged_.begin(), charged_.end(), cand.
eta() - dR - weightCone_, ByEta());
149 IT charged_end = std::upper_bound(charged_begin, charged_.end(), cand.
eta() + dR + weightCone_, ByEta());
150 IT pileup_begin = std::lower_bound(pileup_.begin(), pileup_.end(), cand.
eta() - dR - weightCone_, ByEta());
151 IT pileup_end = std::upper_bound(pileup_begin, pileup_.end(), cand.
eta() + dR + weightCone_, ByEta());
152 IT neutral_begin = std::lower_bound(neutral_.begin(), neutral_.end(), cand.
eta() -
dR, ByEta());
153 IT neutral_end = std::upper_bound(neutral_begin, neutral_.end(), cand.
eta() +
dR, ByEta());
156 for (IT ineutral = neutral_begin; ineutral < neutral_end; ++ineutral) {
158 if (pdgId > 0 &&
abs((*ineutral)->pdgId()) != pdgId)
continue;
160 if (threshold > 0 && (*ineutral)->pt() <
threshold)
continue;
163 if (mydr2 >= dR2 || mydr2 < innerR2)
continue;
165 if (
std::find(vetos.begin(), vetos.end(), *ineutral) != vetos.end()) {
169 float &
w = weights_[ineutral-neutral_.begin()];
171 double sumc = 0, sump = 0.0;
172 for (IT icharged = charged_begin; icharged < charged_end; ++icharged) {
173 float hisdr2 = std::max<float>(
reco::deltaR2(**icharged, **ineutral), 0.01f);
174 if (hisdr2 > weightCone2)
continue;
175 if (
std::find(vetos_.begin(), vetos_.end(), *icharged) != vetos_.end()) {
180 for (IT ipileup = pileup_begin; ipileup < pileup_end; ++ipileup) {
181 float hisdr2 = std::max<float>(
reco::deltaR2(**ipileup, **ineutral), 0.01f);
182 if (hisdr2 > weightCone2)
continue;
183 if (
std::find(vetos_.begin(), vetos_.end(), *ipileup) != vetos_.end()) {
188 w = (sump == 0 ? 1 : sumc/(sump+sumc));
191 isosum += w * (*ineutral)->pt();
float isoSumNeutralsWeighted(const reco::Candidate &cand, float dR, float innerR, float threshold, SelfVetoPolicy selfVeto, int pdgId=-1) const
std::vector< const pat::PackedCandidate * > neutral_
virtual CandidatePtr sourceCandidatePtr(size_type i) const
void clearVetos()
clear all vetos
const std::vector< pat::PackedCandidate > * allcands_
void addVetos(const reco::Candidate &cand)
veto footprint from this candidate, for the isolation of all candidates and also for calculation of n...
float neutralAbsIsoWeighted(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from all neutrals (with weights)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual double eta() const
momentum pseudorapidity
float neutralHadAbsIsoWeighted(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from neutral hadrons (with weights)
float isoSumRaw(const std::vector< const pat::PackedCandidate * > &cands, const reco::Candidate &cand, float dR, float innerR, float threshold, SelfVetoPolicy selfVeto, int pdgId=-1) const
float chargedAbsIso(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from charged from the PV.
SelfVetoPolicy
Self-veto policy.
Abs< T >::type abs(const T &t)
double deltaR2(const T1 &t1, const T2 &t2)
void setPackedCandidates(const std::vector< pat::PackedCandidate > &all, int fromPV_thresh=1, float dz_thresh=9999., bool also_leptons=false)
Initialize with the list of packed candidates (note: clears also all vetos)
std::vector< const pat::PackedCandidate * > charged_
std::vector< LinkConnSpec >::const_iterator IT
bool isNonnull() const
Checks for non-null.
float neutralHadAbsIsoRaw(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from neutral hadrons (uncorrected)
std::vector< const pat::PackedCandidate * > pileup_
float neutralAbsIsoRaw(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from all neutrals (uncorrected)
float photonAbsIsoRaw(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from photons (uncorrected)
float puAbsIso(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from charged from PU.
float photonAbsIsoWeighted(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from photons (with weights)
virtual size_t numberOfSourceCandidatePtrs() const =0
std::vector< float > weights_
virtual double eta() const =0
momentum pseudorapidity