CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MixingModule_Full2Fast.py
Go to the documentation of this file.
2 
3 # this function serves gen-level PU mixing
4 # it sets the parameters of the vertex generator of the PileUpProducer to the parameters of process.VtxSmeared
5 # process.VtxSmeared is the vertex generator used to smear the vertex of the signal events
7 
8  # get right vertex generator parameters
9  if not hasattr(process,"VtxSmeared"):
10  "WARNING: no vtx smearing applied (ok for steps other than SIM)"
11  return process
12 
13  vertexGenerator = process.VtxSmeared
14  vertexGeneratorParameterNames = vertexGenerator.parameterNames_()
15  vertexGeneratorType = vertexGenerator.type_()
16 
17  # set vertex generator parameters in PileUpProducer
18  vertexParameters = cms.PSet()
19  for name in vertexGeneratorParameterNames:
20  exec("vertexParameters.{0} = {1}".format(name,getattr(vertexGenerator,name).dumpPython()))
21 
22  if vertexGeneratorType.find("Betafunc") == 0:
23  vertexParameters.type = cms.string("BetaFunc")
24  elif vertexGeneratorType.find("Flat") == 0:
25  vertexParameters.type = cms.string("Flat")
26  elif vertexGeneratorType.find("Gauss"):
27  vertexParameters.type = cms.string("Gaussian")
28  else:
29  raise Error("WARNING: given vertex generator type for vertex smearing is not supported")
30 
31  # add parameters to PileUpProducer
32  process.famosPileUp.VertexGenerator = vertexParameters
33 
34  return process
35 
36