2 from pathlib
import Path
14 Argparse action for handling Enums
19 enum_type = kwargs.pop(
"enum",
None)
23 raise ValueError(
"type must be assigned an Enum when using EnumAction")
24 if not issubclass(enum_type, Enum):
25 raise TypeError(
"type must be an Enum when using EnumAction")
28 kwargs.setdefault(
"choices",
tuple(e.name
for e
in enum_type))
30 super(EnumAction, self).
__init__(**kwargs)
34 def __call__(self, parser, namespace, values, option_string=None):
37 setattr(namespace, self.dest, e)
40 raise ValueError(
"%s is not a validly enumerated algorithm." % values)
51 seedingAlgorithm=SeedingAlgorithm.Default,
64 events=100, numThreads=-1, logLevel=acts.logging.INFO
66 rnd = acts.examples.RandomNumbers(seed=42)
67 outputDir = Path(outputDir)
75 outputDirCsv=outputDir /
"csv",
76 outputDirRoot=outputDir,
84 outputDirCsv=outputDir /
"csv",
85 outputDirRoot=outputDir,
87 preSelectParticles=
None,
90 srcdir = Path(__file__).resolve().parent.parent.parent.parent
96 /
"Examples/Algorithms/Digitization/share/default-smearing-config-generic.json",
102 ParticleSmearingSigmas,
104 SeedFinderOptionsArg,
111 TruthSeedRanges(pt=(1.0 * u.GeV,
None), eta=(-2.5, 2.5), nHits=(9,
None)),
114 r=(
None, 200 * u.mm),
115 deltaR=(1 * u.mm, 60 * u.mm),
116 collisionRegion=(-250 * u.mm, 250 * u.mm),
117 z=(-2000 * u.mm, 2000 * u.mm),
120 radLengthPerSeed=0.1,
125 bFieldInZ=1.99724 * u.T,
127 acts.logging.VERBOSE,
128 seedingAlgorithm=seedingAlgorithm,
129 geoSelectionConfigFile=srcdir
130 /
"Examples/Algorithms/TrackFinding/share/geoSelection-genericDetector.json",
131 inputParticles=
"particles_final",
132 outputDirRoot=outputDir,
137 if "__main__" == __name__:
138 p = argparse.ArgumentParser(
139 description=
"Example script to run seed finding",
145 enum=SeedingAlgorithm,
146 default=SeedingAlgorithm.Default,
147 help=
"Select the seeding algorithm to use",
150 args = p.parse_args()
152 detector, trackingGeometry, _ = acts.examples.GenericDetector.create()
154 field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T))
157 trackingGeometry, field, outputDir=Path.cwd(), seedingAlgorithm=args.algorithm