Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:02

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("Test")
0004 
0005 #------------------------------------------------------------------------------------------------------
0006 # To configure the Matching, we have to configure the PAT-Workflow starting from the patDefaultSequence:
0007 #------------------------------------------------------------------------------------------------------
0008 
0009 from PhysicsTools.PatAlgos.patTemplate_cfg import *
0010 
0011 ## increase the number of events a bit
0012 process.maxEvents.input = 1000
0013 
0014 ## add inFlightMuons
0015 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0016 process.inFlightMuons = cms.EDProducer("PATGenCandsFromSimTracksProducer",
0017         src           = cms.InputTag("g4SimHits"),   ## use "fastSimProducer" for FastSim
0018         setStatus     = cms.int32(-1),
0019         particleTypes = cms.vstring("mu+"),          ## picks also mu-, of course
0020         filter        = cms.vstring("pt > 0.5"),     ## just for testing
0021         makeMotherLink = cms.bool(True),
0022         writeAncestors = cms.bool(True),             ## save also the intermediate GEANT ancestors of the muons
0023         genParticles   = cms.InputTag("genParticles"),
0024 )
0025 ## prepare several clones of match associations for status 1, 3 and in flight muons (status -1)
0026 process.muMatch3 = process.muonMatch.clone(mcStatus = [3]) # hard scattering
0027 process.muMatch1 = process.muonMatch.clone(mcStatus = [1]) # stable
0028 
0029 
0030 ## add the new matches to the default sequence
0031 process.patDefaultSequence.replace(process.muonMatch,
0032                                    process.muMatch1 +
0033                                    process.muMatch3
0034 )
0035 
0036 process.patMuons.genParticleMatch = cms.VInputTag(
0037     cms.InputTag("muMatch3"),
0038     cms.InputTag("muMatch1")
0039 )
0040 
0041 
0042 #-----------------------------------------
0043 # As usual add those two usefull things:
0044 #----------------------------------------
0045 
0046 process.TFileService = cms.Service("TFileService",
0047   fileName = cms.string('analyzePatMCMatching.root')
0048 )
0049 
0050 process.MessageLogger = cms.Service("MessageLogger")
0051 
0052 
0053 #----------------------------------------------------------------------
0054 # Finally let's analyze the matching and run all that in correct order:
0055 #----------------------------------------------------------------------
0056 
0057 process.analyzePatMCMatching = cms.EDAnalyzer("PatMCMatching",
0058   muonSrc     = cms.untracked.InputTag("cleanPatMuons")                                             
0059 )
0060 
0061 
0062 process.outpath.remove(process.out)
0063 
0064 process.p = cms.Path(process.patDefaultSequence + process.analyzePatMCMatching)
0065 
0066 del(process.out)
0067 del(process.outpath)
0068