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 DDG4 import OutputLevel as Output
0016 from g4units import GeV
0017 #
0018 #
0019 """
0020 
0021    dd4hep example setup using the python configuration
0022 
0023    \author  M.Frank
0024    \version 1.0
0025 
0026 """
0027 
0028 
0029 def run():
0030   kernel = DDG4.Kernel()
0031   install_dir = os.environ['DD4hepINSTALL']
0032   kernel.setOutputLevel(str('Geant4Converter'), Output.DEBUG)
0033   kernel.setOutputLevel(str('RootOutput'), Output.INFO)
0034   kernel.setOutputLevel(str('ShellHandler'), Output.DEBUG)
0035   kernel.setOutputLevel(str('Gun'), Output.INFO)
0036   kernel.loadGeometry(str("file:" + install_dir + "/examples/ClientTests/compact/FCC_HcalBarrel.xml"))
0037 
0038   geant4 = DDG4.Geant4(kernel)
0039   geant4.printDetectors()
0040   geant4.setupCshUI()
0041 
0042   # Configure field
0043   geant4.setupTrackingField(prt=True)
0044   # Configure I/O
0045   geant4.setupROOTOutput('RootOutput', 'FCC_' + time.strftime('%Y-%m-%d_%H-%M'), mc_truth=False)
0046   # Setup particle gun
0047   geant4.setupGun("Gun", particle='pi-', energy=100 * GeV, multiplicity=1)
0048   # Now the calorimeters
0049   seq, act = geant4.setupTracker('HcalBarrel')
0050   seq, act = geant4.setupDetector('ContainmentShell', 'Geant4EscapeCounter')
0051   # Now build the physics list:
0052   phys = kernel.physicsList()
0053   phys.extends = 'QGSP_BERT'
0054   phys.enableUI()
0055   phys.dump()
0056   # and run
0057   geant4.execute()
0058 
0059 
0060 if __name__ == "__main__":
0061   run()