Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 # This configuration is an example that recalibrates the slimmedJets from MiniAOD
0002 # and adds a new userfloat "oldJetMass" and an additional b-tag discriminator to them
0003 
0004 ## import skeleton process
0005 from PhysicsTools.PatAlgos.patTemplate_cfg import *
0006 
0007 #process.Tracer = cms.Service("Tracer")
0008 
0009 ## uncomment the following line to update different jet collections
0010 ## and add them to the event content
0011 from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection
0012 
0013 ## An example where the jet energy correction are updated to the current GlobalTag
0014 ## and a userFloat containing the previous mass of the jet and an additional
0015 ## b-tag discriminator are added
0016 from RecoJets.Configuration.RecoPFJets_cff import ak8PFJetsPuppiSoftDropMass
0017 process.oldJetMass = ak8PFJetsPuppiSoftDropMass.clone(
0018   src = cms.InputTag("slimmedJets"),
0019   matched = cms.InputTag("slimmedJets") )
0020 patAlgosToolsTask.add(process.oldJetMass)
0021 
0022 updateJetCollection(
0023    process,
0024    jetSource = cms.InputTag('slimmedJets'),
0025    jetCorrections = ('AK4PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'),
0026    btagDiscriminators = ['pfCombinedSecondaryVertexV2BJetTags', 'pfDeepCSVDiscriminatorsJetTags:BvsAll', 'pfDeepCSVDiscriminatorsJetTags:CvsB', 'pfDeepCSVDiscriminatorsJetTags:CvsL'], ## to add discriminators,
0027    btagPrefix = 'TEST',
0028 )
0029 process.updatedPatJets.userData.userFloats.src += ['oldJetMass']
0030 
0031 ## An example where the jet corrections are undone
0032 updateJetCollection(
0033    process,
0034    labelName = 'UndoneJEC',
0035    jetSource = cms.InputTag('slimmedJets'),
0036    jetCorrections = ('AK4PFchs', cms.vstring([]), 'None')
0037 )
0038 process.updatedPatJetsUndoneJEC.userData.userFloats.src = []
0039 
0040 ## An example where the jet corrections are reapplied
0041 updateJetCollection(
0042    process,
0043    labelName = 'ReappliedJEC',
0044    jetSource = cms.InputTag('selectedUpdatedPatJetsUndoneJEC'),
0045    jetCorrections = ('AK4PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None')
0046 )
0047 process.updatedPatJetsReappliedJEC.userData.userFloats.src = []
0048 
0049 ## An example where the pileup jet id is recomputed
0050 from RecoJets.JetProducers.PileupJetID_cfi import pileupJetId
0051 process.pileupJetIdUpdated = pileupJetId.clone(
0052   jets=cms.InputTag("slimmedJets"),
0053   inputIsCorrected=True,
0054   applyJec=True,
0055   vertexes=cms.InputTag("offlineSlimmedPrimaryVertices")
0056   )
0057 patAlgosToolsTask.add(process.pileupJetIdUpdated)
0058 
0059 updateJetCollection(
0060    process,
0061    labelName = 'PileupJetID',
0062    jetSource = cms.InputTag('slimmedJets'),
0063 )
0064 process.updatedPatJetsPileupJetID.userData.userInts.src = ['pileupJetIdUpdated:fullId']
0065 process.updatedPatJetsPileupJetID.userData.userFloats.src = ['pileupJetIdUpdated:fullDiscriminant']
0066 
0067 ## An example where the jet energy corrections are updated to the current GlobalTag
0068 ## and specified b-tag discriminators are rerun and added to SoftDrop subjets
0069 updateJetCollection(
0070    process,
0071    labelName = 'SoftDropSubjets',
0072    jetSource = cms.InputTag('slimmedJetsAK8PFPuppiSoftDropPacked:SubJets'),
0073    jetCorrections = ('AK4PFPuppi', cms.vstring(['L2Relative', 'L3Absolute']), 'None'),
0074    btagDiscriminators = ['pfCombinedSecondaryVertexV2BJetTags', 'pfCombinedInclusiveSecondaryVertexV2BJetTags'],
0075    explicitJTA = True,          # needed for subjet b tagging
0076    svClustering = False,        # needed for subjet b tagging (IMPORTANT: Needs to be set to False to disable ghost-association which does not work with slimmed jets)
0077    fatJets = cms.InputTag('slimmedJetsAK8'), # needed for subjet b tagging
0078    rParam = 0.8,                # needed for subjet b tagging
0079    algo = 'ak'                  # has to be defined but is not used with svClustering=False
0080 )
0081 process.updatedPatJetsSoftDropSubjets.userData.userFloats.src = []
0082 
0083 ## An example where puppi jet specifics are computed
0084 from PhysicsTools.PatAlgos.patPuppiJetSpecificProducer_cfi import patPuppiJetSpecificProducer
0085 process.patPuppiJetSpecificProducer = patPuppiJetSpecificProducer.clone(
0086   src=cms.InputTag("slimmedJetsPuppi"),
0087   )
0088 patAlgosToolsTask.add(process.patPuppiJetSpecificProducer)
0089 
0090 updateJetCollection(
0091    process,
0092    labelName = 'PuppiJetSpecific',
0093    jetSource = cms.InputTag('slimmedJetsPuppi'),
0094 )
0095 process.updatedPatJetsPuppiJetSpecific.userData.userFloats.src = ['patPuppiJetSpecificProducer:puppiMultiplicity', 'patPuppiJetSpecificProducer:neutralPuppiMultiplicity', 'patPuppiJetSpecificProducer:neutralHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:photonPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFEMPuppiMultiplicity' ]
0096 
0097 ## ------------------------------------------------------
0098 #  In addition you usually want to change the following
0099 #  parameters:
0100 ## ------------------------------------------------------
0101 #
0102 #   process.GlobalTag.globaltag =  ...    ##  (according to https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions)
0103 #                                         ##
0104 from PhysicsTools.PatAlgos.patInputFiles_cff import filesRelValTTbarPileUpMINIAODSIM
0105 process.source.fileNames = filesRelValTTbarPileUpMINIAODSIM
0106 #                                         ##
0107 process.maxEvents.input = 100
0108 #                                         ##
0109 from Configuration.EventContent.EventContent_cff import MINIAODSIMEventContent
0110 process.out.outputCommands = MINIAODSIMEventContent.outputCommands
0111 process.out.outputCommands.append('keep *_selectedUpdatedPatJets*_*_*')
0112 process.out.outputCommands.append('drop *_selectedUpdatedPatJets*_caloTowers_*')
0113 process.out.outputCommands.append('drop *_selectedUpdatedPatJets*_genJets_*')
0114 process.out.outputCommands.append('drop *_selectedUpdatedPatJets*_pfCandidates_*')
0115 #                                         ##
0116 process.out.fileName = 'patTuple_updateJets_fromMiniAOD.root'
0117 #                                         ##
0118 #   process.options.wantSummary = False   ##  (to suppress the long output at the end of the job)