Newer
Older
Markus Frank
committed
"""
Perform a material scan using Geant4 shotting geantinos
@author M.Frank
@version 1.0
"""
Marko Petric
committed
Markus Frank
committed
def run():
Marko Petric
committed
import CLICSid, DDG4
Markus Frank
committed
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)
Markus Frank
committed
sid.setupPhysics('QGSP_BERT')
Markus Frank
committed
#
Markus Frank
committed
gen = sid.geant4.setupGun('Gun','pi-',10*GeV,Standalone=True)
Markus Frank
committed
# Now initialize. At the Geant4 command prompt we can write the geometry:
# Idle> /ddg4/Writer/write
Markus Frank
committed
# 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)
#
Markus Frank
committed
ui.Commands = [
Markus Frank
committed
'/run/beamOn 0',
Markus Frank
committed
'/ddg4/Writer/Output CLICSiD.gdml',
'/ddg4/Writer/OverWrite 1',
Markus Frank
committed
'/ddg4/Writer/write'
Markus Frank
committed
]
Markus Frank
committed
kernel.NumEvents = 0
Markus Frank
committed
kernel.configure()
kernel.initialize()
kernel.run()
kernel.terminate()
if __name__ == "__main__":
run()