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 geantservice = SimG4Svc("SimG4Svc", physicslist=physicslistTool, regions=["SimG4FastSimOpFiberRegion/fastfiber"], actions=actionTool) from Configurables import SimG4Alg, SimG4PrimariesFromEdmTool # next, create the G4 algorithm, giving the list of names of tools ("XX/YY") edmConverter = SimG4PrimariesFromEdmTool("EdmConverter") from Configurables import SimG4SaveDRcaloHits, SimG4SaveDRcaloMCTruth
# DD4hep geometry service from Configurables import GeoSvc ## parse the given xml file geoservice = GeoSvc("GeoSvc", detectors=['file:..//data/Barrel_testCaloSD_rphiz.xml']) # Geant4 service # Configures the Geant simulation: geometry, physics list and user actions from Configurables import SimG4Svc, SimG4FastSimPhysicsList, SimG4GflashHomoCalo, SimG4FastSimCalorimeterRegion ## create parametrisation of the calorimeter gflash = SimG4GflashHomoCalo("gflash", material="G4_PbWO4") regiontoolcalo = SimG4FastSimCalorimeterRegion("modelCalo", volumeNames=["BarrelECal"], 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=["SimG4FastSimCalorimeterRegion/modelCalo"]) # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4SaveCalHits, SimG4PrimariesFromEdmTool savecaltool = SimG4SaveCalHits("saveCalHits", readoutNames=["ECalHits"]) savecaltool.DataOutputs.positionedCaloHits.Path = "positionedCaloHits" savecaltool.DataOutputs.caloHits.Path = "caloHits" # 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",
from Configurables import SimG4GflashSamplingCalo ## create parametrisation of the calorimeter gflash = SimG4GflashSamplingCalo("gflash") gflash.materialActive = "G4_lAr" gflash.materialPassive = "G4_Pb" gflash.thicknessActive = 4 gflash.thicknessPassive = 2 from Configurables import SimG4FastSimCalorimeterRegion regiontoolcalo = SimG4FastSimCalorimeterRegion("modelCalo") regiontoolcalo.volumeNames = ["ECalBarrel"] regiontoolcalo.parametrisation = gflash from Configurables import SimG4FastSimPhysicsList ## create overlay on top of FTFP_BERT physics list, attaching fast sim/parametrization process physicslisttool = SimG4FastSimPhysicsList("Physics") physicslisttool.fullphysics = "SimG4FtfpBert" from Configurables import SimG4Svc ## attach those tools to the G4 service geantservice = SimG4Svc("SimG4Svc") geantservice.physicslist = physicslisttool geantservice.regions = [regiontooltracker, regiontoolcalo] ApplicationMgr().ExtSvc += [geantservice] # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools # 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") from Configurables import SimG4SaveSmearedParticles