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 import logging
0022 
0023 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
0024 logger = logging.getLogger(__name__)
0025 
0026 
0027 def run():
0028   import DDG4
0029   import CLICSid
0030   import g4units
0031 
0032   sid = CLICSid.CLICSid()
0033   sid.loadGeometry()
0034   DDG4.Core.setPrintFormat(str("%-32s %6s %s"))
0035   # Configure UI
0036   sid.geant4.setupCshUI(ui=None)
0037   gun = sid.geant4.setupGun("Gun",
0038                             Standalone=True,
0039                             particle='geantino',
0040                             energy=20 * g4units.GeV,
0041                             position=(0, 0, 0),
0042                             multiplicity=1,
0043                             isotrop=False)
0044   scan = DDG4.SteppingAction(sid.kernel, 'Geant4MaterialScanner/MaterialScan')
0045   sid.kernel.steppingAction().adopt(scan)
0046 
0047   # Now build the physics list:
0048   sid.setupPhysics('QGSP_BERT')
0049   sid.test_config()
0050   sid.kernel.NumEvents = 1
0051 
0052   # 3 shots in different directions:
0053   gun.direction = (0, 1, 0)
0054   sid.kernel.run()
0055   gun.direction = (1, 0, 0)
0056   sid.kernel.run()
0057   gun.direction = (1, 1, 1)
0058   sid.kernel.run()
0059 
0060   sid.kernel.terminate()
0061   logger.info('End of run. Terminating .......')
0062   logger.info('TEST_PASSED')
0063 
0064 
0065 if __name__ == "__main__":
0066   run()