CMS 3D CMS Logo

Classes | Functions
objects.JetAnalyzer Namespace Reference

Classes

class  JetAnalyzer
 

Functions

def cleanJetsAndLeptons (jets, leptons, deltaR, arbitration)
 
def cleanNearestJetOnly (jets, leptons, deltaR)
 
def shiftJERfactor (JERShift, aeta)
 

Function Documentation

def objects.JetAnalyzer.cleanJetsAndLeptons (   jets,
  leptons,
  deltaR,
  arbitration 
)

Definition at line 24 of file JetAnalyzer.py.

References reco.deltaR2().

24 def cleanJetsAndLeptons(jets,leptons,deltaR,arbitration):
25  dr2 = deltaR**2
26  goodjet = [ True for j in jets ]
27  goodlep = [ True for l in leptons ]
28  for il, l in enumerate(leptons):
29  ibest, d2m = -1, dr2
30  for i,j in enumerate(jets):
31  d2i = deltaR2(l.eta(),l.phi(), j.eta(),j.phi())
32  if d2i < dr2:
33  choice = arbitration(j,l)
34  if choice == j:
35  # if the two match, and we prefer the jet, then drop the lepton and be done
36  goodlep[il] = False
37  break
38  elif choice == (j,l) or choice == (l,j):
39  # asked to keep both, so we don't consider this match
40  continue
41  if d2i < d2m:
42  ibest, d2m = i, d2i
43  # this lepton has been killed by a jet, then we clean the jet that best matches it
44  if not goodlep[il]: continue
45  if ibest != -1: goodjet[ibest] = False
46  return ( [ j for (i ,j) in enumerate(jets) if goodjet[i ] == True ],
47  [ l for (il,l) in enumerate(leptons) if goodlep[il] == True ] )
48 
49 
50 
def cleanJetsAndLeptons(jets, leptons, deltaR, arbitration)
Definition: JetAnalyzer.py:24
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
def objects.JetAnalyzer.cleanNearestJetOnly (   jets,
  leptons,
  deltaR 
)

Definition at line 12 of file JetAnalyzer.py.

References reco.deltaR2().

12 def cleanNearestJetOnly(jets,leptons,deltaR):
13  dr2 = deltaR**2
14  good = [ True for j in jets ]
15  for l in leptons:
16  ibest, d2m = -1, dr2
17  for i,j in enumerate(jets):
18  d2i = deltaR2(l.eta(),l.phi(), j.eta(),j.phi())
19  if d2i < d2m:
20  ibest, d2m = i, d2i
21  if ibest != -1: good[ibest] = False
22  return [ j for (i,j) in enumerate(jets) if good[i] == True ]
23 
def cleanNearestJetOnly(jets, leptons, deltaR)
Definition: JetAnalyzer.py:12
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
def objects.JetAnalyzer.shiftJERfactor (   JERShift,
  aeta 
)

Definition at line 51 of file JetAnalyzer.py.

51 def shiftJERfactor(JERShift, aeta):
52  factor = 1.079 + JERShift*0.026
53  if aeta > 3.2: factor = 1.056 + JERShift * 0.191
54  elif aeta > 2.8: factor = 1.395 + JERShift * 0.063
55  elif aeta > 2.3: factor = 1.254 + JERShift * 0.062
56  elif aeta > 1.7: factor = 1.208 + JERShift * 0.046
57  elif aeta > 1.1: factor = 1.121 + JERShift * 0.029
58  elif aeta > 0.5: factor = 1.099 + JERShift * 0.028
59  return factor
60 
61 
62 
63 
64 
def shiftJERfactor(JERShift, aeta)
Definition: JetAnalyzer.py:51