CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
enablePileUpCorrection.py
Go to the documentation of this file.
2 
3 def enablePileUpCorrectionInPF2PAT( process, postfix, sequence='PF2PAT'):
4  """
5  Modifies the PF2PAT sequence according to the recipe of JetMET:
6  """
7 
8  # pile up subtraction
9  getattr(process,"pfNoPileUp"+postfix).enable = True
10  getattr(process,"pfPileUp"+postfix).Enable = True
11  getattr(process,"pfPileUp"+postfix).checkClosestZVertex = False
12  getattr(process,"pfPileUp"+postfix).Vertices = 'goodOfflinePrimaryVertices'
13 
14  getattr(process,"pfJets"+postfix).doAreaFastjet = True
15  getattr(process,"pfJets"+postfix).doRhoFastjet = False
16 
17  # adding goodOfflinePrimaryVertices before pfPileUp
18  process.load('CommonTools.ParticleFlow.goodOfflinePrimaryVertices_cfi')
19  getattr(process, 'pfNoPileUpSequence'+postfix).replace( getattr(process,"pfPileUp"+postfix),
20  process.goodOfflinePrimaryVertices +
21  getattr(process,"pfPileUp"+postfix) )
22 
23 def enablePileUpCorrectionInPAT( process, postfix, sequence ):
24  # PAT specific stuff:
25 
26  jetCorrFactors = getattr(process,"patJetCorrFactors"+postfix)
27  # using non-pileup-charged-hadron-substracted kt6PFJets consistently with JetMET recommendation
28  jetCorrFactors.rho = cms.InputTag("kt6PFJets", "rho")
29 
30 
31 def enablePileUpCorrection( process, postfix, sequence='patPF2PATSequence'):
32  """
33  Enables the pile-up correction for jets in a PF2PAT+PAT sequence
34  to be called after the usePF2PAT function.
35  """
36 
37  enablePileUpCorrectionInPF2PAT( process, postfix, sequence)
38  enablePileUpCorrectionInPAT( process, postfix, sequence)
39 
40