Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:23:37

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