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
15  const math::XYZTLorentzVector &p4, float mindr, float maxdr,
16  float kt_scale, float ptthresh, float deadcone_ch,
17  float deadcone_pu, float deadcone_ph, float deadcone_nh,
18  float dZ_cut)
19 {
20 
21  float chiso=0, nhiso=0, phiso=0, puiso=0;
22  float drcut = std::max(mindr, std::min(maxdr, float(kt_scale/p4.pt())));
23  for(auto const & pc : *pfcands){
24  float dr = deltaR(p4, pc.p4());
25  if(dr>drcut)
26  continue;
27  float pt = pc.p4().pt();
28  int id = pc.pdgId();
29  if(std::abs(id)==211){
30  bool fromPV = (pc.fromPV()>1 || fabs(pc.dz()) < dZ_cut);
31  if(fromPV && dr > deadcone_ch){
32  // if charged hadron and from primary vertex, add to charged hadron isolation
33  chiso += pt;
34  }else if(!fromPV && pt > ptthresh && dr > deadcone_pu){
35  // if charged hadron and NOT from primary vertex, add to pileup isolation
36  puiso += pt;
37  }
38  }
39  // if neutral hadron, add to neutral hadron isolation
40  if(std::abs(id)==130 && pt>ptthresh && dr>deadcone_nh)
41  nhiso += pt;
42  // if photon, add to photon isolation
43  if(std::abs(id)==22 && pt>ptthresh && dr>deadcone_ph)
44  phiso += pt;
45 
46  }
47 
48  return pat::PFIsolation(chiso, nhiso, phiso, puiso);
49 
50 }
51 
52 }
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: HeavyIon.h:7
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
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
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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)