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 25 of file JetAnalyzer.py.

References reco.deltaR2().

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

Definition at line 13 of file JetAnalyzer.py.

References reco.deltaR2().

13 def cleanNearestJetOnly(jets,leptons,deltaR):
14  dr2 = deltaR**2
15  good = [ True for j in jets ]
16  for l in leptons:
17  ibest, d2m = -1, dr2
18  for i,j in enumerate(jets):
19  d2i = deltaR2(l.eta(),l.phi(), j.eta(),j.phi())
20  if d2i < d2m:
21  ibest, d2m = i, d2i
22  if ibest != -1: good[ibest] = False
23  return [ j for (i,j) in enumerate(jets) if good[i] == True ]
24 
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
def cleanNearestJetOnly(jets, leptons, deltaR)
Definition: JetAnalyzer.py:13
def objects.JetAnalyzer.shiftJERfactor (   JERShift,
  aeta 
)

Definition at line 52 of file JetAnalyzer.py.

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