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

References HLTMuonOfflineAnalyzer_cfi.deltaR2.

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

Definition at line 15 of file JetAnalyzer.py.

References HLTMuonOfflineAnalyzer_cfi.deltaR2.

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

Definition at line 54 of file JetAnalyzer.py.

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

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