CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GenPlusSimParticles_cfi.py
Go to the documentation of this file.
1 # These customize functions can be used to produce or keep a GenPlusSimParticleProducer collection,
2 # which contains particles from the generator (e.g. Pythia) and simulation (i.e., GEANT).
3 #
4 # Add to the cmsDriver.py command an argument such as:
5 # --customise SimG4Core/CustomPhysics/GenPlusSimParticles_cfi.customizeProduce,SimG4Core/CustomPhysics/GenPlusSimParticles_cfi.customizeKeep
6 
7 import FWCore.ParameterSet.Config as cms
8 
9 def customizeKeep (process):
10  outputTypes = ["RAWSIM", "RECOSIM", "AODSIM", "MINIAODSIM"]
11  for a in outputTypes:
12  b = a + "output"
13  if hasattr (process, b):
14  getattr (process, b).outputCommands.append ("keep *_genParticlePlusGeant_*_*")
15 
16  return process
17 
18 
19 def customizeProduce (process):
20  process.genParticlePlusGeant = cms.EDProducer("GenPlusSimParticleProducer",
21  src = cms.InputTag("g4SimHits"), # use "famosSimHits" for FAMOS
22  setStatus = cms.int32(8), # set status = 8 for GEANT GPs
23  filter = cms.vstring("pt > 10.0"), # just for testing (optional)
24  genParticles = cms.InputTag("genParticles") # original genParticle list
25  )
26 
27  if hasattr (process, "simulation_step") and hasattr(process, "psim"):
28  getattr(process, "simulation_step")._seq = getattr(process,"simulation_step")._seq * process.genParticlePlusGeant
29 
30  return process
31