forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvolume_association_test.py
More file actions
executable file
·70 lines (59 loc) · 1.82 KB
/
volume_association_test.py
File metadata and controls
executable file
·70 lines (59 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python3
import acts
import argparse
import acts.examples
import acts.examples.odd_light as odd_light
from acts.examples import geant4 as acts_g4
from acts import GeometryContext, logging
def volumeAssociationTest(sequencer, ntests, tdetector):
rnd = acts.examples.RandomNumbers(seed=42)
alg = acts.examples.VolumeAssociationTest(
name="VolumeAssociation",
ntests=ntests,
detector=tdetector,
randomNumbers=rnd,
randomRange=[1100, 3100],
level=logging.DEBUG,
)
# Add the algorithm to the sequenceer
sequencer.addAlgorithm(alg)
return sequencer
def main():
# Parse the command line arguments
p = argparse.ArgumentParser()
p.add_argument(
"-i",
"--input",
type=str,
default="odd-light.gdml",
help="GDML input file (optional)",
)
p.add_argument(
"-s",
"--sensitives",
type=str,
default="phys_vol",
help="Match string for sensitive surfaces",
)
p.add_argument(
"-p",
"--passives",
type=str,
default="pass_vol",
help="Match string for passive surfaces",
)
p.add_argument(
"-n", "--events", type=int, default=1000, help="Number of events to generate"
)
p.add_argument("-t", "--tests", type=int, default=10000, help="Tests per track")
args = p.parse_args()
geoContext = GeometryContext()
# Convert the detector surfaces from GDML
[_, ssurfaces, psurfaces] = acts_g4.convertSurfaces(
args.input, [args.sensitives], [args.passives]
)
odd = odd_light.get_detector(geoContext, ssurfaces, psurfaces, logging.INFO)
seq = acts.examples.Sequencer(events=args.events, numThreads=1)
volumeAssociationTest(seq, args.tests, odd).run()
if "__main__" == __name__:
main()