CMS 3D CMS Logo

MiniIsolation.cc
Go to the documentation of this file.
5 
6 namespace pat {
7 
8  // Computes MiniIsolation given a 4-vector of the object in question
9  // and a collection of packed PF cands. Computed as a sum of PFCand pT
10  // inside a cone of radius dR = max(mindir, min(maxdr, kt_scale/pT))
11  // Excludes PFCands inside of "deadcone" radius.
12  // For nh, ph, pu, only include particles with pT > ptthresh
13  // Some documentation can be found here: https://hypernews.cern.ch/HyperNews/CMS/get/susy/1991.html
14 
15  float miniIsoDr(const reco::Candidate::PolarLorentzVector &p4, float mindr, float maxdr, float kt_scale) {
16  return std::max(mindr, std::min(maxdr, float(kt_scale / p4.pt())));
17  }
18 
21  float mindr,
22  float maxdr,
23  float kt_scale,
24  float ptthresh,
25  float deadcone_ch,
26  float deadcone_pu,
27  float deadcone_ph,
28  float deadcone_nh,
29  float dZ_cut) {
30  float chiso = 0, nhiso = 0, phiso = 0, puiso = 0;
31  float drcut = miniIsoDr(p4, mindr, maxdr, kt_scale);
32  for (auto const &pc : *pfcands) {
33  float dr2 = deltaR2(p4, pc);
34  if (dr2 > drcut * drcut)
35  continue;
36  float pt = pc.p4().pt();
37  int id = pc.pdgId();
38  if (std::abs(id) == 211) {
39  bool fromPV = (pc.fromPV() > 1 || fabs(pc.dz()) < dZ_cut);
40  if (fromPV && dr2 > deadcone_ch * deadcone_ch) {
41  // if charged hadron and from primary vertex, add to charged hadron isolation
42  chiso += pt;
43  } else if (!fromPV && pt > ptthresh && dr2 > deadcone_pu * deadcone_pu) {
44  // if charged hadron and NOT from primary vertex, add to pileup isolation
45  puiso += pt;
46  }
47  }
48  // if neutral hadron, add to neutral hadron isolation
49  if (std::abs(id) == 130 && pt > ptthresh && dr2 > deadcone_nh * deadcone_nh)
50  nhiso += pt;
51  // if photon, add to photon isolation
52  if (std::abs(id) == 22 && pt > ptthresh && dr2 > deadcone_ph * deadcone_ph)
53  phiso += pt;
54  }
55 
56  return pat::PFIsolation(chiso, nhiso, phiso, puiso);
57  }
58 
61  double dr,
62  double rho,
63  const std::vector<double> &area) {
64  double absEta = std::abs(p4.eta());
65  double ea = 0;
66  //Eta dependent effective area
67  if (absEta < 0.800)
68  ea = area.at(0);
69  else if (absEta < 1.300)
70  ea = area.at(1);
71  else if (absEta < 2.000)
72  ea = area.at(2);
73  else if (absEta < 2.200)
74  ea = area.at(3);
75  else if (absEta < 2.500)
76  ea = area.at(4);
77 
78  double correction = rho * ea * (dr / 0.3) * (dr / 0.3);
79  double correctedIso = iso.chargedHadronIso() + std::max(0.0, iso.neutralHadronIso() + iso.photonIso() - correction);
80  return correctedIso / p4.pt();
81  }
82 
83 } // namespace pat
float neutralHadronIso() const
Definition: PFIsolation.h:29
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: HeavyIon.h:7
float photonIso() const
Definition: PFIsolation.h:30
double muonRelMiniIsoPUCorrected(const PFIsolation &iso, const reco::Candidate::PolarLorentzVector &p4, double dr, double rho, const std::vector< double > &area)
float chargedHadronIso() const
Definition: PFIsolation.h:28
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float miniIsoDr(const reco::Candidate::PolarLorentzVector &p4, float mindr, float maxdr, float kt_scale)
PFIsolation getMiniPFIsolation(const pat::PackedCandidateCollection *pfcands, const reco::Candidate::PolarLorentzVector &p4, float mindr=0.05, float maxdr=0.2, float kt_scale=10.0, float ptthresh=0.5, float deadcone_ch=0.0001, float deadcone_pu=0.01, float deadcone_ph=0.01, float deadcone_nh=0.01, float dZ_cut=0.0)
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38