File indexing completed on 2025-08-05 08:10:09
0001
0002
0003 from pathlib import Path
0004
0005 import acts
0006 import acts.examples
0007 from acts.examples.simulation import (
0008 addParticleGun,
0009 EtaConfig,
0010 PhiConfig,
0011 ParticleConfig,
0012 addFatras,
0013 addGeant4,
0014 )
0015
0016 u = acts.UnitConstants
0017
0018 if "__main__" == __name__:
0019 detector, trackingGeometry, decorators = acts.examples.TelescopeDetector.create(
0020 bounds=[200, 200],
0021 positions=[30, 60, 90, 120, 150, 180, 210, 240, 270],
0022 stereos=[0, 0, 0, 0, 0, 0, 0, 0, 0],
0023 binValue=2,
0024 )
0025
0026 field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T))
0027
0028 outputDir = Path.cwd() / "telescope_simulation"
0029 if not outputDir.exists():
0030 outputDir.mkdir()
0031
0032 for geant, postfix in [(False, "fatras"), (True, "geant4")]:
0033 rnd = acts.examples.RandomNumbers(seed=42)
0034
0035 s = acts.examples.Sequencer(events=1, numThreads=1, logLevel=acts.logging.INFO)
0036
0037 addParticleGun(
0038 s,
0039 EtaConfig(-10.0, 10.0),
0040 PhiConfig(0.0, 360.0 * u.degree),
0041 ParticleConfig(1000, acts.PdgParticle.eMuon, False),
0042 multiplicity=1,
0043 rnd=rnd,
0044 outputDirRoot=outputDir / postfix,
0045 )
0046
0047 if geant:
0048 addGeant4(
0049 s,
0050 detector,
0051 trackingGeometry,
0052 field,
0053 rnd=rnd,
0054 outputDirRoot=outputDir / postfix,
0055 outputDirCsv=outputDir / postfix,
0056 logLevel=acts.logging.VERBOSE,
0057 )
0058 else:
0059 addFatras(
0060 s,
0061 trackingGeometry,
0062 field,
0063 rnd=rnd,
0064 outputDirRoot=outputDir / postfix,
0065 )
0066
0067 s.run()