Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:26

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("TestGenParticlePruner")
0004 
0005 process.include( "FWCore/MessageLogger/data/MessageLogger.cfi" )
0006 process.include( "SimGeneral/HepPDTESSource/data/pythiapdt.cfi" )
0007 
0008 process.maxEvents = cms.untracked.PSet(
0009     input = cms.untracked.int32(50)
0010 )
0011 
0012 process.source = cms.Source(
0013     "PoolSource",
0014     fileNames = cms.untracked.vstring("file:genevents.root")
0015 )
0016 
0017 process.out = cms.OutputModule( "PoolOutputModule",
0018   fileName = cms.untracked.string( "genevents_pruned.root" ),
0019   outputCommands= cms.untracked.vstring(
0020     "drop *",
0021     "keep *_genParticles_*_*"
0022   )
0023 )
0024 
0025 process.prunedGenParticles = cms.EDProducer(
0026     "GenParticlePruner",
0027     src = cms.InputTag("genParticles"),
0028     select = cms.vstring(
0029     "drop  *  ", # this is the default
0030     "keep++ pdgId = {Z0}",
0031     "drop pdgId = {Z0} & status = 2"
0032     )
0033 )
0034 
0035 process.printPrunedTree = cms.EDAnalyzer(
0036     "ParticleTreeDrawer",
0037     src = cms.InputTag("prunedGenParticles"),
0038     printIndex = cms.untracked.bool(True),
0039     printStatus = cms.untracked.bool(True)
0040 )
0041 
0042 process.p = cms.Path(
0043     process.prunedGenParticles *
0044     process.printPrunedTree
0045 )
0046 
0047 process.o = cms.EndPath(
0048     process.out 
0049 )