Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 08:23:47

0001 # ==========================================================================
0002 #  AIDA Detector description implementation
0003 # --------------------------------------------------------------------------
0004 # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 # All rights reserved.
0006 #
0007 # For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 # For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
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   # Configure UI
0034   geant4.setupCshUI()
0035   if args.batch:
0036     kernel.UI = ''
0037 
0038   # Configure field
0039   geant4.setupTrackingField(prt=True)
0040   # Configure I/O
0041   geant4.setupROOTOutput('RootOutput', 'Assemblies_' + time.strftime('%Y-%m-%d_%H-%M'), mc_truth=False)
0042   # Setup particle gun
0043   geant4.setupGun("Gun", particle='e-', energy=2 * GeV, position=(0.15 * mm, 0.12 * mm, 0.1 * cm), multiplicity=1)
0044   # First the tracking detectors
0045   seq, act = geant4.setupTracker('VXD')
0046   # Now build the physics list:
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()