Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:09

0001 ## import skeleton process
0002 from PhysicsTools.PatAlgos.patTemplate_cfg import *
0003 
0004 
0005 # Get a list of good primary vertices, in 42x, these are DAF vertices
0006 from PhysicsTools.SelectorUtils.pvSelector_cfi import pvSelector
0007 process.goodOfflinePrimaryVertices = cms.EDFilter(
0008     "PrimaryVertexObjectFilter",
0009     filterParams = pvSelector.clone( minNdof = cms.double(4.0), maxZ = cms.double(24.0) ),
0010     src=cms.InputTag('offlinePrimaryVertices')
0011     )
0012 
0013 
0014 # Configure PAT to use PF2PAT instead of AOD sources
0015 # this function will modify the PAT sequences. It is currently 
0016 # not possible to run PF2PAT+PAT and standart PAT at the same time
0017 from PhysicsTools.PatAlgos.tools.pfTools import *
0018 postfix = "PFlow"
0019 usePF2PAT(process,runPF2PAT=True, jetAlgo='AK5', runOnMC=True, postfix=postfix)
0020 process.pfPileUpPFlow.Enable = True
0021 process.pfPileUpPFlow.checkClosestZVertex = cms.bool(False)
0022 process.pfPileUpPFlow.Vertices = cms.InputTag('goodOfflinePrimaryVertices')
0023 process.pfJetsPFlow.doAreaFastjet = True
0024 process.pfJetsPFlow.doRhoFastjet = False
0025 
0026 
0027 # Compute the mean pt per unit area (rho) from the
0028 # PFchs inputs
0029 from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets
0030 process.kt6PFJetsPFlow = kt4PFJets.clone(
0031     rParam = cms.double(0.6),
0032     src = cms.InputTag('pfNoElectron'+postfix),
0033     doAreaFastjet = cms.bool(True),
0034     doRhoFastjet = cms.bool(True)
0035     )
0036 process.patJetCorrFactorsPFlow.rho = cms.InputTag("kt6PFJetsPFlow", "rho")
0037 
0038 
0039 # Add the PV selector and KT6 producer to the sequence
0040 getattr(process,"patPF2PATSequence"+postfix).replace(
0041     getattr(process,"pfNoElectron"+postfix),
0042     getattr(process,"pfNoElectron"+postfix)*process.kt6PFJetsPFlow )
0043 
0044 process.patseq = cms.Sequence(    
0045     process.goodOfflinePrimaryVertices*
0046     getattr(process,"patPF2PATSequence"+postfix)
0047     )
0048 
0049 # Adjust the event content
0050 process.out.outputCommands += [
0051     'keep *_selectedPat*_*_*',
0052     'keep *_goodOfflinePrimaryVertices*_*_*',    
0053     'keep double_*PFlow*_*_PAT'
0054 ]
0055 
0056 
0057 ## let it run
0058 process.p = cms.Path(
0059     process.patseq
0060     )
0061 
0062 ## ------------------------------------------------------
0063 #  In addition you usually want to change the following
0064 #  parameters:
0065 ## ------------------------------------------------------
0066 #
0067 #   process.GlobalTag.globaltag =  ...    ##  (according to https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions)
0068 #                                         ##
0069 #   process.source.fileNames = [          ##
0070 #    '/store/relval/CMSSW_3_8_6/RelValTTbar/GEN-SIM-RECO/START38_V13-v1/0065/F438C4C4-BCE7-DF11-BC6B-002618943885.root'
0071 #   ]                                     ##  (e.g. 'file:AOD.root')
0072 #                                         ##
0073 #   process.maxEvents.input = ...         ##  (e.g. -1 to run on all events)
0074 #                                         ##
0075 #   process.out.outputCommands = [ ... ]  ##  (e.g. taken from PhysicsTools/PatAlgos/python/patEventContent_cff.py)
0076 #                                         ##
0077 #   process.out.fileName = ...            ##  (e.g. 'myTuple.root')
0078 #                                         ##
0079 process.options.wantSummary = True        ##  (to suppress the long output at the end of the job)