Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:45

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 from __future__ import absolute_import, unicode_literals
0012 import os
0013 import time
0014 import DDG4
0015 from g4units import GeV, mm, cm
0016 #
0017 """
0018    dd4hep example setup using the python configuration
0019 
0020    \author  M.Frank
0021    \version 1.0
0022 
0023 """
0024 
0025 
0026 def run():
0027   args = DDG4.CommandLine()
0028   kernel = DDG4.Kernel()
0029   install_dir = os.environ['DD4hepExamplesINSTALL']
0030   kernel.loadGeometry(str("file:" + install_dir + "/examples/ClientTests/compact/Assemblies.xml"))
0031   #
0032   geant4 = DDG4.Geant4(kernel, tracker='Geant4TrackerCombineAction')
0033   geant4.printDetectors()
0034   # Configure UI
0035   geant4.setupCshUI()
0036   if args.batch:
0037     kernel.UI = ''
0038 
0039   # Configure field
0040   geant4.setupTrackingField(prt=True)
0041   # Configure I/O
0042   geant4.setupROOTOutput('RootOutput', 'Assemblies_' + time.strftime('%Y-%m-%d_%H-%M'), mc_truth=False)
0043   # Setup particle gun
0044   geant4.setupGun("Gun", particle='e-', energy=2 * GeV, position=(0.15 * mm, 0.12 * mm, 0.1 * cm), multiplicity=1)
0045   # First the tracking detectors
0046   seq, act = geant4.setupTracker('VXD')
0047   # Now build the physics list:
0048   phys = kernel.physicsList()
0049   phys.extends = 'QGSP_BERT'
0050   phys.enableUI()
0051   phys.dump()
0052 
0053   DDG4.setPrintLevel(DDG4.OutputLevel.DEBUG)
0054   geant4.execute()
0055 
0056 
0057 if __name__ == "__main__":
0058   run()