Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:03:39

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 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   # Configure field
0042   geant4.setupTrackingField(prt=True)
0043   # Configure I/O
0044   geant4.setupROOTOutput('RootOutput', 'FCC_' + time.strftime('%Y-%m-%d_%H-%M'), mc_truth=False)
0045   # Setup particle gun
0046   geant4.setupGun("Gun", particle='pi-', energy=100 * GeV, multiplicity=1)
0047   # Now the calorimeters
0048   seq, act = geant4.setupTracker('HcalBarrel')
0049   seq, act = geant4.setupDetector('ContainmentShell', 'Geant4EscapeCounter')
0050   # Now build the physics list:
0051   phys = kernel.physicsList()
0052   phys.extends = 'QGSP_BERT'
0053   phys.enableUI()
0054   phys.dump()
0055   # and run
0056   geant4.execute()
0057 
0058 
0059 if __name__ == "__main__":
0060   run()