8 return c1->eta() < c2->
eta();
25 if (
p.charge() == 0) {
28 if ((
abs(
p.pdgId()) == 211) || (also_leptons && ((
abs(
p.pdgId()) == 11) || (
abs(
p.pdgId()) == 13)))) {
29 if (
p.fromPV() > fromPV_thresh && fabs(
p.dz()) < dz_thresh && fabs(
p.dxy()) < dxy_thresh) {
48 for (
unsigned int i = 0,
n =
cand.numberOfSourceCandidatePtrs();
i <
n; ++
i) {
50 if (
cp.isNonnull() &&
cp.isAvailable())
51 vetos_.push_back(&*
cp);
87 return isoSumNeutralsWeighted(
cand,
dR, innerR,
threshold, selfVeto, 130);
97 return isoSumNeutralsWeighted(
cand,
dR, innerR,
threshold, selfVeto, 22);
107 float dR2 =
dR *
dR, innerR2 = innerR * innerR;
109 std::vector<const reco::Candidate *>
vetos(vetos_);
110 for (
unsigned int i = 0,
n =
cand.numberOfSourceCandidatePtrs();
i <
n; ++
i) {
111 if (selfVeto == selfVetoNone)
114 if (
cp.isNonnull() &&
cp.isAvailable()) {
116 if (selfVeto == selfVetoFirst)
121 typedef std::vector<const pat::PackedCandidate *>::const_iterator
IT;
126 for (
IT icharged = candsbegin; icharged < candsend; ++icharged) {
135 if (mydr2 >=
dR2 || mydr2 < innerR2)
142 isosum += (*icharged)->pt();
149 if (weightCone_ <= 0)
150 throw cms::Exception(
"LogicError",
"you must set a valid weight cone to use this method");
151 float dR2 =
dR *
dR, innerR2 = innerR * innerR, weightCone2 = weightCone_ * weightCone_;
153 std::vector<const reco::Candidate *>
vetos(vetos_);
154 for (
unsigned int i = 0,
n =
cand.numberOfSourceCandidatePtrs();
i <
n; ++
i) {
155 if (selfVeto == selfVetoNone)
158 if (
cp.isNonnull() &&
cp.isAvailable()) {
160 if (selfVeto == selfVetoFirst)
165 typedef std::vector<const pat::PackedCandidate *>::const_iterator
IT;
174 for (
IT ineutral = neutral_begin; ineutral < neutral_end; ++ineutral) {
183 if (mydr2 >=
dR2 || mydr2 < innerR2)
190 float &
w = weights_[ineutral - neutral_.begin()];
192 double sumc = 0, sump = 0.0;
193 for (
IT icharged = charged_begin; icharged < charged_end; ++icharged) {
194 float hisdr2 = std::max<float>(
reco::deltaR2(**icharged, **ineutral), 0.01f);
195 if (hisdr2 > weightCone2)
197 if (
std::find(vetos_.begin(), vetos_.end(), *icharged) != vetos_.end()) {
202 for (
IT ipileup = pileup_begin; ipileup < pileup_end; ++ipileup) {
203 float hisdr2 = std::max<float>(
reco::deltaR2(**ipileup, **ineutral), 0.01f);
204 if (hisdr2 > weightCone2)
206 if (
std::find(vetos_.begin(), vetos_.end(), *ipileup) != vetos_.end()) {
211 w = (sump == 0 ? 1 : sumc / (sump + sumc));
214 isosum +=
w * (*ineutral)->pt();
std::vector< const pat::PackedCandidate * > neutral_
void clearVetos()
clear all vetos
float puAbsIso(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from charged from PU.
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...
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
double eta() const override
momentum pseudorapidity
float photonAbsIsoWeighted(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from photons (with weights)
SelfVetoPolicy
Self-veto policy.
Abs< T >::type abs(const T &t)
std::vector< const pat::PackedCandidate * > charged_
std::vector< LinkConnSpec >::const_iterator IT
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 neutralHadAbsIsoWeighted(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from neutral hadrons (with weights)
std::vector< const pat::PackedCandidate * > pileup_
float isoSumNeutralsWeighted(const reco::Candidate &cand, float dR, float innerR, float threshold, SelfVetoPolicy selfVeto, int pdgId=-1) const
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
float neutralAbsIsoWeighted(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from all neutrals (with weights)
float photonAbsIsoRaw(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from photons (uncorrected)
float neutralHadAbsIsoRaw(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from neutral hadrons (uncorrected)
float neutralAbsIsoRaw(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from all neutrals (uncorrected)
std::vector< float > weights_
float chargedAbsIso(const reco::Candidate &cand, float dR, float innerR=0, float threshold=0, SelfVetoPolicy selfVeto=selfVetoAll) const
Isolation from charged from the PV.
void setPackedCandidates(const std::vector< pat::PackedCandidate > &all, int fromPV_thresh=1, float dz_thresh=9999., float dxy_thresh=9999., bool also_leptons=false)
Initialize with the list of packed candidates (note: clears also all vetos)