File indexing completed on 2026-09-22 08:03:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 import os
0012 import time
0013 import DDG4
0014 from DDG4 import OutputLevel as Output
0015 from g4units import GeV
0016
0017
0018 """
0019
0020 dd4hep example setup using the python configuration
0021
0022 \author M.Frank
0023 \version 1.0
0024
0025 """
0026
0027
0028 def run():
0029 kernel = DDG4.Kernel()
0030 install_dir = os.environ['DD4hepINSTALL']
0031 kernel.setOutputLevel(str('Geant4Converter'), Output.DEBUG)
0032 kernel.setOutputLevel(str('RootOutput'), Output.INFO)
0033 kernel.setOutputLevel(str('ShellHandler'), Output.DEBUG)
0034 kernel.setOutputLevel(str('Gun'), Output.INFO)
0035 kernel.loadGeometry(str("file:" + install_dir + "/examples/ClientTests/compact/FCC_HcalBarrel.xml"))
0036
0037 geant4 = DDG4.Geant4(kernel)
0038 geant4.printDetectors()
0039 geant4.setupCshUI()
0040
0041
0042 geant4.setupTrackingField(prt=True)
0043
0044 geant4.setupROOTOutput('RootOutput', 'FCC_' + time.strftime('%Y-%m-%d_%H-%M'), mc_truth=False)
0045
0046 geant4.setupGun("Gun", particle='pi-', energy=100 * GeV, multiplicity=1)
0047
0048 seq, act = geant4.setupTracker('HcalBarrel')
0049 seq, act = geant4.setupDetector('ContainmentShell', 'Geant4EscapeCounter')
0050
0051 phys = kernel.physicsList()
0052 phys.extends = 'QGSP_BERT'
0053 phys.enableUI()
0054 phys.dump()
0055
0056 geant4.execute()
0057
0058
0059 if __name__ == "__main__":
0060 run()