File indexing completed on 2025-01-30 09:17:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 """
0012 dd4hep example setup using the python configuration
0013
0014 \author M.Frank
0015 \version 1.0
0016
0017 """
0018 from __future__ import absolute_import, unicode_literals
0019 import logging
0020 import sys
0021
0022
0023 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
0024
0025
0026 def show_help():
0027 logging.info("Check_shape.py -option [-option] ")
0028 logging.info(" -geometry <geometry file> Geometry file ")
0029 logging.info(" -vis Enable visualization ")
0030 logging.info(" -batch Batch execution ")
0031
0032
0033 def run():
0034 cnt = 0
0035 geo = None
0036 vis = False
0037 batch = False
0038 for i in sys.argv:
0039 cnt = cnt + 1
0040 c = i.upper()
0041 if c.find('BATCH') < 2 and c.find('BATCH') >= 0:
0042 batch = True
0043 elif c[:4] == '-GEO':
0044 geo = sys.argv[cnt]
0045 elif c[:4] == '-VIS':
0046 vis = True
0047
0048 if not geo:
0049 show_help()
0050 sys.exit(1)
0051
0052 import DDG4
0053 kernel = DDG4.Kernel()
0054
0055 geant4 = DDG4.Geant4(kernel, tracker='Geant4TrackerCombineAction')
0056 if batch:
0057 ui = geant4.setupCshUI(typ=None, ui=None, vis=None)
0058 kernel.UI = 'UI'
0059 else:
0060 ui = geant4.setupCshUI(vis=vis)
0061 kernel.loadGeometry(geo)
0062
0063 geant4.setupTrackingField(prt=True)
0064
0065 geant4.setupPhysics('')
0066 kernel.physicsList().enableUI()
0067 DDG4.setPrintLevel(DDG4.OutputLevel.DEBUG)
0068
0069 ui.Commands = [
0070 '/ddg4/ConstructGeometry/printVolume /world_volume_1',
0071 '/ddg4/ConstructGeometry/printMaterial Air',
0072 '/ddg4/ConstructGeometry/printMaterial Vacuum',
0073 '/ddg4/UI/exit'
0074 ]
0075 kernel.NumEvents = 0
0076 kernel.configure()
0077 kernel.initialize()
0078 kernel.run()
0079 kernel.terminate()
0080
0081
0082
0083 if __name__ == "__main__":
0084 run()