smeartool.tVertexSigma = 180.0 * units.picosecond from Configurables import PythiaInterface pythia8gentool = PythiaInterface() ### Example of pythia configuration file to generate events # take from $K4GEN if defined, locally if not path_to_pythiafile = os.environ.get("K4GEN", "") pythiafilename = "Pythia_standard.cmd" pythia8gentool.pythiacard = os.path.join(path_to_pythiafile, pythiafilename) pythia8gentool.doEvtGenDecays = False pythia8gentool.printPythiaStatistics = True from Configurables import GenAlg pythia8gen = GenAlg("Pythia8") pythia8gen.SignalProvider = pythia8gentool pythia8gen.VertexSmearingTool = smeartool pythia8gen.hepmc.Path = "hepmc" ApplicationMgr().TopAlg += [pythia8gen] ### Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter() hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.hepmcStatusList = [] # convert particles with all statuses hepmc_converter.GenParticles.Path = "GenParticles" ApplicationMgr().TopAlg += [hepmc_converter] ### Filters generated particles # accept is a list of particle statuses that should be accepted from Configurables import GenParticleFilter genfilter = GenParticleFilter("StableParticles")
smeartool = GaussSmearVertex() smeartool.xVertexSigma = 0.5 * units.mm smeartool.yVertexSigma = 0.5 * units.mm smeartool.zVertexSigma = 40.0 * units.mm smeartool.tVertexSigma = 180.0 * units.picosecond from Configurables import ConstPtParticleGun pgun_tool = ConstPtParticleGun() pgun_tool.PdgCodes = [13] pgun_tool.PhiMin = 0.0 pgun_tool.PhiMax = constants.twopi from Configurables import GenAlg genalg_pgun = GenAlg() genalg_pgun.SignalProvider = ConstPtParticleGun('ToolSvc.ConstPtParticleGun') genalg_pgun.VertexSmearingTool = smeartool genalg_pgun.hepmc.Path = "hepmc" ApplicationMgr().TopAlg += [genalg_pgun] from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter() hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.genparticles.Path = "GenParticlesAll" hepmc_converter.genvertices.Path = "GenVertices" ApplicationMgr().TopAlg += [hepmc_converter] from Configurables import GenParticleFilter ### Filters generated particles # accept is a list of particle statuses that should be accepted genfilter = GenParticleFilter("StableParticleFilter") genfilter.accept = [1]
guntool = MomentumRangeParticleGun() guntool.ThetaMin = 0 guntool.ThetaMax = 2 * constants.pi guntool.PdgCodes = [11] from Configurables import FlatSmearVertex vertexsmeartool = FlatSmearVertex() vertexsmeartool.xVertexMin = -25. vertexsmeartool.xVertexMax = 25. vertexsmeartool.yVertexMin = -25. vertexsmeartool.yVertexMax = 25. vertexsmeartool.zVertexMin = -25. vertexsmeartool.zVertexMax = 25. from Configurables import GenAlg gen = GenAlg() gen.SignalProvider = guntool gen.VertexSmearingTool = vertexsmeartool gen.hepmc.Path = "hepmc" # reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.genparticles.Path = "allGenParticles" hepmc_converter.genvertices.Path = "allGenVertices" # DD4hep geometry service # Parses the given xml file from Configurables import GeoSvc geoservice = GeoSvc( "GeoSvc", detectors=[