3 from pathlib
import Path
4 from typing
import Optional
13 trackingGeometry: acts.TrackingGeometry,
14 field: acts.MagneticFieldProvider,
17 inputParticlePath: Optional[Path] =
None,
19 directNavigation=
False,
20 reverseFilteringMomThreshold=0 * u.GeV,
40 events=100, numThreads=-1, logLevel=acts.logging.INFO
44 s.addContextDecorator(d)
46 rnd = acts.examples.RandomNumbers(seed=42)
47 outputDir = Path(outputDir)
49 if inputParticlePath
is None:
52 ParticleConfig(num=1, pdg=acts.PdgParticle.eMuon, randomizeCharge=
True),
56 vtxGen=acts.examples.GaussianVertexGenerator(
57 mean=acts.Vector4(0, 0, 0, 0),
58 stddev=acts.Vector4(0, 0, 0, 0),
64 acts.logging.getLogger(
"Truth tracking example").info(
65 "Reading particles from %s", inputParticlePath.resolve()
67 assert inputParticlePath.exists()
69 acts.examples.RootParticleReader(
70 level=acts.logging.INFO,
71 filePath=
str(inputParticlePath.resolve()),
72 particleCollection=
"particles_input",
82 enableInteractions=
True,
89 digiConfigFile=digiConfigFile,
98 inputParticles=
"particles_input",
99 seedingAlgorithm=SeedingAlgorithm.TruthSmeared,
100 particleHypothesis=acts.ParticleHypothesis.muon,
102 pt=(1 * u.GeV,
None),
112 reverseFilteringMomThreshold,
116 acts.examples.TrackSelectorAlgorithm(
117 level=acts.logging.INFO,
118 inputTracks=
"tracks",
119 outputTracks=
"selected-tracks",
120 selectorConfig=acts.TrackSelector.Config(
126 acts.examples.TracksToTrajectories(
127 level=acts.logging.INFO,
128 inputTracks=
"selected-tracks",
129 outputTrajectories=
"trajectories-from-tracks",
132 s.addWhiteboardAlias(
"trajectories",
"trajectories-from-tracks")
135 acts.examples.RootTrajectoryStatesWriter(
136 level=acts.logging.INFO,
137 inputTrajectories=
"trajectories",
138 inputParticles=
"truth_seeds_selected",
139 inputSimHits=
"simhits",
140 inputMeasurementParticlesMap=
"measurement_particles_map",
141 inputMeasurementSimHitsMap=
"measurement_simhits_map",
142 filePath=
str(outputDir /
"trackstates_fitter.root"),
147 acts.examples.RootTrajectorySummaryWriter(
148 level=acts.logging.INFO,
149 inputTrajectories=
"trajectories",
150 inputParticles=
"truth_seeds_selected",
151 inputMeasurementParticlesMap=
"measurement_particles_map",
152 filePath=
str(outputDir /
"tracksummary_fitter.root"),
157 acts.examples.TrackFitterPerformanceWriter(
158 level=acts.logging.INFO,
159 inputTrajectories=
"trajectories",
160 inputParticles=
"truth_seeds_selected",
161 inputMeasurementParticlesMap=
"measurement_particles_map",
162 filePath=
str(outputDir /
"performance_track_fitter.root"),
169 if "__main__" == __name__:
170 srcdir = Path(__file__).resolve().parent.parent.parent.parent
173 detector, trackingGeometry, decorators = acts.examples.GenericDetector.create()
175 field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T))
180 digiConfigFile=srcdir
181 /
"Examples/Algorithms/Digitization/share/default-smearing-config-generic.json",
183 outputDir=Path.cwd(),