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 #
0012 """
0013 
0014    Perform a material scan using Geant4 shotting geantinos
0015 
0016    @author  M.Frank
0017    @version 1.0
0018 
0019 """
0020 from __future__ import absolute_import, unicode_literals
0021 from g4units import GeV
0022 
0023 
0024 def run():
0025   import CLICSid
0026   import DDG4
0027 
0028   sid = CLICSid.CLICSid()
0029   sid.loadGeometry()
0030   sid.geant4.printDetectors()
0031   kernel = sid.kernel
0032   kernel.UI = "UI"
0033   ui = sid.geant4.setupCshUI(ui=None)
0034   #
0035   # Setup the GDML writer action
0036   writer = DDG4.Action(kernel, 'Geant4GDMLWriteAction/Writer')
0037   writer.enableUI()
0038   kernel.registerGlobalAction(writer)
0039   sid.setupPhysics('QGSP_BERT')
0040   #
0041   sid.geant4.setupGun('Gun', 'pi-', 10 * GeV, Standalone=True)
0042   # Now initialize. At the Geant4 command prompt we can write the geometry:
0043   # Idle> /ddg4/Writer/write
0044   # or by configuring the UI using ui.Commands
0045   #
0046   # Please note: The Geant4 physics list must be initialized BEFORE
0047   # invoking the writer with options. Otherwise the particle definitions
0048   # are missing!
0049   # If you ONLY want to dump the geometry to GDML you must call
0050   # /run/beamOn 0
0051   # before writing the GDML file!
0052   # You also need to setup a minimal generation action like:
0053   # sid.geant4.setupGun('Gun','pi-',10*GeV,Standalone=True)
0054   #
0055   ui.Commands = [
0056       '/run/beamOn 0',
0057       '/ddg4/Writer/Output CLICSiD.gdml',
0058       '/ddg4/Writer/OverWrite 1',
0059       '/ddg4/Writer/write'
0060       ]
0061   kernel.NumEvents = 0
0062   kernel.configure()
0063   kernel.initialize()
0064   kernel.run()
0065   kernel.terminate()
0066 
0067 
0068 if __name__ == "__main__":
0069   run()