from Gaudi.Configuration import * from Configurables import FCCDataSvc podioevent = FCCDataSvc("EventDataSvc") ################## Particle gun setup _pi = 3.14159 from Configurables import MomentumRangeParticleGun pgun = MomentumRangeParticleGun("ParticleGun_Electron") pgun.PdgCodes = [11] pgun.MomentumMin = momentum * GeV pgun.MomentumMax = momentum * GeV pgun.PhiMin = 0 pgun.PhiMax = 2 * _pi pgun.ThetaMin = thetaMin * _pi / 180. pgun.ThetaMax = thetaMax * _pi / 180. from Configurables import GenAlg genalg_pgun = GenAlg() genalg_pgun.SignalProvider = pgun genalg_pgun.hepmc.Path = "hepmc" from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter() hepmc_converter.hepmc.Path="hepmc" hepmc_converter.GenParticles.Path="GenParticles" ################## Simulation setup # Detector geometry from Configurables import GeoSvc
from Gaudi.Configuration import * # Data service from Configurables import FCCDataSvc podioevent = FCCDataSvc("EventDataSvc") from Configurables import MomentumRangeParticleGun from GaudiKernel import PhysicalConstants as constants guntool = MomentumRangeParticleGun() guntool.ThetaMin = 0 guntool.ThetaMax = 2 * constants.pi guntool.PdgCodes = [11] from Configurables import GenAlg gen = GenAlg() gen.SignalProvider = guntool 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=[ 'file:Detector/DetFCChhBaseline1/compact/FCChh_DectEmptyMaster.xml',
help='specify compact file for the geometry') args, _ = parser.parse_known_args() from Gaudi.Configuration import * # Data service from Configurables import FCCDataSvc podioevent = FCCDataSvc("EventDataSvc") from Configurables import GenAlg, MomentumRangeParticleGun ## 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 pgun_tool = MomentumRangeParticleGun(PdgCodes=[13, -13]) pgun_tool.ThetaMin = 0.0 pgun_tool.ThetaMax = 2 * 3.14 gen = GenAlg("ParticleGun", SignalProvider=pgun_tool, VertexSmearingTool="FlatSmearVertex") gen.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") # DD4hep geometry service # Parses the given xml file
from Gaudi.Configuration import * from Configurables import ApplicationMgr, HepMCDumper from Configurables import MomentumRangeParticleGun from GaudiKernel import PhysicalConstants as constants guntool = MomentumRangeParticleGun("Gun2") guntool.ThetaMin = 0 guntool.ThetaMax = 2 * constants.pi guntool.PdgCodes = [11] guntool2 = MomentumRangeParticleGun("Gun1") guntool2.ThetaMin = 0 guntool2.ThetaMax = 2 * constants.pi guntool2.PdgCodes = [11] from Configurables import ConstPileUp pileuptool = ConstPileUp() pileuptool.numPileUpEvents = 10 from Configurables import GenAlg gen = GenAlg() gen.SignalProvider = guntool gen.PileUpProvider = guntool2 gen.PileUpTool = pileuptool gen.hepmc.Path = "hepmc" from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.genparticles.Path = "allGenParticles" hepmc_converter.genvertices.Path = "allGenVertices" dumper = HepMCDumper("Dumper") dumper.hepmc.Path = "hepmc"
############################################### Particle Gun setup ### To consistently get particles in both the barrel and the endcap, ### use a double particle gun - one electron in the forward region, one pion in the barrel region _pi = 3.14159 from Configurables import MomentumRangeParticleGun pgun1_electron = MomentumRangeParticleGun("ParticleGun1_Electron") pgun1_electron.PdgCodes = [11] pgun1_electron.MomentumMin = 50 * GeV pgun1_electron.MomentumMax = 50 * GeV pgun1_electron.PhiMin = 0 pgun1_electron.PhiMax = 2 * _pi # corresponds to 4.7 < eta < 5.4 pgun1_electron.ThetaMin = 0.5 * _pi / 180. pgun1_electron.ThetaMax = 1.5 * _pi / 180. from Configurables import MomentumRangeParticleGun pgun2_pion = MomentumRangeParticleGun("ParticleGun2_Pion") pgun2_pion.PdgCodes = [211] pgun2_pion.MomentumMin = 20 * GeV pgun2_pion.MomentumMax = 20 * GeV pgun2_pion.PhiMin = 0 pgun2_pion.PhiMax = 2 * _pi # corresponds to -0.17 < eta < 0.17 pgun2_pion.ThetaMin = 80 * _pi / 180. pgun2_pion.ThetaMax = 100 * _pi / 180. from Configurables import ConstPileUp pileuptool = ConstPileUp()
from Configurables import ApplicationMgr ApplicationMgr().EvtSel = 'NONE' ApplicationMgr().EvtMax = 2 ApplicationMgr().OutputLevel = INFO ApplicationMgr().StopOnSignal = True ApplicationMgr().ExtSvc += ['RndmGenSvc'] from Configurables import FCCDataSvc ## Data service podioevent = FCCDataSvc("EventDataSvc") ApplicationMgr().ExtSvc += [podioevent] from Configurables import MomentumRangeParticleGun guntool = MomentumRangeParticleGun() guntool.ThetaMin = 45 * constants.pi / 180. guntool.ThetaMax = 135 * constants.pi / 180. guntool.PhiMin = 0. guntool.PhiMax = 2. * constants.pi guntool.MomentumMin = 1. *units.GeV guntool.MomentumMax = 1. *units.GeV guntool.PdgCodes = [11] # 11 electron, 13 muon, 22 photon, 111 pi0, 211 pi+ from Configurables import GenAlg gen = GenAlg() gen.SignalProvider=guntool gen.hepmc.Path = "hepmc" ApplicationMgr().TopAlg += [gen] from Configurables import HepMCToEDMConverter ## reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles