CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
objects.JetAnalyzer Namespace Reference

Classes

class  JetAnalyzer
 

Functions

def cleanJetsAndLeptons
 
def cleanNearestJetOnly
 
def shiftJERfactor
 

Function Documentation

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

Definition at line 26 of file JetAnalyzer.py.

References reco.deltaR2().

26 
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 
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
def objects.JetAnalyzer.cleanNearestJetOnly (   jets,
  leptons,
  deltaR 
)

Definition at line 14 of file JetAnalyzer.py.

References reco.deltaR2().

14 
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 ]
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
def objects.JetAnalyzer.shiftJERfactor (   JERShift,
  aeta 
)

Definition at line 53 of file JetAnalyzer.py.

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

53 
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