from Gaudi.Configuration import * from Configurables import ParticleGunAlg, MomentumRangeParticleGun, Gaudi__ParticlePropertySvc pgun = MomentumRangeParticleGun( "PGun", PdgCodes=[11], # electron MomentumMin=10, # GeV MomentumMax=10, # GeV ThetaMin=-0.45, # rad ThetaMax=-0.45, # rad PhiMin=1.6, # rad PhiMax=1.6) # rad gen = ParticleGunAlg("ParticleGun", ParticleGunTool=pgun) gen.DataOutputs.hepmc.Path = "hepmc" ppservice = Gaudi__ParticlePropertySvc( "ParticlePropertySvc", ParticlePropertiesFile="../../../Generation/data/ParticleTable.txt") from Configurables import HepMCConverter hepmc_converter = HepMCConverter("Converter") hepmc_converter.DataInputs.hepmc.Path = "hepmc" hepmc_converter.DataOutputs.genparticles.Path = "allGenParticles" hepmc_converter.DataOutputs.genvertices.Path = "allGenVertices" from Configurables import HepMCDumper hepmc_dump = HepMCDumper("hepmc") hepmc_dump.DataInputs.hepmc.Path = "hepmc" from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc", detectors=['file:compact/Box_dd4hepCaloSD.xml'],
from Gaudi.Configuration import * from Configurables import ApplicationMgr, THistSvc, Gaudi__ParticlePropertySvc from Configurables import HepMCDumper, ParticleGunAlg, MomentumRangeParticleGun, HepMCHistograms, FlatSmearVertex dumper = HepMCDumper("Dumper") dumper.Inputs.hepmc.Path="hepmc" particlePropertySvc = Gaudi__ParticlePropertySvc("ParticlePropertySvc") guntool = MomentumRangeParticleGun() gun = ParticleGunAlg("gun", ParticleGunTool = "MomentumRangeParticleGun", VertexSmearingTool = "FlatSmearVertex" ) gun.Outputs.hepmc.Path = "hepmc" gun.addTool(FlatSmearVertex, name="FlatSmearVertex") gun.FlatSmearVertex.xVertexMin = -10 gun.FlatSmearVertex.xVertexMax = 10 gun.FlatSmearVertex.yVertexMin = -10 gun.FlatSmearVertex.yVertexMax = 10 gun.FlatSmearVertex.zVertexMin = -30 gun.FlatSmearVertex.zVertexMax = 30 histo = HepMCHistograms("GenHistograms") histo.Inputs.hepmc.Path="hepmc" THistSvc().Output = ["rec DATAFILE='GenHistograms.root' TYP='ROOT' OPT='RECREATE'"] THistSvc().PrintAll=True THistSvc().AutoSave=True THistSvc().AutoFlush=True THistSvc().OutputLevel=VERBOSE
### |-------------------------------|----------------------------------|---------------------------------------------------------|------------------------|----------------------------------|-----------------------------------------------| ### | generating single particle events from a given list of types, with momentum, phi and theta from a given range, saving to HepMC | convert `HepMC::GenEvent` to EDM | geometry parsed from XML (TestHCal.xml) by DD4hep using GeoSvc | FTFP_BERT physics list | saving HCal hits | write the EDM output to ROOT file using PODIO | from Gaudi.Configuration import * from Configurables import FCCDataSvc ## Data service podioevent = FCCDataSvc("EventDataSvc") from Configurables import ParticleGunAlg ## Particle Gun using MomentumRangeParticleGun tool and FlatSmearVertex # MomentumRangeParticleGun generates particles of given type(s) within given momentum, phi and theta range # FlatSmearVertex smears the vertex with uniform distribution gen = ParticleGunAlg("ParticleGun", ParticleGunTool="MomentumRangeParticleGun", VertexSmearingToolPGun="FlatSmearVertex") gen.DataOutputs.hepmc.Path = "hepmc" from Configurables import Gaudi__ParticlePropertySvc ## Particle service # list of possible particles is defined in ParticlePropertiesFile ppservice = Gaudi__ParticlePropertySvc("ParticlePropertySvc", ParticlePropertiesFile="Generation/data/ParticleTable.txt") from Configurables import HepMCConverter ## Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles hepmc_converter = HepMCConverter("Converter") hepmc_converter.DataInputs.hepmc.Path="hepmc" hepmc_converter.DataOutputs.genparticles.Path="allGenParticles" hepmc_converter.DataOutputs.genvertices.Path="allGenVertices" from Configurables import GeoSvc
from Gaudi.Configuration import * from Configurables import ApplicationMgr, HepMCReader, HepMCDumper from Configurables import ParticleGunAlg, MomentumRangeParticleGun pgun = MomentumRangeParticleGun( "PGun", PdgCodes=[11], # electron MomentumMin=20, # GeV MomentumMax=20, # GeV ThetaMin=1.58, # rad ThetaMax=1.58, # rad PhiMin=0, # rad PhiMax=0) # rad gen = ParticleGunAlg("ParticleGun", ParticleGunTool=pgun, VertexSmearingToolPGun="FlatSmearVertex") gen.DataOutputs.hepmc.Path = "hepmc" from Configurables import Gaudi__ParticlePropertySvc ## Particle service # list of possible particles is defined in ParticlePropertiesFile ppservice = Gaudi__ParticlePropertySvc( "ParticlePropertySvc", ParticlePropertiesFile="Generation/data/ParticleTable.txt") from Configurables import HepMCConverter hepmc_converter = HepMCConverter("Converter") hepmc_converter.DataInputs.hepmc.Path = "hepmc" hepmc_converter.DataOutputs.genparticles.Path = "allGenParticles"
from Gaudi.Configuration import * from Configurables import ApplicationMgr, THistSvc, Gaudi__ParticlePropertySvc from Configurables import HepMCDumper, ParticleGunAlg, MomentumRangeParticleGun, HepMCHistograms, FlatSmearVertex dumper = HepMCDumper("Dumper") dumper.Inputs.hepmc.Path = "hepmc" particlePropertySvc = Gaudi__ParticlePropertySvc("ParticlePropertySvc") guntool = MomentumRangeParticleGun() gun = ParticleGunAlg("gun", ParticleGunTool="MomentumRangeParticleGun", VertexSmearingTool="FlatSmearVertex") gun.Outputs.hepmc.Path = "hepmc" gun.addTool(FlatSmearVertex, name="FlatSmearVertex") gun.FlatSmearVertex.xVertexMin = -10 gun.FlatSmearVertex.xVertexMax = 10 gun.FlatSmearVertex.yVertexMin = -10 gun.FlatSmearVertex.yVertexMax = 10 gun.FlatSmearVertex.zVertexMin = -30 gun.FlatSmearVertex.zVertexMax = 30 histo = HepMCHistograms("GenHistograms") histo.Inputs.hepmc.Path = "hepmc" THistSvc().Output = [ "rec DATAFILE='GenHistograms.root' TYP='ROOT' OPT='RECREATE'" ]
particlePropertySvc = Gaudi__ParticlePropertySvc( "ParticlePropertySvc", ParticlePropertiesFile='Generation/data/ParticleTable.txt') guntool = MomentumRangeParticleGun(PdgCodes=[-211, 211, -11, -13, 13, 11]) smeartool = FlatSmearVertex("smeartoolname") # FCCSW standard unit of length: [mm] smeartool.xVertexMin = -10 smeartool.xVertexMax = 10 smeartool.yVertexMin = -10 smeartool.yVertexMax = 10 smeartool.zVertexMin = -30 smeartool.zVertexMax = 30 gun = ParticleGunAlg("gun", ParticleGunTool=guntool, VertexSmearingToolPGun=smeartool) gun.DataOutputs.hepmc.Path = "hepmc" from Configurables import HepMCConverter hepmc_converter = HepMCConverter("Converter") hepmc_converter.DataInputs.hepmc.Path = "hepmc" hepmc_converter.DataOutputs.genparticles.Path = "allGenParticles" hepmc_converter.DataOutputs.genvertices.Path = "allGenVertices" histo = HepMCHistograms("GenHistograms") histo.DataInputs.hepmc.Path = "hepmc" THistSvc().Output = [ "rec DATAFILE='GenHistograms.root' TYP='ROOT' OPT='RECREATE'" ]