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 }
59 
62  double dr,
63  double rho,
64  const std::vector<double> &area) {
65  double absEta = std::abs(p4.eta());
66  double ea = 0;
67  //Eta dependent effective area
68  if (absEta<0.800) ea = area.at(0);
69  else if (absEta<1.300) ea = area.at(1);
70  else if (absEta<2.000) ea = area.at(2);
71  else if (absEta<2.200) ea = area.at(3);
72  else if (absEta<2.500) ea = area.at(4);
73 
74  double correction = rho * ea * (dr/0.3) * (dr/0.3);
75  double correctedIso = iso.chargedHadronIso() + std::max(0.0, iso.neutralHadronIso()+iso.photonIso() - correction);
76  return correctedIso/p4.pt();
77  }
78 
79 }
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: HeavyIon.h:7
double muonRelMiniIsoPUCorrected(const PFIsolation &iso, const reco::Candidate::PolarLorentzVector &p4, double dr, double rho, const std::vector< double > &area)
double p4[4]
Definition: TauolaWrapper.h:92
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
float miniIsoDr(const reco::Candidate::PolarLorentzVector &p4, float mindr, float maxdr, float kt_scale)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
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)
float chargedHadronIso() const
Definition: PFIsolation.h:33
float photonIso() const
Definition: PFIsolation.h:35
float neutralHadronIso() const
Definition: PFIsolation.h:34
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39