Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:19

0001 # These customize functions can be used to produce or keep a GenPlusSimParticleProducer collection,
0002 # which contains particles from the generator (e.g. Pythia) and simulation (i.e., GEANT).  
0003 #
0004 # Add to the cmsDriver.py command an argument such as:  
0005 # --customise SimG4Core/CustomPhysics/GenPlusSimParticles_cfi.customizeProduce,SimG4Core/CustomPhysics/GenPlusSimParticles_cfi.customizeKeep
0006 
0007 import FWCore.ParameterSet.Config as cms
0008 
0009 def customizeKeep (process):
0010   outputTypes = ["RAWSIM", "RECOSIM", "AODSIM", "MINIAODSIM"]
0011   for a in outputTypes:
0012     b = a + "output"
0013     if hasattr (process, b):
0014       getattr (process, b).outputCommands.append ("keep *_genParticlePlusGeant_*_*")
0015 
0016   return process
0017 
0018 
0019 def customizeProduce (process):
0020     process.genParticlePlusGeant = cms.EDProducer("GenPlusSimParticleProducer",
0021                                                   src = cms.InputTag("g4SimHits"),            # use "fastSimProducer" for FastSim
0022                                                   setStatus = cms.int32(8),                   # set status = 8 for GEANT GPs 
0023                                                   filter = cms.vstring("pt > 10.0"),          # just for testing (optional) 
0024                                                   genParticles = cms.InputTag("genParticles") # original genParticle list 
0025                                                   )  
0026 
0027     if hasattr (process, "simulation_step") and hasattr(process, "psim"):
0028       getattr(process, "simulation_step")._seq = getattr(process,"simulation_step")._seq * process.genParticlePlusGeant   
0029 
0030     return process 
0031