Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
telescope_simulation.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file telescope_simulation.py
1 #!/usr/bin/env python3
2 
3 from pathlib import Path
4 
5 import acts
6 import acts.examples
7 from acts.examples.simulation import (
8  addParticleGun,
9  EtaConfig,
10  PhiConfig,
11  ParticleConfig,
12  addFatras,
13  addGeant4,
14 )
15 
16 u = acts.UnitConstants
17 
18 if "__main__" == __name__:
19  detector, trackingGeometry, decorators = acts.examples.TelescopeDetector.create(
20  bounds=[200, 200],
21  positions=[30, 60, 90, 120, 150, 180, 210, 240, 270],
22  binValue=2,
23  )
24 
25  field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T))
26 
27  outputDir = Path.cwd() / "telescope_simulation"
28  if not outputDir.exists():
29  outputDir.mkdir()
30 
31  for geant, postfix in [(False, "fatras"), (True, "geant4")]:
32  rnd = acts.examples.RandomNumbers(seed=42)
33 
34  s = acts.examples.Sequencer(events=1, numThreads=1, logLevel=acts.logging.INFO)
35 
37  s,
38  EtaConfig(-10.0, 10.0),
39  PhiConfig(0.0, 360.0 * u.degree),
40  ParticleConfig(1000, acts.PdgParticle.eMuon, False),
41  multiplicity=1,
42  rnd=rnd,
43  outputDirRoot=outputDir / postfix,
44  )
45 
46  if geant:
47  addGeant4(
48  s,
49  detector,
50  trackingGeometry,
51  field,
52  rnd=rnd,
53  outputDirRoot=outputDir / postfix,
54  outputDirCsv=outputDir / postfix,
55  logLevel=acts.logging.VERBOSE,
56  )
57  else:
58  addFatras(
59  s,
60  trackingGeometry,
61  field,
62  rnd=rnd,
63  outputDirRoot=outputDir / postfix,
64  )
65 
66  s.run()