Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
volume_association_test.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file volume_association_test.py
1 #!/usr/bin/env python3
2 
3 import acts
4 import argparse
5 import acts.examples
6 import acts.examples.odd_light as odd_light
7 from acts.examples import geant4 as acts_g4
8 
9 from acts import GeometryContext, logging
10 
11 
12 def volumeAssociationTest(sequencer, ntests, tdetector):
13 
14  rnd = acts.examples.RandomNumbers(seed=42)
15 
16  alg = acts.examples.VolumeAssociationTest(
17  name="VolumeAssociation",
18  ntests=ntests,
19  detector=tdetector,
20  randomNumbers=rnd,
21  randomRange=[1100, 3100],
22  level=logging.DEBUG,
23  )
24  # Add the algorithm to the sequenceer
25  sequencer.addAlgorithm(alg)
26  return sequencer
27 
28 
29 def main():
30  # Parse the command line arguments
31  p = argparse.ArgumentParser()
32  p.add_argument(
33  "-i",
34  "--input",
35  type=str,
36  default="odd-light.gdml",
37  help="GDML input file (optional)",
38  )
39  p.add_argument(
40  "-s",
41  "--sensitives",
42  type=str,
43  default="phys_vol",
44  help="Match string for sensitive surfaces",
45  )
46  p.add_argument(
47  "-p",
48  "--passives",
49  type=str,
50  default="pass_vol",
51  help="Match string for passive surfaces",
52  )
53  p.add_argument(
54  "-n", "--events", type=int, default=1000, help="Number of events to generate"
55  )
56  p.add_argument("-t", "--tests", type=int, default=10000, help="Tests per track")
57 
58  args = p.parse_args()
59  geoContext = GeometryContext()
60 
61  # Convert the detector surfaces from GDML
62  [elements, ssurfaces, psurfaces] = acts_g4.convertSurfaces(
63  args.input, [args.sensitives], [args.passives]
64  )
65  odd = odd_light.get_detector(geoContext, ssurfaces, psurfaces, logging.INFO)
66  seq = acts.examples.Sequencer(events=args.events, numThreads=1)
67  volumeAssociationTest(seq, args.tests, odd).run()
68 
69 
70 if "__main__" == __name__:
71  main()