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

References reco.deltaR2().

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

Definition at line 14 of file JetAnalyzer.py.

References reco.deltaR2().

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

Definition at line 53 of file JetAnalyzer.py.

Referenced by objects.JetAnalyzer.JetAnalyzer.smearJets().

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