Skip to content

Commit

Permalink
Merge pull request #11083 from wulsin/addGenPlusSimParticles76X
Browse files Browse the repository at this point in the history
Add customize configuration file to produce/keep a collection of part…
  • Loading branch information
cmsbuild committed Sep 8, 2015
2 parents d5d4133 + 4659405 commit 0253050
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions SimG4Core/CustomPhysics/python/GenPlusSimParticles_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# These customize functions can be used to produce or keep a GenPlusSimParticleProducer collection,
# which contains particles from the generator (e.g. Pythia) and simulation (i.e., GEANT).
#
# Add to the cmsDriver.py command an argument such as:
# --customise SimG4Core/CustomPhysics/GenPlusSimParticles_cfi.customizeProduce,SimG4Core/CustomPhysics/GenPlusSimParticles_cfi.customizeKeep

import FWCore.ParameterSet.Config as cms

def customizeKeep (process):
outputTypes = ["RAWSIM", "RECOSIM", "AODSIM", "MINIAODSIM"]
for a in outputTypes:
b = a + "output"
if hasattr (process, b):
getattr (process, b).outputCommands.append ("keep *_genParticlePlusGeant_*_*")

return process


def customizeProduce (process):
process.genParticlePlusGeant = cms.EDProducer("GenPlusSimParticleProducer",
src = cms.InputTag("g4SimHits"), # use "famosSimHits" for FAMOS
setStatus = cms.int32(8), # set status = 8 for GEANT GPs
filter = cms.vstring("pt > 10.0"), # just for testing (optional)
genParticles = cms.InputTag("genParticles") # original genParticle list
)

if hasattr (process, "simulation_step") and hasattr(process, "psim"):
getattr(process, "simulation_step")._seq = getattr(process,"simulation_step")._seq * process.genParticlePlusGeant

return process

0 comments on commit 0253050

Please sign in to comment.