File indexing completed on 2026-09-15 08:23:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 import os
0012 import time
0013 import DDG4
0014 from g4units import GeV, mm, cm
0015
0016 """
0017 dd4hep example setup using the python configuration
0018
0019 \author M.Frank
0020 \version 1.0
0021
0022 """
0023
0024
0025 def run():
0026 args = DDG4.CommandLine()
0027 kernel = DDG4.Kernel()
0028 install_dir = os.environ['DD4hepExamplesINSTALL']
0029 kernel.loadGeometry(str("file:" + install_dir + "/examples/ClientTests/compact/Assemblies.xml"))
0030
0031 geant4 = DDG4.Geant4(kernel, tracker='Geant4TrackerCombineAction')
0032 geant4.printDetectors()
0033
0034 geant4.setupCshUI()
0035 if args.batch:
0036 kernel.UI = ''
0037
0038
0039 geant4.setupTrackingField(prt=True)
0040
0041 geant4.setupROOTOutput('RootOutput', 'Assemblies_' + time.strftime('%Y-%m-%d_%H-%M'), mc_truth=False)
0042
0043 geant4.setupGun("Gun", particle='e-', energy=2 * GeV, position=(0.15 * mm, 0.12 * mm, 0.1 * cm), multiplicity=1)
0044
0045 seq, act = geant4.setupTracker('VXD')
0046
0047 phys = kernel.physicsList()
0048 phys.extends = 'QGSP_BERT'
0049 phys.enableUI()
0050 phys.dump()
0051
0052 DDG4.setPrintLevel(DDG4.OutputLevel.DEBUG)
0053 geant4.execute()
0054
0055
0056 if __name__ == "__main__":
0057 run()