Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-29 07:35:53

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 import os
0012 import DDG4
0013 #
0014 """
0015 
0016    dd4hep example setup using the python configuration
0017    and reading a HepEvt event
0018 
0019    \author  M.Frank
0020    \version 1.0
0021 
0022 """
0023 
0024 
0025 def run():
0026   from MiniTelSetup import Setup
0027   args = DDG4.CommandLine()
0028   m = Setup()
0029   if args.batch:
0030     m.kernel.UI = ''
0031   m.configure()
0032   m.defineOutput()
0033   fname = os.environ['DD4hepExamplesINSTALL'] + '/examples/DDG4/data/Muons10GeV.HEPEvt'
0034   m.setupInput('Geant4EventReaderHepEvtShort|' + fname)
0035   m.setupGenerator()
0036   m.setupPhysics(model='FTFP_BERT')
0037   #
0038   # Add customizable Geant4PhysicsList to Geant4PhysicsListActionSequence
0039   # with G4VModularPhysicsList FTP_BERT
0040   phys_list = m.geant4.addPhysics('MyPhysics')
0041   #
0042   # Add G4StepLimiterPhysics constructor to the Geant4PhysicsList.
0043   # Will be registered to the G4VModularPhysicsList later
0044   limiter_physics = phys_list.addPhysicsConstructorType('G4StepLimiterPhysics')
0045   limiter_physics.SetApplyToAll(True)
0046   #
0047   # Create output
0048   m.phys.dump()
0049   #
0050   # Run a a number of events
0051   if args.events:
0052     m.run(num_events=int(args.events))
0053   else:
0054     m.run(num_events=1)
0055 
0056 
0057 if __name__ == '__main__':
0058   run()