Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:23:59

0001 ## import skeleton process
0002 from PhysicsTools.PatAlgos.patTemplate_cfg import *
0003 
0004 # verbose flags for the PF2PAT modules
0005 #process.Tracer = cms.Service("Tracer")
0006 
0007 runOnMC = True
0008 
0009 if runOnMC:
0010     from PhysicsTools.PatAlgos.patInputFiles_cff import filesRelValProdTTbarAODSIM
0011     process.source.fileNames = filesRelValProdTTbarAODSIM
0012 else:
0013     from PhysicsTools.PatAlgos.patInputFiles_cff import filesSingleMuRECO
0014     process.source.fileNames = filesSingleMuRECO
0015     process.GlobalTag.globaltag = cms.string( autoCond[ 'com10' ] )
0016 
0017 # load the PAT config (for the PAT only part)
0018 process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff")
0019 patAlgosToolsTask.add(process.patCandidatesTask)
0020 #Temporary customize to the unit tests that fail due to old input samples
0021 process.patTaus.skipMissingTauID = True
0022 
0023 process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff")
0024 patAlgosToolsTask.add(process.selectedPatCandidatesTask)
0025 
0026 # An empty postfix means that only PF2PAT is run,
0027 # otherwise both standard PAT and PF2PAT are run. In the latter case PF2PAT
0028 # collections have standard names + postfix (e.g. patElectronPFlow)
0029 postfix = "PFlow"
0030 jetAlgo = "AK4"
0031 #Define Objects to be excluded from Top Projection. Default is Tau, so objects are not cleaned for taus
0032 excludeFromTopProjection=['Tau']
0033 
0034 # Configure PAT to use PF2PAT instead of AOD sources
0035 # this function will modify the PAT sequences.
0036 from PhysicsTools.PatAlgos.tools.pfTools import *
0037 usePF2PAT(process,runPF2PAT=True, jetAlgo=jetAlgo, runOnMC=runOnMC, postfix=postfix,excludeFromTopProjection=excludeFromTopProjection)
0038 # to run second PF2PAT+PAT with different postfix uncomment the following lines
0039 # and add the corresponding sequence to path
0040 #postfix2 = "PFlow2"
0041 #jetAlgo2="AK7"
0042 #usePF2PAT(process,runPF2PAT=True, jetAlgo=jetAlgo2, runOnMC=True, postfix=postfix2)
0043 
0044 # to use tau-cleaned jet collection uncomment the following:
0045 #getattr(process,"pfNoTau"+postfix).enable = True
0046 
0047 # to switch default tau (HPS) to old default tau (shrinking cone) uncomment
0048 # the following:
0049 # note: in current default taus are not preselected i.e. you have to apply
0050 # selection yourself at analysis level!
0051 #adaptPFTaus(process,"shrinkingConePFTau",postfix=postfix)
0052 
0053 
0054 if not runOnMC:
0055     # removing MC matching for standard PAT sequence
0056     # for the PF2PAT+PAT sequence, it is done in the usePF2PAT function
0057     removeMCMatchingPF2PAT( process, '' )
0058 
0059 # Add PF2PAT output to the created file
0060 from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
0061 process.out.outputCommands = cms.untracked.vstring('drop *',
0062                                                    'keep recoPFCandidates_particleFlow_*_*',
0063                            'keep *_selectedPatJets*_*_*',
0064                            'drop *_selectedPatJets*%s*_caloTowers_*'%(postfix),
0065                            'drop *_selectedPatJets_pfCandidates_*',
0066                            'keep *_selectedPatElectrons*_*_*',
0067                            'keep *_selectedPatMuons*_*_*',
0068                            'keep *_selectedPatTaus*_*_*',
0069                            'keep *_patMETs*_*_*',
0070                            'keep *_selectedPatPhotons*_*_*',
0071                            'keep *_selectedPatTaus*_*_*',
0072                                                    )
0073 
0074 ## ------------------------------------------------------
0075 #  In addition you usually want to change the following
0076 #  parameters:
0077 ## ------------------------------------------------------
0078 #
0079 #   process.GlobalTag.globaltag =  ...    ##  (according to https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions)
0080 #                                         ##
0081 #   process.source.fileNames =  ...
0082 #
0083 process.maxEvents.input = 10
0084 #                                         ##
0085 #   process.out.outputCommands = [ ... ]  ##  (e.g. taken from PhysicsTools/PatAlgos/python/patEventContent_cff.py)
0086 #                                         ##
0087 process.out.fileName = 'patTuple_PATandPF2PAT.root'
0088 #                                         ##
0089 #   process.options.wantSummary = False   ##  (to suppress the long output at the end of the job)
0090 
0091 #process.prune(verbose=True)