File indexing completed on 2025-01-30 09:17:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 from __future__ import absolute_import, unicode_literals
0022 import DDG4
0023 import CLICSid
0024 import logging
0025 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
0026 logger = logging.getLogger(__name__)
0027
0028
0029 def run():
0030 import os
0031 import time
0032 import g4units
0033 install_dir = os.environ['DD4hepExamplesINSTALL']
0034 file = str("file:" + install_dir + "/examples/CLICSiD/compact/SiD_ECAL_Parallel_Readout.xml")
0035 sid = CLICSid.CLICSid()
0036 sid.kernel.loadGeometry(file)
0037 sid.kernel.UI = "UI"
0038 sid.geant4.setupCshUI()
0039 sid.setupField(quiet=False)
0040 DDG4.importConstants(sid.kernel.detectorDescription(), debug=False)
0041
0042 sid.geant4.printDetectors()
0043 sid.geant4.setupROOTOutput('RootOutput', 'CLICSiD_' + time.strftime('%Y-%m-%d_%H-%M'))
0044
0045 sid.geant4.setupGun("Gun",
0046 Standalone=True,
0047 particle='e+',
0048 energy=20 * g4units.GeV,
0049 position=(0, 0, 0),
0050 multiplicity=1,
0051 isotrop=True)
0052
0053
0054
0055
0056
0057
0058 det = str('EcalBarrel')
0059 typ = sid.geant4.sensitive_types['calorimeter']
0060 seq = DDG4.SensitiveSequence(sid.kernel, str('Geant4SensDetActionSequence/') + det)
0061 seq.enableUI()
0062 act = DDG4.SensitiveAction(sid.kernel, str(typ + '/EcalBarrelHandler'), det)
0063 act.enableUI()
0064 seq.add(act)
0065
0066
0067 act = DDG4.SensitiveAction(sid.kernel, str(typ + '/EcalBarrelHandler_0'), det)
0068 act.ReadoutName = 'EcalBarrelHits_0'
0069 act.enableUI()
0070 seq.add(act)
0071
0072
0073 act = DDG4.SensitiveAction(sid.kernel, str(typ + '/EcalBarrelHandler_1'), det)
0074 act.ReadoutName = 'EcalBarrelHits_1'
0075 act.enableUI()
0076 seq.add(act)
0077
0078
0079 act = DDG4.SensitiveAction(sid.kernel, str(typ + '/EcalBarrelHandler_2'), det)
0080 act.ReadoutName = 'EcalBarrelHits_2'
0081 act.enableUI()
0082 seq.add(act)
0083
0084
0085 sid.setupPhysics('QGSP_BERT')
0086 sid.test_config()
0087 sid.kernel.run()
0088 sid.kernel.terminate()
0089
0090
0091 if __name__ == "__main__":
0092 run()