gen.VertexSmearingTool = vertexsmeartool 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" from Configurables import GeoSvc geoservice = GeoSvc( "GeoSvc", detectors=['file:Test/TestGeometry/data/Barrel_testCaloSD_phieta.xml']) from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc") 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" ])
# DD4hep geometry service # Parses the given xml file from Configurables import GeoSvc geoservice = GeoSvc( "GeoSvc", detectors=[ 'file:Detector/DetFCChhBaseline1/compact/FCChh_DectEmptyMaster.xml', 'file:Detector/DetFCChhTrackerTkLayout/compact/Tracker.xml' ], OutputLevel=INFO) # Geant4 service # Configures the Geant simulation: geometry, physics list and user actions from Configurables import SimG4Svc # giving the names of tools will initialize the tools of that type geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist="SimG4FtfpBert", actions="SimG4FullSimActions", InteractiveMode="true") from Configurables import ApplicationMgr ApplicationMgr( TopAlg=[], EvtSel='NONE', EvtMax=1, # order is important, as GeoSvc is needed by SimG4Svc ExtSvc=[geoservice, geantservice], OutputLevel=DEBUG)
detectors=[ 'file:Detector/DetFCChhBaseline1/compact/FCChh_DectEmptyMaster.xml', 'file:Detector/DetFCChhTrackerTkLayout/compact/Tracker.xml', 'file:Detector/DetFCChhECalInclined/compact/FCChh_ECalBarrel_withCryostat.xml', 'file:Detector/DetFCChhHCalTile/compact/FCChh_HCalBarrel_TileCal.xml', 'file:Detector/DetFCChhHCalTile/compact/FCChh_HCalExtendedBarrel_TileCal.xml', 'file:Detector/DetFCChhCalDiscs/compact/Endcaps_coneCryo.xml', 'file:Detector/DetFCChhCalDiscs/compact/Forward_coneCryo.xml' ], OutputLevel=INFO) # Geant4 service # Configures the Geant simulation: geometry, physics list and user actions from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist="SimG4FtfpBert", actions="SimG4FullSimActions") # range cut geantservice.g4PreInitCommands += ["/run/setCut 0.1 mm"] # Magnetic field from Configurables import SimG4ConstantMagneticFieldTool if magnetic_field == 1: field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool", FieldOn=True, IntegratorStepper="ClassicalRK4") else: field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool", FieldOn=False)
from Configurables import SimG4Svc, SimG4FastSimPhysicsList, SimG4ParticleSmearFormula, SimG4FastSimTrackerRegion, SimG4GflashSamplingCalo, SimG4FastSimCalorimeterRegion ## create particle smearing tool, used for smearing in the tracker smeartool = SimG4ParticleSmearFormula("smear", resolutionMomentum = "0.013") ## create region and a parametrisation model, pass smearing tool regiontooltracker = SimG4FastSimTrackerRegion("modelTracker", volumeNames=["TrackerEnvelopeBarrel"], smearing=smeartool) ## create parametrisation of the calorimeter gflash = SimG4GflashSamplingCalo("gflash", materialActive = "G4_lAr", materialPassive = "G4_Pb", thicknessActive = 4, thicknessPassive = 2) regiontoolcalo = SimG4FastSimCalorimeterRegion("modelCalo", volumeNames=["ECalBarrel"], parametrisation = gflash) ## create overlay on top of FTFP_BERT physics list, attaching fast sim/parametrization process physicslisttool = SimG4FastSimPhysicsList("Physics", fullphysics="SimG4FtfpBert") ## attach those tools to the G4 service geantservice = SimG4Svc("SimG4Svc", physicslist=physicslisttool, regions=[regiontooltracker, regiontoolcalo]) # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4SaveSmearedParticles, SimG4SaveCalHits, SimG4PrimariesFromEdmTool # first, create a tool that saves the smeared particles # Name of that tool in GAUDI is "XX/YY" where XX is the tool class name ("SimG4SaveSmearedParticles") # and YY is the given name ("saveSmearedParticles") saveparticlestool = SimG4SaveSmearedParticles("saveSmearedParticles") saveparticlestool.particles.Path = "smearedParticles" saveparticlestool.particlesMCparticles.Path = "particleMCparticleAssociation" savecaltool = SimG4SaveCalHits("saveCalHits", readoutNames = ["ECalHitsPhiEta"]) savecaltool.positionedCaloHits.Path = "positionedCaloHits" savecaltool.caloHits.Path = "caloHits" # next, create the G4 algorithm, giving the list of names of tools ("XX/YY") particle_converter = SimG4PrimariesFromEdmTool("EdmConverter")
OutputLevel=INFO) # Geant4 service # Configures the Geant simulation: geometry, physics list and user actions from Configurables import SimG4Svc, SimG4UserLimitPhysicsList, SimG4UserLimitRegion from GaudiKernel.SystemOfUnits import mm ## create region and a parametrisation model, pass smearing tool regiontool = SimG4UserLimitRegion("limits", volumeNames=["TrackerEnvelopeBarrel"], maxStep=1 * mm) # create overlay on top of FTFP_BERT physics list, attaching fast sim/parametrization process physicslisttool = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4FtfpBert") # attach those tools to the G4 service geantservice = SimG4Svc("SimG4Svc", physicslist=physicslisttool, regions=["SimG4UserLimitRegion/limits"]) # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4PrimariesFromEdmTool # next, create the G4 algorithm, giving the list of names of tools ("XX/YY") particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") particle_converter.genParticles.Path = "allGenParticles" geantsim = SimG4Alg("SimG4Alg", eventProvider=particle_converter) # PODIO algorithm from Configurables import PodioOutput out = PodioOutput("out", filename="out_limits.root") out.outputCommands = ["keep *"]
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:../data/TestBoxCaloSD_volumes.xml']) from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist='SimG4TestPhysicsList', actions='SimG4FullSimActions') from Configurables import SimG4Alg, SimG4SaveCalHits savecaltool = SimG4SaveCalHits("saveECalHits", readoutNames = ["ECalHits"]) savecaltool.positionedCaloHits.Path = "positionedCaloHits" savecaltool.caloHits.Path = "caloHits" geantsim = SimG4Alg("SimG4Alg", outputs= ["SimG4SaveCalHits/saveECalHits"]) from Configurables import FCCDataSvc, PodioOutput podiosvc = FCCDataSvc("EventDataSvc") out = PodioOutput("out", filename="testCellId_dd4hep_volumes.root") out.outputCommands = ["keep *"] # ApplicationMgr from Configurables import ApplicationMgr ApplicationMgr( TopAlg = [reader, hepmc_converter, hepmc_dump, geantsim, out],
# Geant4 service # Configures the Geant simulation: geometry, physics list and user actions from Configurables import SimG4Svc, SimG4FastSimPhysicsList, SimG4FastSimActions, SimG4ParticleSmearSimple # create particle smearing tool, used for smearing in the tracker smeartool = SimG4ParticleSmearSimple("Smear", detectorNames=["TrackerEnvelopeBarrel"], sigma=0.013) # create actions initialization tool actionstool = SimG4FastSimActions("Actions", smearing=smeartool) # create overlay on top of FTFP_BERT physics list, attaching fast sim/parametrization process physicslisttool = SimG4FastSimPhysicsList("Physics", fullphysics="SimG4FtfpBert") # attach those tools to the G4 service geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist=physicslisttool, actions=actionstool) # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4SaveSmearedParticles, SimG4PrimariesFromEdmTool # first, create a tool that saves the smeared particles # Name of that tool in GAUDI is "XX/YY" where XX is the tool class name ("SimG4SaveSmearedParticles") # and YY is the given name ("saveSmearedParticles") saveparticlestool = SimG4SaveSmearedParticles("saveSmearedParticles") saveparticlestool.DataOutputs.particles.Path = "smearedParticles" saveparticlestool.DataOutputs.particlesMCparticles.Path = "particleMCparticleAssociation" # next, create the G4 algorithm, giving the list of names of tools ("XX/YY") particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") particle_converter.DataInputs.genParticles.Path = "allGenParticles" geantsim = SimG4Alg("SimG4Alg",
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=DEBUG) 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" ])
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" # Geant4 service # Configures the Geant simulation: geometry, physics list and user actions from Configurables import SimG4Svc # giving the names of tools will initialize the tools of that type geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist="SimG4GeantinoDeposits", actions="SimG4FullSimActions", magneticField=field) geantservice.g4PostInitCommands += ["/tracking/storeTrajectory 1"] # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4SaveTrackerHits, SimG4SaveTrajectory, SimG4GeantinosFromEdmTool # first, create a tool that saves the tracker hits # Name of that tool in GAUDI is "XX/YY" where XX is the tool class name ("SimG4SaveTrackerHits") # and YY is the given name ("saveTrackerHits") savetrajectorytool = SimG4SaveTrajectory("saveTrajectory") savetrajectorytool.trajectory.Path = "trajectory" savetrajectorytool.trajectoryPoints.Path = "trajectoryPoints"
from Configurables import SimG4Svc, SimG4FastSimPhysicsList, SimG4ParticleSmearFormula, SimG4FastSimTrackerRegion, SimG4GflashSamplingCalo, SimG4FastSimCalorimeterRegion ## create particle smearing tool, used for smearing in the tracker smeartool = SimG4ParticleSmearFormula("smear", resolutionMomentum = "0.013") ## create region and a parametrisation model, pass smearing tool regiontooltracker = SimG4FastSimTrackerRegion("modelTracker", volumeNames=["TrackerEnvelopeBarrel"], smearing=smeartool) ## create parametrisation of the calorimeter gflash = SimG4GflashSamplingCalo("gflash", materialActive = "G4_lAr", materialPassive = "G4_Pb", thicknessActive = 4, thicknessPassive = 2) regiontoolcalo = SimG4FastSimCalorimeterRegion("modelCalo", volumeNames=["ECalBarrel"], parametrisation = gflash) ## create overlay on top of FTFP_BERT physics list, attaching fast sim/parametrization process physicslisttool = SimG4FastSimPhysicsList("Physics", fullphysics="SimG4FtfpBert") ## attach those tools to the G4 service geantservice = SimG4Svc("SimG4Svc", physicslist=physicslisttool, regions=["SimG4FastSimTrackerRegion/modelTracker", "SimG4FastSimCalorimeterRegion/modelCalo"]) # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4SaveSmearedParticles, SimG4SaveCalHits, SimG4PrimariesFromEdmTool # first, create a tool that saves the smeared particles # Name of that tool in GAUDI is "XX/YY" where XX is the tool class name ("SimG4SaveSmearedParticles") # and YY is the given name ("saveSmearedParticles") saveparticlestool = SimG4SaveSmearedParticles("saveSmearedParticles") saveparticlestool.particles.Path = "smearedParticles" saveparticlestool.particlesMCparticles.Path = "particleMCparticleAssociation" savecaltool = SimG4SaveCalHits("saveCalHits", readoutNames = ["ECalHitsPhiEta"]) savecaltool.positionedCaloHits.Path = "positionedCaloHits" savecaltool.caloHits.Path = "caloHits" # next, create the G4 algorithm, giving the list of names of tools ("XX/YY") particle_converter = SimG4PrimariesFromEdmTool("EdmConverter")
'file:Detector/DetFCChhBaseline1/compact/FCChh_TrackerAir.xml'], OutputLevel=INFO) # Geant4 service # Configures the Geant simulation: geometry, physics list and user actions from Configurables import SimG4Svc, SimG4FastSimPhysicsList, SimG4ParticleSmearRootFile, SimG4FastSimTrackerRegion from GaudiKernel.SystemOfUnits import GeV, TeV # create particle smearing tool, used for smearing in the tracker smeartool = SimG4ParticleSmearRootFile("Smear", filename="/eos/project/f/fccsw-web/testsamples/tkLayout_example_resolutions.root") ## create region and a parametrisation model, pass smearing tool regiontool = SimG4FastSimTrackerRegion("model", volumeNames=["TrackerEnvelopeBarrel"], minMomentum = 5*GeV, maxMomentum = 10*TeV, maxEta=6, smearing=smeartool) # create overlay on top of FTFP_BERT physics list, attaching fast sim/parametrization process physicslisttool = SimG4FastSimPhysicsList("Physics", fullphysics="SimG4FtfpBert") # attach those tools to the G4 service geantservice = SimG4Svc("SimG4Svc", physicslist=physicslisttool, regions=["SimG4FastSimTrackerRegion/model"]) # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4SaveSmearedParticles, SimG4PrimariesFromEdmTool # first, create a tool that saves the smeared particles # Name of that tool in GAUDI is "XX/YY" where XX is the tool class name ("SimG4SaveSmearedParticles") # and YY is the given name ("saveSmearedParticles") saveparticlestool = SimG4SaveSmearedParticles("saveSmearedParticles") saveparticlestool.particles.Path = "smearedParticles" saveparticlestool.particlesMCparticles.Path = "particleMCparticleAssociation" # next, create the G4 algorithm, giving the list of names of tools ("XX/YY") particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") particle_converter.genParticles.Path = "allGenParticles" geantsim = SimG4Alg("SimG4Alg", outputs = ["SimG4SaveSmearedParticles/saveSmearedParticles"],
physicslist = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4GeantinoPhysicsList") regions = [regiontool] #physicslist = SimG4GeantinoPhysicsList() #regions = [] else: from Configurables import SimG4UserLimitRegion, SimG4UserLimitPhysicsList regiontool = SimG4UserLimitRegion("limits", volumeNames=["world"], maxStep = 0.1*units.mm) physicslist = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4FtfpBert") regions = [regiontool] geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist=physicslist, regions=regions, actions=actions, magneticField=field) # range cut geantservice.g4PostInitCommands += ["/run/setCut 0.1 mm"] if simargs.trajectories: geantservice.g4PostInitCommands += ["/tracking/storeTrajectory 1"] from Configurables import SimG4Alg, SimG4SingleParticleGeneratorTool, SimG4SaveTrackerHits, SimG4SaveParticleHistory outputHitsTools = [] if simargs.trajectories: from Configurables import SimG4SaveTrajectory savetrajectorytool = SimG4SaveTrajectory("saveTrajectory") savetrajectorytool.trajectory.Path = "trajectory" savetrajectorytool.trajectoryPoints.Path = "trajectoryPoints" outputHitsTools += [ "SimG4SaveTrajectory/saveTrajectory"]
IntegratorStepper="ClassicalRK4", FieldComponentZ=0.000, MaximumStep=10000.0) # Geant4 service # Configures the Geant simulation: geometry, physics list and user actions from Configurables import SimG4Svc, SimG4UserLimitPhysicsList, SimG4UserLimitRegion, SimG4FullSimActions from GaudiKernel.SystemOfUnits import mm regiontool = SimG4UserLimitRegion("limits", volumeNames=["CDCH"], maxStep = 2*mm) physicslisttool = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4FtfpBert") actions = SimG4FullSimActions() actions.enableHistory=True geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist=physicslisttool, actions=actions, regions=["SimG4UserLimitRegion/limits"], magneticField=field) geantservice.g4PostInitCommands +=["/process/eLoss/minKinEnergy 1 MeV"] geantservice.g4PostInitCommands += ["/tracking/storeTrajectory 1"] # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4SaveTrackerHits, SimG4SaveTrajectory, SimG4SaveParticleHistory # first, create a tool that saves the tracker hits # Name of that tool in GAUDI is "XX/YY" where XX is the tool class name ("SimG4SaveTrackerHits") # and YY is the given name ("saveTrackerHits") savetrajectorytool = SimG4SaveTrajectory("saveTrajectory") savetrajectorytool.trajectory.Path = "trajectory" savetrajectorytool.trajectoryPoints.Path = "trajectoryPoints"
from Gaudi.Configuration import * from Configurables import GeoSvc, SimG4Svc, ApplicationMgr # initialize master geometry of FCC-hh geoservice = GeoSvc( "GeoSvc", detectors=['file:Detector/DetFCChhBaseline1/compact/FCChh_DectMaster.xml']) # giving the names of tools will initialize the tools of that type # adding G4 command that actually runs the overlap check geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist="SimG4FtfpBert", actions="SimG4FullSimActions", g4PostInitCommands=[ '/geometry/test/recursion_depth 3', '/geometry/test/run' ]) ApplicationMgr(TopAlg=[], EvtSel='NONE', EvtMax=1, ExtSvc=[geoservice, geantservice])
OutputLevel=INFO) # Geant4 service # Configures the Geant simulation: geometry, physics list and user actions from Configurables import SimG4Svc, SimG4UserLimitPhysicsList, SimG4UserLimitRegion from GaudiKernel.SystemOfUnits import mm ## create region and a parametrisation model, pass smearing tool regiontool = SimG4UserLimitRegion("limits", volumeNames=["TrackerEnvelopeBarrel"], maxStep=1 * mm) # create overlay on top of FTFP_BERT physics list, attaching fast sim/parametrization process physicslisttool = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4FtfpBert") # attach those tools to the G4 service geantservice = SimG4Svc("SimG4Svc", physicslist=physicslisttool, regions=[regiontool]) # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4PrimariesFromEdmTool # next, create the G4 algorithm, giving the list of names of tools ("XX/YY") particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") particle_converter.genParticles.Path = "allGenParticles" geantsim = SimG4Alg("SimG4Alg", eventProvider=particle_converter) # PODIO algorithm from Configurables import PodioOutput out = PodioOutput("out", filename="out_limits.root") out.outputCommands = ["keep *"]
# # physicslist = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4GeantinoPhysicsList") # regions = [regiontool] # #physicslist = SimG4GeantinoPhysicsList() # #regions = [] #else: # from Configurables import SimG4UserLimitRegion, SimG4UserLimitPhysicsList # regiontool = SimG4UserLimitRegion("limits", volumeNames=["world"], # maxStep = 0.1*units.mm) # physicslist = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4FtfpBert") # regions = [regiontool] # geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist="SimG4FtfpBert", regions=[], actions=actions, magneticField=field) # range cut geantservice.g4PostInitCommands += ["/run/setCut 0.1 mm"] if simargs.trajectories: geantservice.g4PostInitCommands += ["/tracking/storeTrajectory 1"] from Configurables import SimG4Alg, SimG4SingleParticleGeneratorTool, SimG4SaveTrackerHits, SimG4SaveParticleHistory outputHitsTools = [] if simargs.trajectories: from Configurables import SimG4SaveTrajectory savetrajectorytool = SimG4SaveTrajectory("saveTrajectory") savetrajectorytool.trajectory.Path = "trajectory" savetrajectorytool.trajectoryPoints.Path = "trajectoryPoints" outputHitsTools += [ "SimG4SaveTrajectory/saveTrajectory"]