Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-30 08:06:58

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