### |-------------------------------|----------------------------------|---------------------------------------------------------|------------------------|----------------------------------|-----------------------------------------------| ### | 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 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 guntool = MomentumRangeParticleGun() gen = GenAlg("ParticleGun", SignalProvider=guntool, 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") from Configurables import HepMCToEDMConverter ## Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.genparticles.Path = "allGenParticles"
apply_paths(fatjetSaveTool, out_names["fatjets"]) metSaveTool = DelphesSaveMet("met", delphesMETArrayName="MissingET/momentum", delphesSHTArrayName="ScalarHT/energy") apply_paths(metSaveTool, out_names["met"]) #### Pythia generator from Configurables import PythiaInterface from Configurables import PoissonPileUp from Configurables import HepMCFullMerge pythia8gentool = PythiaInterface(Filename=pythiaConfFile, OutputLevel=messageLevelPythia) mergetool = HepMCFullMerge() pileuptool = PoissonPileUp(numPileUpEvents=140) ## Write the HepMC::GenEvent to the data service from Configurables import GenAlg pythia8gen = GenAlg("Pythia8", SignalProvider=pythia8gentool, PileUpProvider=pythia8gentool, PileUpTool=pileuptool, HepMCMergeTool=mergetool) pythia8gen.hepmc.Path = "hepmc" ## Delphes simulator -> define objects to be written out from Configurables import DelphesSimulation delphessim = DelphesSimulation(DelphesCard=delphesCard, ROOTOutputFile=delphesRootOutFile, ApplyGenFilter=True, OutputLevel=messageLevelDelphes, outputs=["DelphesSaveChargedParticles/muons", "DelphesSaveChargedParticles/electrons", "DelphesSaveNeutralParticles/photons", "DelphesSaveChargedParticles/pfcharged", "DelphesSaveNeutralParticles/pfphotons", "DelphesSaveNeutralParticles/pfneutrals", "DelphesSaveGenJets/genJets",
from Gaudi.Configuration import * from Configurables import HepMCFileReader, GenAlg readertool = HepMCFileReader("ReaderTool") readertool.Filename = "Test/TestGeometry/data/testHepMCrandom.dat" reader = GenAlg("Reader") reader.SignalProvider = readertool reader.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" from Configurables import HepMCDumper hepmc_dump = HepMCDumper("hepmc") hepmc_dump.hepmc.Path = "hepmc" from Configurables import GeoSvc geoservice = GeoSvc( "GeoSvc", detectors=['file:Test/TestGeometry/data/TestBoxCaloSD_volumes.xml']) from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc",
ParticlePropertiesFile='Generation/data/ParticleTable.txt') guntool = MomentumRangeParticleGun("SignalProvider", PdgCodes=[-211]) guntool2 = MomentumRangeParticleGun("PileUpProvider", PdgCodes=[11]) smeartool = FlatSmearVertex("smeartoolname") smeartool.xVertexMin = -10 * units.mm smeartool.xVertexMax = 10 * units.mm smeartool.yVertexMin = -10 * units.mm smeartool.yVertexMax = 10 * units.mm smeartool.zVertexMin = -30 * units.mm smeartool.zVertexMax = 30 * units.mm pileuptool = ConstPileUp("MyPileUpConfig", numPileUpEvents=1) from Configurables import GenAlg gun = GenAlg() gun.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" histo = HepMCHistograms("GenHistograms") histo.hepmc.Path = "hepmc" THistSvc().Output = [ "rec DATAFILE='GenHistograms.root' TYP='ROOT' OPT='RECREATE'" ] THistSvc().PrintAll = True
guntool = MomentumRangeParticleGun("SignalProvider", PdgCodes=[-211]) guntool2 = MomentumRangeParticleGun("PileUpProvider", PdgCodes=[11]) smeartool = FlatSmearVertex("smeartoolname") smeartool.xVertexMin = -10 * units.mm smeartool.xVertexMax = 10 * units.mm smeartool.yVertexMin = -10 * units.mm smeartool.yVertexMax = 10 * units.mm smeartool.zVertexMin = -30 * units.mm smeartool.zVertexMax = 30 * units.mm pileuptool = ConstPileUp("MyPileUpConfig", numPileUpEvents=0) from Configurables import GenAlg gun1 = GenAlg("gun1", SignalProvider=guntool) gun2 = GenAlg("gun2", SignalProvider=guntool2) gun1.hepmc.Path = "hepmc1" gun2.hepmc.Path = "hepmc2" from Configurables import HepMCToEDMConverter hepmc_converter1 = HepMCToEDMConverter("Converter1") hepmc_converter1.hepmc.Path = "hepmc1" hepmc_converter1.genparticles.Path = "signalGenParticles" hepmc_converter1.genvertices.Path = "signalGenVertices" hepmc_converter2 = HepMCToEDMConverter("Converter2") hepmc_converter2.hepmc.Path = "hepmc2" hepmc_converter2.genparticles.Path = "pileupGenParticles" hepmc_converter2.genvertices.Path = "pileupGenVertices"
from Gaudi.Configuration import * from Configurables import GenAlg, 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 = GenAlg("ParticleGun", SignalProvider=pgun) gen.hepmc.Path = "hepmc" ppservice = Gaudi__ParticlePropertySvc("ParticlePropertySvc", ParticlePropertiesFile="../../../Generation/data/ParticleTable.txt") from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path="hepmc" hepmc_converter.genparticles.Path="allGenParticles" hepmc_converter.genvertices.Path="allGenVertices" from Configurables import HepMCDumper hepmc_dump = HepMCDumper("hepmc") hepmc_dump.hepmc.Path="hepmc" from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc", detectors=['file:compact/Box_dd4hepStopParticleSD.xml'], OutputLevel = DEBUG) from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector',
yVertexMean=0 * units.mm, yVertexSigma=0.5 * units.mm, zVertexMean=0 * units.mm, zVertexSigma=70 * units.mm, tVertexMean=0 * units.picosecond, tVertexSigma=30 * units.picosecond) pileuptool = ConstPileUp(numPileUpEvents=2) pileupreader = HepMCFileReader( Filename="/eos/project/f/fccsw-web/testsamples/FCC_minbias_100TeV.dat") from Configurables import PythiaInterface, GenAlg ### PYTHIA algorithm pythia8gentool = PythiaInterface("Pythia8Interface", Filename=pythiafile) pythia8gen = GenAlg("Pythia8", SignalProvider=pythia8gentool, PileUpProvider=pileupreader, VertexSmearingTool=smeartool) pythia8gen.PileUpTool = pileuptool pythia8gen.hepmc.Path = "hepmcevent" from Configurables import HepMCToEDMConverter ### Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmcevent" hepmc_converter.hepmcStatusList = [] # convert particles with all statuses hepmc_converter.genparticles.Path = "all_genparticles" hepmc_converter.genvertices.Path = "all_genvertices" from Configurables import GenParticleFilter ### Filters generated particles # accept is a list of particle statuses that should be accepted
jetSaveTool = DelphesSaveJets("jets", delphesArrayName="JetEnergyScale/jets") apply_paths(jetSaveTool, out_names["jets"]) fatjetSaveTool = DelphesSaveJets("fatjets", delphesArrayName="FatJetFinder/jets", saveSubstructure=True) apply_paths(fatjetSaveTool, out_names["fatjets"]) metSaveTool = DelphesSaveMet("met", delphesMETArrayName="MissingET/momentum", delphesSHTArrayName="ScalarHT/energy") apply_paths(metSaveTool, out_names["met"]) ## Pythia generator from Configurables import PythiaInterface pythia8gentool = PythiaInterface(Filename=pythiaConfFile, OutputLevel=messageLevelPythia) ## Write the HepMC::GenEvent to the data service from Configurables import GenAlg pythia8gen = GenAlg("Pythia8", SignalProvider=pythia8gentool) pythia8gen.hepmc.Path = "hepmc" ## Delphes simulator -> define objects to be written out from Configurables import DelphesSimulation delphessim = DelphesSimulation(DelphesCard=delphesCard, ROOTOutputFile=delphesRootOutFile, ApplyGenFilter=True, OutputLevel=messageLevelDelphes, outputs=["DelphesSaveChargedParticles/muons", "DelphesSaveChargedParticles/electrons", "DelphesSaveNeutralParticles/photons", "DelphesSaveChargedParticles/pfcharged", "DelphesSaveNeutralParticles/pfphotons", "DelphesSaveNeutralParticles/pfneutrals", "DelphesSaveGenJets/genJets",
smeartool.yVertexSigma = 0.5 * units.mm smeartool.zVertexSigma = 40.0 * units.mm 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 Gaudi.Configuration import * from Configurables import ApplicationMgr, FCCDataSvc, PodioOutput podioevent = FCCDataSvc("EventDataSvc") # reads HepMC text file and write the HepMC::GenEvent to the data service from Configurables import GenAlg, HepMCDumper, PoissonPileUp, HepMCFileReader genpileup = PoissonPileUp(name="ConstPileUp", numPileUpEvents=1) readertool = HepMCFileReader("ReaderTool", Filename="/eos/project/f/fccsw-web/testsamples/example_MyPythia.dat") readertool_pileup = HepMCFileReader("ReaderToolPileup", Filename="/eos/project/f/fccsw-web/testsamples/example_MyPythia.dat") reader = GenAlg("Reader", SignalProvider=readertool, PileUpProvider=readertool_pileup, PileUpTool=genpileup) # have a look at the source code of GenAlg, in Generation/src/components/GenAlg.cpp # In the following line, # reader.YYY.Path = "ZZZ" # YYY matches the string passed to declareOutput in the constructor of the algorithm # XXX declares a name for the product (the HepMC::GenEvent) reader.hepmc.Path = "hepmc" dumper = HepMCDumper() dumper.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") # the input product name matches the output product name of the previous module hepmc_converter.hepmc.Path="hepmc" hepmc_converter.genparticles.Path="all_genparticles" hepmc_converter.genvertices.Path="all_genvertices"
) from Configurables import FlatSmearVertex smearTool = FlatSmearVertex( "VertexSmearingTool", yVertexMin=-36.42, # mm yVertexMax=-26.42, # mm zVertexMin=-52.135, # mm zVertexMax=-42.135, # mm beamDirection=0 # 1, 0, -1 ) from Configurables import HepMCToEDMConverter hepmc2edm = HepMCToEDMConverter("Converter") gen = GenAlg("ParticleGun", SignalProvider=pgun, VertexSmearingTool=smearTool) from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc", detectors=['file:share/compact/DRcalo.xml']) from Configurables import SimG4Svc, SimG4FastSimPhysicsList, SimG4FastSimOpFiberRegion, SimG4OpticalPhysicsList regionTool = SimG4FastSimOpFiberRegion("fastfiber") opticalPhysicsTool = SimG4OpticalPhysicsList("opticalPhysics", fullphysics="SimG4FtfpBert") physicslistTool = SimG4FastSimPhysicsList("Physics", fullphysics=opticalPhysicsTool) from Configurables import SimG4DRcaloActions actionTool = SimG4DRcaloActions("SimG4DRcaloActions") # Name of the tool in GAUDI is "XX/YY" where XX is the tool class name and YY is the given name
xVertexMin=pileupconf['xVertexSigma'], xVertexMax=pileupconf['yVertexSigma'], yVertexMin=pileupconf['zVertexSigma'], yVertexMax=pileupconf['tVertexSigma'], ) pythia8gentool = PythiaInterface(Filename=pythiaConfFile, OutputLevel=messageLevelPythia) mergetool = HepMCFullMerge() pileuptool = PoissonPileUp(numPileUpEvents=140) VertexSmearingTool = smeartool ## Write the HepMC::GenEvent to the data service from Configurables import GenAlg pythia8gen = GenAlg("Pythia8", SignalProvider=pythia8gentool, PileUpProvider=pythia8gentool, PileUpTool=pileuptool, HepMCMergeTool=mergetool, VertexSmearingTool=smeartool) pythia8gen.hepmc.Path = "hepmc" ## Delphes simulator -> define objects to be written out from Configurables import DelphesSimulation delphessim = DelphesSimulation( DelphesCard=delphesCard, ROOTOutputFile=delphesRootOutFile, ApplyGenFilter=True, OutputLevel=messageLevelDelphes, outputs=[ "DelphesSaveChargedParticles/muons", "DelphesSaveChargedParticles/electrons", "DelphesSaveNeutralParticles/photons",
smeartool = GaussSmearVertex( xVertexMean=0. * units.mm, xVertexSigma=0.5 * units.mm, yVertexMean=0 * units.mm, yVertexSigma=0.5 * units.mm, zVertexMean=0* units.mm, zVertexSigma=70*units.mm, tVertexMean = 0 * units.picosecond, tVertexSigma = 30 * units.picosecond) from Configurables import PythiaInterface, GenAlg ### PYTHIA algorithm pythia8gentool = PythiaInterface("Pythia8Interface", Filename=pythiafile) pythia8gen = GenAlg("Pythia8", SignalProvider=pythia8gentool, VertexSmearingTool=smeartool) pythia8gen.hepmc.Path = "hepmcevent" gen = GenAlg("ParticleGun", SignalProvider=pythia8gentool, VertexSmearingTool="FlatSmearVertex") gen.hepmc.Path = "hepmc" # DD4hep geometry service # Parses the given xml file from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc", detectors=['file:Detector/DetFCChhBaseline1/compact/FCChh_DectMaster.xml'], OutputLevel = DEBUG) from Configurables import HepMCToEDMConverter ## Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles hepmc_converter = HepMCToEDMConverter("Converter")
from Gaudi.Configuration import * from GaudiKernel import SystemOfUnits as units from Configurables import FCCDataSvc ## Data service podioevent = FCCDataSvc("EventDataSvc") from Configurables import HepMCDumper, MomentumRangeParticleGun, HepMCHistograms, FlatSmearVertex, ConstPileUp guntool = MomentumRangeParticleGun("SignalProvider", PdgCodes=[11]) from Configurables import GenAlg gun = GenAlg(SignalProvider=guntool) gun.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" # convert (final state) EDM back to HepMC from Configurables import EDMToHepMCConverter edm_converter = EDMToHepMCConverter("BackConverter") edm_converter.hepmc.Path = "hepmcconverted" edm_converter.genparticles.Path = "allGenParticles" edm_converter.genvertices.Path = "allGenVertices" from Configurables import HepMCDumper dumper = HepMCDumper("Dumper") dumper.hepmc.Path = "hepmc"
smeartool = GaussSmearVertex("GaussSmearVertex") if simargs.useVertexSmearTool: smeartool.xVertexSigma = 0.5 * units.mm smeartool.yVertexSigma = 0.5 * units.mm smeartool.zVertexSigma = 40 * units.mm smeartool.tVertexSigma = 180 * units.picosecond if simargs.singlePart: pgun_tool = ConstPtParticleGun(PdgCodes=[pdg], PhiMin=phiMin, PhiMax=phiMax, EtaMin=etaMin, EtaMax=etaMax, PtList=ptList) genalg = GenAlg("Pythia8", SignalProvider=pgun_tool, VertexSmearingTool=smeartool) genalg.hepmc.Path = "hepmc" else: from Configurables import PythiaInterface, GenAlg, GaussSmearVertex pythia8gentool = PythiaInterface("Pythia8", Filename=card) genalg = GenAlg("Pythia8", SignalProvider=pythia8gentool, VertexSmearingTool=smeartool) genalg.hepmc.Path = "hepmc" from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.genparticles.Path = "allGenParticles"
from Configurables import FCCDataSvc podioEvent = FCCDataSvc("EventDataSvc") ApplicationMgr().ExtSvc += [podioEvent] ApplicationMgr().OutputLevel = INFO # Pythia generator from Configurables import PythiaInterface pythia8gentool = PythiaInterface() pythia8gentool.Filename = "Pythia_ee_ZH_Htautau.cmd" # Write the HepMC::GenEvent to the data service from Configurables import GenAlg pythia8gen = GenAlg() pythia8gen.SignalProvider = pythia8gentool 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("Converter") hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.hepmcStatusList = [] # convert particles with all statuses hepmc_converter.genparticles.Path = "genParticles" hepmc_converter.genvertices.Path = "genVertices" ApplicationMgr().TopAlg += [hepmc_converter] # FCC event-data model output -> define objects to be written out
"ParticlePropertySvc", ParticlePropertiesFile=DATAPATH + '/ParticleTable.txt') ### Example of pythia configuration file to generate events #pythiafile="Test/TestGeneration/data/ee_ZH_Zmumu_Hbb.txt" #### Data service podioevent = FCCDataSvc("EventDataSvc") ### PYTHIA algorithm #pythia8gentool = PythiaInterface("Pythia8Interface", Filename=pythiafile) #pythia8gen = GenAlg("Pythia8", SignalProvider=pythia8gentool) #pythia8gen.hepmc.Path = "hepmcevent" # guntool = ParticleGun("SignalProvider", PdgCodes=[211, 22, 11, -13, 2112, 2212]) guntool = ParticleGun("SignalProvider", PdgCodes=[11]) gun = GenAlg('ParticleGunAlg', SignalProvider=guntool) gun.hepmc.Path = "hepmcevent" ### Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmcevent" hepmc_converter.genparticles.Path = "GenParticle" hepmc_converter.genvertices.Path = "Genvertex" # from CMS_detector_cfg import detservice from SCTau_detector_cfg import detservice from papas_cfg import papasalg #output fcc particles to root # out = PodioOutput("out", OutputLevel=INFO) out = PodioOutput("out", OutputLevel=DEBUG)
zVertexMax=pileupconf['zVertexMax']) genpileup = PoissonPileUp(name="Pileup", numPileUpEvents=pileupconf['numPileUpEvents']) mergetool = HepMCFullMerge() readertool = HepMCFileReader( "ReaderTool", Filename="/eos/project/f/fccsw-web/testsamples/FCC_minbias_100TeV.dat") readertool_pileup = HepMCFileReader( "ReaderToolPileup", Filename="/eos/project/f/fccsw-web/testsamples/FCC_minbias_100TeV.dat") reader = GenAlg("Reader", SignalProvider=readertool, PileUpProvider=readertool_pileup, PileUpTool=genpileup, HepMCMergeTool=mergetool, VertexSmearingTool=smeartool) reader.hepmc.Path = "hepmc" dumper = HepMCDumper() dumper.hepmc.Path = "hepmc" ApplicationMgr( TopAlg=[reader, dumper], EvtSel='NONE', EvtMax=1, ExtSvc=[albersevent], )
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',
from Configurables import GaussSmearVertex, ConstPtParticleGun, GenAlg smeartool = GaussSmearVertex("GaussSmearVertex") smeartool.xVertexSigma = 0.5 * units.mm smeartool.yVertexSigma = 0.5 * units.mm smeartool.zVertexSigma = 40 * units.mm smeartool.tVertexSigma = 180 * units.picosecond from Configurables import GaussSmearVertex, ConstPtParticleGun, GenAlg pgun_tool = ConstPtParticleGun("ParticleProviderTool") pgun_tool.PdgCodes = [11, 13] from Configurables import GenAlg genalg_pgun = GenAlg("ParticleGun") genalg_pgun.SignalProvider = pgun_tool genalg_pgun.VertexSmearingTool = smeartool genalg_pgun.hepmc.Path = "hepmc" #from Configurables import PythiaInterface #pythia8gentool = PythiaInterface("Pythia8Tool") #genalg_pythia = GenAlg("Pythia8Algorithm") #genalg_pythia.SignalProvider = pythia8gentool #genalg_pythia.VertexSmearingTool=smeartool #genalg_pythia.hepmc.Path = "hepmc" from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmc"
################## 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 geoservice = GeoSvc("GeoSvc") # if FCC_DETECTORS is empty, this should use relative path to working directory path_to_detector = os.environ.get("FCCDETECTORS", "") detectors_to_use=[
from Gaudi.Configuration import * from Configurables import GenAlg ## 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 = GenAlg("ParticleGun", SignalProvider="MomentumRangeParticleGun", VertexSmearingTool="FlatSmearVertex") gen.hepmc.Path = "hepmc" from Configurables import HepMCToEDMConverter ## Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.genparticles.Path = "allGenParticles" hepmc_converter.genvertices.Path = "allGenVertices" mc_particle_algs = [gen, hepmc_converter] mc_particle_svcs = []
from Gaudi.Configuration import * from Configurables import ApplicationMgr, HepMCDumper from Configurables import HepMCFileReader, GenAlg readertool = HepMCFileReader("ReaderTool", Filename="Test/TestGeometry/data/testHepMCrandom.dat") reader = GenAlg("Reader", SignalProvider=readertool) reader.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" from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc", detectors=['file:Test/TestGeometry/data/TestBoxCaloSD_3readouts.xml'], OutputLevel = INFO) from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc", physicslist='SimG4TestPhysicsList') from Configurables import SimG4Alg, SimG4SaveCalHits, InspectHitsCollectionsTool inspecttool = InspectHitsCollectionsTool("inspect", readoutNames=["ECalHits"], OutputLevel = DEBUG) savecaltool = SimG4SaveCalHits("saveECalHits", readoutNames = ["ECalHits"], OutputLevel = DEBUG) savecaltool.positionedCaloHits.Path = "positionedCaloHits" savecaltool.caloHits.Path = "caloHits" geantsim = SimG4Alg("SimG4Alg", outputs= ["SimG4SaveCalHits/saveECalHits","InspectHitsCollectionsTool/inspect"]) from Configurables import RedoSegmentation
pgun_tool = MomentumRangeParticleGun(PdgCodes=[13], PhiMin=0., PhiMax=constants.pi * 0.5, ThetaMin=constants.pi / 2., ThetaMax=constants.pi * 0.9, MomentumMin=10000, MomentumMax=100000) pgun_tool2 = MomentumRangeParticleGun(PdgCodes=[13], PhiMin=0., PhiMax=constants.pi * 0.5, ThetaMin=constants.pi / 2., ThetaMax=constants.pi * 0.9, MomentumMin=10000, MomentumMax=100000) gen = GenAlg("ParticleGun", SignalProvider=pgun_tool, PileUpProvider=pgun_tool2, PileUpTool=pileuptool) gen.hepmc.Path = "hepmc" from Configurables import GeoSvc geoservice = GeoSvc( "GeoSvc", detectors=[ 'file:Detector/DetFCChhBaseline1/compact/FCChh_DectEmptyMaster.xml', 'file:Detector/DetFCChhTrackerTkLayout/compact/Tracker.xml', ], ) from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmc"