Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-29 08:25: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 #   Subtest using CLICSid showing the usage of the G4Particle gun using
0015 #   the Geant4GeneratorWrapper object.
0016 #
0017 #   @author  M.Frank
0018 #   @version 1.0
0019 #
0020 # ==========================================================================
0021 import DDG4
0022 import CLICSid
0023 import logging
0024 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
0025 logger = logging.getLogger(__name__)
0026 
0027 
0028 def run():
0029   import os
0030   import time
0031   import g4units
0032   install_dir = os.environ['DD4hepExamplesINSTALL']
0033   file = str("file:" + install_dir + "/examples/CLICSiD/compact/SiD_ECAL_Parallel_Readout.xml")
0034   sid = CLICSid.CLICSid()
0035   sid.kernel.loadGeometry(file)
0036   sid.kernel.UI = "UI"
0037   sid.geant4.setupCshUI()
0038   sid.setupField(quiet=False)
0039   DDG4.importConstants(sid.kernel.detectorDescription(), debug=False)
0040   #
0041   sid.geant4.printDetectors()
0042   sid.geant4.setupROOTOutput('RootOutput', 'CLICSiD_' + time.strftime('%Y-%m-%d_%H-%M'))
0043   #
0044   sid.geant4.setupGun("Gun",
0045                       Standalone=True,
0046                       particle='e+',
0047                       energy=20 * g4units.GeV,
0048                       position=(0, 0, 0),
0049                       multiplicity=1,
0050                       isotrop=True)
0051   # =============================================================================
0052   #
0053   #  Setup the parallel readout for the detector EcalBarrel
0054   #
0055   # =============================================================================
0056   # First use the default definition for the basic setup (and the first sensitive action)
0057   det = str('EcalBarrel')
0058   typ = sid.geant4.sensitive_types['calorimeter']
0059   seq = DDG4.SensitiveSequence(sid.kernel, str('Geant4SensDetActionSequence/') + det)
0060   seq.enableUI()
0061   act = DDG4.SensitiveAction(sid.kernel, str(typ + '/EcalBarrelHandler'), det)
0062   act.enableUI()
0063   seq.add(act)
0064   #
0065   # Add extra parallel readout action with readout EcalBarrelHits_0
0066   act = DDG4.SensitiveAction(sid.kernel, str(typ + '/EcalBarrelHandler_0'), det)
0067   act.ReadoutName = 'EcalBarrelHits_0'
0068   act.enableUI()
0069   seq.add(act)
0070   #
0071   # Add extra parallel readout action with readout EcalBarrelHits_1
0072   act = DDG4.SensitiveAction(sid.kernel, str(typ + '/EcalBarrelHandler_1'), det)
0073   act.ReadoutName = 'EcalBarrelHits_1'
0074   act.enableUI()
0075   seq.add(act)
0076   #
0077   # Add extra parallel readout action with readout EcalBarrelHits_2
0078   act = DDG4.SensitiveAction(sid.kernel, str(typ + '/EcalBarrelHandler_2'), det)
0079   act.ReadoutName = 'EcalBarrelHits_2'
0080   act.enableUI()
0081   seq.add(act)
0082   # =============================================================================
0083 
0084   sid.setupPhysics('QGSP_BERT')
0085   sid.test_config()
0086   sid.kernel.run()
0087   sid.kernel.terminate()
0088 
0089 
0090 if __name__ == "__main__":
0091   run()