Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
geant4.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file geant4.py
1 #!/usr/bin/env python3
2 from pathlib import Path
3 
4 import acts
5 import acts.examples
6 from acts.examples.simulation import addParticleGun, addGeant4, EtaConfig
7 from acts.examples.odd import getOpenDataDetector
8 from common import getOpenDataDetectorDirectory
9 
10 u = acts.UnitConstants
11 
12 
13 def runGeant4(
14  detector,
15  trackingGeometry,
16  field,
17  outputDir,
19 ):
20  s = s or acts.examples.Sequencer(events=100, numThreads=1)
21  s.config.logLevel = acts.logging.INFO
22  rnd = acts.examples.RandomNumbers()
24  s,
25  EtaConfig(-2.0, 2.0),
26  rnd=rnd,
27  )
28  outputDir = Path(outputDir)
29  addGeant4(
30  s,
31  detector,
32  trackingGeometry,
33  field,
34  outputDirCsv=outputDir / "csv",
35  outputDirRoot=outputDir,
36  rnd=rnd,
37  )
38  return s
39 
40 
41 if "__main__" == __name__:
42  detector, trackingGeometry, decorators = getOpenDataDetector(
44  )
45 
46  field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T))
47 
48  runGeant4(detector, trackingGeometry, field, Path.cwd()).run()