Skip to content
Snippets Groups Projects
CLIC_GDML.py 1.46 KiB
Newer Older
"""

   Perform a material scan using Geant4 shotting geantinos

   @author  M.Frank
   @version 1.0

"""
from __future__ import absolute_import
from g4units import *
  from DDG4 import OutputLevel as Output
  
  sid = CLICSid.CLICSid()
  sid.loadGeometry()
  sid.geant4.printDetectors()
  kernel = sid.kernel
  kernel.UI = "UI"
  ui = sid.geant4.setupCshUI(ui=None)
  #
  # Setup the GDML writer action
  writer = DDG4.Action(kernel,'Geant4GDMLWriteAction/Writer')
  writer.enableUI()
  kernel.registerGlobalAction(writer)
  gen = sid.geant4.setupGun('Gun','pi-',10*GeV,Standalone=True)
  # Now initialize. At the Geant4 command prompt we can write the geometry:
  # Idle> /ddg4/Writer/write
  # or by configuring the UI using ui.Commands
  #
  # Please note: The Geant4 physics list must be initialized BEFORE
  # invoking the writer with options. Otherwise the particle definitions
  # are missing!
  # If you ONLY want to dump the geometry to GDML you must call
  # /run/beamOn 0
  # before writing the GDML file!
  # You also need to setup a minimal generation action like:
  # sid.geant4.setupGun('Gun','pi-',10*GeV,Standalone=True)
  #
    '/ddg4/Writer/Output CLICSiD.gdml',
    '/ddg4/Writer/OverWrite 1',
  kernel.configure()
  kernel.initialize()
  kernel.run()
  kernel.terminate()

if __name__ == "__main__":
  run()