コード例 #1
0
ファイル: SUSY_pattuple_cff.py プロジェクト: nmohr/usercode
def loadPATTriggers(process,HLTMenu):
    #-- Trigger matching ----------------------------------------------------------
    from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
    switchOnTrigger( process )
    process.patTriggerSequence.remove( process.patTriggerMatcher )
    process.patTriggerEvent.patTriggerMatches  = []
    # If we have to rename the default trigger menu
    process.patTrigger.processName = HLTMenu
    process.patTriggerEvent.processName = HLTMenu
コード例 #2
0
def loadPATTriggers(process,HLTMenu,theJetNames,electronMatches,muonMatches,tauMatches,jetMatches,photonMatches):
    #-- Trigger matching ----------------------------------------------------------
    def pfSwitchOnTriggerMatchEmbedding(process, matches, src, embedder, sequence='patDefaultSequencePF'):
        setattr(process,src.replace('PF','TriggerMatchPF'),getattr(process,embedder).clone(src=src, matches=matches))
        theSequence = getattr(process,sequence)
        theSequence += getattr(process,src.replace('PF','TriggerMatchPF'))
    from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger, switchOnTriggerMatchEmbedding
    switchOnTrigger(process, triggerProducer='patTrigger', triggerEventProducer='patTriggerEvent', sequence='patDefaultSequence', hltProcess=HLTMenu)
    process.patTriggerPF = process.patTrigger.clone()
    process.patTriggerEventPF = process.patTriggerEvent.clone()
    process.patDefaultSequencePF += process.patTriggerPF 
    process.patDefaultSequencePF += process.patTriggerEventPF 
    switchOnTrigger(process, triggerProducer='patTriggerPF', triggerEventProducer='patTriggerEventPF', sequence='patDefaultSequencePF', hltProcess=HLTMenu)
    #Electrons
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanElectronTriggerMatchHLTEle20SWL1R
    process.patElectronMatch = cleanElectronTriggerMatchHLTEle20SWL1R.clone(matchedCuts = cms.string( electronMatches ))
    process.patElectronMatchPF = cleanElectronTriggerMatchHLTEle20SWL1R.clone(matchedCuts = cms.string( electronMatches ), src='selectedPatElectronsPF')
    process.patDefaultSequencePF += process.patElectronMatchPF
    switchOnTriggerMatchEmbedding( process, ['patElectronMatch'], hltProcess=HLTMenu)
    pfSwitchOnTriggerMatchEmbedding( process, ['patElectronMatchPF'], 'selectedPatElectronsPF', 'cleanPatElectronsTriggerMatch' )
    #Muons
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanMuonTriggerMatchHLTMu9
    process.patMuonMatch = cleanMuonTriggerMatchHLTMu9.clone(matchedCuts = cms.string( muonMatches ))
    process.patMuonMatchPF = cleanMuonTriggerMatchHLTMu9.clone(matchedCuts = cms.string( muonMatches ),src = 'selectedPatMuonsPF',matched='patTriggerPF')
    process.patDefaultSequencePF += process.patMuonMatchPF
    switchOnTriggerMatchEmbedding( process, ['patMuonMatch'], hltProcess=HLTMenu)
    pfSwitchOnTriggerMatchEmbedding( process, ['patMuonMatchPF'], 'selectedPatMuonsPF', 'cleanPatMuonsTriggerMatch' )
    #Photons
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanPhotonTriggerMatchHLTPhoton20CleanedL1R
    process.patPhotonMatch = cleanPhotonTriggerMatchHLTPhoton20CleanedL1R.clone(matchedCuts = cms.string( photonMatches ))
    switchOnTriggerMatchEmbedding( process, ['patPhotonMatch'], hltProcess=HLTMenu)
    #Jets
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanJetTriggerMatchHLTJet15U
    process.patJetMatchAK5Calo = cleanJetTriggerMatchHLTJet15U.clone(matchedCuts = cms.string( jetMatches ),src='cleanPatJetsAK5Calo')
    switchOnTriggerMatchEmbedding( process, ['patJetMatchAK5Calo'], hltProcess=HLTMenu)
    for jetType in theJetNames:
        setattr(process,'patJetMatch'+jetType,cleanJetTriggerMatchHLTJet15U.clone(matchedCuts = cms.string( jetMatches ),src = 'cleanPatJets'+jetType))
    process.patJetMatchPF = cleanJetTriggerMatchHLTJet15U.clone(src='selectedPatJetsPF', matchedCuts = cms.string( jetMatches ))
    process.patDefaultSequencePF += process.patJetMatchPF
    for jetType in theJetNames:
        switchOnTriggerMatchEmbedding( process, ['patJetMatch'+jetType], hltProcess=HLTMenu)
    pfSwitchOnTriggerMatchEmbedding( process, ['patJetMatchPF'], 'selectedPatJetsPF', 'cleanPatJetsAK5CaloTriggerMatch' )
    #Taus
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanTauTriggerMatchHLTDoubleLooseIsoTau15
    process.patTauMatch = cleanTauTriggerMatchHLTDoubleLooseIsoTau15.clone(matchedCuts = cms.string( tauMatches ))
    process.patTauMatchPF = cleanTauTriggerMatchHLTDoubleLooseIsoTau15.clone(src='selectedPatTausPF', matchedCuts = cms.string( tauMatches ))
    process.patDefaultSequencePF += process.patTauMatchPF
    switchOnTriggerMatchEmbedding( process, ['patTauMatch'], hltProcess=HLTMenu)
    pfSwitchOnTriggerMatchEmbedding( process, ['patTauMatchPF'], 'selectedPatTausPF', 'cleanPatTausTriggerMatch' )
コード例 #3
0
def loadPATTriggers(process,HLTMenu,theJetNames,electronMatches,muonMatches,tauMatches,jetMatches,photonMatches):
    #-- Trigger matching ----------------------------------------------------------
    def pfSwitchOnTriggerMatchEmbedding(process, matches, src, embedder, sequence='patDefaultSequencePF'):
        setattr(process,src.replace('PF','TriggerMatchPF'),getattr(process,embedder).clone(src=src, matches=matches))
        theSequence = getattr(process,sequence)
        theSequence += getattr(process,src.replace('PF','TriggerMatchPF'))
    from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger, switchOnTriggerMatchEmbedding
    switchOnTrigger(process, triggerProducer='patTrigger', triggerEventProducer='patTriggerEvent', sequence='patDefaultSequence', hltProcess=HLTMenu)
    process.patTriggerPF = process.patTrigger.clone()
    process.patTriggerEventPF = process.patTriggerEvent.clone()
    process.patDefaultSequencePF += process.patTriggerPF 
    process.patDefaultSequencePF += process.patTriggerEventPF 
    switchOnTrigger(process, triggerProducer='patTriggerPF', triggerEventProducer='patTriggerEventPF', sequence='patDefaultSequencePF', hltProcess=HLTMenu)
    #Electrons
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanElectronTriggerMatchHLTEle20SWL1R
    process.patElectronMatch = cleanElectronTriggerMatchHLTEle20SWL1R.clone(matchedCuts = cms.string( electronMatches ))
    process.patElectronMatchPF = cleanElectronTriggerMatchHLTEle20SWL1R.clone(matchedCuts = cms.string( electronMatches ), src='selectedPatElectronsPF')
    process.patDefaultSequencePF += process.patElectronMatchPF
    switchOnTriggerMatchEmbedding( process, ['patElectronMatch'], hltProcess=HLTMenu)
    pfSwitchOnTriggerMatchEmbedding( process, ['patElectronMatchPF'], 'selectedPatElectronsPF', 'cleanPatElectronsTriggerMatch' )
    #Muons
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanMuonTriggerMatchHLTMu9
    process.patMuonMatch = cleanMuonTriggerMatchHLTMu9.clone(matchedCuts = cms.string( muonMatches ))
    process.patMuonMatchPF = cleanMuonTriggerMatchHLTMu9.clone(matchedCuts = cms.string( muonMatches ),src = 'selectedPatMuonsPF',matched='patTriggerPF')
    process.patDefaultSequencePF += process.patMuonMatchPF
    switchOnTriggerMatchEmbedding( process, ['patMuonMatch'], hltProcess=HLTMenu)
    pfSwitchOnTriggerMatchEmbedding( process, ['patMuonMatchPF'], 'selectedPatMuonsPF', 'cleanPatMuonsTriggerMatch' )
    #Photons
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanPhotonTriggerMatchHLTPhoton20CleanedL1R
    process.patPhotonMatch = cleanPhotonTriggerMatchHLTPhoton20CleanedL1R.clone(matchedCuts = cms.string( photonMatches ))
    switchOnTriggerMatchEmbedding( process, ['patPhotonMatch'], hltProcess=HLTMenu)
    #Jets
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanJetTriggerMatchHLTJet15U
    process.patJetMatchAK5Calo = cleanJetTriggerMatchHLTJet15U.clone(matchedCuts = cms.string( jetMatches ),src='cleanPatJetsAK5Calo')
    switchOnTriggerMatchEmbedding( process, ['patJetMatchAK5Calo'], hltProcess=HLTMenu)
    for jetType in theJetNames:
        setattr(process,'patJetMatch'+jetType,cleanJetTriggerMatchHLTJet15U.clone(matchedCuts = cms.string( jetMatches ),src = 'cleanPatJets'+jetType))
    process.patJetMatchPF = cleanJetTriggerMatchHLTJet15U.clone(src='selectedPatJetsPF', matchedCuts = cms.string( jetMatches ))
    process.patDefaultSequencePF += process.patJetMatchPF
    for jetType in theJetNames:
        switchOnTriggerMatchEmbedding( process, ['patJetMatch'+jetType], hltProcess=HLTMenu)
    pfSwitchOnTriggerMatchEmbedding( process, ['patJetMatchPF'], 'selectedPatJetsPF', 'cleanPatJetsAK5CaloTriggerMatch' )
    #Taus
    from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanTauTriggerMatchHLTDoubleLooseIsoTau15
    process.patTauMatch = cleanTauTriggerMatchHLTDoubleLooseIsoTau15.clone(matchedCuts = cms.string( tauMatches ))
    process.patTauMatchPF = cleanTauTriggerMatchHLTDoubleLooseIsoTau15.clone(src='selectedPatTausPF', matchedCuts = cms.string( tauMatches ))
    process.patDefaultSequencePF += process.patTauMatchPF
    switchOnTriggerMatchEmbedding( process, ['patTauMatch'], hltProcess=HLTMenu)
    pfSwitchOnTriggerMatchEmbedding( process, ['patTauMatchPF'], 'selectedPatTausPF', 'cleanPatTausTriggerMatch' )
コード例 #4
0
def common_config(process, reportEveryNum=100, maxEvents=-1, runOnData=False) :
    usePFIso( process )
    if runOnData:
        removeMCMatching(process, ['All'])

    process.patElectrons.pfElectronSource = 'particleFlow'
    addPfMET(process, 'PF')

    switchOnTrigger(process)
    process.patTrigger.addL1Algos = cms.bool(True)
#    switchOnTriggerMatchEmbedding(process)
                
    # this is needed so we can correct the pfMET by adjusting the e/mu-pt
    # when switching to one of the dedicated Heep/TeV muon reconstructors
    addPFCandidates(process, 'particleFlow')
    process.selectedPatPFParticles.cut = "abs(pdgId())==11 || abs(pdgId())==13"

    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport.reportEvery = reportEveryNum

    process.maxEvents.input = maxEvents    ##  (e.g. -1 to run on all events)
    #process.GlobalTag.globaltag = 'FT_53_V18_AN3::All'
    process.GlobalTag.globaltag = 'GR_P_V42_AN3::All'
    #process.GlobalTag.globaltag = cms.string('GR_R_52_V8::All')
    #                                         ##
    process.out.outputCommands = [
    # GEN
        'keep *_prunedGenParticles_*_*',
        'keep GenEventInfoProduct_*_*_*',
        'keep GenRunInfoProduct_*_*_*',
    # TRIGGER
        'keep edmTriggerResults_TriggerResults*_*_*',
        'keep *_hltTriggerSummaryAOD_*_*',
        'keep L1GlobalTriggerReadoutRecord_gtDigis_*_*',
        'keep *_userPat*_*_*',
        'keep *_patTrigger_*_*',
        'keep *_patTriggerEvent_*_*',
    # PILEUP
        'keep *_addPileupInfo_*_*',     
    # PF CANDS
        'keep *_selectedPatPFParticles*_*_*'
        ]
    
##  (to suppress the long output at the end of the job)    
    process.options.wantSummary = True        
コード例 #5
0
def common_config(process, reportEveryNum=100, maxEvents=-1, runOnData=False) :
    usePFIso( process )
    if runOnData:
        removeMCMatching(process, ['All'])

    process.patElectrons.pfElectronSource = 'particleFlow'
    addPfMET(process, 'PF')

    switchOnTrigger(process)
    process.patTrigger.addL1Algos = cms.bool(True)
                
    # this is needed so we can correct the pfMET by adjusting the e/mu-pt
    # when switching to one of the dedicated Heep/TeV muon reconstructors
    addPFCandidates(process, 'particleFlow')
    process.selectedPatPFParticles.cut = "abs(pdgId())==11 || abs(pdgId())==13"

    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport.reportEvery = reportEveryNum

    process.maxEvents.input = maxEvents    ##  (e.g. -1 to run on all events)
#    process.GlobalTag.globaltag = cms.string('GR_R_52_V8::All')
    process.GlobalTag.globaltag = cms.string('FT53_V21A_AN6::All')
    #                                         ##
    process.out.outputCommands = [
    # GEN
        'keep *_prunedGenParticles_*_*',
        'keep GenEventInfoProduct_*_*_*',
        'keep GenRunInfoProduct_*_*_*',
    # TRIGGER
        'keep edmTriggerResults_TriggerResults*_*_*',
        'keep *_hltTriggerSummaryAOD_*_*',
        'keep L1GlobalTriggerReadoutRecord_gtDigis_*_*',
        'keep *_userPat*_*_*',
        'keep *_patTrigger_*_*',
        'keep *_patTriggerEvent_*_*',
    # PILEUP
        'keep *_addPileupInfo_*_*',     
    # PF CANDS
        'keep *_selectedPatPFParticles*_*_*'
        ]
    
##  (to suppress the long output at the end of the job)    
    process.options.wantSummary = True        
def loadPATTriggers(process, HLTMenu):
    #-- Trigger matching ----------------------------------------------------------
    from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger, switchOnTriggerMatchEmbedding
    #	from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanPhotonTriggerMatchHLTPhoton20CleanedL1R
    #    process.patPhotonMatch = cleanPhotonTriggerMatchHLTPhoton20CleanedL1R.clone(matchedCuts = cms.string( photonMatches ))
    # firing trigger objects used in succeeding HLT path 'HLT_Photon20_Cleaned_L1R'
    process.patPhotonMatch = cms.EDProducer(
        "PATTriggerMatcherDRDPtLessByR"  # match by DeltaR only, best match by DeltaR
        ,
        src=cms.InputTag("selectedPatPhotons"),
        matched=cms.InputTag(
            "patTrigger"
        )  # default producer label as defined in PhysicsTools/PatAlgos/python/triggerLayer1/triggerProducer_cfi.py
        ,
        matchedCuts=cms.string(
            'path( "HLT_Photon26_CaloIdL_IsoVL_Photon18_v*" ) || path( "HLT_Photon20_CaloIdVL*" ) || path( "HLT_Photon30_CaloIdVL_v*" )|| path( "HLT_Photon50_CaloIdVL*" )|| path( "HLT_Photon75_CaloIdVL*" )|| path( "HLT_Photon90_CaloIdVL*" )'
        )
        #, andOr                      = cms.bool( False )  # AND
        #, filterIdsEnum              = cms.vstring( '*' ) # wildcard, overlaps with 'filterIds'
        #, filterIds                  = cms.vint32( 0 )    # wildcard, overlaps with 'filterIdsEnum'
        #, filterLabels               = cms.vstring( '*' ) # wildcard
        #, pathNames                  = cms.vstring(
        #'HLT_Photon20_Cleaned_L1R'
        #)
        #, pathLastFilterAcceptedOnly = cms.bool( True )   # select only trigger objects used in last filters of succeeding paths
        #, collectionTags             = cms.vstring( '*' ) # wildcard
        ,
        maxDPtRel=cms.double(0.5),
        maxDeltaR=cms.double(0.5),
        resolveAmbiguities=cms.bool(True)  # only one match per trigger object
        ,
        resolveByMatchQuality=cms.bool(
            True
        )  # take best match found per reco object: by DeltaR here (s. above)
    )

    switchOnTrigger(process)
    process.patTrigger.addL1Algos = cms.bool(True)
    switchOnTrigger(process)  # to fix event content
    switchOnTriggerMatchEmbedding(process, ['patPhotonMatch'])
コード例 #7
0
## ---
## Define the path as empty skeleton
## ---
process.p = cms.Path(
)

### ===========
### PAT trigger
### ===========

## --
## Switch on
## --
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger( process, sequence = 'p' ) # overwrite sequence default "patDefaultSequence", since it is not used in any path

## --
## Modify configuration according to your needs
## --
# add L1 algorithms' collection
process.patTrigger.addL1Algos     = cms.bool( True ) # default: 'False'
# add L1 objects collection-wise (latest collection)
process.patTrigger.l1ExtraMu      = cms.InputTag( 'l1extraParticles', ''            )
process.patTrigger.l1ExtraNoIsoEG = cms.InputTag( 'l1extraParticles', 'NonIsolated' )
process.patTrigger.l1ExtraIsoEG   = cms.InputTag( 'l1extraParticles', 'Isolated'    )
process.patTrigger.l1ExtraCenJet  = cms.InputTag( 'l1extraParticles', 'Central'     )
process.patTrigger.l1ExtraForJet  = cms.InputTag( 'l1extraParticles', 'Forward'     )
process.patTrigger.l1ExtraTauJet  = cms.InputTag( 'l1extraParticles', 'Tau'         )
process.patTrigger.l1ExtraETM     = cms.InputTag( 'l1extraParticles', 'MET'         )
process.patTrigger.l1ExtraHTM     = cms.InputTag( 'l1extraParticles', 'MHT'         )
コード例 #8
0
process.load("HHbbTauTau.TreeProduction.TreeContentConfig_cff")

#-------------------------------------------------------
# PAT
#------------------------------------------------------
process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
process.load("PhysicsTools.PatAlgos.patSequences_cff")

import PhysicsTools.PatAlgos.tools.tauTools as tauTools
#tauTools.switchToPFTauHPS(process) # For HPS Taus

## --
## Switch on PAT trigger
## --
import PhysicsTools.PatAlgos.tools.trigTools as trigTools
trigTools.switchOnTrigger(
    process, outputModule='')  # This is optional and can be omitted.

process.mainTreeContentSequence = cms.Sequence(process.eventBlock +
                                               process.vertexBlock +
                                               process.electronBlock +
                                               process.jetBlock +
                                               process.metBlock +
                                               process.muonBlock +
                                               process.tauBlock +
                                               process.triggerBlock +
                                               process.triggerObjectBlock)

process.simTreeContentSequence = cms.Sequence()
if options.includeSim:
    process.simTreeContentSequence = cms.Sequence(process.genParticleBlock +
                                                  process.genMETBlock)
コード例 #9
0
    process.plotSignalJets *
    process.signalJetsLeadObject *
    process.plotSignalJetsLeadObject *
    #process.signalJetsCollimationCut *
    process.preselectedSignalJetRefs *
    process.preselectedSignalJets *
    process.plotPreselectedSignalJets *
    #process.signalJetsRecoTauPiZeros *
    process.addFakeBackground *
    process.eventSampleFlag *
    process.buildTaus
)

# Store the trigger stuff in the event
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(
    process, sequence="selectSignal", outputModule='', hltProcess=_hltProcess)

# Keep only a subset of data
poolOutputCommands = cms.untracked.vstring(
    'drop *',
    'keep patTriggerObjects_*_*_TANC',
    'keep patTriggerFilters_*_*_TANC',
    'keep patTriggerPaths_*_*_TANC',
    'keep patTriggerEvent_*_*_TANC',
    'keep PileupSummaryInfo_*_*_*',
    'keep *_ak5PFJets_*_TANC',
    'keep *_kt6PFJets_*_TANC', # for PU subtraction
    'keep *_offlinePrimaryVertices_*_TANC',
    'keep *_offlinePrimaryVerticesDA_*_TANC',
    #'keep *_offlineBeamSpot_*_TANC',
    'keep *_particleFlow_*_TANC',
コード例 #10
0
# Compute the mean pt per unit area (rho) from the PFCHS inputs
from RecoJets.Configuration.RecoPFJets_cff import kt6PFJets, ak5PFJets
process.kt6PFJetsPFlow = kt6PFJets.clone(src=cms.InputTag('pfNoElectron' +
                                                          postfix),
                                         doAreaFastjet=cms.bool(True),
                                         doRhoFastjet=cms.bool(True))
process.patJetCorrFactorsPFlow.rho = cms.InputTag("kt6PFJetsPFlow", "rho")

process.ak5PFJetsPileUp = ak5PFJets.clone(src=cms.InputTag('pfPileUp' +
                                                           postfix))

# switch on PAT trigger
# included by SFonseca
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
#switchOnTrigger( process,triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', sequence = 'patPF2PATSequence',hltProcess = 'HLT', outputModule = 'out')
switchOnTrigger(process, sequence='patPF2PATSequence' + postfix)
process.patTrigger.addL1Algos = cms.bool(True)
switchOnTrigger(process,
                sequence='patPF2PATSequence' + postfix)  # to fix event content
#-------------------------------------------------------------------------------------------------------------
"""
process.pileUpN1PrimaryVertices = cms.EDFilter("RecoTauPileUpVertexSelector",
    filter = cms.bool(False),
    src = cms.InputTag('goodOfflinePrimaryVertices'),
    minTrackSumPt = cms.double(0.)
    #minTrackSumPt = cms.double(5.)
    )

process.pileUpN2PrimaryVertices = process.pileUpN1PrimaryVertices.clone(
    src = cms.InputTag('pileUpN1PrimaryVertices')
    )
コード例 #11
0
ファイル: test_higgs.py プロジェクト: tmoulik/HiggsTauTau
process.load("VHTauTau.TreeMaker.TreeCreator_cfi")
process.load("VHTauTau.TreeMaker.TreeWriter_cfi")
process.load("VHTauTau.TreeMaker.TreeContentConfig_cff")

#-------------------------------------------------------
# PAT 
#------------------------------------------------------
process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
process.load("PhysicsTools.PatAlgos.patSequences_cff")

#import PhysicsTools.PatAlgos.tools.tauTools as tauTools
#tauTools.switchToPFTauHPS(process) # For HPS Taus

## --
## Switch on PAT trigger
## --
import PhysicsTools.PatAlgos.tools.trigTools as trigTools
trigTools.switchOnTrigger( process, outputModule='' ) # This is optional and can be omitted.

process.p = cms.Path(
  process.treeCreator +
  process.treeContentSequence +
  process.treeWriter
)

# List File names here
#---------------------------------------
process.PoolSource.fileNames = [
'file:./patTuple_higgs.root' 
]
コード例 #12
0
def addPATSequences(process,runMC):
    # Load the PAT config
    from PhysicsTools.PatAlgos.patEventContent_cff import patEventContent
    process.out = cms.OutputModule("PoolOutputModule",
	    fileName = cms.untracked.string('patTuple.root'),
	    SelectEvents   = cms.untracked.PSet( SelectEvents = cms.vstring('pat_step') ),
	    outputCommands = cms.untracked.vstring('drop *', *patEventContent )
            )
    ###
    process.load('PhysicsTools.PatAlgos.patSequences_cff')

    from PhysicsTools.PatAlgos.tools.pfTools import usePF2PAT
    postfix = "PFlow"
    jetAlgo="AK5"
    jetCorrections = None
    if runMC:
	jetCorrections = ('AK5PFchs', ['L1FastJet','L2Relative','L3Absolute'])
    else:
	jetCorrections = ('AK5PFchs', ['L1FastJet','L2Relative','L3Absolute','L2L3Residual'])

    usePF2PAT(process,runPF2PAT=True,
                      jetAlgo=jetAlgo, runOnMC=runMC, postfix=postfix,jetCorrections=jetCorrections)

    #from PhysicsTools.PatAlgos.tools.coreTools import removeMCMatching
    #if not runMC:
    #    removeMCMatching(process, ['All'],"")

 
    #-----------------Customization----------------
    process.pfPileUpPFlow.Enable = True
    process.pfPileUpPFlow.checkClosestZVertex = False
    process.pfPileUpPFlow.Vertices = cms.InputTag('goodOfflinePrimaryVertices')
    process.pfPileUpPFlow.verbose = True
    process.pfJetsPFlow.doAreaFastjet = True
    process.pfJetsPFlow.doRhoFastjet = False

    from PhysicsTools.SelectorUtils.pvSelector_cfi import pvSelector
    process.goodOfflinePrimaryVertices = cms.EDFilter(
	"PrimaryVertexObjectFilter",
	filterParams = pvSelector.clone( minNdof = cms.double(4.0), maxZ = cms.double(24.0) ),
	src=cms.InputTag('offlinePrimaryVertices')
	)
    
    # Compute the mean pt per unit area (rho) from the PFCHS inputs
    #from RecoJets.Configuration.RecoPFJets_cff import kt6PFJets,ak5PFJets
    #process.kt6PFJetsPFlow = kt6PFJets.clone(
    #	src = cms.InputTag('pfNoElectron'+postfix),
    #	doAreaFastjet = cms.bool(True),
    #	doRhoFastjet = cms.bool(True)
    #	)
    #process.patJetCorrFactorsPFlow.rho = cms.InputTag("kt6PFJetsPFlow", "rho")
    from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets
    process.kt6PFJetsForPAT = kt4PFJets.clone(
	    rParam = cms.double(0.6),
	    doAreaFastjet = cms.bool(True),
	    doRhoFastjet = cms.bool(True)
	    )
    process.patJetCorrFactorsPFlow.rho = cms.InputTag("kt6PFJetsForPAT", "rho")

    from RecoJets.JetProducers.ak5PFJets_cfi import ak5PFJets
    process.ak5PFJetsPileUp = ak5PFJets.clone( src = cms.InputTag('pfPileUp'+postfix) )

    # Switch on PAT trigger
    from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
    #switchOnTrigger( process,triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', sequence = 'patPF2PATSequence',hltProcess = 'HLT', outputModule = 'out')
    
    switchOnTrigger( process ,sequence ='patPF2PATSequence'+postfix)
    process.patTrigger.addL1Algos = cms.bool( True )
    switchOnTrigger( process ,sequence = 'patPF2PATSequence'+postfix) # to fix event content
    #-------------------------------------------------------------------------------------------------------------
    
    # Add modules to default sequence
    #if runMC:
    #    getattr(process, "patElectrons"+postfix).embedGenMatch = True
    #    getattr(process, "patMuons"+postfix).embedGenMatch = True
    #else:
    #    getattr(process, "patElectrons"+postfix).embedGenMatch = False
    #    getattr(process, "patMuons"+postfix).embedGenMatch = False

    # Add modules to default sequence
    getattr(process,"patPF2PATSequence"+postfix).replace(
	getattr(process,"pfNoElectron"+postfix),
	getattr(process,"pfNoElectron"+postfix)*process.kt6PFJetsForPAT
	)

    getattr(process,"patPF2PATSequence"+postfix).replace(
	getattr(process,"pfNoPileUp"+postfix),
	getattr(process,"pfNoPileUp"+postfix) * process.ak5PFJetsPileUp
	)

    #----------------------------------------------
    # Let it run
    process.pat_step = cms.Path(
	process.goodOfflinePrimaryVertices * 
	#process.patDefaultSequence  +
	getattr(process,"patPF2PATSequence"+postfix)
    )

    # Add PatTrigger output to the created file
    from PhysicsTools.PatAlgos.patEventContent_cff import patTriggerEventContent
    # Add PF2PAT output to the created file
    from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
    patOutputCommands = cms.untracked.vstring('drop *',
	    'keep recoPFCandidates_particleFlow_*_*',
	    *patEventContentNoCleaning) 

    # Adjust the event content
    patOutputCommands += [
	#'keep *_selectedPat*_*_*',
	'keep *_genParticles*_*_*',
	'keep *_offlinePrimaryVertices*_*_*',
	'keep *_goodOfflinePrimaryVertices*_*_*',
	#'keep *_pileUpN*PrimaryVertices_*_*',
	#'keep *_pfPileUpExclN*_*_*',
	'keep *_pfPileUpPFlow*_*_*',
	'keep *_pfNoPileUpPFlow*_*_*',
	'keep *_ak5PFJetsPileUp_*_*',
	'keep *_ak5PFJets_*_*',
	'keep recoTracks_generalTracks_*_*',
	'keep HcalNoiseSummary_hcalnoise_*_*',
	'keep *_BeamHaloSummary_*_*', 
     #------- Trigger collections ------
	'keep edmTriggerResults_TriggerResults_*_*',
	'keep *_hltTriggerSummaryAOD_*_*',
	'keep L1GlobalTriggerObjectMapRecord_*_*_*',
	'keep L1GlobalTriggerReadoutRecord_*_*_*',
     #------- CASTOR rec hits ------
	'keep *_logErrorHarvester_*_*', 
	'keep *_castorreco_*_*',
     #------- Calo towers (just for now) ------ 
	'keep *_towerMaker_*_*',
     #---------------PatTrigger----------------
	'keep patTriggerObjects_patTrigger*_*_*',
	'keep patTriggerFilters_patTrigger*_*_*',
	'keep patTriggerPaths_patTrigger*_*_*',
	'keep patTriggerEvent_patTriggerEvent*_*_*'
    ]
    process.out.outputCommands = patOutputCommands

    # top projections in PF2PAT:
    getattr(process,"pfNoPileUp"+postfix).enable = True 
    getattr(process,"pfNoMuon"+postfix).enable = True 
    getattr(process,"pfNoElectron"+postfix).enable = True 
    getattr(process,"pfNoTau"+postfix).enable = False 
    getattr(process,"pfNoJet"+postfix).enable = True

    # verbose flags for the PF2PAT modules
    getattr(process,"pfNoJet"+postfix).verbose = False
コード例 #13
0
        doBTagging = True,
        outputModule = "")
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# import utility function for configuring PAT trigger matching
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTriggerMatching, switchOnTrigger

# make trigger-matched collections of electrons and taus
#from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanElectronTriggerMatchHLTEle27CaloIdVTCaloIsoTTrkIdTTrkIsoT
#process.cleanElectronTriggerMatchHLTElectronPlusTau = cleanElectronTriggerMatchHLTEle27CaloIdVTCaloIsoTTrkIdTTrkIsoT.clone()
#process.cleanElectronTriggerMatchHLTElectronPlusTau.matchedCuts = cms.string( 'path( "HLT_Ele*_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_*IsoPFTau20_v*" )' )
# do matching
#switchOnTriggerMatching(process, triggerMatchers = [ 'cleanElectronTriggerMatchHLTElectronPlusTau' ], hltProcess = HLTprocessName, outputModule = '')

switchOnTrigger(process, hltProcess = HLTprocessName, outputModule = '')

#process.patTrigger.addL1Algos = cms.bool(True)
from TauAnalysis.Configuration.cfgOptionMethods import _setTriggerProcess
_setTriggerProcess(process, cms.InputTag("TriggerResults", "", HLTprocessName))
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# import utility function for managing pat::METs
import TauAnalysis.Configuration.tools.metTools as metTools

# uncomment to add pfMET
# set Boolean swich to true in order to apply type-1 corrections
metTools.addPFMet(process, correct = False)

# uncomment to replace caloMET by pfMET in all di-tau objects
コード例 #14
0
ファイル: matchtool_cfg.py プロジェクト: CMSRA2Tau/PATConfig
#        'file:///disk1/knutzen/CMSSW/CMSSW_5_3_3_patch3/src/aachen3a/TEST/TEST/MyOutputFile.root'
         '/store/mc/Summer12/TTJets_TuneZ2star_8TeV-madgraph-tauola/AODSIM/PU_S8_START52_V9-v1/0000/B27ECBD4-06C2-E111-BEA5-001A9281171E.root' 

    )

)

process.load("PhysicsTools/PatAlgos/patSequences_cff")

from PhysicsTools.PatAlgos.tools.tauTools import *
switchToPFTauHPS(process) #create HPS Taus from the pat default sequence


# switch on PAT trigger
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process) #create pat trigger objects

process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")



process.TFileService = cms.Service("TFileService",
                                               fileName = cms.string('TriggerEfficiencyTree.root') #output file
                                                                                  )
###############################################
#############    User input  ##################
###############################################

# Enter a list with all trigger filter names you want to investigate.
# A bool with the same name will be created for each filter which denotes if a filter object is matched to the tag tau
filterName = [
コード例 #15
0
def configurePatTuple(process, isMC=True, **kwargs):
    '''
    Core function for PATTuple production
    '''
    #fix argparser output
    isMC = bool(isMC)

    ########################
    ##                    ##
    ##  PATTuple content  ##
    ##                    ##
    ########################
    # Stuff we always keep
    output_commands = [
        '*_addPileupInfo_*_*',
        'edmMergeableCounter_*_*_*',
        '*_lumiProducer_*_*',
        '*_particleFlow_*_*',
        '*_offlineBeamSpot_*_*',
        '*_generalTracks_*_*',
        '*_electronGsfTracks_*_*',
        '*_gsfElectrons_*_*',
        '*_gsfElectronCores_*_*',
        '*_offlinePrimaryVertices*_*_*',
        '*_ak5GenJets_*_*',
        '*_hltTriggerSummaryAOD_*_*',
        'edmTriggerResults_TriggerResults_*_%s' % process.name_(),
        '*_MEtoEDMConverter*_*_%s' % process.name_(),
        'LHEEventProduct_*_*_*',
        'GenEventInfoProduct_generator_*_*',
        '*_kt6PFJetsForRhoComputationVoronoi_rho_*',
        '*_kt6PFJetsForIso_rho_*',
        '*_kt6PFJets_rho_*',
        '*_kt6PFJetsHZGPho_rho_*',
        '*_kt6PFJetsCentralHZGEle_rho_*',
        '*_kt6PFJetsCentralHZGMu_rho_*',
        '*_kt6PFJetsCentralNeutralHZGMu_rho_*',
        '*_kt6PFJetsCentral_rho_*',
        '*_kt6PFJetsCentralNeutral_rho_*',  # for zz muons
        '*_photonCore_*_*',
        '*_boostedFsrPhotons_*_*',
        # for Zmumu -> embedded samples
        # https://twiki.cern.ch/twiki/bin/view/CMS/MuonTauReplacementRecHit
        '*_generalTracksORG_*_EmbeddedRECO',
        '*_electronGsfTracksORG_*_EmbeddedRECO',
        'double_TauSpinnerReco_TauSpinnerWT_EmbeddedSPIN',
        'double_ZmumuEvtSelEffCorrWeightProducer_weight_EmbeddedRECO',
        'double_muonRadiationCorrWeightProducer_weight_EmbeddedRECO',
        'GenFilterInfo_generator_minVisPtFilter_EmbeddedRECO',
    ]
    # Define our patTuple production sequence
    process.tuplize = cms.Sequence()
    # Only keep interesting genParticles
    process.load("FinalStateAnalysis.RecoTools.genParticleTrimmer_cfi")
    process.genParticles = process.prunedGenParticles.clone()
    if isMC:
        #process.tuplize += process.genParticles
        #output_commands.append('*_genParticles_*_%s' % process.name_())
        output_commands.append('*_genParticles_*_*')

    output_commands.append('*_tauGenJetsSelectorAllHadrons_*_*')
    output_commands.append('*_tauGenJets_*_*')
    output_commands.append('*_ak5GenJets_*_*')

    ########################
    ##                    ##
    ##        PAT         ##
    ##                    ##
    ########################

    # Run pat default sequence
    process.load("PhysicsTools.PatAlgos.patSequences_cff")

    # Embed PF Isolation in electrons & muons
    pfTools.usePFIso(process)
    # Setup H2Tau custom iso definitions
    setup_h2tau_iso(process)
    # Setup hZg custom iso definitions
    add_hZg_iso_needs(process)

    # Now run PAT
    process.tuplize += process.patDefaultSequence

    # Add FSR photons for ZZ analysis
    process.load("FinalStateAnalysis.PatTools.fsrPhotons_cff")
    process.tuplize += process.fsrPhotonSequence

    ########################
    ##        GEN         ##
    ########################

    # Disable gen match embedding - we keep it in the ntuple
    process.patMuons.embedGenMatch = False
    process.patElectrons.embedGenMatch = False
    process.patTaus.embedGenMatch = False
    process.patTaus.embedGenJetMatch = False
    process.patPhotons.embedGenMatch = False
    if not isMC:
        coreTools.runOnData(process)

    ########################
    ##       MUONS        ##
    ########################

    # Unembed junk
    process.patMuons.embedCaloMETMuonCorrs = False
    process.patMuons.embedTcMETMuonCorrs = False
    process.patMuons.embedTrack = True
    process.patMuons.pvSrc = cms.InputTag("selectedPrimaryVertex")

    process.load("FinalStateAnalysis.PatTools.patMuonProduction_cff")
    final_muon_collection = chain_sequence(process.customizeMuonSequence,
                                           "selectedPatMuons")
    process.customizeMuonSequence.insert(0, process.selectedPatMuons)
    process.patDefaultSequence.replace(process.selectedPatMuons,
                                       process.customizeMuonSequence)
    process.cleanPatMuons.src = final_muon_collection
    process.patMuonRochesterCorrectionEmbedder.isMC = cms.bool(bool(isMC))

    ########################
    ##        TAUS        ##
    ########################

    # Use HPS taus
    tautools.switchToPFTauHPS(
        process)  #this NEEDS a sequence called patDefaultSequence
    # Disable tau IsoDeposits
    process.patDefaultSequence.remove(process.patPFTauIsolation)
    process.patTaus.isoDeposits = cms.PSet()
    process.patTaus.userIsolation = cms.PSet()

    process.load("FinalStateAnalysis.PatTools.patTauProduction_cff")
    # Require all taus to pass decay mode finding and have high PT
    process.patTauGarbageRemoval.cut = cms.string(
        "pt > 17 && abs(eta) < 2.5 && tauID('decayModeFindingNewDMs')")
    final_tau_collection = chain_sequence(process.customizeTauSequence,
                                          "selectedPatTaus")
    # Inject into the pat sequence
    process.customizeTauSequence.insert(0, process.selectedPatTaus)
    process.patDefaultSequence.replace(process.selectedPatTaus,
                                       process.customizeTauSequence)
    process.cleanPatTaus.src = final_tau_collection
    # Remove muons and electrons
    process.cleanPatTaus.checkOverlaps.muons.requireNoOverlaps = False
    process.cleanPatTaus.checkOverlaps.electrons.requireNoOverlaps = False
    # Cuts already applied by the garbage removal
    process.cleanPatTaus.preselection = ''
    process.cleanPatTaus.finalCut = ''

    ########################
    ##     ELECTRONS      ##
    ########################

    # Use POG recommendations for (these) electron Isos
    process.elPFIsoValueGamma04PFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueGamma04NoPFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueCharged04PFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.015)')
    process.elPFIsoValueCharged04NoPFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.015)')

    # Do extra electron ID
    process.load("FinalStateAnalysis.PatTools.electrons.electronID_cff")
    if cmssw_major_version() == 4:
        process.patDefaultSequence.replace(
            process.patElectrons,
            process.recoElectronID42X + process.patElectrons)
        process.patElectrons.electronIDSources = process.electronIDSources42X
    else:
        process.patDefaultSequence.replace(
            process.patElectrons,
            process.recoElectronID5YX + process.patElectrons)
        process.patElectrons.electronIDSources = process.electronIDSources5YX

    process.electronMatch.checkCharge = cms.bool(False)
    process.patElectrons.embedTrack = False
    process.patElectrons.embedPFCandidate = False
    process.patElectrons.embedGsfElectronCore = False
    process.patElectrons.embedSuperCluster = True

    # Produce the electron collections
    process.load("FinalStateAnalysis.PatTools.patElectronProduction_cff")

    # Electron Energy Regression and Calibrations
    process.load(
        "EgammaAnalysis.ElectronTools.electronRegressionEnergyProducer_cfi")
    process.load("EgammaAnalysis.ElectronTools.calibratedPatElectrons_cfi")

    #setup the energy regression for the specific dataset
    if kwargs['eleReg']:
        print "-- Applying Electron Regression and Calibration --"

        process.customizeElectronSequence += process.eleRegressionEnergy
        process.customizeElectronSequence += process.calibratedPatElectrons

        process.eleRegressionEnergy.energyRegressionType = cms.uint32(2)
        process.calibratedPatElectrons.correctionsType = cms.int32(2)

        if isMC:
            process.calibratedPatElectrons.inputDataset = cms.string(
                "Summer12_LegacyPaper")
        else:
            process.calibratedPatElectrons.inputDataset = cms.string(
                "22Jan2013ReReco")

        process.calibratedPatElectrons.combinationType = cms.int32(3)
        process.calibratedPatElectrons.lumiRatio = cms.double(1.0)
        process.calibratedPatElectrons.synchronization = cms.bool(True)
        process.calibratedPatElectrons.isMC = cms.bool(isMC == 1)
        process.calibratedPatElectrons.verbose = cms.bool(False)

    final_electron_collection = chain_sequence(
        process.customizeElectronSequence,
        "selectedPatElectrons",
        # Some of the EGamma modules have non-standard src InputTags,
        # specify them here.
        ("src", "inputPatElectronsTag", "inputElectronsTag"))

    #process.tuplize += process.customizeElectronSequence #why do we need this?
    process.customizeElectronSequence.insert(0, process.selectedPatElectrons)
    process.patDefaultSequence.replace(process.selectedPatElectrons,
                                       process.customizeElectronSequence)
    # We have to do the pat Jets before the pat electrons since we embed them
    process.customizeElectronSequence.insert(0, process.selectedPatJets)

    # Define cleanPatElectrons input collection
    process.cleanPatElectrons.src = final_electron_collection

    # Define the default lepton cleaning
    process.cleanPatElectrons.preselection = cms.string('pt > 5')
    process.cleanPatElectrons.checkOverlaps.muons.requireNoOverlaps = False
    # Make sure we don't kill any good taus by calling them electrons
    # Note that we don't actually remove these overlaps.
    process.cleanPatElectrons.checkOverlaps.taus = cms.PSet(
        src=final_tau_collection,
        algorithm=cms.string("byDeltaR"),
        preselection=cms.string(
            "tauID('decayModeFinding') > 0.5 &&"
            "tauID('byLooseCombinedIsolationDeltaBetaCorr') > 0.5 &&"
            "tauID('againstElectronLoose') > 0.5 && "
            "pt > 10"),
        deltaR=cms.double(0.1),
        checkRecoComponents=cms.bool(False),
        pairCut=cms.string(""),
        requireNoOverlaps=cms.bool(False),
    )

    ########################
    ##        JETS        ##
    ########################

    # Use PFJets and turn on JEC
    jec = ['L1FastJet', 'L2Relative', 'L3Absolute']
    # If we are running on data (not MC), or embedded sample,
    # apply the MC-DATA residual correction.
    if not isMC or kwargs['embedded']:
        jec.extend(['L2L3Residual'])

    # tmp
    # define the b-tag squences for offline reconstruction
    process.load("RecoBTag.SecondaryVertex.secondaryVertex_cff")
    process.load("RecoBTau.JetTagComputer.combinedMVA_cff")
    process.load('RecoVertex/AdaptiveVertexFinder/inclusiveVertexing_cff')
    process.load('RecoBTag/SecondaryVertex/bToCharmDecayVertexMerger_cfi')
    #process.load("PhysicsTools.PatAlgos.patSequences_cff")

    # Define options for BTagging - these are release dependent.
    btag_options = {'doBTagging': True}
    if cmssw_major_version() == 5:
        btag_options['btagInfo'] = [
            'impactParameterTagInfos', 'secondaryVertexTagInfos',
            'softMuonTagInfos', 'secondaryVertexNegativeTagInfos',
            'inclusiveSecondaryVertexFinderFilteredTagInfos'
        ]
        btag_options['btagdiscriminators'] = [
            'trackCountingHighEffBJetTags',
            'trackCountingHighPurBJetTags',
            'simpleSecondaryVertexHighEffBJetTags',
            'simpleSecondaryVertexHighPurBJetTags',
            'simpleInclusiveSecondaryVertexHighEffBJetTags',
            'simpleInclusiveSecondaryVertexHighPurBJetTags',
            'combinedSecondaryVertexMVABJetTags',
            'combinedSecondaryVertexBJetTags',
            'jetBProbabilityBJetTags',
            'jetProbabilityBJetTags',
        ]

    #Avoid embedding
    process.patJets.embedPFCandidates = True
    process.patJets.embedCaloTowers = False
    process.patJets.embedGenJetMatch = True
    process.patJets.addAssociatedTracks = True
    process.patJets.embedGenPartonMatch = True

    # Add AK5chs PFJets
    jettools.addJetCollection(process,
                              cms.InputTag('ak5PFchsJets'),
                              algoLabel="AK5",
                              typeLabel="PFchs",
                              doJTA=True,
                              jetCorrLabel=('AK5PFchs', jec),
                              doType1MET=False,
                              doL1Cleaning=False,
                              doL1Counters=False,
                              genJetCollection=cms.InputTag('ak5GenJets'),
                              doJetID=True,
                              **btag_options)

    # Use AK5 PFJets
    jettools.switchJetCollection(
        process,
        cms.InputTag('ak5PFJets'),
        doJTA=True,
        jetCorrLabel=('AK5PF', jec),
        #jetCorrLabel = None,
        doType1MET=False,
        doJetID=True,
        genJetCollection=cms.InputTag("ak5GenJets"),
        **btag_options)

    # Customize/embed all our sequences
    process.load("FinalStateAnalysis.PatTools.patJetProduction_cff")
    helpers.cloneProcessingSnippet(process, process.customizeJetSequence,
                                   'AK5PFchs')
    process.patJetGarbageRemoval.cut = 'pt > 12'
    final_jet_collection = chain_sequence(process.customizeJetSequence,
                                          "patJets")
    process.customizeJetSequence.insert(0, process.patJets)
    # Make it a "complete" sequence
    process.customizeJetSequence += process.selectedPatJets
    #    process.customizeJetSequence += process.btagging
    # We can't mess up the selected pat jets because the taus use them.
    process.selectedPatJets.src = final_jet_collection
    process.patDefaultSequence.replace(process.patJets,
                                       process.customizeJetSequence)

    process.customizeJetSequenceAK5PFchs.remove(process.patJetsPUIDAK5PFchs)
    process.customizeJetSequenceAK5PFchs.remove(
        process.pileupJetIdProducerAK5PFchs)
    process.patJetGarbageRemovalAK5PFchs.cut = 'pt > 20'
    process.patJetCorrFactorsAK5PFchs.payload = cms.string('AK5PFchs')
    final_jetchs_collection = chain_sequence(
        process.customizeJetSequenceAK5PFchs, "patJetsAK5PFchs")
    process.customizeJetSequenceAK5PFchs.insert(0, process.patJetsAK5PFchs)
    # Make it a "complete" sequence
    process.customizeJetSequenceAK5PFchs += process.selectedPatJetsAK5PFchs
    # We can't mess up the selected pat jets because the taus use them.
    process.selectedPatJetsAK5PFchs.src = final_jetchs_collection
    process.selectedPatJetsAK5chsPF = process.selectedPatJetsAK5PFchs.clone(
    )  #that's what we keep
    process.customizeJetSequenceAK5PFchs += process.selectedPatJetsAK5chsPF
    process.patDefaultSequence.replace(process.patJetsAK5PFchs,
                                       process.customizeJetSequenceAK5PFchs)

    output_commands.append('*_selectedPatJets_*_*')
    output_commands.append('*_selectedPatJetsAK5chsPF_*_*')
    output_commands.append('*SecondaryVertexTagInfo*_*_*_*')
    output_commands.append('*TrackIPTagInfo*_*_*_*')
    output_commands.append('*SoftLeptonTagInfo*_*_*_*')
    output_commands.append('*_ak5PFJets_*_*')
    output_commands.append('*_ak5PFchsJets_*_*')

    ########################
    ##        MET         ##
    ########################

    # Use PFMEt
    mettools.addPfMET(process)

    # We cut out a lot of the junky taus and jets - but we need these
    # to correctly apply the MET uncertainties.  So, let's make a
    # non-cleaned version of the jet and tau sequence.
    process.jetsForMetSyst = helpers.cloneProcessingSnippet(
        process, process.customizeJetSequence, 'ForMETSyst')
    process.tausForMetSyst = helpers.cloneProcessingSnippet(
        process, process.customizeTauSequence, 'ForMETSyst')
    # Don't apply any cut for these
    process.patTauGarbageRemovalForMETSyst.cut = ''
    process.patJetGarbageRemovalForMETSyst.cut = ''
    process.tuplize += process.jetsForMetSyst
    process.tuplize += process.tausForMetSyst
    # We have to make our clone of cleanPatTaus separately, since e/mu
    # cleaning is applied - therefore it isn't in the customizeTausSequence.
    process.cleanPatTausForMETSyst = process.cleanPatTaus.clone(
        src=cms.InputTag(process.cleanPatTaus.src.value() + "ForMETSyst"))
    process.cleanPatTausForMETSyst.preselection = ''
    process.cleanPatTausForMETSyst.finalCut = ''
    process.patTausEmbedJetInfoForMETSyst.jetSrc = \
        final_jet_collection.value() + "ForMETSyst"
    process.tuplize += process.cleanPatTausForMETSyst

    # Setup MET production
    process.load("FinalStateAnalysis.PatTools.patMETProduction_cff")
    # The MET systematics depend on all other systematics
    process.systematicsMET.tauSrc = cms.InputTag("cleanPatTausForMETSyst")
    process.systematicsMET.muonSrc = cms.InputTag("cleanPatMuons")
    process.systematicsMET.electronSrc = cms.InputTag("cleanPatElectrons")

    final_met_collection = chain_sequence(process.customizeMETSequence,
                                          "patMETsPF")
    process.tuplize += process.customizeMETSequence
    process.patMETsPF.addGenMET = bool(isMC)
    output_commands.append('*_%s_*_*' % final_met_collection.value())

    # Make a version with the MVA MET reconstruction method
    process.load("FinalStateAnalysis.PatTools.met.mvaMetOnPatTuple_cff")
    process.tuplize += process.pfMEtMVAsequence
    mva_met_sequence = helpers.cloneProcessingSnippet(
        process, process.customizeMETSequence, "MVA")
    final_mvamet_collection = chain_sequence(mva_met_sequence, "patMEtMVA")
    process.tuplize += mva_met_sequence
    output_commands.append('*_%s_*_*' % final_mvamet_collection.value())

    # Keep all the data formats needed for the systematics
    output_commands.append('recoLeafCandidates_*_*_%s' % process.name_())
    # We can drop to jet and tau MET specific products. They were only used for
    # computation of the MET numbers.
    output_commands.append('drop recoLeafCandidates_*ForMETSyst_*_%s' %
                           process.name_())

    ########################
    ##      PHOTONS       ##
    ########################

    #alter the photon matching to accept various fakes
    # and sort matches by d-pt-rel
    if isMC:
        process.photonMatch = cms.EDProducer(
            "MCMatcherByPt",
            src=cms.InputTag("photons"),
            maxDPtRel=cms.double(100.0),
            mcPdgId=cms.vint32(),
            mcStatus=cms.vint32(1),
            resolveByMatchQuality=cms.bool(False),
            maxDeltaR=cms.double(0.3),
            checkCharge=cms.bool(False),
            resolveAmbiguities=cms.bool(True),
            matched=cms.InputTag("genParticles"))

    # Setup pat::Photon Production
    process.load("FinalStateAnalysis.PatTools.patPhotonProduction_cff")
    final_photon_collection = chain_sequence(process.customizePhotonSequence,
                                             "selectedPatPhotons")
    #setup PHOSPHOR for a specific dataset
    if cmssw_major_version() == 4:  # for now 2011 = CMSSW42X
        process.patPhotonPHOSPHOREmbedder.year = cms.uint32(2011)
    else:  # 2012 is 5YX
        process.patPhotonPHOSPHOREmbedder.year = cms.uint32(2012)
    process.patPhotonPHOSPHOREmbedder.isMC = cms.bool(bool(isMC))
    #inject photons into pat sequence
    process.customizePhotonSequence.insert(0, process.selectedPatPhotons)
    process.patDefaultSequence.replace(process.selectedPatPhotons,
                                       process.customizePhotonSequence)
    process.cleanPatPhotons.src = final_photon_collection

    ########################
    ##      TRIGGER       ##
    ########################

    trigtools.switchOnTrigger(process)

    #configure the PAT trigger
    if kwargs['HLTprocess']:
        process.patTrigger.processName = cms.string(kwargs['HLTprocess'])
        process.patTriggerEvent.processName = cms.string(kwargs['HLTprocess'])

    ########################
    ##   --------------   ##
    ########################

    output_commands.append('*_cleanPatTaus_*_*')
    output_commands.append('*_cleanPatElectrons_*_*')
    output_commands.append('*_cleanPatMuons_*_*')
    output_commands.append('*_cleanPatPhotons_*_*')

    ########################
    ##                    ##
    ##        FSA         ##
    ##                    ##
    ########################

    # Now build the PATFinalStateLS object, which holds LumiSection info.
    process.load(
        "FinalStateAnalysis.PatTools.finalStates.patFinalStateLSProducer_cfi")
    process.tuplize += process.finalStateLS
    output_commands.append('*_finalStateLS_*_*')
    if isMC:
        process.finalStateLS.xSec = kwargs['xSec']

    # Tell the framework to shut up!
    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport.reportEvery = 1000

    # Which collections are used to build the final states
    fs_daughter_inputs = {
        'electrons': 'cleanPatElectrons',
        'muons': 'cleanPatMuons',
        'taus': 'cleanPatTaus',
        'photons': 'cleanPatPhotons',
        'jets': 'selectedPatJets',
        'pfmet': final_met_collection,
        'mvamet': final_mvamet_collection,
    }

    # Setup all the PATFinalState objects
    produce_final_states(process,
                         fs_daughter_inputs,
                         output_commands,
                         process.tuplize,
                         kwargs['puTag'],
                         zzMode=kwargs.get('zzMode', False))

    return process.tuplize, output_commands
コード例 #16
0
## ---
## Define the path as empty skeleton
## ---
process.p = cms.Path()

### ===========
### PAT trigger
### ===========

## --
## Switch on
## --
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(
    process, sequence='p'
)  # overwrite sequence default "patDefaultSequence", since it is not used in any path

## --
## Modify configuration according to your needs
## --
# add L1 algorithms' collection
process.patTrigger.addL1Algos = cms.bool(True)  # default: 'False'
# add L1 objects collection-wise (latest collection)
process.patTrigger.l1ExtraMu = cms.InputTag('l1extraParticles', '')
process.patTrigger.l1ExtraNoIsoEG = cms.InputTag('l1extraParticles',
                                                 'NonIsolated')
process.patTrigger.l1ExtraIsoEG = cms.InputTag('l1extraParticles', 'Isolated')
process.patTrigger.l1ExtraCenJet = cms.InputTag('l1extraParticles', 'Central')
process.patTrigger.l1ExtraForJet = cms.InputTag('l1extraParticles', 'Forward')
process.patTrigger.l1ExtraTauJet = cms.InputTag('l1extraParticles', 'Tau')
コード例 #17
0
def configurePatTuple(process, isMC=True, **kwargs):

    # Stuff we always keep
    output_commands = [
#        '*',
        '*_addPileupInfo_*_*',
        'edmMergeableCounter_*_*_*',
        '*_lumiProducer_*_*',
        '*_particleFlow_*_*',
        '*_offlineBeamSpot_*_*',
        '*_generalTracks_*_*',
        '*_electronGsfTracks_*_*',
        '*_offlinePrimaryVertices*_*_*',
        '*_ak5GenJets_*_*',
        '*_hltTriggerSummaryAOD_*_*',
        'edmTriggerResults_TriggerResults_*_%s' % process.name_(),
        '*_MEtoEDMConverter*_*_%s' % process.name_(),
        'LHEEventProduct_*_*_*',
        'GenEventInfoProduct_generator_*_*',
        '*_kt6PFJetsForRhoComputationVoronoi_rho_*',
        '*_kt6PFJetsForIso_rho_*',
        '*_kt6PFJets_rho_*',
        '*_kt6PFJetsCentralHZGPho_rho_*',
        '*_kt6PFJetsCentralHZGEle_rho_*',
        '*_kt6PFJetsCentralHZGMu_rho_*',
        '*_kt6PFJetsCentralNeutralHZGMu_rho_*',
        '*_kt6PFJetsCentral_rho_*',
        '*_kt6PFJetsCentralNeutral_rho_*', #for zz muons
        '*_photonCore_*_*',
        # for Zmumu -> embedded samples
        '*_generator_weight_*', # 2k11
        "GenFilterInfo_generator_minVisPtFilter_*", #2k12
        '*_genDaughters_*_*',
        '*_boosted*_*_*',
        '*_tmfTracks_*_*',
    ]
    # Define our patTuple production sequence
    process.tuplize = cms.Sequence()
    # Only keep interesting genParticles
    process.load("FinalStateAnalysis.RecoTools.genParticleTrimmer_cfi")
    process.genParticles = process.prunedGenParticles.clone()
    if isMC:
        #process.tuplize += process.genParticles
        #output_commands.append('*_genParticles_*_%s' % process.name_())
        output_commands.append('*_genParticles_*_*')

    output_commands.append('*_tauGenJetsSelectorAllHadrons_*_*')
    output_commands.append('*_tauGenJets_*_*')
    output_commands.append('*_ak5GenJets_*_*')
    # Select vertices
    process.load("FinalStateAnalysis.RecoTools.vertexSelection_cff")
    output_commands.append('*_selectedPrimaryVertex_*_*')
    output_commands.append('*_selectPrimaryVerticesQuality_*_*')
    process.tuplize += process.selectPrimaryVertices

    # Run the ZZ recipe for rho
    from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets \
            as zzCantDoAnythingRight

    process.kt6PFJetsForIso = zzCantDoAnythingRight.clone(
        rParam = cms.double(0.6),
        doAreaFastjet = cms.bool(True),
        doRhoFastjet = cms.bool(True),
        Rho_EtaMax = cms.double(2.5),
        Ghost_EtaMax = cms.double(2.5),
    )
    process.tuplize += process.kt6PFJetsForIso

    # Standard services
    process.load('Configuration.StandardSequences.Services_cff')
    # tack on seeds for FSA PATTuple modules
    add_fsa_random_seeds(process)
    
    
    if cmssw_major_version() == 5 and cmssw_minor_version() >= 3: 
        process.load('Configuration.Geometry.GeometryIdeal_cff')
    else:
        process.load('Configuration.StandardSequences.GeometryIdeal_cff')
        
    process.load('Configuration.StandardSequences.MagneticField_cff')
    process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')

    # Rerun tau ID
    if cmssw_major_version() == 4:
        process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
        # Optimization - remove PFTauTagInfo compatibility layer
        process.recoTauClassicHPSSequence.remove(process.pfRecoTauTagInfoProducer)
        process.recoTauClassicHPSSequence.remove(process.ak5PFJetTracksAssociatorAtVertex)
        assert(process.combinatoricRecoTaus.modifiers[3].name.value() == 'TTIworkaround')
        del process.combinatoricRecoTaus.modifiers[3]
        # Don't build junky taus below 19 GeV
        process.combinatoricRecoTaus.builders[0].minPtToBuild = cms.double(17)
        process.tuplize += process.recoTauClassicHPSSequence
    else:
        # We can run less tau stuff in 52, since HPS taus already built.
        process.load("RecoTauTag.Configuration.updateHPSPFTaus_cff")
        process.tuplize += process.updateHPSPFTaus

    ## Run rho computation.  Only necessary in 42X
    if cmssw_major_version() == 4:
        from RecoJets.Configuration.RecoPFJets_cff import kt6PFJets
        kt6PFJets.Rho_EtaMax = cms.double(4.4)
        kt6PFJets.doRhoFastjet = True
        process.kt6PFJets = kt6PFJets
        process.tuplize += process.kt6PFJets

    # In 4_X we have to rerun ak5PFJets with area computation enabled.
    if cmssw_major_version() == 4:
        process.load("RecoJets.Configuration.RecoPFJets_cff")
        process.ak5PFJets.doAreaFastjet = True
        process.tuplize += process.ak5PFJets
        # Only keep the new ak5PFJets
        output_commands.append('*_ak5PFJets_*_%s' % process.name_())
    else:
        # Just keep the normal ones
        output_commands.append('*_ak5PFJets_*_*')

    # In the embedded samples, we need to re-run the b-tagging
    if kwargs['embedded']:
       process.load('RecoBTag/Configuration/RecoBTag_cff')
       process.load('RecoJets/JetAssociationProducers/ak5JTA_cff')
       process.ak5JetTracksAssociatorAtVertex.jets   = cms.InputTag("ak5PFJets")
       process.ak5JetTracksAssociatorAtVertex.tracks = cms.InputTag("tmfTracks")
       process.tuplize += process.ak5JetTracksAssociatorAtVertex
       process.tuplize += process.btagging

    # Run pat default sequence
    process.load("PhysicsTools.PatAlgos.patSequences_cff")
    # Embed PF Isolation in electrons & muons
    pfTools.usePFIso(process)
    # Setup H2Tau custom iso definitions
    setup_h2tau_iso(process)
    # Setup hZg custom iso definitions
    add_hZg_iso_needs(process)
    
    # Use POG recommendations for (these) electron Isos
    process.elPFIsoValueGamma04PFIdPFIso.deposits[0].vetos = cms.vstring('EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueGamma04NoPFIdPFIso.deposits[0].vetos = cms.vstring('EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueCharged04PFIdPFIso.deposits[0].vetos = cms.vstring('EcalEndcaps:ConeVeto(0.015)')
    process.elPFIsoValueCharged04NoPFIdPFIso.deposits[0].vetos = cms.vstring('EcalEndcaps:ConeVeto(0.015)')

    # Unembed junk
    process.patMuons.embedCaloMETMuonCorrs = False
    process.patMuons.embedTcMETMuonCorrs = False
    process.patMuons.embedTrack = True
    process.patMuons.pvSrc = cms.InputTag("selectedPrimaryVertex")

    # Do extra electron ID
    process.load("FinalStateAnalysis.PatTools.electrons.electronID_cff")
    process.tuplize += process.recoElectronID
    process.patElectrons.electronIDSources = process.electronIDSources
    process.patElectrons.embedTrack = True

    # Now run PAT
    process.tuplize += process.patDefaultSequence

    # Add FSR photons for ZZ analysis
    process.load("FinalStateAnalysis.PatTools.fsrPhotons_cff")
    process.tuplize += process.fsrPhotonSequence

    # Use HPS taus
    tautools.switchToPFTauHPS(process)
    # Disable tau IsoDeposits
    process.patDefaultSequence.remove(process.patPFTauIsolation)
    process.patTaus.isoDeposits = cms.PSet()
    process.patTaus.userIsolation = cms.PSet()

    # Disable gen match embedding - we keep it in the ntuple
    process.patMuons.embedGenMatch = False
    process.patElectrons.embedGenMatch = False
    process.patTaus.embedGenMatch = False
    process.patTaus.embedGenJetMatch = False

    # Use PFJets and turn on JEC
    jec = [ 'L1FastJet', 'L2Relative', 'L3Absolute' ]
    # If we are running on data (not MC), or embedded sample,
    # apply the MC-DATA residual correction.
    if not isMC or kwargs['embedded']:
        jec.extend([ 'L2L3Residual' ])

    # Define options for BTagging - these are release dependent.
    btag_options = {'doBTagging' : True}
    if cmssw_major_version() == 5:
        btag_options['btagInfo'] = [
            'impactParameterTagInfos',
            'secondaryVertexTagInfos',
            'softMuonTagInfos',
            'secondaryVertexNegativeTagInfos'
        ]
        btag_options['btagdiscriminators'] = [
            'trackCountingHighEffBJetTags',
            'simpleSecondaryVertexHighEffBJetTags',
            'combinedSecondaryVertexMVABJetTags',
            'combinedSecondaryVertexBJetTags',
        ]

    # Use AK5 PFJets
    jettools.switchJetCollection(
        process,
        cms.InputTag('ak5PFJets'),
        doJTA = False,
        jetCorrLabel = ('AK5PF', jec),
        #jetCorrLabel = None,
        doType1MET = False,
        doJetID = True,
        genJetCollection = cms.InputTag("ak5GenJets"),
        **btag_options
    )
    process.patJets.embedPFCandidates = False
    process.patJets.embedCaloTowers = False
    process.patJets.embedGenJetMatch = False
    process.patJets.addAssociatedTracks = False
    process.patJets.embedGenPartonMatch = False
    #process.patJetCorrFactors.useRho = True
    ## Let's use the same rho as in the TauID, so we don't need to do it twice.
    #process.patJetCorrFactors.rho = cms.InputTag(
        #"kt6PFJetsForRhoComputationVoronoi", "rho")

    # Use PFMEt
    mettools.addPfMET(process)
    if not isMC:
        coreTools.runOnData(process)
        process.patMETsPF.addGenMET = False
    output_commands.append('*_selectedPatJets_*_*')

    # Customize/embed all our sequences
    process.load("FinalStateAnalysis.PatTools.patJetProduction_cff")
    # We have to keep all jets (for the MVA MET...)
    process.patJetGarbageRemoval.cut = 'pt > 0'

    final_jet_collection = chain_sequence(
        process.customizeJetSequence, "patJets")
    process.customizeJetSequence.insert(0, process.patJets)
    # Make it a "complete" sequence
    process.customizeJetSequence += process.selectedPatJets
    # We can't mess up the selected pat jets because the taus use them.
    process.selectedPatJets.src = final_jet_collection
    process.patDefaultSequence.replace(process.patJets,
                                       process.customizeJetSequence)

    # Produce the electron collections
    process.load("FinalStateAnalysis.PatTools.patElectronProduction_cff")
    final_electron_collection = chain_sequence(
        process.customizeElectronSequence, "selectedPatElectrons")
    process.tuplize += process.customizeElectronSequence
    process.customizeElectronSequence.insert(0, process.selectedPatElectrons)
    process.patDefaultSequence.replace(process.selectedPatElectrons,
                                       process.customizeElectronSequence)
    # We have to do the pat Jets before the pat electrons since we embed them
    process.customizeElectronSequence.insert(0, process.selectedPatJets)
    process.cleanPatElectrons.src = final_electron_collection
    #setup the energy regression for the specific dataset
    process.patElectronEnergyCorrections.isMC  = cms.bool(bool(isMC))
    process.patElectronEnergyCorrections.isAOD = \
                                               cms.bool(bool(kwargs['isAOD']))
    process.patElectronEnergyCorrections.dataSet = \
                                     cms.string(kwargs['calibrationTarget'])

    process.load("FinalStateAnalysis.PatTools.patMuonProduction_cff")
    final_muon_collection = chain_sequence(
        process.customizeMuonSequence, "selectedPatMuons")
    process.customizeMuonSequence.insert(0, process.selectedPatMuons)
    process.patDefaultSequence.replace(process.selectedPatMuons,
                                       process.customizeMuonSequence)
    process.cleanPatMuons.src = final_muon_collection
    process.patMuonRochesterCorrectionEmbedder.isMC = cms.bool(bool(isMC))
    

    process.load("FinalStateAnalysis.PatTools.patTauProduction_cff")
    final_tau_collection = chain_sequence(
        process.customizeTauSequence, "selectedPatTaus")
    # Inject into the pat sequence
    process.customizeTauSequence.insert(0, process.selectedPatTaus)
    process.patDefaultSequence.replace(process.selectedPatTaus,
                                       process.customizeTauSequence)
    process.cleanPatTaus.src = final_tau_collection
    # Remove muons and electrons
    process.cleanPatTaus.checkOverlaps.muons.requireNoOverlaps = False
    process.cleanPatTaus.checkOverlaps.electrons.requireNoOverlaps = False
    # Apply a loose preselection
    process.cleanPatTaus.preselection = 'abs(eta) < 2.5 & pt > 17'
    # Don't apply any "final" cut
    process.cleanPatTaus.finalCut = ''

    # Setup pat::Photon Production
    process.load("FinalStateAnalysis.PatTools.patPhotonProduction_cff")
    final_photon_collection = chain_sequence(process.customizePhotonSequence,
                                             "selectedPatPhotons")
    #inject photons into pat sequence
    process.customizePhotonSequence.insert(0,process.selectedPatPhotons)
    process.patDefaultSequence.replace(process.selectedPatPhotons,
                                       process.customizePhotonSequence)
    process.cleanPatPhotons.src = final_photon_collection

    # Setup MET production
    process.load("FinalStateAnalysis.PatTools.patMETProduction_cff")
    final_met_collection = chain_sequence(
        process.customizeMETSequence, "patMETsPF")
    process.tuplize += process.customizeMETSequence
    # The MET systematics depend on all other systematics
    process.systematicsMET.tauSrc = cms.InputTag("cleanPatTaus")
    process.systematicsMET.muonSrc = cms.InputTag("cleanPatMuons")
    process.systematicsMET.electronSrc = cms.InputTag("cleanPatElectrons")

    # Keep all the data formats needed for the systematics
    output_commands.append('recoLeafCandidates_*_*_%s'
                           % process.name_())

    # Define the default lepton cleaning
    process.cleanPatElectrons.preselection = cms.string('pt > 5')
    process.cleanPatElectrons.checkOverlaps.muons.requireNoOverlaps = False
    # Make sure we don't kill any good taus by calling them electrons
    # Note that we don't actually remove these overlaps.
    process.cleanPatElectrons.checkOverlaps.taus = cms.PSet(
        src = final_tau_collection,
        algorithm = cms.string("byDeltaR"),
        preselection = cms.string(
            "tauID('decayModeFinding') > 0.5 &&"
            "tauID('byLooseCombinedIsolationDeltaBetaCorr') > 0.5 &&"
            "tauID('againstElectronLoose') > 0.5 && "
            "pt > 10"
        ),
        deltaR = cms.double(0.1),
        checkRecoComponents = cms.bool(False),
        pairCut = cms.string(""),
        requireNoOverlaps = cms.bool(False),
    )

    output_commands.append('*_cleanPatTaus_*_*')
    output_commands.append('*_cleanPatElectrons_*_*')
    output_commands.append('*_cleanPatMuons_*_*')
    output_commands.append('*_cleanPatPhotons_*_*')
    output_commands.append('*_%s_*_*' % final_met_collection.value())

    trigtools.switchOnTrigger(process)

    # Now build the PATFinalStateLS object, which holds LumiSection info.
    process.load(
        "FinalStateAnalysis.PatTools.finalStates.patFinalStateLSProducer_cfi")
    process.tuplize += process.finalStateLS
    output_commands.append('*_finalStateLS_*_*')
    if isMC:
        process.finalStateLS.xSec = kwargs['xSec']

    # Tell the framework to shut up!
    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport.reportEvery = 1000

    # Which collections are used to build the final states
    fs_daughter_inputs = {
        'electrons' : 'cleanPatElectrons',
        'muons' : 'cleanPatMuons',
        'taus' : 'cleanPatTaus',
        'photons' : 'cleanPatPhotons',
        'jets' : 'selectedPatJets',        
        'met' : final_met_collection,
    }

    # Setup all the PATFinalState objects
    produce_final_states(process, fs_daughter_inputs, output_commands,
                         process.tuplize, kwargs['puTag'])

    return process.tuplize, output_commands
コード例 #18
0
def configurePatTuple(process, isMC=True, **kwargs):
    # Stuff we always keep
    output_commands = [
        '*_addPileupInfo_*_*',
        'edmMergeableCounter_*_*_*',
        '*_lumiProducer_*_*',
        '*_particleFlow_*_*',
        '*_offlineBeamSpot_*_*',
        '*_generalTracks_*_*',
        '*_electronGsfTracks_*_*',
        '*_gsfElectrons_*_*',
        '*_gsfElectronCores_*_*',
        '*_offlinePrimaryVertices*_*_*',
        '*_ak5GenJets_*_*',
        '*_hltTriggerSummaryAOD_*_*',
        'edmTriggerResults_TriggerResults_*_%s' % process.name_(),
        '*_MEtoEDMConverter*_*_%s' % process.name_(),
        'LHEEventProduct_*_*_*',
        'GenEventInfoProduct_generator_*_*',
        '*_kt6PFJetsForRhoComputationVoronoi_rho_*',
        '*_kt6PFJetsForIso_rho_*',
        '*_kt6PFJets_rho_*',
        '*_kt6PFJetsHZGPho_rho_*',
        '*_kt6PFJetsCentralHZGEle_rho_*',
        '*_kt6PFJetsCentralHZGMu_rho_*',
        '*_kt6PFJetsCentralNeutralHZGMu_rho_*',
        '*_kt6PFJetsCentral_rho_*',
        '*_kt6PFJetsCentralNeutral_rho_*',  # for zz muons
        '*_photonCore_*_*',
        '*_boostedFsrPhotons_*_*',
        # for Zmumu -> embedded samples
        # https://twiki.cern.ch/twiki/bin/view/CMS/MuonTauReplacementRecHit
        '*_generalTracksORG_*_EmbeddedRECO',
        '*_electronGsfTracksORG_*_EmbeddedRECO',
        'double_TauSpinnerReco_TauSpinnerWT_EmbeddedSPIN',
        'double_ZmumuEvtSelEffCorrWeightProducer_weight_EmbeddedRECO',
        'double_muonRadiationCorrWeightProducer_weight_EmbeddedRECO',
        'GenFilterInfo_generator_minVisPtFilter_EmbeddedRECO',
    ]
    # Define our patTuple production sequence
    process.tuplize = cms.Sequence()
    # Only keep interesting genParticles
    process.load("FinalStateAnalysis.RecoTools.genParticleTrimmer_cfi")
    process.genParticles = process.prunedGenParticles.clone()
    if isMC:
        #process.tuplize += process.genParticles
        #output_commands.append('*_genParticles_*_%s' % process.name_())
        output_commands.append('*_genParticles_*_*')

    output_commands.append('*_tauGenJetsSelectorAllHadrons_*_*')
    output_commands.append('*_tauGenJets_*_*')
    output_commands.append('*_ak5GenJets_*_*')
    # Select vertices
    process.load("FinalStateAnalysis.RecoTools.vertexSelection_cff")
    output_commands.append('*_selectedPrimaryVertex*_*_*')
    output_commands.append('*_selectPrimaryVerticesQuality*_*_*')
    process.tuplize += process.selectPrimaryVertices

    # Run the ZZ recipe for rho
    from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets \
        as zzCantDoAnythingRight

    process.kt6PFJetsForIso = zzCantDoAnythingRight.clone(
        rParam=cms.double(0.6),
        doAreaFastjet=cms.bool(True),
        doRhoFastjet=cms.bool(True),
        Rho_EtaMax=cms.double(2.5),
        Ghost_EtaMax=cms.double(2.5),
    )
    process.tuplize += process.kt6PFJetsForIso

    # Standard services
    process.load('Configuration.StandardSequences.Services_cff')
    # tack on seeds for FSA PATTuple modules
    add_fsa_random_seeds(process)

    if cmssw_major_version() == 5 and cmssw_minor_version() >= 3:
        process.load('Configuration.Geometry.GeometryDB_cff')
    else:
        process.load('Configuration.StandardSequences.GeometryDB_cff')

    process.load('Configuration.StandardSequences.MagneticField_cff')
    process.load(
        'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')

    # Rerun tau ID
    process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
    # Optimization - remove PFTauTagInfo compatibility layer
    process.recoTauClassicHPSSequence.remove(
        process.pfRecoTauTagInfoProducer)
    process.recoTauClassicHPSSequence.remove(
        process.ak5PFJetTracksAssociatorAtVertex)
    assert(process.combinatoricRecoTaus.modifiers[3].name.value() ==
           'TTIworkaround')
    del process.combinatoricRecoTaus.modifiers[3]
    # Don't build junky taus below 19 GeV
    process.combinatoricRecoTaus.builders[0].minPtToBuild = cms.double(17)
    process.tuplize += process.recoTauClassicHPSSequence

    ## Run rho computation.  Only necessary in 42X
    if cmssw_major_version() == 4:
        # This function call can klobber everything if it isn't done
        # before the other things are attached to the process, so do it now.
        # The klobbering would occur through usePFIso->setupPFIso->_loadPFBRECO
        from CommonTools.ParticleFlow.Tools.pfIsolation import _loadPFBRECO
        _loadPFBRECO(process)
        process.load("RecoJets.Configuration.RecoPFJets_cff")
        process.kt6PFJets.Rho_EtaMax = cms.double(4.4)
        process.kt6PFJets.doRhoFastjet = True
        process.tuplize += process.kt6PFJets

    # In 4_X we have to rerun ak5PFJets with area computation enabled.
    if cmssw_major_version() == 4:
        process.load("RecoJets.Configuration.RecoPFJets_cff")
        process.ak5PFJets.doAreaFastjet = True
        process.tuplize += process.ak5PFJets
        # Only keep the new ak5PFJets
        output_commands.append('*_ak5PFJets_*_%s' % process.name_())
    else:
        # Just keep the normal ones
        output_commands.append('*_ak5PFJets_*_*')

    # Run pat default sequence
    process.load("PhysicsTools.PatAlgos.patSequences_cff")
    # Embed PF Isolation in electrons & muons
    pfTools.usePFIso(process)
    # Setup H2Tau custom iso definitions
    setup_h2tau_iso(process)
    # Setup hZg custom iso definitions
    add_hZg_iso_needs(process)

    #alter the photon matching to accept various fakes
    # and sort matches by d-pt-rel
    if isMC:
        process.photonMatch = cms.EDProducer(
            "MCMatcherByPt",
            src=cms.InputTag("photons"),
            maxDPtRel=cms.double(100.0),
            mcPdgId=cms.vint32(),
            mcStatus=cms.vint32(1),
            resolveByMatchQuality=cms.bool(False),
            maxDeltaR=cms.double(0.3),
            checkCharge=cms.bool(False),
            resolveAmbiguities=cms.bool(True),
            matched=cms.InputTag("genParticles")
        )

    # Use POG recommendations for (these) electron Isos
    process.elPFIsoValueGamma04PFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueGamma04NoPFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueCharged04PFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.015)')
    process.elPFIsoValueCharged04NoPFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.015)')

    # Unembed junk
    process.patMuons.embedCaloMETMuonCorrs = False
    process.patMuons.embedTcMETMuonCorrs = False
    process.patMuons.embedTrack = True
    process.patMuons.pvSrc = cms.InputTag("selectedPrimaryVertex")

    # Do extra electron ID
    process.load("FinalStateAnalysis.PatTools.electrons.electronID_cff")
    if cmssw_major_version() == 4:
        process.patDefaultSequence.replace(process.patElectrons,
                                           process.recoElectronID42X +
                                           process.patElectrons)
        process.patElectrons.electronIDSources = process.electronIDSources42X
    else:
        process.patDefaultSequence.replace(process.patElectrons,
                                           process.recoElectronID5YX +
                                           process.patElectrons)
        process.patElectrons.electronIDSources = process.electronIDSources5YX

    process.electronMatch.checkCharge = cms.bool(False)
    process.patElectrons.embedTrack = False
    process.patElectrons.embedPFCandidate = False
    process.patElectrons.embedGsfElectronCore = False
    process.patElectrons.embedSuperCluster = True

    # Now run PAT
    process.tuplize += process.patDefaultSequence

    # Add FSR photons for ZZ analysis
    process.load("FinalStateAnalysis.PatTools.fsrPhotons_cff")
    process.tuplize += process.fsrPhotonSequence

    # Use HPS taus
    tautools.switchToPFTauHPS(process)
    # Disable tau IsoDeposits
    process.patDefaultSequence.remove(process.patPFTauIsolation)
    process.patTaus.isoDeposits = cms.PSet()
    process.patTaus.userIsolation = cms.PSet()

    # Disable gen match embedding - we keep it in the ntuple
    process.patMuons.embedGenMatch = False
    process.patElectrons.embedGenMatch = False
    process.patTaus.embedGenMatch = False
    process.patTaus.embedGenJetMatch = False
    process.patPhotons.embedGenMatch = False

    # Use PFJets and turn on JEC
    jec = ['L1FastJet', 'L2Relative', 'L3Absolute']
    # If we are running on data (not MC), or embedded sample,
    # apply the MC-DATA residual correction.
    if not isMC or kwargs['embedded']:
        jec.extend(['L2L3Residual'])

    # Define options for BTagging - these are release dependent.
    btag_options = {'doBTagging': True}
    if cmssw_major_version() == 5:
        btag_options['btagInfo'] = [
            'impactParameterTagInfos',
            'secondaryVertexTagInfos',
            'softMuonTagInfos',
            'secondaryVertexNegativeTagInfos'
        ]
        btag_options['btagdiscriminators'] = [
            'trackCountingHighEffBJetTags',
            'simpleSecondaryVertexHighEffBJetTags',
            'combinedSecondaryVertexMVABJetTags',
            'combinedSecondaryVertexBJetTags',
        ]

    # Use AK5 PFJets
    jettools.switchJetCollection(
        process,
        cms.InputTag('ak5PFJets'),
        doJTA=False,
        jetCorrLabel=('AK5PF', jec),
        #jetCorrLabel = None,
        doType1MET=False,
        doJetID=True,
        genJetCollection=cms.InputTag("ak5GenJets"),
        **btag_options
    )
    process.patJets.embedPFCandidates = False
    process.patJets.embedCaloTowers = False
    process.patJets.embedGenJetMatch = False
    process.patJets.addAssociatedTracks = False
    process.patJets.embedGenPartonMatch = False
    #process.patJetCorrFactors.useRho = True
    ## Let's use the same rho as in the TauID, so we don't need to do it twice.
    #process.patJetCorrFactors.rho = cms.InputTag(
        #"kt6PFJetsForRhoComputationVoronoi", "rho")

    # Use PFMEt
    mettools.addPfMET(process)
    if not isMC:
        coreTools.runOnData(process)
        process.patMETsPF.addGenMET = False
    output_commands.append('*_selectedPatJets_*_*')

    # Customize/embed all our sequences
    process.load("FinalStateAnalysis.PatTools.patJetProduction_cff")
    process.patJetGarbageRemoval.cut = 'pt > 12'

    final_jet_collection = chain_sequence(
        process.customizeJetSequence, "patJets")
    process.customizeJetSequence.insert(0, process.patJets)
    # Make it a "complete" sequence
    process.customizeJetSequence += process.selectedPatJets
    # We can't mess up the selected pat jets because the taus use them.
    process.selectedPatJets.src = final_jet_collection
    process.patDefaultSequence.replace(process.patJets,
                                       process.customizeJetSequence)

    # Produce the electron collections
    process.load("FinalStateAnalysis.PatTools.patElectronProduction_cff")

    # Electron Energy Regression and Calibrations
    process.load(
        "EgammaAnalysis.ElectronTools.electronRegressionEnergyProducer_cfi")
    process.load("EgammaAnalysis.ElectronTools.calibratedPatElectrons_cfi")

    #setup the energy regression for the specific dataset
    if kwargs['eleReg']:
        print "-- Applying Electron Regression and Calibration --"

        process.customizeElectronSequence += process.eleRegressionEnergy
        process.customizeElectronSequence += process.calibratedPatElectrons

        process.eleRegressionEnergy.energyRegressionType = cms.uint32(2)
        process.calibratedPatElectrons.correctionsType = cms.int32(2)

        if isMC:
            process.calibratedPatElectrons.inputDataset = cms.string(
                "Summer12_LegacyPaper")
        else:
            process.calibratedPatElectrons.inputDataset = cms.string(
                "22Jan2013ReReco")

        process.calibratedPatElectrons.combinationType = cms.int32(3)
        process.calibratedPatElectrons.lumiRatio = cms.double(1.0)
        process.calibratedPatElectrons.synchronization = cms.bool(True)
        process.calibratedPatElectrons.isMC = cms.bool(isMC == 1)
        process.calibratedPatElectrons.verbose = cms.bool(False)

    final_electron_collection = chain_sequence(
        process.customizeElectronSequence, "selectedPatElectrons",
        # Some of the EGamma modules have non-standard src InputTags,
        # specify them here.
        ("src", "inputPatElectronsTag", "inputElectronsTag")
    )

    process.tuplize += process.customizeElectronSequence
    process.customizeElectronSequence.insert(0, process.selectedPatElectrons)
    process.patDefaultSequence.replace(process.selectedPatElectrons,
                                       process.customizeElectronSequence)
    # We have to do the pat Jets before the pat electrons since we embed them
    process.customizeElectronSequence.insert(0, process.selectedPatJets)

    # Define cleanPatElectrons input collection
    process.cleanPatElectrons.src = final_electron_collection

    process.load("FinalStateAnalysis.PatTools.patMuonProduction_cff")
    final_muon_collection = chain_sequence(
        process.customizeMuonSequence, "selectedPatMuons")
    process.customizeMuonSequence.insert(0, process.selectedPatMuons)
    process.patDefaultSequence.replace(process.selectedPatMuons,
                                       process.customizeMuonSequence)
    process.cleanPatMuons.src = final_muon_collection
    process.patMuonRochesterCorrectionEmbedder.isMC = cms.bool(bool(isMC))

    process.load("FinalStateAnalysis.PatTools.patTauProduction_cff")
    # Require all taus to pass decay mode finding and have high PT
    process.patTauGarbageRemoval.cut = cms.string(
        "pt > 17 && abs(eta) < 2.5 && tauID('decayModeFinding')")
    final_tau_collection = chain_sequence(
        process.customizeTauSequence, "selectedPatTaus")
    # Inject into the pat sequence
    process.customizeTauSequence.insert(0, process.selectedPatTaus)
    process.patDefaultSequence.replace(process.selectedPatTaus,
                                       process.customizeTauSequence)
    process.cleanPatTaus.src = final_tau_collection
    # Remove muons and electrons
    process.cleanPatTaus.checkOverlaps.muons.requireNoOverlaps = False
    process.cleanPatTaus.checkOverlaps.electrons.requireNoOverlaps = False
    # Cuts already applied by the garbage removal
    process.cleanPatTaus.preselection = ''
    process.cleanPatTaus.finalCut = ''

    # Setup pat::Photon Production
    process.load("FinalStateAnalysis.PatTools.patPhotonProduction_cff")
    final_photon_collection = chain_sequence(process.customizePhotonSequence,
                                             "selectedPatPhotons")
    #setup PHOSPHOR for a specific dataset
    if cmssw_major_version() == 4:  # for now 2011 = CMSSW42X
        process.patPhotonPHOSPHOREmbedder.year = cms.uint32(2011)
    else:  # 2012 is 5YX
        process.patPhotonPHOSPHOREmbedder.year = cms.uint32(2012)
    process.patPhotonPHOSPHOREmbedder.isMC = cms.bool(bool(isMC))
    #inject photons into pat sequence
    process.customizePhotonSequence.insert(0, process.selectedPatPhotons)
    process.patDefaultSequence.replace(process.selectedPatPhotons,
                                       process.customizePhotonSequence)
    process.cleanPatPhotons.src = final_photon_collection

    # We cut out a lot of the junky taus and jets - but we need these
    # to correctly apply the MET uncertainties.  So, let's make a
    # non-cleaned version of the jet and tau sequence.
    process.jetsForMetSyst = helpers.cloneProcessingSnippet(
        process, process.customizeJetSequence, 'ForMETSyst')
    process.tausForMetSyst = helpers.cloneProcessingSnippet(
        process, process.customizeTauSequence, 'ForMETSyst')
    # Don't apply any cut for these
    process.patTauGarbageRemovalForMETSyst.cut = ''
    process.patJetGarbageRemovalForMETSyst.cut = ''
    process.tuplize += process.jetsForMetSyst
    process.tuplize += process.tausForMetSyst
    # We have to make our clone of cleanPatTaus separately, since e/mu
    # cleaning is applied - therefore it isn't in the customizeTausSequence.
    process.cleanPatTausForMETSyst = process.cleanPatTaus.clone(
        src=cms.InputTag(process.cleanPatTaus.src.value() + "ForMETSyst"))
    process.cleanPatTausForMETSyst.preselection = ''
    process.cleanPatTausForMETSyst.finalCut = ''
    process.patTausEmbedJetInfoForMETSyst.jetSrc = \
        final_jet_collection.value() + "ForMETSyst"
    process.tuplize += process.cleanPatTausForMETSyst

    # Setup MET production
    process.load("FinalStateAnalysis.PatTools.patMETProduction_cff")
    # The MET systematics depend on all other systematics
    process.systematicsMET.tauSrc = cms.InputTag("cleanPatTausForMETSyst")
    process.systematicsMET.muonSrc = cms.InputTag("cleanPatMuons")
    process.systematicsMET.electronSrc = cms.InputTag("cleanPatElectrons")

    final_met_collection = chain_sequence(
        process.customizeMETSequence, "patMETsPF")
    process.tuplize += process.customizeMETSequence
    output_commands.append('*_%s_*_*' % final_met_collection.value())

    # Make a version with the MVA MET reconstruction method
    process.load("FinalStateAnalysis.PatTools.met.mvaMetOnPatTuple_cff")
    process.tuplize += process.pfMEtMVAsequence
    mva_met_sequence = helpers.cloneProcessingSnippet(
        process, process.customizeMETSequence, "MVA")
    final_mvamet_collection = chain_sequence(
        mva_met_sequence, "patMEtMVA")
    process.tuplize += mva_met_sequence
    output_commands.append('*_%s_*_*' % final_mvamet_collection.value())

    # Keep all the data formats needed for the systematics
    output_commands.append('recoLeafCandidates_*_*_%s'
                           % process.name_())
    # We can drop to jet and tau MET specific products. They were only used for
    # computation of the MET numbers.
    output_commands.append('drop recoLeafCandidates_*ForMETSyst_*_%s'
                           % process.name_())

    # Define the default lepton cleaning
    process.cleanPatElectrons.preselection = cms.string(
        'pt > 5')
    process.cleanPatElectrons.checkOverlaps.muons.requireNoOverlaps = False
    # Make sure we don't kill any good taus by calling them electrons
    # Note that we don't actually remove these overlaps.
    process.cleanPatElectrons.checkOverlaps.taus = cms.PSet(
        src=final_tau_collection,
        algorithm=cms.string("byDeltaR"),
        preselection=cms.string(
            "tauID('decayModeFinding') > 0.5 &&"
            "tauID('byLooseCombinedIsolationDeltaBetaCorr') > 0.5 &&"
            "tauID('againstElectronLoose') > 0.5 && "
            "pt > 10"
        ),
        deltaR=cms.double(0.1),
        checkRecoComponents=cms.bool(False),
        pairCut=cms.string(""),
        requireNoOverlaps=cms.bool(False),
    )

    output_commands.append('*_cleanPatTaus_*_*')
    output_commands.append('*_cleanPatElectrons_*_*')
    output_commands.append('*_cleanPatMuons_*_*')
    output_commands.append('*_cleanPatPhotons_*_*')

    trigtools.switchOnTrigger(process)

    #configure the PAT trigger
    if kwargs['HLTprocess']:
        process.patTrigger.processName = cms.string(kwargs['HLTprocess'])
        process.patTriggerEvent.processName = cms.string(kwargs['HLTprocess'])

    # Now build the PATFinalStateLS object, which holds LumiSection info.
    process.load(
        "FinalStateAnalysis.PatTools.finalStates.patFinalStateLSProducer_cfi")
    process.tuplize += process.finalStateLS
    output_commands.append('*_finalStateLS_*_*')
    if isMC:
        process.finalStateLS.xSec = kwargs['xSec']

    # Tell the framework to shut up!
    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport.reportEvery = 1000

    # Which collections are used to build the final states
    fs_daughter_inputs = {
        'electrons':  'cleanPatElectrons',
        'muons':  'cleanPatMuons',
        'taus':  'cleanPatTaus',
        'photons':  'cleanPatPhotons',
        'jets':  'selectedPatJets',
        'pfmet':  final_met_collection,
        'mvamet':  final_mvamet_collection,
    }

    # Setup all the PATFinalState objects
    produce_final_states(process, fs_daughter_inputs, output_commands,
                         process.tuplize, kwargs['puTag'],
                         zzMode=kwargs.get('zzMode', False))

    return process.tuplize, output_commands
コード例 #19
0
def addPATSequences(process, runMC):
    # Load the PAT config
    from PhysicsTools.PatAlgos.patEventContent_cff import patEventContent
    process.out = cms.OutputModule(
        "PoolOutputModule",
        fileName=cms.untracked.string('patTuple.root'),
        SelectEvents=cms.untracked.PSet(SelectEvents=cms.vstring('pat_step')),
        outputCommands=cms.untracked.vstring('drop *', *patEventContent))
    ###
    process.load('PhysicsTools.PatAlgos.patSequences_cff')

    from PhysicsTools.PatAlgos.tools.pfTools import usePF2PAT
    postfix = "PFlow"
    jetAlgo = "AK5"
    jetCorrections = None
    if runMC:
        jetCorrections = ('AK5PFchs',
                          ['L1FastJet', 'L2Relative', 'L3Absolute'])
    else:
        jetCorrections = ('AK5PFchs', [
            'L1FastJet', 'L2Relative', 'L3Absolute', 'L2L3Residual'
        ])

    usePF2PAT(process,
              runPF2PAT=True,
              jetAlgo=jetAlgo,
              runOnMC=runMC,
              postfix=postfix,
              jetCorrections=jetCorrections)

    #from PhysicsTools.PatAlgos.tools.coreTools import removeMCMatching
    #if not runMC:
    #    removeMCMatching(process, ['All'],"")

    #-----------------Customization----------------
    process.pfPileUpPFlow.Enable = True
    process.pfPileUpPFlow.checkClosestZVertex = False
    process.pfPileUpPFlow.Vertices = cms.InputTag('goodOfflinePrimaryVertices')
    process.pfPileUpPFlow.verbose = True
    process.pfJetsPFlow.doAreaFastjet = True
    process.pfJetsPFlow.doRhoFastjet = False

    from PhysicsTools.SelectorUtils.pvSelector_cfi import pvSelector
    process.goodOfflinePrimaryVertices = cms.EDFilter(
        "PrimaryVertexObjectFilter",
        filterParams=pvSelector.clone(minNdof=cms.double(4.0),
                                      maxZ=cms.double(24.0)),
        src=cms.InputTag('offlinePrimaryVertices'))

    # Compute the mean pt per unit area (rho) from the PFCHS inputs
    #from RecoJets.Configuration.RecoPFJets_cff import kt6PFJets,ak5PFJets
    #process.kt6PFJetsPFlow = kt6PFJets.clone(
    #	src = cms.InputTag('pfNoElectron'+postfix),
    #	doAreaFastjet = cms.bool(True),
    #	doRhoFastjet = cms.bool(True)
    #	)
    #process.patJetCorrFactorsPFlow.rho = cms.InputTag("kt6PFJetsPFlow", "rho")
    from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets
    process.kt6PFJetsForPAT = kt4PFJets.clone(rParam=cms.double(0.6),
                                              doAreaFastjet=cms.bool(True),
                                              doRhoFastjet=cms.bool(True))
    process.patJetCorrFactorsPFlow.rho = cms.InputTag("kt6PFJetsForPAT", "rho")

    from RecoJets.JetProducers.ak5PFJets_cfi import ak5PFJets
    process.ak5PFJetsPileUp = ak5PFJets.clone(src=cms.InputTag('pfPileUp' +
                                                               postfix))

    # Switch on PAT trigger
    from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
    #switchOnTrigger( process,triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', sequence = 'patPF2PATSequence',hltProcess = 'HLT', outputModule = 'out')

    switchOnTrigger(process, sequence='patPF2PATSequence' + postfix)
    process.patTrigger.addL1Algos = cms.bool(True)
    switchOnTrigger(process, sequence='patPF2PATSequence' +
                    postfix)  # to fix event content
    #-------------------------------------------------------------------------------------------------------------

    # Add modules to default sequence
    #if runMC:
    #    getattr(process, "patElectrons"+postfix).embedGenMatch = True
    #    getattr(process, "patMuons"+postfix).embedGenMatch = True
    #else:
    #    getattr(process, "patElectrons"+postfix).embedGenMatch = False
    #    getattr(process, "patMuons"+postfix).embedGenMatch = False

    # Add modules to default sequence
    getattr(process, "patPF2PATSequence" + postfix).replace(
        getattr(process, "pfNoElectron" + postfix),
        getattr(process, "pfNoElectron" + postfix) * process.kt6PFJetsForPAT)

    getattr(process, "patPF2PATSequence" + postfix).replace(
        getattr(process, "pfNoPileUp" + postfix),
        getattr(process, "pfNoPileUp" + postfix) * process.ak5PFJetsPileUp)

    #----------------------------------------------
    # Let it run
    process.pat_step = cms.Path(
        process.goodOfflinePrimaryVertices *
        #process.patDefaultSequence  +
        getattr(process, "patPF2PATSequence" + postfix))

    # Add PatTrigger output to the created file
    from PhysicsTools.PatAlgos.patEventContent_cff import patTriggerEventContent
    # Add PF2PAT output to the created file
    from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
    patOutputCommands = cms.untracked.vstring(
        'drop *', 'keep recoPFCandidates_particleFlow_*_*',
        *patEventContentNoCleaning)

    # Adjust the event content
    patOutputCommands += [
        #'keep *_selectedPat*_*_*',
        'keep *_genParticles*_*_*',
        'keep *_offlinePrimaryVertices*_*_*',
        'keep *_goodOfflinePrimaryVertices*_*_*',
        #'keep *_pileUpN*PrimaryVertices_*_*',
        #'keep *_pfPileUpExclN*_*_*',
        'keep *_pfPileUpPFlow*_*_*',
        'keep *_pfNoPileUpPFlow*_*_*',
        'keep *_ak5PFJetsPileUp_*_*',
        'keep *_ak5PFJets_*_*',
        'keep recoTracks_generalTracks_*_*',
        'keep HcalNoiseSummary_hcalnoise_*_*',
        'keep *_BeamHaloSummary_*_*',
        #------- Trigger collections ------
        'keep edmTriggerResults_TriggerResults_*_*',
        'keep *_hltTriggerSummaryAOD_*_*',
        'keep L1GlobalTriggerObjectMapRecord_*_*_*',
        'keep L1GlobalTriggerReadoutRecord_*_*_*',
        #------- CASTOR rec hits ------
        'keep *_logErrorHarvester_*_*',
        'keep *_castorreco_*_*',
        #------- Calo towers (just for now) ------
        'keep *_towerMaker_*_*',
        #---------------PatTrigger----------------
        'keep patTriggerObjects_patTrigger*_*_*',
        'keep patTriggerFilters_patTrigger*_*_*',
        'keep patTriggerPaths_patTrigger*_*_*',
        'keep patTriggerEvent_patTriggerEvent*_*_*'
    ]
    process.out.outputCommands = patOutputCommands

    # top projections in PF2PAT:
    getattr(process, "pfNoPileUp" + postfix).enable = True
    getattr(process, "pfNoMuon" + postfix).enable = True
    getattr(process, "pfNoElectron" + postfix).enable = True
    getattr(process, "pfNoTau" + postfix).enable = False
    getattr(process, "pfNoJet" + postfix).enable = True

    # verbose flags for the PF2PAT modules
    getattr(process, "pfNoJet" + postfix).verbose = False
コード例 #20
0
# --------------------------------------------------------------------------------
# define "hooks" for replacing configuration parameters
# in case running jobs on the CERN batch system
#
# __process.source.fileNames = #inputFileNames#
# __process.maxEvents.input = cms.untracked.int32(#maxEvents#)
# __process.analyzeZtoMuTauEvents.filters[0] = copy.deepcopy(#genPhaseSpaceCut#)
# __process.saveZtoMuTauPlots.outputFileName = #plotsOutputFileName#
#
# --------------------------------------------------------------------------------

# --------------------------------------------------------------------------------
# import utility function for configuring PAT trigger matching
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger

switchOnTrigger(process, hltProcess="HLT", outputModule="")
process.patTrigger.addL1Algos = cms.bool(True)
# --------------------------------------------------------------------------------

# --------------------------------------------------------------------------------
# import utility function for switching pat::Tau input
# to different reco::Tau collection stored on AOD
from PhysicsTools.PatAlgos.tools.tauTools import *

# comment-out to take reco::CaloTaus instead of reco::PFTaus
# as input for pat::Tau production
# switchToCaloTau(process)

# comment-out to take shrinking dR = 5.0/Et(PFTau) signal cone
# instead of fixed dR = 0.07 signal cone reco::PFTaus
# as input for pat::Tau production
コード例 #21
0
def configurePatTuple(process, isMC=True, **kwargs):

    # Stuff we always keep
    output_commands = [
        #        '*',
        '*_addPileupInfo_*_*',
        'edmMergeableCounter_*_*_*',
        '*_lumiProducer_*_*',
        '*_particleFlow_*_*',
        '*_offlineBeamSpot_*_*',
        '*_generalTracks_*_*',
        '*_electronGsfTracks_*_*',
        '*_offlinePrimaryVertices*_*_*',
        '*_ak5GenJets_*_*',
        '*_hltTriggerSummaryAOD_*_*',
        'edmTriggerResults_TriggerResults_*_%s' % process.name_(),
        '*_MEtoEDMConverter*_*_%s' % process.name_(),
        'LHEEventProduct_*_*_*',
        'GenEventInfoProduct_generator_*_*',
        '*_kt6PFJetsForRhoComputationVoronoi_rho_*',
        '*_kt6PFJetsForIso_rho_*',
        '*_kt6PFJets_rho_*',
        '*_kt6PFJetsCentralHZGPho_rho_*',
        '*_kt6PFJetsCentralHZGEle_rho_*',
        '*_kt6PFJetsCentralHZGMu_rho_*',
        '*_kt6PFJetsCentralNeutralHZGMu_rho_*',
        '*_kt6PFJetsCentral_rho_*',
        '*_kt6PFJetsCentralNeutral_rho_*',  #for zz muons
        '*_photonCore_*_*',
        # for Zmumu -> embedded samples
        '*_generator_weight_*',  # 2k11
        "GenFilterInfo_generator_minVisPtFilter_*",  #2k12
        '*_genDaughters_*_*',
        '*_boosted*_*_*',
        '*_tmfTracks_*_*',
    ]
    # Define our patTuple production sequence
    process.tuplize = cms.Sequence()
    # Only keep interesting genParticles
    process.load("FinalStateAnalysis.RecoTools.genParticleTrimmer_cfi")
    process.genParticles = process.prunedGenParticles.clone()
    if isMC:
        #process.tuplize += process.genParticles
        #output_commands.append('*_genParticles_*_%s' % process.name_())
        output_commands.append('*_genParticles_*_*')

    output_commands.append('*_tauGenJetsSelectorAllHadrons_*_*')
    output_commands.append('*_tauGenJets_*_*')
    output_commands.append('*_ak5GenJets_*_*')
    # Select vertices
    process.load("FinalStateAnalysis.RecoTools.vertexSelection_cff")
    output_commands.append('*_selectedPrimaryVertex_*_*')
    output_commands.append('*_selectPrimaryVerticesQuality_*_*')
    process.tuplize += process.selectPrimaryVertices

    # Run the ZZ recipe for rho
    from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets \
            as zzCantDoAnythingRight

    process.kt6PFJetsForIso = zzCantDoAnythingRight.clone(
        rParam=cms.double(0.6),
        doAreaFastjet=cms.bool(True),
        doRhoFastjet=cms.bool(True),
        Rho_EtaMax=cms.double(2.5),
        Ghost_EtaMax=cms.double(2.5),
    )
    process.tuplize += process.kt6PFJetsForIso

    # Standard services
    process.load('Configuration.StandardSequences.Services_cff')
    # tack on seeds for FSA PATTuple modules
    add_fsa_random_seeds(process)

    if cmssw_major_version() == 5 and cmssw_minor_version() >= 3:
        process.load('Configuration.Geometry.GeometryIdeal_cff')
    else:
        process.load('Configuration.StandardSequences.GeometryIdeal_cff')

    process.load('Configuration.StandardSequences.MagneticField_cff')
    process.load(
        'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')

    # Rerun tau ID
    if cmssw_major_version() == 4:
        process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
        # Optimization - remove PFTauTagInfo compatibility layer
        process.recoTauClassicHPSSequence.remove(
            process.pfRecoTauTagInfoProducer)
        process.recoTauClassicHPSSequence.remove(
            process.ak5PFJetTracksAssociatorAtVertex)
        assert (process.combinatoricRecoTaus.modifiers[3].name.value() ==
                'TTIworkaround')
        del process.combinatoricRecoTaus.modifiers[3]
        # Don't build junky taus below 19 GeV
        process.combinatoricRecoTaus.builders[0].minPtToBuild = cms.double(17)
        process.tuplize += process.recoTauClassicHPSSequence
    else:
        # We can run less tau stuff in 52, since HPS taus already built.
        process.load("RecoTauTag.Configuration.updateHPSPFTaus_cff")
        process.tuplize += process.updateHPSPFTaus

    ## Run rho computation.  Only necessary in 42X
    if cmssw_major_version() == 4:
        from RecoJets.Configuration.RecoPFJets_cff import kt6PFJets
        kt6PFJets.Rho_EtaMax = cms.double(4.4)
        kt6PFJets.doRhoFastjet = True
        process.kt6PFJets = kt6PFJets
        process.tuplize += process.kt6PFJets

    # In 4_X we have to rerun ak5PFJets with area computation enabled.
    if cmssw_major_version() == 4:
        process.load("RecoJets.Configuration.RecoPFJets_cff")
        process.ak5PFJets.doAreaFastjet = True
        process.tuplize += process.ak5PFJets
        # Only keep the new ak5PFJets
        output_commands.append('*_ak5PFJets_*_%s' % process.name_())
    else:
        # Just keep the normal ones
        output_commands.append('*_ak5PFJets_*_*')

    # In the embedded samples, we need to re-run the b-tagging
    if kwargs['embedded']:
        process.load('RecoBTag/Configuration/RecoBTag_cff')
        process.load('RecoJets/JetAssociationProducers/ak5JTA_cff')
        process.ak5JetTracksAssociatorAtVertex.jets = cms.InputTag("ak5PFJets")
        process.ak5JetTracksAssociatorAtVertex.tracks = cms.InputTag(
            "tmfTracks")
        process.tuplize += process.ak5JetTracksAssociatorAtVertex
        process.tuplize += process.btagging

    # Run pat default sequence
    process.load("PhysicsTools.PatAlgos.patSequences_cff")
    # Embed PF Isolation in electrons & muons
    pfTools.usePFIso(process)
    # Setup H2Tau custom iso definitions
    setup_h2tau_iso(process)
    # Setup hZg custom iso definitions
    add_hZg_iso_needs(process)

    # Use POG recommendations for (these) electron Isos
    process.elPFIsoValueGamma04PFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueGamma04NoPFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueCharged04PFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.015)')
    process.elPFIsoValueCharged04NoPFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.015)')

    # Unembed junk
    process.patMuons.embedCaloMETMuonCorrs = False
    process.patMuons.embedTcMETMuonCorrs = False
    process.patMuons.embedTrack = True
    process.patMuons.pvSrc = cms.InputTag("selectedPrimaryVertex")

    # Do extra electron ID
    process.load("FinalStateAnalysis.PatTools.electrons.electronID_cff")
    process.tuplize += process.recoElectronID
    process.patElectrons.electronIDSources = process.electronIDSources
    process.patElectrons.embedTrack = True

    # Now run PAT
    process.tuplize += process.patDefaultSequence

    # Add FSR photons for ZZ analysis
    process.load("FinalStateAnalysis.PatTools.fsrPhotons_cff")
    process.tuplize += process.fsrPhotonSequence

    # Use HPS taus
    tautools.switchToPFTauHPS(process)
    # Disable tau IsoDeposits
    process.patDefaultSequence.remove(process.patPFTauIsolation)
    process.patTaus.isoDeposits = cms.PSet()
    process.patTaus.userIsolation = cms.PSet()

    # Disable gen match embedding - we keep it in the ntuple
    process.patMuons.embedGenMatch = False
    process.patElectrons.embedGenMatch = False
    process.patTaus.embedGenMatch = False
    process.patTaus.embedGenJetMatch = False

    # Use PFJets and turn on JEC
    jec = ['L1FastJet', 'L2Relative', 'L3Absolute']
    # If we are running on data (not MC), or embedded sample,
    # apply the MC-DATA residual correction.
    if not isMC or kwargs['embedded']:
        jec.extend(['L2L3Residual'])

    # Define options for BTagging - these are release dependent.
    btag_options = {'doBTagging': True}
    if cmssw_major_version() == 5:
        btag_options['btagInfo'] = [
            'impactParameterTagInfos', 'secondaryVertexTagInfos',
            'softMuonTagInfos', 'secondaryVertexNegativeTagInfos'
        ]
        btag_options['btagdiscriminators'] = [
            'trackCountingHighEffBJetTags',
            'simpleSecondaryVertexHighEffBJetTags',
            'combinedSecondaryVertexMVABJetTags',
            'combinedSecondaryVertexBJetTags',
        ]

    # Use AK5 PFJets
    jettools.switchJetCollection(
        process,
        cms.InputTag('ak5PFJets'),
        doJTA=False,
        jetCorrLabel=('AK5PF', jec),
        #jetCorrLabel = None,
        doType1MET=False,
        doJetID=True,
        genJetCollection=cms.InputTag("ak5GenJets"),
        **btag_options)
    process.patJets.embedPFCandidates = False
    process.patJets.embedCaloTowers = False
    process.patJets.embedGenJetMatch = False
    process.patJets.addAssociatedTracks = False
    process.patJets.embedGenPartonMatch = False
    #process.patJetCorrFactors.useRho = True
    ## Let's use the same rho as in the TauID, so we don't need to do it twice.
    #process.patJetCorrFactors.rho = cms.InputTag(
    #"kt6PFJetsForRhoComputationVoronoi", "rho")

    # Use PFMEt
    mettools.addPfMET(process)
    if not isMC:
        coreTools.runOnData(process)
        process.patMETsPF.addGenMET = False
    output_commands.append('*_selectedPatJets_*_*')

    # Customize/embed all our sequences
    process.load("FinalStateAnalysis.PatTools.patJetProduction_cff")
    # We have to keep all jets (for the MVA MET...)
    process.patJetGarbageRemoval.cut = 'pt > 0'

    final_jet_collection = chain_sequence(process.customizeJetSequence,
                                          "patJets")
    process.customizeJetSequence.insert(0, process.patJets)
    # Make it a "complete" sequence
    process.customizeJetSequence += process.selectedPatJets
    # We can't mess up the selected pat jets because the taus use them.
    process.selectedPatJets.src = final_jet_collection
    process.patDefaultSequence.replace(process.patJets,
                                       process.customizeJetSequence)

    # Produce the electron collections
    process.load("FinalStateAnalysis.PatTools.patElectronProduction_cff")
    final_electron_collection = chain_sequence(
        process.customizeElectronSequence, "selectedPatElectrons")
    process.tuplize += process.customizeElectronSequence
    process.customizeElectronSequence.insert(0, process.selectedPatElectrons)
    process.patDefaultSequence.replace(process.selectedPatElectrons,
                                       process.customizeElectronSequence)
    # We have to do the pat Jets before the pat electrons since we embed them
    process.customizeElectronSequence.insert(0, process.selectedPatJets)
    process.cleanPatElectrons.src = final_electron_collection
    #setup the energy regression for the specific dataset
    process.patElectronEnergyCorrections.isMC = cms.bool(bool(isMC))
    process.patElectronEnergyCorrections.isAOD = \
                                               cms.bool(bool(kwargs['isAOD']))
    process.patElectronEnergyCorrections.dataSet = \
                                     cms.string(kwargs['calibrationTarget'])

    process.load("FinalStateAnalysis.PatTools.patMuonProduction_cff")
    final_muon_collection = chain_sequence(process.customizeMuonSequence,
                                           "selectedPatMuons")
    process.customizeMuonSequence.insert(0, process.selectedPatMuons)
    process.patDefaultSequence.replace(process.selectedPatMuons,
                                       process.customizeMuonSequence)
    process.cleanPatMuons.src = final_muon_collection
    process.patMuonRochesterCorrectionEmbedder.isMC = cms.bool(bool(isMC))

    process.load("FinalStateAnalysis.PatTools.patTauProduction_cff")
    final_tau_collection = chain_sequence(process.customizeTauSequence,
                                          "selectedPatTaus")
    # Inject into the pat sequence
    process.customizeTauSequence.insert(0, process.selectedPatTaus)
    process.patDefaultSequence.replace(process.selectedPatTaus,
                                       process.customizeTauSequence)
    process.cleanPatTaus.src = final_tau_collection
    # Remove muons and electrons
    process.cleanPatTaus.checkOverlaps.muons.requireNoOverlaps = False
    process.cleanPatTaus.checkOverlaps.electrons.requireNoOverlaps = False
    # Apply a loose preselection
    process.cleanPatTaus.preselection = 'abs(eta) < 2.5 & pt > 17'
    # Don't apply any "final" cut
    process.cleanPatTaus.finalCut = ''

    # Setup pat::Photon Production
    process.load("FinalStateAnalysis.PatTools.patPhotonProduction_cff")
    final_photon_collection = chain_sequence(process.customizePhotonSequence,
                                             "selectedPatPhotons")
    #inject photons into pat sequence
    process.customizePhotonSequence.insert(0, process.selectedPatPhotons)
    process.patDefaultSequence.replace(process.selectedPatPhotons,
                                       process.customizePhotonSequence)
    process.cleanPatPhotons.src = final_photon_collection

    # Setup MET production
    process.load("FinalStateAnalysis.PatTools.patMETProduction_cff")
    final_met_collection = chain_sequence(process.customizeMETSequence,
                                          "patMETsPF")
    process.tuplize += process.customizeMETSequence
    # The MET systematics depend on all other systematics
    process.systematicsMET.tauSrc = cms.InputTag("cleanPatTaus")
    process.systematicsMET.muonSrc = cms.InputTag("cleanPatMuons")
    process.systematicsMET.electronSrc = cms.InputTag("cleanPatElectrons")

    # Keep all the data formats needed for the systematics
    output_commands.append('recoLeafCandidates_*_*_%s' % process.name_())

    # Define the default lepton cleaning
    process.cleanPatElectrons.preselection = cms.string('pt > 5')
    process.cleanPatElectrons.checkOverlaps.muons.requireNoOverlaps = False
    # Make sure we don't kill any good taus by calling them electrons
    # Note that we don't actually remove these overlaps.
    process.cleanPatElectrons.checkOverlaps.taus = cms.PSet(
        src=final_tau_collection,
        algorithm=cms.string("byDeltaR"),
        preselection=cms.string(
            "tauID('decayModeFinding') > 0.5 &&"
            "tauID('byLooseCombinedIsolationDeltaBetaCorr') > 0.5 &&"
            "tauID('againstElectronLoose') > 0.5 && "
            "pt > 10"),
        deltaR=cms.double(0.1),
        checkRecoComponents=cms.bool(False),
        pairCut=cms.string(""),
        requireNoOverlaps=cms.bool(False),
    )

    output_commands.append('*_cleanPatTaus_*_*')
    output_commands.append('*_cleanPatElectrons_*_*')
    output_commands.append('*_cleanPatMuons_*_*')
    output_commands.append('*_cleanPatPhotons_*_*')
    output_commands.append('*_%s_*_*' % final_met_collection.value())

    trigtools.switchOnTrigger(process)

    # Now build the PATFinalStateLS object, which holds LumiSection info.
    process.load(
        "FinalStateAnalysis.PatTools.finalStates.patFinalStateLSProducer_cfi")
    process.tuplize += process.finalStateLS
    output_commands.append('*_finalStateLS_*_*')
    if isMC:
        process.finalStateLS.xSec = kwargs['xSec']

    # Tell the framework to shut up!
    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport.reportEvery = 1000

    # Which collections are used to build the final states
    fs_daughter_inputs = {
        'electrons': 'cleanPatElectrons',
        'muons': 'cleanPatMuons',
        'taus': 'cleanPatTaus',
        'photons': 'cleanPatPhotons',
        'jets': 'selectedPatJets',
        'met': final_met_collection,
    }

    # Setup all the PATFinalState objects
    produce_final_states(process, fs_daughter_inputs, output_commands,
                         process.tuplize, kwargs['puTag'])

    return process.tuplize, output_commands
コード例 #22
0
def addPlainPat(process, dataVersion, doPatTrigger=True, doPatTaus=True, doHChTauDiscriminators=True, doPatMET=True, doPatElectronID=True,
                doPatCalo=True, doBTagging=True, doPatMuonPFIsolation=False, doPatTauIsoDeposits=False,
                doTauHLTMatching=True, matchingTauTrigger=None, matchingJetTrigger=None,
                includePFCands=False):
    out = None
    outdict = process.outputModules_()
    if outdict.has_key("out"):
        out = outdict["out"]

    outputCommands = []

    # Tau Discriminators
    process.hplusPatTauSequence = cms.Sequence()
    if doPatTaus:
        process.hplusPatTauSequence = addPFTausAndDiscriminators(process, dataVersion, doPatCalo, doHChTauDiscriminators)

    # PAT Layer 0+1
    process.load("PhysicsTools.PatAlgos.patSequences_cff")

    sequence = cms.Sequence(
        process.hplusPatTauSequence
    )

    # Restrict input to AOD
    restrictInputToAOD(process, ["All"])

    # Remove MC stuff if we have collision data (has to be done any add*Collection!)
    # This also adds the L2L3Residual JEC correction to the process.patJetCorrFactors
    if dataVersion.isData():
        runOnData(process, outputInProcess = out!=None)

    # Jets
    # Produce kt6 rho for L1Fastjet
    process.load('RecoJets.Configuration.RecoPFJets_cff')
    process.kt6PFJets.doRhoFastjet = True
    process.ak5PFJets.doAreaFastjet = True
    process.ak5PFJetSequence = cms.Sequence(process.kt6PFJets * process.ak5PFJets)
   
    # Set defaults
    process.patJets.jetSource = cms.InputTag("ak5CaloJets")
    process.patJets.trackAssociationSource = cms.InputTag("ak5JetTracksAssociatorAtVertex")
    setPatJetDefaults(process.patJets)
    setPatJetCorrDefaults(process.patJetCorrFactors, dataVersion)
    process.patDefaultSequence.replace(process.patJetCorrFactors,
                                       process.ak5PFJetSequence*process.patJetCorrFactors)
    process.selectedPatJets.cut = jetPreSelection

    # The default JEC to be embedded to pat::Jets are L2Relative,
    # L3Absolute, L5Flavor and L7Parton. The default JEC to be applied
    # is L2L3Residual, or L3Absolute, or Uncorrected (in this order).

    if doPatCalo:
        # Add JPT jets
        # FIXME: Disabled for now until the JEC for JPT works again (with the latest JEC)
#        addJetCollection(process, cms.InputTag('JetPlusTrackZSPCorJetAntiKt5'),
#                         'AK5', 'JPT',
#                         doJTA        = True,
#                         doBTagging   = doBTagging,
#                         jetCorrLabel = ('AK5JPT', process.patJetCorrFactors.levels),
#                         doType1MET   = False,
#                         doL1Cleaning = False,
#                         doL1Counters = True,
#                         genJetCollection = cms.InputTag("ak5GenJets"),
#                         doJetID      = True
#        )
    
        # Add PF jets
        addJetCollection(process, cms.InputTag('ak5PFJets'),
                         'AK5', 'PF',
                         doJTA        = True,
                         doBTagging   = doBTagging,
                         jetCorrLabel = ('AK5PF', process.patJetCorrFactors.levels),
                         doType1MET   = False,
                         doL1Cleaning = False,
                         doL1Counters = True,
                         genJetCollection = cms.InputTag("ak5GenJets"),
                         doJetID      = True
        )
        setPatJetCorrDefaults(process.patJetCorrFactorsAK5PF, dataVersion, True)

    else:
        setPatJetCorrDefaults(process.patJetCorrFactors, dataVersion, True)
        switchJetCollection(process, cms.InputTag('ak5PFJets'),
                            doJTA        = True,
                            doBTagging   = doBTagging,
                            jetCorrLabel = ('AK5PF', process.patJetCorrFactors.levels),
                            doType1MET   = False,
                            genJetCollection = cms.InputTag("ak5GenJets"),
                            doJetID      = True
        )
    
    outputCommands.extend([
            "keep *_selectedPatJets_*_*",
            "keep *_selectedPatJetsAK5JPT_*_*",
            "keep *_selectedPatJetsAK5PF_*_*",
            'drop *_selectedPatJets_pfCandidates_*', ## drop for default patJets which are CaloJets
            'drop *_*PF_caloTowers_*',
            'drop *_*JPT_pfCandidates_*',
            'drop *_*Calo_pfCandidates_*',
            ])

    # Taus

    # Set default PATTauProducer options here, they should be
    # replicated to all added tau collections (and the first call to
    # addTauCollection should replace the default producer modified
    # here)
    setPatTauDefaults(process.patTaus, includePFCands)
    process.selectedPatTaus.cut = tauPreSelection

    if doPatTaus:
        if doHChTauDiscriminators:
            addHChTauDiscriminators()

        # Don't enable TCTau nor shrinking cone tau
        # if doPatCalo:
        #     tauTools.addTauCollection(process,cms.InputTag('caloRecoTauProducer'),
        #                      algoLabel = "caloReco",
        #                      typeLabel = "Tau")
        #     setPatTauDefaults(process.patTausCaloRecoTau, True)
        #     process.patTausCaloRecoTau.embedLeadTrack = not includePFCands
        #     process.patTausCaloRecoTau.embedLeadPFChargedHadrCand = False
    
        # tauTools.addTauCollection(process,cms.InputTag('shrinkingConePFTauProducer'),
        #                  algoLabel = "shrinkingCone",
        #                  typeLabel = "PFTau")
        # # Disable isoDeposits like this until the problem with doPFIsoDeposits is fixed 
        # if not doPatTauIsoDeposits:
        #     process.patTausShrinkingConePFTau.isoDeposits = cms.PSet()

        tauTools.addTauCollection(process,cms.InputTag('hpsPFTauProducer'),
                         algoLabel = "hps",
                         typeLabel = "PFTau")
        if not doPatTauIsoDeposits:
            process.patTausHpsPFTau.isoDeposits = cms.PSet()
        addPatTauIsolationEmbedding(process, process.patDefaultSequence, "HpsPFTau")

        tauTools.addTauCollection(process,cms.InputTag('hpsTancTaus'),
                                  algoLabel = "hpsTanc",
                                  typeLabel = "PFTau")
        if not doPatTauIsoDeposits:
            process.patTausHpsTancPFTau.isoDeposits = cms.PSet()
        # Disable discriminators which are not in AOD
#        del process.patTausHpsTancPFTau.tauIDSources.againstCaloMuon
#        del process.patTausHpsTancPFTau.tauIDSources.byHPSvloose
        addPatTauIsolationEmbedding(process, process.patDefaultSequence, "HpsTancPFTau")

        # Add visible taus    
        if dataVersion.isMC():
            process.VisibleTaus = cms.EDProducer("HLTTauMCProducer",
                GenParticles  = cms.untracked.InputTag("genParticles"),
                ptMinTau      = cms.untracked.double(3),
                ptMinMuon     = cms.untracked.double(3),
                ptMinElectron = cms.untracked.double(3),
                BosonID       = cms.untracked.vint32(23),
                EtaMax         = cms.untracked.double(2.5)
            )
            sequence *= process.VisibleTaus
            outputCommands.append("keep *_VisibleTaus_*_*")

    else:
        # FIXME: this is broken at the moment
        #removeSpecificPATObjects(process, ["Taus"], outputInProcess= out != None)
        process.patDefaultSequence.remove(process.patTaus)
        process.patDefaultSequence.remove(process.selectedPatTaus)

    outputCommands.extend(["drop *_selectedPatTaus_*_*",
#                           "keep *_selectedPatTausCaloRecoTau_*_*",
#                           "keep *_selectedPatTausShrinkingConePFTau_*_*",
                           "keep *_selectedPatTausHpsPFTau_*_*",
                           "keep *_selectedPatTausHpsTancPFTau_*_*",
                           #"keep *_cleanPatTaus_*_*",
                           #"drop *_cleanPatTaus_*_*",
                           #"keep *_patTaus*_*_*",
                           #"keep *_patPFTauProducerFixedCone_*_*",
                           # keep these until the embedding problem with pat::Tau is fixed
                           #"keep recoPFCandidates_particleFlow_*_*",
                           #"keep recoTracks_generalTracks_*_*"
                           ])

    # MET
    addPfMET(process, 'PF')
    if doPatCalo:
        addTcMET(process, 'TC')
    else:
        # FIXME: This is broken at the moment...
        #removeSpecificPATObjects(process, ["METs"], outputInProcess= out != None)
        #process.patDefaultSequen
        process.patDefaultSequence.remove(process.patMETCorrections)
        process.patDefaultSequence.remove(process.patMETs)
        del process.patMETCorrections
        del process.patMETs

    outputCommands.extend([
            "keep *_patMETs_*_*",
            "keep *_patMETsTC_*_*",
            "keep *_patMETsPF_*_*",
            "keep *_genMetTrue_*_*",
            ])

    # Muons
    setPatLeptonDefaults(process.patMuons, includePFCands)
    if doPatMuonPFIsolation:
        addPFMuonIsolation(process, process.patMuons, sequence, verbose=True)

    outputCommands.extend([
            "keep *_selectedPatMuons_*_*"
            ])

    # Electrons
    # In order to calculate the transverse impact parameter w.r.t.
    # beam spot instead of primary vertex, see
    setPatLeptonDefaults(process.patMuons, includePFCands)

    # Electron ID, see
    # https://twiki.cern.ch/twiki/bin/view/CMS/SimpleCutBasedEleID
    if doPatElectronID:
        addPatElectronID(process, process.patElectrons, process.patDefaultSequence)

    outputCommands.extend([
            "keep *_selectedPatElectrons_*_*"
            ])

    # Photons
#    process.patPhotons.embedGenMatch = False
    outputCommands.extend([
            "keep *_selectedPatPhotons_*_*"
            ])

    # Trigger
    if doPatTrigger:
        outMod= ''
        if out != None:
            outMod  = 'out'
        switchOnTrigger(process, hltProcess=dataVersion.getTriggerProcess(), outputModule=outMod)
        process.patTrigger.addL1Algos = cms.bool(True)
        process.patTrigger.l1ExtraMu = cms.InputTag("l1extraParticles")
        process.patTrigger.l1ExtraCenJet = cms.InputTag("l1extraParticles", "Central")
        process.patTrigger.l1ExtraTauJet = cms.InputTag("l1extraParticles", "Tau")
        process.patTrigger.l1ExtraForJet = cms.InputTag("l1extraParticles", "Forward")
        process.patTrigger.l1ExtraETM = cms.InputTag("l1extraParticles", "MET")
        process.patTrigger.l1ExtraHTM = cms.InputTag("l1extraParticles", "MHT")


        # Keep StandAlone trigger objects for enabling trigger
        # matching in the analysis phase with PAT tools
        outputCommands.extend(patTriggerStandAloneEventContent)


    # Remove cleaning step and set the event content
    if out == None:
        myRemoveCleaning(process)
    else:
        backup = out.outputCommands[:]
        myRemoveCleaning(process)
#        backup_pat = out.outputCommands[:]

        # Remove PFParticles here, they are explicitly included when needed
#        backup_pat = filter(lambda n: "selectedPatPFParticles" not in n, backup_pat)

        out.outputCommands = backup
#        out.outputCommands.extend(backup_pat)
        out.outputCommands.extend(outputCommands)

    # Build sequence
    sequence *= process.patDefaultSequence

    # Tau+HLT matching
    if doTauHLTMatching:
        sequence *= HChTriggerMatching.addTauHLTMatching(process, matchingTauTrigger, matchingJetTrigger)

    return sequence
コード例 #23
0
ファイル: shyft_data_noiso.py プロジェクト: tocheng/usercode
                                    applyfilter=cms.untracked.bool(True),
                                    debugOn=cms.untracked.bool(False),
                                    numtrack=cms.untracked.uint32(10),
                                    thresh=cms.untracked.double(0.2))

# Run b-tagging and ak5 genjets sequences on 35x inputs
from PhysicsTools.PatAlgos.tools.cmsswVersionTools import *
if use35x:
    if useData:
        run36xOn35Input(process)
    else:
        run36xOn35xInput(process, "ak5GenJets")

# switch on PAT trigger
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process)

# switch to 8e29 menu. Note this is needed to match SD production
if useData == False:
    process.patTriggerEvent.processName = cms.string('REDIGI')
    process.patTrigger.processName = cms.string('REDIGI')

process.primaryVertexFilter = cms.EDFilter(
    "GoodVertexFilter",
    vertexCollection=cms.InputTag('offlinePrimaryVertices'),
    minimumNDOF=cms.uint32(4),
    maxAbsZ=cms.double(15),
    maxd0=cms.double(2))

from PhysicsTools.PatAlgos.tools.pfTools import *
postfix = "PFlow"
コード例 #24
0
from RecoJets.Configuration.RecoPFJets_cff import kt6PFJets,ak5PFJets
process.kt6PFJetsPFlow = kt6PFJets.clone(
    src = cms.InputTag('pfNoElectron'+postfix),
    doAreaFastjet = cms.bool(True),
    doRhoFastjet = cms.bool(True)
    )
process.patJetCorrFactorsPFlow.rho = cms.InputTag("kt6PFJetsPFlow", "rho")

process.ak5PFJetsPileUp = ak5PFJets.clone( src = cms.InputTag('pfPileUp'+postfix) )


# switch on PAT trigger
# included by SFonseca
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
#switchOnTrigger( process,triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', sequence = 'patPF2PATSequence',hltProcess = 'HLT', outputModule = 'out')
switchOnTrigger( process ,sequence ='patPF2PATSequence'+postfix)
process.patTrigger.addL1Algos = cms.bool( True )
switchOnTrigger( process ,sequence = 'patPF2PATSequence'+postfix) # to fix event content
#-------------------------------------------------------------------------------------------------------------

"""
process.pileUpN1PrimaryVertices = cms.EDFilter("RecoTauPileUpVertexSelector",
    filter = cms.bool(False),
    src = cms.InputTag('goodOfflinePrimaryVertices'),
    minTrackSumPt = cms.double(0.)
    #minTrackSumPt = cms.double(5.)
    )

process.pileUpN2PrimaryVertices = process.pileUpN1PrimaryVertices.clone(
    src = cms.InputTag('pileUpN1PrimaryVertices')
    )
コード例 #25
0
## generate typeI corrected MET with x/y shift
process.pfType1XYCorrectedMet = process.pfType1CorrectedMet.clone(
	applyType0Corrections = cms.bool(False),
	srcType1Corrections = cms.VInputTag(
	cms.InputTag('pfJetMETcorr', 'type1'),        
	cms.InputTag('pfMEtSysShiftCorr')
	)
   )

process.patPFMETsTypeIXYcorrected = process.patPFMETs.clone(
    metSource = cms.InputTag('pfType1XYCorrectedMet'),
   )

#Turn on trigger info
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process, triggerProducer='patTrigger', triggerEventProducer='patTriggerEvent', sequence='patDefaultSequence', hltProcess="HLT")

process.load("Workspace.ConfigurableAnalysis.configurableAnalysis_ForPattuple_cff")
process.TFileService.fileName = cms.string(options.output)
process.load('CommonTools/RecoAlgos/HBHENoiseFilterResultProducer_cfi')
process.load('RecoMET.METAnalyzers.CSCHaloFilter_cfi')
process.load('RecoMET.METFilters.trackingFailureFilter_cfi')
process.load('RecoMET.METFilters.EcalDeadCellTriggerPrimitiveFilter_cfi')
## For AOD and RECO recommendation to use recovered rechits
process.EcalDeadCellTriggerPrimitiveFilter.tpDigiCollection = cms.InputTag("ecalTPSkimNA")
process.load('RecoMET.METFilters.inconsistentMuonPFCandidateFilter_cfi')
process.load('RecoMET.METFilters.greedyMuonPFCandidateFilter_cfi')
process.load('RecoMET.METFilters.eeNoiseFilter_cfi')
process.load('MyAnalyzers.TriggerFilter.triggerFilter_cfi')

process.scrapingVeto = cms.EDFilter("FilterOutScraping",
コード例 #26
0
    process.qualitySequence = cms.Sequence()

# Final path
process.selectBackground = cms.Path(
    process.qualitySequence *
    process.selectEnrichedEvents *  # <-- defined in filterType.py
    process.rereco * process.selectAndMatchJets * process.removeBiasedJets *
    process.preselectBackgroundJets * process.eventSampleFlag *
    process.buildTaus
    #process.backgroundJetsRecoTauPiZeros
)

# Store the trigger stuff in the event
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process,
                sequence="selectBackground",
                outputModule='',
                hltProcess=_hltProcess)

# Keep only a subset of data
poolOutputCommands = cms.untracked.vstring(
    'drop *',
    'keep patTriggerObjects_*_*_TANC',
    'keep patTriggerFilters_*_*_TANC',
    'keep patTriggerPaths_*_*_TANC',
    'keep patTriggerEvent_*_*_TANC',
    'keep PileupSummaryInfo_*_*_*',
    'keep *_ak5PFJets_*_TANC',
    'keep *_kt6PFJets_*_TANC',  # for PU subtraction
    'keep *_offlinePrimaryVertices_*_TANC',
    'keep *_offlinePrimaryVerticesDA_*_TANC',
    #'keep *_offlineBeamSpot_*_TANC',
コード例 #27
0
 
 # pf Isolation is in CMSSW7X by default, but the producers were renamed
 # eg. elPFIsoValueCharged03PFIdPFIso -> elPFIsoValueCharged03PFId (no PFIso at the end)
 
 #-- Remove MC dependencies ----------------------------
 if not options.isMC:
     from PhysicsTools.PatAlgos.tools.coreTools import *
     runOnData(process)
     # Above also adds 'L2L3Residual' corrections to Jet Correction factors
 
 #-- Jet corrections -----------------------------------
 #process.patJetCorrFactors.levels = options.jetMetCorrections
 
 #-- Trigger Match embedding ---------------------------
 from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger, switchOnTriggerMatchEmbedding
 switchOnTrigger(process, hltProcess=options.hltName)
 switchOnTriggerMatchEmbedding( process, triggerMatchers = [ 'eleTriggerMatcher', 'muonTriggerMatcher' ], hltProcess = options.hltName)
 process.patDefaultSequence += process.patTrigger
 process.patDefaultSequence += process.eleTriggerMatcher
 process.patDefaultSequence += process.muonTriggerMatcher
 process.patDefaultSequence += process.cleanPatElectronsTriggerMatch
 process.patDefaultSequence += process.cleanPatMuonsTriggerMatch
 
 #Additional electron ids as defined for VBTF
 process.load("ElectroWeakAnalysis.WENu.simpleEleIdSequence_cff")
 process.simpleEleId80relIso.src = "gedGsfElectrons"
 process.patElectrons.electronIDSources.simpleEleId80relIso = cms.InputTag("simpleEleId80relIso")
 process.patDefaultSequence.replace(process.patElectrons,process.simpleEleId80relIso+process.patElectrons)
 
 ##-- Add jet collections ------------------------------
 #from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
コード例 #28
0
#process.outpath = cms.EndPath(process.out)

#-- SUSYPAT and GlobalTag Settings -----------------------------------------------------------
#process.GlobalTag.globaltag = 'START42_V13::All' # MC Setting
from PhysicsTools.Configuration.SUSY_pattuple_cff import addDefaultSUSYPAT, getSUSY_pattuple_outputCommands

process.GlobalTag.globaltag = 'GR_R_42_V19::All' 	# Data Setting
addDefaultSUSYPAT(process,False,'HLT',['L1FastJet','L2Relative','L3Absolute','L2L3Residual'],'',['AK5PF','AK5JPT'])
process.metJESCorAK5PFTypeI.corrector = cms.string('ak5PFL2L3Residual') # Type1PFMET Residual for data only.
#addDefaultSUSYPAT(process,True,'HLT',['L1FastJet','L2Relative','L3Absolute'],'',['AK5PF','AK5JPT'])
SUSY_pattuple_outputCommands = getSUSY_pattuple_outputCommands( process )
############################## END SUSYPAT specifics ####################################

#Turn on trigger info
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process, triggerProducer='patTrigger', triggerEventProducer='patTriggerEvent', sequence='patDefaultSequence', hltProcess="HLT")

process.load("Workspace.ConfigurableAnalysis.configurableAnalysis_ForPattuple_cff")
process.load('CommonTools/RecoAlgos/HBHENoiseFilterResultProducer_cfi')

#-- Output module configuration -----------------------------------------------
process.out.fileName = "SUSYPAT.root" 
process.out.splitLevel = cms.untracked.int32(99)  # Turn on split level (smaller files???)
process.out.overrideInputFileSplitLevels = cms.untracked.bool(True)
process.out.dropMetaData = cms.untracked.string('DROPPED')   # Get rid of metadata related to dropped collections
process.out.outputCommands = cms.untracked.vstring('drop *',"keep *_HBHENoiseFilterResultProducer_*_*","keep *_BFieldColl_*_*","keep *_JetCorrectionColl_*_*", *SUSY_pattuple_outputCommands )

#-- Execution path ------------------------------------------------------------
# Full path
#This is to run on full sim or data
process.p = cms.Path(process.HBHENoiseFilterResultProducer + process.BFieldColl + process.susyPatDefaultSequence + process.JetCorrColl + process.configurableAnalysis)
def configurePatTupleProduction(process,
                                patSequenceBuilder=buildGenericTauSequence,
                                patPFTauCleanerPrototype=None,
                                patCaloTauCleanerPrototype=None,
                                addSVfitInfo=False,
                                hltProcess="HLT",
                                isMC=False,
                                applyTauVertexMatch=True):

    # check that patSequenceBuilder and patTauCleanerPrototype are defined and non-null
    if patSequenceBuilder is None:
        raise ValueError("Undefined 'patSequenceBuilder' Parameter !!")
    if patPFTauCleanerPrototype is None or patCaloTauCleanerPrototype is None:
        raise ValueError("Undefined 'patTauCleanerPrototype' Parameter !!")

    #--------------------------------------------------------------------------------
    # produce PAT objects
    #--------------------------------------------------------------------------------

    process.load("PhysicsTools.PatAlgos.patSequences_cff")
    process.load("PhysicsTools.PatAlgos.producersLayer1.tauProducer_cff")
    process.load("PhysicsTools.PatAlgos.producersLayer1.muonProducer_cff")
    process.load("PhysicsTools.PatAlgos.producersLayer1.metProducer_cff")
    process.load("TauAnalysis.CandidateTools.muTauPairProduction_cff")

    # per default, do **not** run SVfit algorithm
    if not addSVfitInfo:
        process.allMuTauPairs.doSVreco = cms.bool(False)
        process.allMuTauPairs.doPFMEtSign = cms.bool(False)
        process.allMuTauPairsLooseMuonIsolation.doSVreco = cms.bool(False)
        process.allMuTauPairsLooseMuonIsolation.doPFMEtSign = cms.bool(False)

    if not isMC:
        removeMCMatching(process, ["All"], outputModules=[])
    else:
        # match pat::Taus to all genJets
        # (including to genJets build from electrons/muons produced in tau --> e/mu decays)
        process.tauGenJetMatch.matched = cms.InputTag("tauGenJets")

    #--------------------------------------------------------------------------------
    # configure PAT trigger matching
    switchOnTrigger(process, hltProcess=hltProcess, outputModule='')
    # CV: disable L1Algos in MC for now, to prevent error messages
    #
    #     %MSG-e L1GlobalTriggerObjectMapRecord:  PATTriggerProducer:patTrigger
    #
    #       ERROR: The requested algorithm name = L1_DoubleEG1
    #       does not exists in the trigger menu.
    #       Returning zero pointer for getObjectMap
    #
    #     to be printed for every event (06/05/2011)
    #
    #     for Data the L1Algos flag needs to be enabled,
    #     in order for the prescale computation/correction for Data
    #     implemented in TauAnalysis/TauIdEfficiency/bin/FWLiteTauIdEffAnalyzer.cc to work
    if isMC:
        process.patTrigger.addL1Algos = cms.bool(False)
    else:
        process.patTrigger.addL1Algos = cms.bool(True)

    process.patTauTriggerMatchHLTprotoType = cms.EDProducer(
        "PATTriggerMatcherDRLessByR",
        src=cms.InputTag("cleanLayer1Taus"),
        matched=cms.InputTag("patTrigger"),
        matchedCuts=cms.string('path("HLT_Jet30_v*")'),
        maxDPtRel=cms.double(1.e+3),
        maxDeltaR=cms.double(0.5),
        resolveAmbiguities=cms.bool(True),
        resolveByMatchQuality=cms.bool(True))
    #--------------------------------------------------------------------------------

    #--------------------------------------------------------------------------------
    # compute Pt sum of charged + neutral hadrons and photons within isolation cones of size dR = 0.4/0.6

    process.load("RecoMuon/MuonIsolation/muonPFIsolation_cff")
    patutils.massSearchReplaceAnyInputTag(
        process.muonPFIsolationDepositsSequence, cms.InputTag('muons1stStep'),
        cms.InputTag('muons'))
    process.patMuons.isoDeposits = cms.PSet(
        # CV: strings for IsoDeposits defined in PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc
        pfChargedHadrons=cms.InputTag("muPFIsoDepositCharged"),
        pfNeutralHadrons=cms.InputTag("muPFIsoDepositNeutral"),
        pfPhotons=cms.InputTag("muPFIsoDepositGamma"),
        user=cms.VInputTag(cms.InputTag("muPFIsoDepositChargedAll"),
                           cms.InputTag("muPFIsoDepositPU")))

    process.patMuons.userIsolation = cms.PSet(
        # CV: strings for Isolation values defined in PhysicsTools/PatAlgos/src/MultiIsolator.cc
        pfChargedHadron=cms.PSet(
            deltaR=cms.double(0.4),
            src=process.patMuons.isoDeposits.pfChargedHadrons,
            vetos=process.muPFIsoValueCharged04.deposits[0].vetos,
            skipDefaultVeto=process.muPFIsoValueCharged04.deposits[0].
            skipDefaultVeto),
        pfNeutralHadron=cms.PSet(
            deltaR=cms.double(0.4),
            src=process.patMuons.isoDeposits.pfNeutralHadrons,
            vetos=process.muPFIsoValueNeutral04.deposits[0].vetos,
            skipDefaultVeto=process.muPFIsoValueNeutral04.deposits[0].
            skipDefaultVeto),
        pfGamma=cms.PSet(deltaR=cms.double(0.4),
                         src=process.patMuons.isoDeposits.pfPhotons,
                         vetos=process.muPFIsoValueGamma04.deposits[0].vetos,
                         skipDefaultVeto=process.muPFIsoValueGamma04.
                         deposits[0].skipDefaultVeto),
        user=cms.VPSet(
            cms.PSet(deltaR=cms.double(0.4),
                     src=process.patMuons.isoDeposits.user[0],
                     vetos=process.muPFIsoValueChargedAll04.deposits[0].vetos,
                     skipDefaultVeto=process.muPFIsoValueChargedAll04.
                     deposits[0].skipDefaultVeto),
            cms.PSet(deltaR=cms.double(0.4),
                     src=process.patMuons.isoDeposits.user[1],
                     vetos=process.muPFIsoValuePU04.deposits[0].vetos,
                     skipDefaultVeto=process.muPFIsoValuePU04.deposits[0].
                     skipDefaultVeto)))

    process.patMuonsWithinAcc = cms.EDFilter(
        "PATMuonSelector",
        src=cms.InputTag('patMuons'),
        cut=cms.string("pt > 15. & abs(eta) < 2.1"),
        filter=cms.bool(False))
    process.selectedPatMuonsVBTFid = cms.EDFilter(
        "PATMuonIdSelector",
        src=cms.InputTag('patMuonsWithinAcc'),
        vertexSource=cms.InputTag('selectedPrimaryVertexPosition'),
        beamSpotSource=cms.InputTag('offlineBeamSpot'),
        filter=cms.bool(False))
    #--------------------------------------------------------------------------------

    #--------------------------------------------------------------------------------
    #
    # produce collections of pat::Jets for CaloJets and PFJets
    #
    # NOTE: needed for evaluating jetId for Calo/TCTaus and PFTaus
    #
    jec = ['L1FastJet', 'L2Relative', 'L3Absolute']
    if not isMC:
        jec.extend(['L2L3Residual'])

    addJetCollection(process,
                     cms.InputTag('ak5PFJets'),
                     'AK5',
                     'PF',
                     doJTA=False,
                     doBTagging=False,
                     jetCorrLabel=('AK5PF', cms.vstring(jec)),
                     doType1MET=False,
                     genJetCollection=cms.InputTag("ak5GenJets"),
                     doJetID=True,
                     jetIdLabel="ak5",
                     outputModules=[])

    addJetCollection(process,
                     cms.InputTag('ak5CaloJets'),
                     'AK5',
                     'Calo',
                     doJTA=False,
                     doBTagging=False,
                     jetCorrLabel=('AK5Calo', cms.vstring(jec)),
                     doType1MET=False,
                     genJetCollection=cms.InputTag("ak5GenJets"),
                     doJetID=True,
                     jetIdLabel="ak5",
                     outputModules=[])
    #--------------------------------------------------------------------------------

    #--------------------------------------------------------------------------------
    #
    # configure Jet Energy Corrections
    #
    process.load("TauAnalysis.Configuration.jetCorrectionParameters_cfi")
    #--------------------------------------------------------------------------------

    #--------------------------------------------------------------------------------
    # add pfMET
    process.load("PhysicsTools.PatUtils.patPFMETCorrections_cff")
    if isMC:
        import PhysicsTools.PatAlgos.tools.helpers as configtools
        configtools.cloneProcessingSnippet(process,
                                           process.producePatPFMETCorrections,
                                           "NoSmearing")
        process.selectedPatJetsForMETtype1p2CorrNoSmearing.src = cms.InputTag(
            'patJetsNotOverlappingWithLeptonsForMEtUncertainty')
        process.selectedPatJetsForMETtype2CorrNoSmearing.src = process.selectedPatJetsForMETtype1p2CorrNoSmearing.src

    process.patMEtProductionSequence = cms.Sequence()
    process.patMEtProductionSequence += process.patDefaultSequence

    from PhysicsTools.PatUtils.tools.metUncertaintyTools import runMEtUncertainties
    doSmearJets = None
    if isMC:
        doSmearJets = True
    else:
        doSmearJets = False
    runMEtUncertainties(
        process,
        electronCollection='',
        photonCollection='',
        muonCollection=cms.InputTag('selectedPatMuonsVBTFid'),
        tauCollection='',
        jetCollection=cms.InputTag('patJetsAK5PF'),
        doSmearJets=doSmearJets,
        doApplyType0corr=True,
        sysShiftCorrParameter=None,
        doApplySysShiftCorr=False,
        # CV: shift Jet energy by 3 standard-deviations,
        #     so that template morphing remains an interpolation and no extrapolation is needed
        varyByNsigmas=3.0,
        addToPatDefaultSequence=False)

    if isMC:
        process.patPFMet.addGenMET = cms.bool(True)
        process.patPFJetMETtype1p2Corr.jetCorrLabel = cms.string("L3Absolute")

        process.patMEtProductionSequence += process.metUncertaintySequence
    else:
        process.patPFMet.addGenMET = cms.bool(False)
        process.patPFJetMETtype1p2Corr.jetCorrLabel = cms.string(
            "L2L3Residual")

        process.patMEtProductionSequence += process.patJetsAK5PFnotOverlappingWithLeptonsForMEtUncertainty
        process.patMEtProductionSequence += process.producePatPFMETCorrections
    #--------------------------------------------------------------------------------

    pfJetCollection = 'patJetsAK5PFnotOverlappingWithLeptonsForMEtUncertainty'
    pfMEtCollection = 'patType1CorrectedPFMet'
    if isMC:
        pfJetCollection = 'smearedPatJetsAK5PF'

    #--------------------------------------------------------------------------------
    #
    # produce combinations of muon + tau-jet pairs
    # for collection of pat::Tau objects representing CaloTaus
    #
    switchToCaloTau(process)
    process.patCaloTauProducer = copy.deepcopy(process.patTaus)

    retVal_caloTau = patSequenceBuilder(
        process,
        collectionName=["patCaloTaus", ""],
        jetCollectionName="patJetsAK5Calo",
        patTauProducerPrototype=process.patCaloTauProducer,
        patTauCleanerPrototype=patCaloTauCleanerPrototype,
        triggerMatcherProtoType=process.patTauTriggerMatchHLTprotoType,
        addGenInfo=isMC,
        applyTauJEC=False,
        applyTauVertexMatch=applyTauVertexMatch)
    process.caloTauSequence = retVal_caloTau["sequence"]

    process.patMuonCaloTauPairs = process.allMuTauPairs.clone(
        srcLeg1=cms.InputTag('selectedPatMuonsVBTFid'),
        srcLeg2=cms.InputTag(retVal_caloTau["collection"]),
        srcMET=cms.InputTag('patMETs'),
        srcGenParticles=cms.InputTag(''),
        doSVreco=cms.bool(False),
        doPFMEtSign=cms.bool(False))
    if hasattr(process.patMuonCaloTauPairs, "nSVfit"):
        delattr(process.patMuonCaloTauPairs, "nSVfit")
    if hasattr(process.patMuonCaloTauPairs, "pfMEtSign"):
        delattr(process.patMuonCaloTauPairs, "pfMEtSign")
    #--------------------------------------------------------------------------------

    #--------------------------------------------------------------------------------
    #
    # produce collection of pat::Tau objects representing PFTaus
    # reconstructed by fixed signal cone algorithm
    # (plus combinations of muon + tau-jet pairs)
    #
    #switchToPFTauFixedCone(process)
    #process.patPFTauProducerFixedCone = copy.deepcopy(process.patTaus)
    #
    #retVal_pfTauFixedCone = patSequenceBuilder(
    #    process,
    #    collectionName = [ "patPFTaus", "FixedCone" ],
    #    jetCollectionName = pfJetCollection,
    #    patTauProducerPrototype = process.patPFTauProducerFixedCone,
    #    patTauCleanerPrototype = patPFTauCleanerPrototype,
    #    triggerMatcherProtoType = process.patTauTriggerMatchHLTprotoType,
    #    addGenInfo = isMC,
    #    applyTauJEC = False,
    #    applyTauVertexMatch = applyTauVertexMatch
    #)
    #process.pfTauSequenceFixedCone = retVal_pfTauFixedCone["sequence"]
    #
    #process.patMuonPFTauPairsFixedCone = process.allMuTauPairs.clone(
    #    srcLeg1 = cms.InputTag('selectedPatMuonsVBTFid'),
    #    srcLeg2 = cms.InputTag(retVal_pfTauFixedCone["collection"]),
    #    srcMET = cms.InputTag(pfMEtCollection),
    #    srcGenParticles = cms.InputTag(''),
    #    doSVreco = cms.bool(False)
    #)
    #if hasattr(process.patMuonPFTauPairsFixedCone, "nSVfit"):
    #    delattr(process.patMuonPFTauPairsFixedCone, "nSVfit")
    #if hasattr(process.patMuonPFTauPairsFixedCone, "pfMEtSign"):
    #    delattr(process.patMuonPFTauPairsFixedCone, "pfMEtSign")
    #--------------------------------------------------------------------------------

    #--------------------------------------------------------------------------------
    #
    # produce collection of pat::Tau objects representing PFTaus
    # reconstructed by shrinking signal cone algorithm
    # (plus combinations of muon + tau-jet pairs)
    #
    #switchToPFTauShrinkingCone(process)
    #process.patPFTauProducerShrinkingCone = copy.deepcopy(process.patTaus)
    #
    #retVal_pfTauShrinkingCone = patSequenceBuilder(
    #    process,
    #    collectionName = [ "patPFTaus", "ShrinkingCone" ],
    #    jetCollectionName = pfJetCollection,
    #    patTauProducerPrototype = process.patPFTauProducerShrinkingCone,
    #    patTauCleanerPrototype = patPFTauCleanerPrototype,
    #    triggerMatcherProtoType = process.patTauTriggerMatchHLTprotoType,
    #    addGenInfo = isMC,
    #    applyTauJEC = False,
    #    applyTauVertexMatch = applyTauVertexMatch
    #)
    #process.pfTauSequenceShrinkingCone = retVal_pfTauShrinkingCone["sequence"]
    #
    #process.patMuonPFTauPairsShrinkingCone = process.allMuTauPairs.clone(
    #    srcLeg1 = cms.InputTag('selectedPatMuonsVBTFid'),
    #    srcLeg2 = cms.InputTag(retVal_pfTauShrinkingCone["collection"]),
    #    srcMET = cms.InputTag(pfMEtCollection),
    #    srcGenParticles = cms.InputTag(''),
    #    doSVreco = cms.bool(False)
    #)
    #if hasattr(process.patMuonPFTauPairsShrinkingCone, "nSVfit"):
    #    delattr(process.patMuonPFTauPairsShrinkingCone, "nSVfit")
    #if hasattr(process.patMuonPFTauPairsShrinkingCone, "pfMEtSign"):
    #    delattr(process.patMuonPFTauPairsShrinkingCone, "pfMEtSign")
    #--------------------------------------------------------------------------------

    #--------------------------------------------------------------------------------
    #
    # produce collection of pat::Tau objects representing PFTaus
    # reconstructed by hadron + strips (HPS) algorithm
    # (plus combinations of muon + tau-jet pairs)
    #
    # NOTE: switchToPFTauHPS function overwrites process.cleanPatTaus.preselection using HPS specific discriminators;
    #       undo overwriting, in order to prevent run-time errors in case of subsequence _switchToPFTau call,
    #       arising from the fact that HPS specific discriminators are not available for all tau types
    #
    switchToPFTauHPS(process)
    process.cleanPatTaus.preselection = cms.string('')
    process.patPFTauProducerHPS = copy.deepcopy(process.patTaus)

    retVal_pfTauHPS = patSequenceBuilder(
        process,
        collectionName=["patPFTaus", "HPS"],
        jetCollectionName=pfJetCollection,
        patTauProducerPrototype=process.patPFTauProducerHPS,
        patTauCleanerPrototype=patPFTauCleanerPrototype,
        triggerMatcherProtoType=process.patTauTriggerMatchHLTprotoType,
        addGenInfo=isMC,
        applyTauJEC=True,
        applyTauVertexMatch=applyTauVertexMatch)
    process.pfTauSequenceHPS = retVal_pfTauHPS["sequence"]

    process.patMuonPFTauPairsHPS = process.allMuTauPairs.clone(
        srcLeg1=cms.InputTag('selectedPatMuonsVBTFid'),
        srcLeg2=cms.InputTag(retVal_pfTauHPS["collection"]),
        srcMET=cms.InputTag(pfMEtCollection),
        srcGenParticles=cms.InputTag(''),
        doSVreco=cms.bool(False))
    if hasattr(process.patMuonPFTauPairsHPS, "nSVfit"):
        delattr(process.patMuonPFTauPairsHPS, "nSVfit")
    if hasattr(process.patMuonPFTauPairsHPS, "pfMEtSign"):
        delattr(process.patMuonPFTauPairsHPS, "pfMEtSign")
    #--------------------------------------------------------------------------------

    #--------------------------------------------------------------------------------
    #
    # produce collection of pat::Tau objects representing PFTaus
    # reconstructed by HPS + TaNC combined tau id. algorithm
    # (plus combinations of muon + tau-jet pairs)
    #
    switchToPFTauHPSpTaNC(process)
    process.cleanPatTaus.preselection = cms.string('')
    process.patPFTauProducerHPSpTaNC = copy.deepcopy(process.patTaus)

    retVal_pfTauHPSpTaNC = patSequenceBuilder(
        process,
        collectionName=["patPFTaus", "HPSpTaNC"],
        jetCollectionName=pfJetCollection,
        patTauProducerPrototype=process.patPFTauProducerHPSpTaNC,
        patTauCleanerPrototype=patPFTauCleanerPrototype,
        triggerMatcherProtoType=process.patTauTriggerMatchHLTprotoType,
        addGenInfo=isMC,
        applyTauJEC=True,
        applyTauVertexMatch=applyTauVertexMatch)
    process.pfTauSequenceHPSpTaNC = retVal_pfTauHPSpTaNC["sequence"]

    process.patMuonPFTauPairsHPSpTaNC = process.allMuTauPairs.clone(
        srcLeg1=cms.InputTag('selectedPatMuonsVBTFid'),
        srcLeg2=cms.InputTag(retVal_pfTauHPSpTaNC["collection"]),
        srcMET=cms.InputTag(pfMEtCollection),
        srcGenParticles=cms.InputTag(''),
        doSVreco=cms.bool(False))
    if hasattr(process.patMuonPFTauPairsHPSpTaNC, "nSVfit"):
        delattr(process.patMuonPFTauPairsHPSpTaNC, "nSVfit")
    if hasattr(process.patMuonPFTauPairsHPSpTaNC, "pfMEtSign"):
        delattr(process.patMuonPFTauPairsHPSpTaNC, "pfMEtSign")
    #--------------------------------------------------------------------------------

    process.patTupleProductionSequence = cms.Sequence(
        process.muonPFIsolationSequence + process.patDefaultSequence
        ##+ process.patTrigger + process.patTriggerEvent
        + process.patMuonsWithinAcc + process.selectedPatMuonsVBTFid +
        process.patMEtProductionSequence + process.caloTauSequence
        # store TaNC inputs as discriminators
        #+ process.produceTancMVAInputDiscriminators
        #+ process.pfTauSequenceFixedCone
        #+ process.pfTauSequenceShrinkingCone
        + process.pfTauSequenceHPS + process.pfTauSequenceHPSpTaNC +
        process.patMuonCaloTauPairs
        #+ process.patMuonPFTauPairsFixedCone
        #+ process.patMuonPFTauPairsShrinkingCone
        + process.patMuonPFTauPairsHPS + process.patMuonPFTauPairsHPSpTaNC)

    # return names of "final" collections of CaloTaus/different types of PFTaus
    # to be used as InputTag for further processing
    retVal = {}
    retVal["caloTauCollection"] = retVal_caloTau["collection"]
    retVal["muonCaloTauCollection"] = process.patMuonCaloTauPairs.label()
    #retVal["pfTauCollectionFixedCone"] = retVal_pfTauFixedCone["collection"]
    #retVal["muonPFTauCollectionFixedCone"] = process.patMuonPFTauPairsFixedCone.label()
    #retVal["pfTauCollectionShrinkingCone"] = retVal_pfTauShrinkingCone["collection"]
    #retVal["muonPFTauCollectionShrinkingCone"] = process.patMuonPFTauPairsShrinkingCone.label()
    retVal["pfTauCollectionHPS"] = retVal_pfTauHPS["collection"]
    retVal["muonPFTauCollectionHPS"] = process.patMuonPFTauPairsHPS.label()
    retVal["pfTauCollectionHPSpTaNC"] = retVal_pfTauHPSpTaNC["collection"]
    retVal[
        "muonPFTauCollectionHPSpTaNC"] = process.patMuonPFTauPairsHPSpTaNC.label(
        )
    return retVal
コード例 #30
0
def configurePatTuple(process, isMC=True, **kwargs):
    # Stuff we always keep
    output_commands = [
        '*_addPileupInfo_*_*',
        'edmMergeableCounter_*_*_*',
        '*_lumiProducer_*_*',
        '*_particleFlow_*_*',
        '*_offlineBeamSpot_*_*',
        '*_trackCandidates_*_*',
        '*_gsfTrackCandidates_*_*',
        #'*_generalTracks_*_*',
        '*_electronGsfTracks_*_*',
        '*_offlinePrimaryVertices*_*_*',
        '*_ak5PFJets_*_*',
        '*_ak5GenJets_*_*',
        '*_hltTriggerSummaryAOD_*_*',
        'edmTriggerResults_TriggerResults_*_%s' % process.name_(),
        '*_MEtoEDMConverter*_*_%s' % process.name_(),
        'LHEEventProduct_*_*_*',
        'GenEventInfoProduct_generator_*_*',
        '*_kt6PFJetsForRhoComputationVoronoi_rho_*',
        '*_kt6PFJetsForIso_rho_*',
    ]
    # Define our patTuple production sequence
    process.tuplize = cms.Sequence()
    # Only keep interesting genParticles
    process.load("FinalStateAnalysis.RecoTools.genParticleTrimmer_cfi")
    process.genParticles = process.prunedGenParticles.clone()
    if isMC:
        #process.tuplize += process.genParticles
        #output_commands.append('*_genParticles_*_%s' % process.name_())
        output_commands.append('*_genParticles_*_*')

    output_commands.append('*_tauGenJetsSelectorAllHadrons_*_*')
    output_commands.append('*_tauGenJets_*_*')
    output_commands.append('*_ak5GenJets_*_*')
    # Select vertices
    process.load("FinalStateAnalysis.RecoTools.vertexSelection_cff")
    output_commands.append('*_selectedPrimaryVertex_*_*')
    output_commands.append('*_selectPrimaryVerticesQuality_*_*')
    process.tuplize += process.selectPrimaryVertices

    # Run the ZZ recipe for rho
    from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets \
            as zzCantDoAnythingRight
    process.kt6PFJetsForIso = zzCantDoAnythingRight.clone(
        rParam = cms.double(0.6),
        doAreaFastjet = cms.bool(True),
        doRhoFastjet = cms.bool(True),
        Rho_EtaMax = cms.double(2.5),
        Ghost_EtaMax = cms.double(2.5),
    )
    process.tuplize += process.kt6PFJetsForIso

    # Rerun tau-ID
    process.load('Configuration/StandardSequences/Services_cff')
    process.load('Configuration/StandardSequences/GeometryIdeal_cff')
    process.load('Configuration/StandardSequences/MagneticField_cff')
    process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff')
    process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")

    # Optimization - remove PFTauTagInfo compatibility layer
    process.recoTauClassicHPSSequence.remove(process.pfRecoTauTagInfoProducer)
    assert(process.combinatoricRecoTaus.modifiers[3].name.value() == 'TTIworkaround')
    del process.combinatoricRecoTaus.modifiers[3]

    process.tuplize += process.recoTauClassicHPSSequence
    ## Run rho computation
    #from RecoJets.Configuration.RecoPFJets_cff import kt6PFJets
    #kt6PFJets.Rho_EtaMax = cms.double(2.5)
    #kt6PFJets.doRhoFastjet = True
    #process.kt6PFJets = kt6PFJets
    #process.tuplize += process.kt6PFJets

    # Run pat default sequence
    process.load("PhysicsTools.PatAlgos.patSequences_cff")
    # Embed PF Isolation in electrons & muons
    pfTools.usePFIso(process)
    # Custom veto cones
    process.elPFIsoValuePU04PFIdPFIso.deposits.vetos = cms.vstring()
    process.elPFIsoValueChargedAll04PFIdPFIso.deposits.vetos = cms.vstring(
        'EcalBarrel:ConeVeto(0.01)','EcalEndcaps:ConeVeto(0.015)')

    # Unembed junk
    process.patMuons.embedCaloMETMuonCorrs = False
    process.patMuons.embedTcMETMuonCorrs = False
    process.patMuons.embedTrack = True
    process.patMuons.pvSrc = cms.InputTag("selectedPrimaryVertex")

    # Do extra electron ID
    process.load("FinalStateAnalysis.PatTools.electrons.electronID_cff")
    process.tuplize += process.recoElectronID
    process.patElectrons.electronIDSources = process.electronIDSources
    process.patElectrons.embedTrack = True

    # Run EGamma electron energy calibration
    process.load("EgammaCalibratedGsfElectrons.CalibratedElectronProducers.calibratedGsfElectrons_cfi")
    process.RandomNumberGeneratorService.calibratedGsfElectrons = cms.PSet(
        initialSeed = cms.untracked.uint32(1), # A frickin billion
        engineName = cms.untracked.string('TRandom3')
    )
    process.calibratedGsfElectrons.inputDataset = kwargs['dataset']
    process.calibratedGsfElectrons.isMC = bool(isMC)
    process.calibratedGsfElectrons.isAOD = True
    process.calibratedGsfElectrons.updateEnergyError = cms.bool(True)
    # Run a sanity check on the calibration configuration.
    from FinalStateAnalysis.PatTools.electrons.patElectronEmbedCalibratedGsf_cfi \
            import validate_egamma_calib_config
    validate_egamma_calib_config(process)

    process.tuplize += process.calibratedGsfElectrons
    # Keep the calibratedGsfElectrons - we embed refs to this into the
    # pat::Electrons
    output_commands.append('*_calibratedGsfElectrons_*_*')

    # Now run PAT
    process.tuplize += process.patDefaultSequence

    # Use HPS taus
    tautools.switchToPFTauHPS(process)
    # Disable tau IsoDeposits
    process.patDefaultSequence.remove(process.patPFTauIsolation)
    process.patTaus.isoDeposits = cms.PSet()
    process.patTaus.userIsolation = cms.PSet()

    # Disable gen match embedding - we keep it in the ntuple
    process.patMuons.embedGenMatch = False
    process.patElectrons.embedGenMatch = False
    process.patTaus.embedGenMatch = False
    process.patTaus.embedGenJetMatch = False

    # Use PFJets and turn on JEC
    jec = [ 'L1FastJet', 'L2Relative', 'L3Absolute' ]
    if not isMC:
        jec.extend([ 'L2L3Residual' ])
    # Use AK5 PFJets
    jettools.switchJetCollection(process,
                                 cms.InputTag('ak5PFJets'),
                                 doJTA = False,
                                 doBTagging = True,
                                 jetCorrLabel = ('AK5PF', jec),
                                 #jetCorrLabel = None,
                                 doType1MET = False,
                                 doJetID = True,
                                 genJetCollection = cms.InputTag("ak5GenJets"))
    process.patJets.embedPFCandidates = False
    process.patJets.embedCaloTowers = False
    process.patJets.embedGenJetMatch = False
    process.patJets.addAssociatedTracks = False
    process.patJets.embedGenPartonMatch = False
    process.patJetCorrFactors.useRho = True
    # Let's use the same rho as in the TauID, so we don't need to do it twice.
    process.patJetCorrFactors.rho = cms.InputTag(
        "kt6PFJetsForRhoComputationVoronoi", "rho")

    # Use PFMEt
    mettools.addPfMET(process)
    if not isMC:
        coreTools.runOnData(process)
        process.patMETsPF.addGenMET = False
    output_commands.append('patJets_selectedPatJets_*_*')

    # Customize/embed all our sequences
    process.load("FinalStateAnalysis.PatTools.patJetProduction_cff")
    # We have to keep all jets (for the MVA MET...)
    process.patJetGarbageRemoval.cut = 'pt > 0'

    final_jet_collection = chain_sequence(
        process.customizeJetSequence, "patJets")
    process.customizeJetSequence.insert(0, process.patJets)
    # Make it a "complete" sequence
    process.customizeJetSequence += process.selectedPatJets
    # We can't mess up the selected pat jets because the taus use them.
    process.selectedPatJets.src = final_jet_collection
    process.patDefaultSequence.replace(process.patJets,
                                       process.customizeJetSequence)

    # Produce the electron collections
    process.load("FinalStateAnalysis.PatTools.patElectronProduction_cff")
    final_electron_collection = chain_sequence(
        process.customizeElectronSequence, "selectedPatElectrons")
    process.tuplize += process.customizeElectronSequence
    process.customizeElectronSequence.insert(0, process.selectedPatElectrons)
    process.patDefaultSequence.replace(process.selectedPatElectrons,
                                       process.customizeElectronSequence)
    # We have to do the pat Jets before the pat electrons since we embed them
    process.customizeElectronSequence.insert(0, process.selectedPatJets)
    process.cleanPatElectrons.src = final_electron_collection
    # The "effective area" calculation needs to know if it is data/mc, etc.
    process.patElectronMVAIsoEmbedding.target = kwargs['target']
    process.patElectronEffectiveAreaEmbedder.target = kwargs['target']

    process.load("FinalStateAnalysis.PatTools.patMuonProduction_cff")
    final_muon_collection = chain_sequence(
        process.customizeMuonSequence, "selectedPatMuons")
    process.customizeMuonSequence.insert(0, process.selectedPatMuons)
    process.patDefaultSequence.replace(process.selectedPatMuons,
                                       process.customizeMuonSequence)
    process.cleanPatMuons.src = final_muon_collection
    # The "effective area" calculation needs to know if it is data/mc, etc.
    process.patMuonMVAIdIsoEmbedding.target = kwargs['target']
    process.patMuonEffectiveAreaEmbedder.target = kwargs['target']

    process.load("FinalStateAnalysis.PatTools.patTauProduction_cff")
    final_tau_collection = chain_sequence(
        process.customizeTauSequence, "selectedPatTaus")
    # Inject into the pat sequence
    process.customizeTauSequence.insert(0, process.selectedPatTaus)
    process.patDefaultSequence.replace(process.selectedPatTaus,
                                       process.customizeTauSequence)
    process.cleanPatTaus.src = final_tau_collection
    # Remove muons and electrons
    process.cleanPatTaus.checkOverlaps.muons.requireNoOverlaps = False
    process.cleanPatTaus.checkOverlaps.electrons.requireNoOverlaps = False
    # Don't apply any prselections
    process.cleanPatTaus.preselection = 'abs(eta) < 2.5 & (pt > 18 | userFloat("jetPt") > 18)'

    # Setup MET production
    process.load("FinalStateAnalysis.PatTools.patMETProduction_cff")
    final_met_collection = chain_sequence(
        process.customizeMETSequence, "patMETsPF")
    process.tuplize += process.customizeMETSequence
    # The MET systematics depend on all other systematics
    process.systematicsMET.tauSrc = cms.InputTag("cleanPatTaus")
    process.systematicsMET.muonSrc = cms.InputTag("cleanPatMuons")
    process.systematicsMET.electronSrc = cms.InputTag("cleanPatElectrons")

    # Keep all the data formats needed for the systematics
    output_commands.append('recoLeafCandidates_*_*_%s'
                           % process.name_())

    # Define the default lepton cleaning
    process.cleanPatElectrons.preselection = cms.string('pt > 5')
    process.cleanPatElectrons.checkOverlaps.muons.requireNoOverlaps = False
    # Make sure we don't kill any good taus by calling them electrons
    # Note that we don't actually remove these overlaps.
    process.cleanPatElectrons.checkOverlaps.taus = cms.PSet(
        src = final_tau_collection,
        algorithm = cms.string("byDeltaR"),
        preselection = cms.string(
            "tauID('decayModeFinding') > 0.5 &&"
            "tauID('byLooseCombinedIsolationDeltaBetaCorr') > 0.5 &&"
            "tauID('againstElectronLoose') > 0.5 && "
            "pt > 10"
        ),
        deltaR = cms.double(0.1),
        checkRecoComponents = cms.bool(False),
        pairCut = cms.string(""),
        requireNoOverlaps = cms.bool(False),
    )

    output_commands.append('*_cleanPatTaus_*_*')
    output_commands.append('*_cleanPatElectrons_*_*')
    output_commands.append('*_cleanPatMuons_*_*')
    output_commands.append('*_%s_*_*' % final_met_collection.value())

    #process.load("PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi")
    #trigtools.switchOnTriggerMatchEmbedding(process)
    trigtools.switchOnTrigger(process)

    # Build the PATFinalStateEventObject
    process.load("FinalStateAnalysis.PatTools.finalStates.patFinalStateEventProducer_cfi")
    process.patFinalStateEventProducer.electronSrc = final_electron_collection
    process.patFinalStateEventProducer.muonSrc = cms.InputTag("cleanPatMuons")
    process.patFinalStateEventProducer.tauSrc = cms.InputTag("cleanPatTaus")
    process.patFinalStateEventProducer.jetSrc = cms.InputTag("selectedPatJets")
    process.patFinalStateEventProducer.metSrc = final_met_collection
    process.tuplize += process.patFinalStateEventProducer
    output_commands.append('*_patFinalStateEventProducer_*_*')
    process.patFinalStateEventProducer.puTag = cms.string(kwargs['puTag'])

    # Now build the PATFinalStateLS object, which holds LumiSection info.
    process.load(
        "FinalStateAnalysis.PatTools.finalStates.patFinalStateLSProducer_cfi")
    process.tuplize += process.finalStateLS
    output_commands.append('*_finalStateLS_*_*')
    if isMC:
        process.finalStateLS.xSec = kwargs['xSec']

    # Apply some loose PT cuts on the objects we use to create the final states
    # so the combinatorics don't blow up
    process.muonsForFinalStates = cms.EDFilter(
        "PATMuonRefSelector",
        src = cms.InputTag("cleanPatMuons"),
        cut = cms.string('pt > 4'),
        filter = cms.bool(False),
    )

    process.electronsForFinalStates = cms.EDFilter(
        "PATElectronRefSelector",
        src = cms.InputTag("cleanPatElectrons"),
        cut = cms.string('abs(eta) < 2.5 & pt > 4'),
        filter = cms.bool(False),
    )

    # Require that the PT of the jet (either corrected jet or tau)
    # to be greater than 17
    process.tausForFinalStates = cms.EDFilter(
        "PATTauRefSelector",
        src = cms.InputTag("cleanPatTaus"),
        cut = cms.string('abs(eta) < 2.5 & pt > 17 & tauID("decayModeFinding")'),
        filter = cms.bool(False),
    )

    process.selectObjectsForFinalStates = cms.Sequence(
        process.muonsForFinalStates
        + process.electronsForFinalStates
        + process.tausForFinalStates
    )

    process.tuplize += process.selectObjectsForFinalStates

    # Now build all of our DiLeptons and TriLepton final states
    lepton_types = [('Elec', cms.InputTag("electronsForFinalStates")),
                    ('Mu', cms.InputTag("muonsForFinalStates")),
                    ('Tau', cms.InputTag("tausForFinalStates"))]
    #lepton_types = [('Elec', cms.InputTag("cleanPatElectrons")),
                    #('Mu', cms.InputTag("cleanPatMuons")),
                    #('Tau', cms.InputTag("cleanPatTaus"))]

    process.buildDiLeptons = cms.Sequence()

    process.load(
        "FinalStateAnalysis.PatTools.finalStates.patFinalStatesEmbedExtraCollections_cfi")

    # Build di-lepton pairs
    for dilepton in _combinatorics(lepton_types, 2):
        # Don't build two jet states
        if (dilepton[0][0], dilepton[1][0]) == ('Tau', 'Tau'):
            continue

        # Define some basic selections for building combinations
        cuts = ['smallestDeltaR() > 0.3'] # basic x-cleaning

        producer = cms.EDProducer(
            "PAT%s%sFinalStateProducer" % (dilepton[0][0], dilepton[1][0]),
            evtSrc = cms.InputTag("patFinalStateEventProducer"),
            leg1Src = dilepton[0][1],
            leg2Src = dilepton[1][1],
            # X-cleaning
            cut = cms.string(' & '.join(cuts))
        )
        producer_name = "finalState%s%s" % (dilepton[0][0], dilepton[1][0])
        setattr(process, producer_name + "Raw", producer)
        process.buildDiLeptons += producer
        # Embed the other collections
        embedder_seq = helpers.cloneProcessingSnippet(process,
            process.patFinalStatesEmbedObjects, producer_name)
        process.buildDiLeptons += embedder_seq
        # Do some trickery so the final module has a nice output name
        final_module_name = chain_sequence(embedder_seq, producer_name + "Raw")
        final_module = getattr(process, final_module_name.value())
        final_module.setLabel(producer_name)
        setattr(process, producer_name, final_module)
        output_commands.append("*_%s_*_*" % producer_name)

    process.tuplize += process.buildDiLeptons
    # Build tri-lepton pairs
    process.buildTriLeptons = cms.Sequence()
    for trilepton in _combinatorics(lepton_types, 3):
        # Don't build three jet states
        if (trilepton[0][0], trilepton[1][0], trilepton[2][0]) == \
           ('Tau', 'Tau', 'Tau'):
            continue

        # Define some basic selections for building combinations
        cuts = ['smallestDeltaR() > 0.3'] # basic x-cleaning

        producer = cms.EDProducer(
            "PAT%s%s%sFinalStateProducer" %
            (trilepton[0][0], trilepton[1][0], trilepton[2][0]),
            evtSrc = cms.InputTag("patFinalStateEventProducer"),
            leg1Src = trilepton[0][1],
            leg2Src = trilepton[1][1],
            leg3Src = trilepton[2][1],
            # X-cleaning
            cut = cms.string(' & '.join(cuts))
        )
        producer_name = "finalState%s%s%s" % (
            trilepton[0][0], trilepton[1][0], trilepton[2][0])
        #setattr(process, producer_name, producer)
        #process.buildTriLeptons += producer
        setattr(process, producer_name + "Raw", producer)
        process.buildTriLeptons += producer
        # Embed the other collections
        embedder_seq = helpers.cloneProcessingSnippet(process,
            process.patFinalStatesEmbedObjects, producer_name)
        process.buildTriLeptons += embedder_seq
        # Do some trickery so the final module has a nice output name
        final_module_name = chain_sequence(embedder_seq, producer_name + "Raw")
        final_module = getattr(process, final_module_name.value())
        final_module.setLabel(producer_name)
        setattr(process, producer_name, final_module)
        output_commands.append("*_%s_*_*" % producer_name)
    process.tuplize += process.buildTriLeptons

    # Build 4 lepton final states
    process.buildQuadLeptons = cms.Sequence()
    for quadlepton in _combinatorics(lepton_types, 4):
        # Don't build states with more than 2 hadronic taus
        if [x[0] for x in quadlepton].count('Tau') > 2:
            continue

        # Define some basic selections for building combinations
        cuts = ['smallestDeltaR() > 0.3'] # basic x-cleaning

        producer = cms.EDProducer(
            "PAT%s%s%s%sFinalStateProducer" %
            (quadlepton[0][0], quadlepton[1][0], quadlepton[2][0],
             quadlepton[3][0]),
            evtSrc = cms.InputTag("patFinalStateEventProducer"),
            leg1Src = quadlepton[0][1],
            leg2Src = quadlepton[1][1],
            leg3Src = quadlepton[2][1],
            leg4Src = quadlepton[3][1],
            # X-cleaning
            cut = cms.string(' & '.join(cuts))
        )
        producer_name = "finalState%s%s%s%s" % (
            quadlepton[0][0], quadlepton[1][0], quadlepton[2][0],
            quadlepton[3][0]
        )
        #setattr(process, producer_name, producer)
        #process.buildTriLeptons += producer
        setattr(process, producer_name + "Raw", producer)
        process.buildQuadLeptons += producer
        # Embed the other collections
        embedder_seq = helpers.cloneProcessingSnippet(process,
            process.patFinalStatesEmbedObjects, producer_name)
        process.buildQuadLeptons += embedder_seq
        # Do some trickery so the final module has a nice output name
        final_module_name = chain_sequence(embedder_seq, producer_name + "Raw")
        final_module = getattr(process, final_module_name.value())
        final_module.setLabel(producer_name)
        setattr(process, producer_name, final_module)
        output_commands.append("*_%s_*_*" % producer_name)
    process.tuplize += process.buildQuadLeptons

    # Tell the framework to shut up!
    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport.reportEvery = 1000

    return process.tuplize, output_commands
コード例 #31
0
ファイル: patTuple_data_cfg.py プロジェクト: Andrej-CMS/cmssw
    process.HBHENoiseFilter*
    process.patDefaultSequence*
    process.goodPatJets
    )

# rename output file
process.out.fileName = cms.untracked.string('jet2011A_aod.root')

# reduce verbosity
process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1000)

# process all the events
process.maxEvents.input = 1000
process.options.wantSummary = True

from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
from PhysicsTools.PatAlgos.patEventContent_cff import patExtraAodEventContent
process.out.outputCommands = patEventContentNoCleaning
process.out.outputCommands += patExtraAodEventContent
process.out.outputCommands += [
    'drop patJets_selectedPatJets_*_*',
    'keep patJets_goodPatJets_*_*',
    'keep recoPFCandidates_selectedPatJets*_*_*'
    ]

# switch on PAT trigger
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger( process )
process.patTrigger.addL1Algos = cms.bool( True )
switchOnTrigger( process ) # to fix event content
コード例 #32
0
process.selectSignal = cms.Path(
    process.tauGenJets * process.trueCommonHadronicTaus *
    process.selectedTrueHadronicTaus * process.rereco *
    process.selectedRecoJets * process.recoJetsTruthMatching *
    process.signalJetsMatched * process.signalJets * process.plotSignalJets *
    process.signalJetsLeadObject * process.plotSignalJetsLeadObject *
    #process.signalJetsCollimationCut *
    process.preselectedSignalJetRefs * process.preselectedSignalJets *
    process.plotPreselectedSignalJets *
    #process.signalJetsRecoTauPiZeros *
    process.addFakeBackground * process.eventSampleFlag * process.buildTaus)

# Store the trigger stuff in the event
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process, sequence="selectSignal", outputModule='')

# Keep only a subset of data
poolOutputCommands = cms.untracked.vstring(
    'drop *',
    'keep patTriggerObjects_*_*_TANC',
    'keep patTriggerFilters_*_*_TANC',
    'keep patTriggerPaths_*_*_TANC',
    'keep patTriggerEvent_*_*_TANC',
    'keep PileupSummaryInfo_*_*_*',
    'keep *_ak5PFJets_*_TANC',
    'keep *_kt6PFJets_*_TANC',  # for PU subtraction
    'keep *_offlinePrimaryVertices_*_TANC',
    'keep *_offlineBeamSpot_*_TANC',
    'keep *_particleFlow_*_TANC',
    'keep recoTracks_generalTracks_*_TANC',
コード例 #33
0
#    )

process.load("PhysicsTools/PatAlgos/patSequences_cff")

from PhysicsTools.PatAlgos.tools.tauTools import *
switchToPFTauHPS(process) #create HPS Taus from the pat default sequence

if not runOnMC:
    _jetCorrections=('AK5PF', ['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual'])
else:
    _jetCorrections=('AK5PF', ['L1FastJet', 'L2Relative', 'L3Absolute'])


# switch on PAT trigger
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process) #create pat trigger objects
process.patTriggerSequence = cms.Sequence(
    process.patTrigger*
    process.patTriggerEvent)
process.patDefaultSequence += process.patTriggerSequence

process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")

removeMCMatching(process, ['All'])

from PhysicsTools.PatAlgos.tools.jetTools import *

#do not switch
#switchJetCollection(
#        process,
 #       cms.InputTag('ak5PFJets'),
コード例 #34
0
#--------------------------------------------------------------------------------
# define "hooks" for replacing configuration parameters
# in case running jobs on the CERN batch system
#
#__process.source.fileNames = #inputFileNames#
#__process.maxEvents.input = cms.untracked.int32(#maxEvents#)
#__setattr(process, "genPhaseSpaceCut", copy.deepcopy(#genPhaseSpaceCut#))
#__process.saveZtoMuTauPlots.outputFileName = #plotsOutputFileName#
#__#isBatchMode#
#
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# import utility function for configuring PAT trigger matching
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process, hltProcess = 'HLT', outputModule = '')
process.patTrigger.addL1Algos = cms.bool(True)
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# import utility function for switching pat::Tau input
# to different reco::Tau collection stored on AOD
from PhysicsTools.PatAlgos.tools.tauTools import * 

# comment-out to take reco::CaloTaus instead of reco::PFTaus
# as input for pat::Tau production
#switchToCaloTau(process)

# comment-out to take shrinking dR = 5.0/Et(PFTau) signal cone
# instead of fixed dR = 0.07 signal cone reco::PFTaus
# as input for pat::Tau production
コード例 #35
0
ファイル: runAHtoElecTau_cfg.py プロジェクト: nsahoo/cmssw-1
    outputModule="",
)
# --------------------------------------------------------------------------------

# --------------------------------------------------------------------------------
# import utility function for configuring PAT trigger matching
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTriggerMatching, switchOnTrigger

# make trigger-matched collections of electrons and taus
# from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanElectronTriggerMatchHLTEle27CaloIdVTCaloIsoTTrkIdTTrkIsoT
# process.cleanElectronTriggerMatchHLTElectronPlusTau = cleanElectronTriggerMatchHLTEle27CaloIdVTCaloIsoTTrkIdTTrkIsoT.clone()
# process.cleanElectronTriggerMatchHLTElectronPlusTau.matchedCuts = cms.string( 'path( "HLT_Ele*_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_*IsoPFTau20_v*" )' )
# do matching
# switchOnTriggerMatching(process, triggerMatchers = [ 'cleanElectronTriggerMatchHLTElectronPlusTau' ], hltProcess = HLTprocessName, outputModule = '')

switchOnTrigger(process, hltProcess=HLTprocessName, outputModule="")

# process.patTrigger.addL1Algos = cms.bool(True)
from TauAnalysis.Configuration.cfgOptionMethods import _setTriggerProcess

_setTriggerProcess(process, cms.InputTag("TriggerResults", "", HLTprocessName))
# --------------------------------------------------------------------------------

# --------------------------------------------------------------------------------
# import utility function for managing pat::METs
import TauAnalysis.Configuration.tools.metTools as metTools

# uncomment to add pfMET
# set Boolean swich to true in order to apply type-1 corrections
metTools.addPFMet(process, correct=False)
コード例 #36
0
# let it run

process.p = cms.Path(process.hltSelection * process.scrapingVeto *
                     process.primaryVertexFilter * process.HBHENoiseFilter *
                     process.patDefaultSequence * process.goodPatJets)

# rename output file
process.out.fileName = cms.untracked.string('jet2011A_aod.root')

# reduce verbosity
process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1000)

# process all the events
process.maxEvents.input = 1000
process.options.wantSummary = True

from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
from PhysicsTools.PatAlgos.patEventContent_cff import patExtraAodEventContent
process.out.outputCommands = patEventContentNoCleaning
process.out.outputCommands += patExtraAodEventContent
process.out.outputCommands += [
    'drop patJets_selectedPatJets_*_*', 'keep patJets_goodPatJets_*_*',
    'keep recoPFCandidates_selectedPatJets*_*_*'
]

# switch on PAT trigger
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process)
process.patTrigger.addL1Algos = cms.bool(True)
switchOnTrigger(process)  # to fix event content
コード例 #37
0
def configurePatTuple(process, isMC=True, **kwargs):
    '''
    Core function for PATTuple production
    '''
    #fix argparser output
    isMC = bool(isMC)

    ########################
    ##                    ##
    ##  PATTuple content  ##
    ##                    ##
    ########################
    # Stuff we always keep
    output_commands = [
        '*_addPileupInfo_*_*',
        'edmMergeableCounter_*_*_*',
        '*_lumiProducer_*_*',
        '*_particleFlow_*_*',
        '*_offlineBeamSpot_*_*',
        '*_generalTracks_*_*',
        '*_electronGsfTracks_*_*',
        '*_gsfElectrons_*_*',
        '*_gsfElectronCores_*_*',
        '*_offlinePrimaryVertices*_*_*',
        '*_ak5GenJets_*_*',
        '*_hltTriggerSummaryAOD_*_*',
        'edmTriggerResults_TriggerResults_*_%s' % process.name_(),
        '*_MEtoEDMConverter*_*_%s' % process.name_(),
        'LHEEventProduct_*_*_*',
        'GenEventInfoProduct_generator_*_*',
        '*_kt6PFJetsForRhoComputationVoronoi_rho_*',
        '*_kt6PFJetsForIso_rho_*',
        '*_kt6PFJets_rho_*',
        '*_kt6PFJetsHZGPho_rho_*',
        '*_kt6PFJetsCentralHZGEle_rho_*',
        '*_kt6PFJetsCentralHZGMu_rho_*',
        '*_kt6PFJetsCentralNeutralHZGMu_rho_*',
        '*_kt6PFJetsCentral_rho_*',
        '*_kt6PFJetsCentralNeutral_rho_*',  # for zz muons
        '*_photonCore_*_*',
        '*_boostedFsrPhotons_*_*',
        # for Zmumu -> embedded samples
        # https://twiki.cern.ch/twiki/bin/view/CMS/MuonTauReplacementRecHit
        '*_generalTracksORG_*_EmbeddedRECO',
        '*_electronGsfTracksORG_*_EmbeddedRECO',
        'double_TauSpinnerReco_TauSpinnerWT_EmbeddedSPIN',
        'double_ZmumuEvtSelEffCorrWeightProducer_weight_EmbeddedRECO',
        'double_muonRadiationCorrWeightProducer_weight_EmbeddedRECO',
        'GenFilterInfo_generator_minVisPtFilter_EmbeddedRECO',
    ]
    # Define our patTuple production sequence
    process.tuplize = cms.Sequence()
    # Only keep interesting genParticles
    process.load("FinalStateAnalysis.RecoTools.genParticleTrimmer_cfi")
    process.genParticles = process.prunedGenParticles.clone()
    if isMC:
        #process.tuplize += process.genParticles
        #output_commands.append('*_genParticles_*_%s' % process.name_())
        output_commands.append('*_genParticles_*_*')

    output_commands.append('*_tauGenJetsSelectorAllHadrons_*_*')
    output_commands.append('*_tauGenJets_*_*')
    output_commands.append('*_ak5GenJets_*_*')

    ########################
    ##                    ##
    ##        PAT         ##
    ##                    ##
    ########################

    # Run pat default sequence
    process.load("PhysicsTools.PatAlgos.patSequences_cff")

    # Embed PF Isolation in electrons & muons
    pfTools.usePFIso(process)
    # Setup H2Tau custom iso definitions
    setup_h2tau_iso(process)
    # Setup hZg custom iso definitions
    add_hZg_iso_needs(process)

    # Now run PAT
    process.tuplize += process.patDefaultSequence

    # Add FSR photons for ZZ analysis
    process.load("FinalStateAnalysis.PatTools.fsrPhotons_cff")
    process.tuplize += process.fsrPhotonSequence

    ########################
    ##        GEN         ##
    ########################

    # Disable gen match embedding - we keep it in the ntuple
    process.patMuons.embedGenMatch = False
    process.patElectrons.embedGenMatch = False
    process.patTaus.embedGenMatch = False
    process.patTaus.embedGenJetMatch = False
    process.patPhotons.embedGenMatch = False
    if not isMC:
        coreTools.runOnData(process)

    ########################
    ##       MUONS        ##
    ########################

    # Unembed junk
    process.patMuons.embedCaloMETMuonCorrs = False
    process.patMuons.embedTcMETMuonCorrs = False
    process.patMuons.embedTrack = True
    process.patMuons.pvSrc = cms.InputTag("selectedPrimaryVertex")

    process.load("FinalStateAnalysis.PatTools.patMuonProduction_cff")
    final_muon_collection = chain_sequence(
        process.customizeMuonSequence, "selectedPatMuons")
    process.customizeMuonSequence.insert(0, process.selectedPatMuons)
    process.patDefaultSequence.replace(process.selectedPatMuons,
                                       process.customizeMuonSequence)
    process.cleanPatMuons.src = final_muon_collection
    process.patMuonRochesterCorrectionEmbedder.isMC = cms.bool(bool(isMC))

    ########################
    ##        TAUS        ##
    ########################

    # Use HPS taus
    tautools.switchToPFTauHPS(process) #this NEEDS a sequence called patDefaultSequence
    # Disable tau IsoDeposits
    process.patDefaultSequence.remove(process.patPFTauIsolation)
    process.patTaus.isoDeposits = cms.PSet()
    process.patTaus.userIsolation = cms.PSet()

    process.load("FinalStateAnalysis.PatTools.patTauProduction_cff")
    # Require all taus to pass decay mode finding and have high PT
    process.patTauGarbageRemoval.cut = cms.string(
        "pt > 17 && abs(eta) < 2.5 && tauID('decayModeFindingNewDMs')")
    final_tau_collection = chain_sequence(
        process.customizeTauSequence, "selectedPatTaus")
    # Inject into the pat sequence
    process.customizeTauSequence.insert(0, process.selectedPatTaus)
    process.patDefaultSequence.replace(process.selectedPatTaus,
                                       process.customizeTauSequence)
    process.cleanPatTaus.src = final_tau_collection
    # Remove muons and electrons
    process.cleanPatTaus.checkOverlaps.muons.requireNoOverlaps = False
    process.cleanPatTaus.checkOverlaps.electrons.requireNoOverlaps = False
    # Cuts already applied by the garbage removal
    process.cleanPatTaus.preselection = ''
    process.cleanPatTaus.finalCut = ''

    ########################
    ##     ELECTRONS      ##
    ########################

    # Use POG recommendations for (these) electron Isos
    process.elPFIsoValueGamma04PFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueGamma04NoPFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.08)')
    process.elPFIsoValueCharged04PFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.015)')
    process.elPFIsoValueCharged04NoPFIdPFIso.deposits[0].vetos = cms.vstring(
        'EcalEndcaps:ConeVeto(0.015)')

    # Do extra electron ID
    process.load("FinalStateAnalysis.PatTools.electrons.electronID_cff")
    if cmssw_major_version() == 4:
        process.patDefaultSequence.replace(process.patElectrons,
                                           process.recoElectronID42X +
                                           process.patElectrons)
        process.patElectrons.electronIDSources = process.electronIDSources42X
    else:
        process.patDefaultSequence.replace(process.patElectrons,
                                           process.recoElectronID5YX +
                                           process.patElectrons)
        process.patElectrons.electronIDSources = process.electronIDSources5YX

    process.electronMatch.checkCharge = cms.bool(False)
    process.patElectrons.embedTrack = False
    process.patElectrons.embedPFCandidate = False
    process.patElectrons.embedGsfElectronCore = False
    process.patElectrons.embedSuperCluster = True

    # Produce the electron collections
    process.load("FinalStateAnalysis.PatTools.patElectronProduction_cff")

    # Electron Energy Regression and Calibrations
    process.load(
        "EgammaAnalysis.ElectronTools.electronRegressionEnergyProducer_cfi")
    process.load("EgammaAnalysis.ElectronTools.calibratedPatElectrons_cfi")

    #setup the energy regression for the specific dataset
    if kwargs['eleReg']:
        print "-- Applying Electron Regression and Calibration --"

        process.customizeElectronSequence += process.eleRegressionEnergy
        process.customizeElectronSequence += process.calibratedPatElectrons

        process.eleRegressionEnergy.energyRegressionType = cms.uint32(2)
        process.calibratedPatElectrons.correctionsType = cms.int32(2)

        if isMC:
            process.calibratedPatElectrons.inputDataset = cms.string(
                "Summer12_LegacyPaper")
        else:
            process.calibratedPatElectrons.inputDataset = cms.string(
                "22Jan2013ReReco")

        process.calibratedPatElectrons.combinationType = cms.int32(3)
        process.calibratedPatElectrons.lumiRatio = cms.double(1.0)
        process.calibratedPatElectrons.synchronization = cms.bool(True)
        process.calibratedPatElectrons.isMC = cms.bool(isMC == 1)
        process.calibratedPatElectrons.verbose = cms.bool(False)

    final_electron_collection = chain_sequence(
        process.customizeElectronSequence, "selectedPatElectrons",
        # Some of the EGamma modules have non-standard src InputTags,
        # specify them here.
        ("src", "inputPatElectronsTag", "inputElectronsTag")
    )

    #process.tuplize += process.customizeElectronSequence #why do we need this?
    process.customizeElectronSequence.insert(0, process.selectedPatElectrons)
    process.patDefaultSequence.replace(process.selectedPatElectrons,
                                       process.customizeElectronSequence)
    # We have to do the pat Jets before the pat electrons since we embed them
    process.customizeElectronSequence.insert(0, process.selectedPatJets)

    # Define cleanPatElectrons input collection
    process.cleanPatElectrons.src = final_electron_collection

    # Define the default lepton cleaning
    process.cleanPatElectrons.preselection = cms.string(
        'pt > 5')
    process.cleanPatElectrons.checkOverlaps.muons.requireNoOverlaps = False
    # Make sure we don't kill any good taus by calling them electrons
    # Note that we don't actually remove these overlaps.
    process.cleanPatElectrons.checkOverlaps.taus = cms.PSet(
        src=final_tau_collection,
        algorithm=cms.string("byDeltaR"),
        preselection=cms.string(
            "tauID('decayModeFinding') > 0.5 &&"
            "tauID('byLooseCombinedIsolationDeltaBetaCorr') > 0.5 &&"
            "tauID('againstElectronLoose') > 0.5 && "
            "pt > 10"
        ),
        deltaR=cms.double(0.1),
        checkRecoComponents=cms.bool(False),
        pairCut=cms.string(""),
        requireNoOverlaps=cms.bool(False),
    )

    ########################
    ##        JETS        ##
    ########################

    # Use PFJets and turn on JEC
    jec = ['L1FastJet', 'L2Relative', 'L3Absolute']
    # If we are running on data (not MC), or embedded sample,
    # apply the MC-DATA residual correction.
    if not isMC or kwargs['embedded']:
        jec.extend(['L2L3Residual'])

    # tmp
    # define the b-tag squences for offline reconstruction
    process.load("RecoBTag.SecondaryVertex.secondaryVertex_cff")
    process.load("RecoBTau.JetTagComputer.combinedMVA_cff")
    process.load('RecoVertex/AdaptiveVertexFinder/inclusiveVertexing_cff')
    process.load('RecoBTag/SecondaryVertex/bToCharmDecayVertexMerger_cfi')
    #process.load("PhysicsTools.PatAlgos.patSequences_cff")

    # Define options for BTagging - these are release dependent.
    btag_options = {'doBTagging': True}
    if cmssw_major_version() == 5:
        btag_options['btagInfo'] = [
            'impactParameterTagInfos',
            'secondaryVertexTagInfos',
            'softMuonTagInfos',
            'secondaryVertexNegativeTagInfos',
            'inclusiveSecondaryVertexFinderFilteredTagInfos'
        ]
        btag_options['btagdiscriminators'] = [
            'trackCountingHighEffBJetTags',
            'trackCountingHighPurBJetTags',    
            'simpleSecondaryVertexHighEffBJetTags',
            'simpleSecondaryVertexHighPurBJetTags',
            'simpleInclusiveSecondaryVertexHighEffBJetTags',
            'simpleInclusiveSecondaryVertexHighPurBJetTags',        
            'combinedSecondaryVertexMVABJetTags',
            'combinedSecondaryVertexBJetTags',
            'jetBProbabilityBJetTags', 
            'jetProbabilityBJetTags',   
        ]

    #Avoid embedding
    process.patJets.embedPFCandidates = True
    process.patJets.embedCaloTowers = False
    process.patJets.embedGenJetMatch = True
    process.patJets.addAssociatedTracks = True
    process.patJets.embedGenPartonMatch = True

    # Add AK5chs PFJets
    jettools.addJetCollection(
        process,
        cms.InputTag('ak5PFchsJets'),
        algoLabel = "AK5",
        typeLabel = "PFchs",
        doJTA              = True,
        jetCorrLabel       = ('AK5PFchs', jec),
        doType1MET         = False,
        doL1Cleaning       = False,
        doL1Counters       = False,
        genJetCollection   = cms.InputTag('ak5GenJets'),
        doJetID            = True,
        **btag_options
    )

    # Use AK5 PFJets
    jettools.switchJetCollection(
        process,
        cms.InputTag('ak5PFJets'),
        doJTA=True,
        jetCorrLabel=('AK5PF', jec),
        #jetCorrLabel = None,
        doType1MET=False,
        doJetID=True,
        genJetCollection=cms.InputTag("ak5GenJets"),
        **btag_options
    )

    # Customize/embed all our sequences
    process.load("FinalStateAnalysis.PatTools.patJetProduction_cff")
    helpers.cloneProcessingSnippet( process, process.customizeJetSequence, 'AK5PFchs' )
    process.patJetGarbageRemoval.cut = 'pt > 12'
    final_jet_collection = chain_sequence(
        process.customizeJetSequence, "patJets")
    process.customizeJetSequence.insert(0, process.patJets)
    # Make it a "complete" sequence
    process.customizeJetSequence += process.selectedPatJets
#    process.customizeJetSequence += process.btagging
    # We can't mess up the selected pat jets because the taus use them.
    process.selectedPatJets.src = final_jet_collection
    process.patDefaultSequence.replace(process.patJets,
                                       process.customizeJetSequence)

    process.customizeJetSequenceAK5PFchs.remove( process.patJetsPUIDAK5PFchs )
    process.customizeJetSequenceAK5PFchs.remove( process.pileupJetIdProducerAK5PFchs )
    process.patJetGarbageRemovalAK5PFchs.cut = 'pt > 20'
    process.patJetCorrFactorsAK5PFchs.payload = cms.string('AK5PFchs') 
    final_jetchs_collection = chain_sequence(
        process.customizeJetSequenceAK5PFchs, "patJetsAK5PFchs")
    process.customizeJetSequenceAK5PFchs.insert(0, process.patJetsAK5PFchs)
    # Make it a "complete" sequence
    process.customizeJetSequenceAK5PFchs += process.selectedPatJetsAK5PFchs
    # We can't mess up the selected pat jets because the taus use them.
    process.selectedPatJetsAK5PFchs.src = final_jetchs_collection
    process.selectedPatJetsAK5chsPF  = process.selectedPatJetsAK5PFchs.clone() #that's what we keep
    process.customizeJetSequenceAK5PFchs += process.selectedPatJetsAK5chsPF
    process.patDefaultSequence.replace(process.patJetsAK5PFchs,
                                       process.customizeJetSequenceAK5PFchs)

    output_commands.append('*_selectedPatJets_*_*')
    output_commands.append('*_selectedPatJetsAK5chsPF_*_*')
    output_commands.append('*SecondaryVertexTagInfo*_*_*_*')
    output_commands.append('*TrackIPTagInfo*_*_*_*')
    output_commands.append('*SoftLeptonTagInfo*_*_*_*')
    output_commands.append('*_ak5PFJets_*_*')
    output_commands.append('*_ak5PFchsJets_*_*')

    ########################
    ##        MET         ##
    ########################

    # Use PFMEt
    mettools.addPfMET(process)

    # We cut out a lot of the junky taus and jets - but we need these
    # to correctly apply the MET uncertainties.  So, let's make a
    # non-cleaned version of the jet and tau sequence.
    process.jetsForMetSyst = helpers.cloneProcessingSnippet(
        process, process.customizeJetSequence, 'ForMETSyst')
    process.tausForMetSyst = helpers.cloneProcessingSnippet(
        process, process.customizeTauSequence, 'ForMETSyst')
    # Don't apply any cut for these
    process.patTauGarbageRemovalForMETSyst.cut = ''
    process.patJetGarbageRemovalForMETSyst.cut = ''
    process.tuplize += process.jetsForMetSyst
    process.tuplize += process.tausForMetSyst
    # We have to make our clone of cleanPatTaus separately, since e/mu
    # cleaning is applied - therefore it isn't in the customizeTausSequence.
    process.cleanPatTausForMETSyst = process.cleanPatTaus.clone(
        src=cms.InputTag(process.cleanPatTaus.src.value() + "ForMETSyst"))
    process.cleanPatTausForMETSyst.preselection = ''
    process.cleanPatTausForMETSyst.finalCut = ''
    process.patTausEmbedJetInfoForMETSyst.jetSrc = \
        final_jet_collection.value() + "ForMETSyst"
    process.tuplize += process.cleanPatTausForMETSyst

    # Setup MET production
    process.load("FinalStateAnalysis.PatTools.patMETProduction_cff")
    # The MET systematics depend on all other systematics
    process.systematicsMET.tauSrc = cms.InputTag("cleanPatTausForMETSyst")
    process.systematicsMET.muonSrc = cms.InputTag("cleanPatMuons")
    process.systematicsMET.electronSrc = cms.InputTag("cleanPatElectrons")

    final_met_collection = chain_sequence(
        process.customizeMETSequence, "patMETsPF")
    process.tuplize += process.customizeMETSequence
    process.patMETsPF.addGenMET = bool(isMC)
    output_commands.append('*_%s_*_*' % final_met_collection.value())

    # Make a version with the MVA MET reconstruction method
    process.load("FinalStateAnalysis.PatTools.met.mvaMetOnPatTuple_cff")
    process.tuplize += process.pfMEtMVAsequence
    mva_met_sequence = helpers.cloneProcessingSnippet(
        process, process.customizeMETSequence, "MVA")
    final_mvamet_collection = chain_sequence(
        mva_met_sequence, "patMEtMVA")
    process.tuplize += mva_met_sequence
    output_commands.append('*_%s_*_*' % final_mvamet_collection.value())

    # Keep all the data formats needed for the systematics
    output_commands.append('recoLeafCandidates_*_*_%s'
                           % process.name_())
    # We can drop to jet and tau MET specific products. They were only used for
    # computation of the MET numbers.
    output_commands.append('drop recoLeafCandidates_*ForMETSyst_*_%s'
                           % process.name_())

    ########################
    ##      PHOTONS       ##
    ########################

    #alter the photon matching to accept various fakes
    # and sort matches by d-pt-rel
    if isMC:
        process.photonMatch = cms.EDProducer(
            "MCMatcherByPt",
            src=cms.InputTag("photons"),
            maxDPtRel=cms.double(100.0),
            mcPdgId=cms.vint32(),
            mcStatus=cms.vint32(1),
            resolveByMatchQuality=cms.bool(False),
            maxDeltaR=cms.double(0.3),
            checkCharge=cms.bool(False),
            resolveAmbiguities=cms.bool(True),
            matched=cms.InputTag("genParticles")
        )

    # Setup pat::Photon Production
    process.load("FinalStateAnalysis.PatTools.patPhotonProduction_cff")
    final_photon_collection = chain_sequence(process.customizePhotonSequence,
                                             "selectedPatPhotons")
    #setup PHOSPHOR for a specific dataset
    if cmssw_major_version() == 4:  # for now 2011 = CMSSW42X
        process.patPhotonPHOSPHOREmbedder.year = cms.uint32(2011)
    else:  # 2012 is 5YX
        process.patPhotonPHOSPHOREmbedder.year = cms.uint32(2012)
    process.patPhotonPHOSPHOREmbedder.isMC = cms.bool(bool(isMC))
    #inject photons into pat sequence
    process.customizePhotonSequence.insert(0, process.selectedPatPhotons)
    process.patDefaultSequence.replace(process.selectedPatPhotons,
                                       process.customizePhotonSequence)
    process.cleanPatPhotons.src = final_photon_collection

    ########################
    ##      TRIGGER       ##
    ########################

    trigtools.switchOnTrigger(process)

    #configure the PAT trigger
    if kwargs['HLTprocess']:
        process.patTrigger.processName = cms.string(kwargs['HLTprocess'])
        process.patTriggerEvent.processName = cms.string(kwargs['HLTprocess'])

    ########################
    ##   --------------   ##
    ########################

    output_commands.append('*_cleanPatTaus_*_*')
    output_commands.append('*_cleanPatElectrons_*_*')
    output_commands.append('*_cleanPatMuons_*_*')
    output_commands.append('*_cleanPatPhotons_*_*')

    ########################
    ##                    ##
    ##        FSA         ##
    ##                    ##
    ########################

    # Now build the PATFinalStateLS object, which holds LumiSection info.
    process.load(
        "FinalStateAnalysis.PatTools.finalStates.patFinalStateLSProducer_cfi")
    process.tuplize += process.finalStateLS
    output_commands.append('*_finalStateLS_*_*')
    if isMC:
        process.finalStateLS.xSec = kwargs['xSec']

    # Tell the framework to shut up!
    process.load("FWCore.MessageLogger.MessageLogger_cfi")
    process.MessageLogger.cerr.FwkReport.reportEvery = 1000

    # Which collections are used to build the final states
    fs_daughter_inputs = {
        'electrons':  'cleanPatElectrons',
        'muons':  'cleanPatMuons',
        'taus':  'cleanPatTaus',
        'photons':  'cleanPatPhotons',
        'jets':  'selectedPatJets',
        'pfmet':  final_met_collection,
        'mvamet':  final_mvamet_collection,
    }

    # Setup all the PATFinalState objects
    produce_final_states(process, fs_daughter_inputs, output_commands,
                         process.tuplize, kwargs['puTag'],
                         zzMode=kwargs.get('zzMode', False))

    return process.tuplize, output_commands
コード例 #38
0
# require physics declared
process.load('HLTrigger.special.hltPhysicsDeclared_cfi')
process.hltPhysicsDeclared.L1GtReadoutRecordTag = 'gtDigis'

# require scraping filter
process.scrapingVeto = cms.EDFilter("FilterOutScraping",
                                    applyfilter = cms.untracked.bool(True),
                                    debugOn = cms.untracked.bool(False),
                                    numtrack = cms.untracked.uint32(10),
                                    thresh = cms.untracked.double(0.2)
                                    )


# switch on PAT trigger
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger( process )
process.patTriggerEvent.processName = cms.string( options.hltProcess )
process.patTrigger.processName = cms.string( options.hltProcess )


process.primaryVertexFilter = cms.EDFilter("GoodVertexFilter",
                                           vertexCollection = cms.InputTag('offlinePrimaryVertices'),
                                           minimumNDOF = cms.uint32(4) ,
                                           maxAbsZ = cms.double(24.0), 
                                           maxd0 = cms.double(2) 
                                           )

# Now add the two PF sequences, one for the tight leptons, the other for the loose.
# For both, do the fastjet area calculation for possible pileup subtraction correction. 

from PhysicsTools.PatAlgos.tools.pfTools import *
コード例 #39
0
        'keep *_patTriggerEvent_*_*'))

# PAT muons
# Embed the tracker tracks (by default, every other track is already
# embedded).
process.patMuons.embedTrack = True

# Drop out-of-time photons, which break PAT (for CMSSW_9_2_X)
# process.patCandidatesTask.remove(process.makePatOOTPhotonsTask)
# process.selectedPatCandidatesTask.remove(process.selectedPatOOTPhotons)

# PAT trigger info
process.load('DisplacedDimuons.PATFilter.hltTriggerMatch_cfi')
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger, switchOnTriggerMatchEmbedding

switchOnTrigger(process, outputModule='')
# matching is probably useless for us since it works only for PAT objects
# switchOnTriggerMatchEmbedding(process,
#                               triggerProducer = 'patTrigger', # this is already the default setting
#                               triggerMatchers = [ 'muonTriggerMatchHLTMuons' ],
#                               outputModule = ''
#                               )
# This line is only needed in the "scheduled" mode
# process.patDefaultSequence = cms.Sequence(process.patDefaultSequence._seq * process.patTrigger * process.patTriggerEvent)
# Input for cleanPatMuonsTriggerMatch not found; not sure why
# process.patDefaultSequence = cms.Sequence(process.patDefaultSequence._seq * process.patTrigger * process.patTriggerEvent * process.cleanPatMuonsTriggerMatch)
# Possible alternative to the above: standalone trigger objects.  Saves ~20 kB/event in data.
# from PhysicsTools.PatAlgos.tools.trigTools import switchOnTriggerStandAlone
# switchOnTriggerStandAlone(process, outputModule = '')
# process.patDefaultSequence = cms.Sequence(process.patDefaultSequence._seq * process.patTrigger)
コード例 #40
0
#--------------------------------------------------------------------------------
# define "hooks" for replacing configuration parameters
# in case running jobs on the CERN batch system
#
#__process.source.fileNames = #inputFileNames#
#__process.maxEvents.input = cms.untracked.int32(#maxEvents#)
#__setattr(process, "genPhaseSpaceCut", copy.deepcopy(#genPhaseSpaceCut#))
#__process.saveZtoMuTauPlots.outputFileName = #plotsOutputFileName#
#__#isBatchMode#
#
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# import utility function for configuring PAT trigger matching
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process, hltProcess='HLT', outputModule='')
process.patTrigger.addL1Algos = cms.bool(True)
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# import utility function for switching pat::Tau input
# to different reco::Tau collection stored on AOD
from PhysicsTools.PatAlgos.tools.tauTools import *

# comment-out to take reco::CaloTaus instead of reco::PFTaus
# as input for pat::Tau production
#switchToCaloTau(process)

# comment-out to take shrinking dR = 5.0/Et(PFTau) signal cone
# instead of fixed dR = 0.07 signal cone reco::PFTaus
# as input for pat::Tau production
コード例 #41
0
process.selectBackground = cms.Path(
    process.trigger *
    process.dataQualityFilters *
    process.selectEnrichedEvents * # <-- defined in filterType.py
    process.rereco *
    process.selectAndMatchJets *
    process.removeBiasedJets *
    process.preselectBackgroundJets*
    process.eventSampleFlag*
    process.buildTaus
    #process.backgroundJetsRecoTauPiZeros
)

# Store the trigger stuff in the event
from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger
switchOnTrigger(process, sequence="selectBackground", outputModule='')

# Keep only a subset of data
poolOutputCommands = cms.untracked.vstring(
    'drop *',
    'keep patTriggerObjects_*_*_TANC',
    'keep patTriggerFilters_*_*_TANC',
    'keep patTriggerPaths_*_*_TANC',
    'keep patTriggerEvent_*_*_TANC',
    'keep PileupSummaryInfo_*_*_*',
    'keep *_ak5PFJets_*_TANC',
    'keep *_kt6PFJets_*_TANC', # for PU subtraction
    'keep *_offlinePrimaryVertices_*_TANC',
    'keep *_offlineBeamSpot_*_TANC',
    'keep recoTracks_generalTracks_*_TANC',
    'keep recoTracks_electronGsfTracks_*_TANC',