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 math::XYZTLorentzVector &p4, float mindr, float maxdr,
16  float kt_scale){
17  return std::max(mindr, std::min(maxdr, float(kt_scale/p4.pt())));
18 }
19 
21  const math::XYZTLorentzVector &p4, float mindr, float maxdr,
22  float kt_scale, float ptthresh, float deadcone_ch,
23  float deadcone_pu, float deadcone_ph, float deadcone_nh,
24  float dZ_cut)
25 {
26 
27  float chiso=0, nhiso=0, phiso=0, puiso=0;
28  float drcut = miniIsoDr(p4,mindr,maxdr,kt_scale);
29  for(auto const & pc : *pfcands){
30  float dr = deltaR(p4, pc.p4());
31  if(dr>drcut)
32  continue;
33  float pt = pc.p4().pt();
34  int id = pc.pdgId();
35  if(std::abs(id)==211){
36  bool fromPV = (pc.fromPV()>1 || fabs(pc.dz()) < dZ_cut);
37  if(fromPV && dr > deadcone_ch){
38  // if charged hadron and from primary vertex, add to charged hadron isolation
39  chiso += pt;
40  }else if(!fromPV && pt > ptthresh && dr > deadcone_pu){
41  // if charged hadron and NOT from primary vertex, add to pileup isolation
42  puiso += pt;
43  }
44  }
45  // if neutral hadron, add to neutral hadron isolation
46  if(std::abs(id)==130 && pt>ptthresh && dr>deadcone_nh)
47  nhiso += pt;
48  // if photon, add to photon isolation
49  if(std::abs(id)==22 && pt>ptthresh && dr>deadcone_ph)
50  phiso += pt;
51 
52  }
53 
54  return pat::PFIsolation(chiso, nhiso, phiso, puiso);
55 
56 }
57 
60  double dr,
61  double rho,
62  const std::vector<double> &area)
63  {
64  double absEta = std::abs(p4.eta());
65  double ea = 0;
66  //Eta dependent effective area
67  if (absEta<0.800) ea = area.at(0);
68  else if (absEta<1.300) ea = area.at(1);
69  else if (absEta<2.000) ea = area.at(2);
70  else if (absEta<2.200) ea = area.at(3);
71  else if (absEta<2.500) ea = area.at(4);
72 
73  double correction = rho * ea * (dr/0.3) * (dr/0.3);
74  double correctedIso = iso.chargedHadronIso() + std::max(0.0, iso.neutralHadronIso()+iso.photonIso() - correction);
75  return correctedIso/p4.pt();
76  }
77 
78 }
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: HeavyIon.h:7
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
double muonRelMiniIsoPUCorrected(const PFIsolation &iso, const math::XYZTLorentzVector &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
PFIsolation getMiniPFIsolation(const pat::PackedCandidateCollection *pfcands, const math::XYZTLorentzVector &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 miniIsoDr(const math::XYZTLorentzVector &p4, float mindr, float maxdr, float kt_scale)
float chargedHadronIso() const
Definition: PFIsolation.h:33
float photonIso() const
Definition: PFIsolation.h:35
float neutralHadronIso() const
Definition: PFIsolation.h:34