Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
material_validation.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file material_validation.py
1 #!/usr/bin/env python3
2 import os
3 
4 from acts.examples import Sequencer, RootMaterialTrackWriter
5 
6 import acts
7 from acts import (
8  UnitConstants as u,
9 )
10 from common import getOpenDataDetectorDirectory
11 from acts.examples.odd import getOpenDataDetector
12 
13 
15  trackingGeometry,
16  decorators,
17  field,
18  outputDir,
19  outputName="propagation-material",
20  s=None,
21 ):
22  s = s or Sequencer(events=1000, numThreads=-1)
23 
24  for decorator in decorators:
25  s.addContextDecorator(decorator)
26 
27  nav = acts.Navigator(trackingGeometry=trackingGeometry)
28 
29  stepper = acts.StraightLineStepper()
30  # stepper = acts.EigenStepper(field)
31 
33 
34  rnd = acts.examples.RandomNumbers(seed=42)
35 
36  alg = acts.examples.PropagationAlgorithm(
37  propagatorImpl=prop,
38  level=acts.logging.INFO,
39  randomNumberSvc=rnd,
40  ntests=1000,
41  sterileLogger=True,
42  propagationStepCollection="propagation-steps",
43  recordMaterialInteractions=True,
44  d0Sigma=0,
45  z0Sigma=0,
46  )
47 
48  s.addAlgorithm(alg)
49 
50  s.addWriter(
51  RootMaterialTrackWriter(
52  level=acts.logging.INFO,
53  collection=alg.config.propagationMaterialCollection,
54  filePath=os.path.join(outputDir, (outputName + ".root")),
55  storeSurface=True,
56  storeVolume=True,
57  )
58  )
59 
60  return s
61 
62 
63 if "__main__" == __name__:
64  matDeco = acts.IMaterialDecorator.fromFile("material-map.json")
65 
66  detector, trackingGeometry, decorators = getOpenDataDetector(
67  getOpenDataDetectorDirectory(), mdecorator=matDeco
68  )
69 
70  field = acts.ConstantBField(acts.Vector3(0, 0, 2 * acts.UnitConstants.T))
71 
73  trackingGeometry, decorators, field, outputDir=os.getcwd()
74  ).run()