File indexing completed on 2025-08-05 08:10:09
0001
0002
0003 import os
0004
0005 import acts
0006 import acts.examples
0007 from acts.examples import GenericDetector, AlignedDetector
0008 from acts.examples.odd import getOpenDataDetectorDirectory
0009
0010 u = acts.UnitConstants
0011
0012
0013 def runPropagation(trackingGeometry, field, outputDir, s=None, decorators=[]):
0014 s = s or acts.examples.Sequencer(events=100, numThreads=1)
0015
0016 for d in decorators:
0017 s.addContextDecorator(d)
0018
0019 rnd = acts.examples.RandomNumbers(seed=42)
0020
0021 nav = acts.Navigator(trackingGeometry=trackingGeometry)
0022
0023 stepper = acts.EigenStepper(field)
0024
0025
0026
0027 print("We're running with:", type(stepper).__name__)
0028 prop = acts.examples.ConcretePropagator(acts.Propagator(stepper, nav))
0029
0030 alg = acts.examples.PropagationAlgorithm(
0031 propagatorImpl=prop,
0032 level=acts.logging.INFO,
0033 randomNumberSvc=rnd,
0034 ntests=1000,
0035 sterileLogger=True,
0036 propagationStepCollection="propagation-steps",
0037 )
0038
0039 s.addAlgorithm(alg)
0040
0041
0042 s.addWriter(
0043 acts.examples.ObjPropagationStepsWriter(
0044 level=acts.logging.INFO,
0045 collection="propagation-steps",
0046 outputDir=outputDir + "/obj",
0047 )
0048 )
0049
0050 s.addWriter(
0051 acts.examples.RootPropagationStepsWriter(
0052 level=acts.logging.INFO,
0053 collection="propagation-steps",
0054 filePath=outputDir + "/propagation_steps.root",
0055 )
0056 )
0057
0058 return s
0059
0060
0061 if "__main__" == __name__:
0062 matDeco = None
0063
0064
0065
0066
0067 (
0068 detector,
0069 trackingGeometry,
0070 contextDecorators,
0071 ) = GenericDetector.create(mdecorator=matDeco)
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093 field = acts.ConstantBField(acts.Vector3(0, 0, 2 * acts.UnitConstants.T))
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112 runPropagation(
0113 trackingGeometry, field, os.getcwd(), decorators=contextDecorators
0114 ).run()