2 from pathlib
import Path
3 from typing
import Optional, Union
4 from collections
import namedtuple
9 from acts.examples import Sequencer, GenericDetector, RootParticleReader
13 from acts
import UnitConstants
as u
17 """Get arguments from command line"""
18 parser = argparse.ArgumentParser(description=
"Command line arguments for CKF")
23 help=
"Directory with input root files",
30 help=
"Output directory for new ntuples",
34 "-n",
"--nEvents", dest=
"nEvts", help=
"Number of events to run over", default=1
37 "--sf_maxSeedsPerSpM",
38 dest=
"sf_maxSeedsPerSpM",
39 help=
"Number of compatible seeds considered for middle seed",
45 dest=
"sf_cotThetaMax",
46 help=
"cot of maximum theta angle",
51 "--sf_sigmaScattering",
52 dest=
"sf_sigmaScattering",
53 help=
"How many sigmas of scattering to include in seeds",
58 "--sf_radLengthPerSeed",
59 dest=
"sf_radLengthPerSeed",
60 help=
"Average Radiation Length",
67 help=
"max impact parameter in mm",
72 "--sf_maxPtScattering",
73 dest=
"sf_maxPtScattering",
74 help=
"maximum Pt for scattering cut in GeV",
81 help=
"minimum value for deltaR separation in mm",
88 help=
"maximum value for deltaR separation in mm",
99 geometrySelection: Path,
100 digiConfigFile: Path,
104 truthSmearedSeeded=
False,
105 truthEstimatedSeeded=
False,
107 inputParticlePath: Optional[Path] =
None,
112 RadLengthPerSeed=0.1,
114 MaxPtScattering=10.0,
131 ParticleSmearingSigmas,
133 SeedFinderOptionsArg,
135 TruthEstimatedSeedingAlgorithmConfigArg,
140 events=int(NumEvents),
142 logLevel=acts.logging.INFO,
146 s.addContextDecorator(d)
147 rnd = acts.examples.RandomNumbers(seed=42)
148 outputDir = Path(outputDir)
150 if inputParticlePath
is None:
160 acts.logging.getLogger(
"CKFExample").info(
161 "Reading particles from %s", inputParticlePath.resolve()
163 assert inputParticlePath.exists()
166 level=acts.logging.INFO,
167 filePath=
str(inputParticlePath.resolve()),
168 particleCollection=
"particles_input",
184 digiConfigFile=digiConfigFile,
195 r=(
None, 200 * u.mm),
196 deltaR=(DeltaRMin * u.mm, DeltaRMax * u.mm),
197 collisionRegion=(-250 * u.mm, 250 * u.mm),
198 z=(-2000 * u.mm, 2000 * u.mm),
199 maxSeedsPerSpM=MaxSeedsPerSpM,
200 cotThetaMax=CotThetaMax,
201 sigmaScattering=SigmaScattering,
202 radLengthPerSeed=RadLengthPerSeed,
203 maxPtScattering=MaxPtScattering * u.GeV,
205 impactMax=ImpactMax * u.mm,
209 seedingAlgorithm=SeedingAlgorithm.TruthSmeared
210 if truthSmearedSeeded
211 else SeedingAlgorithm.TruthEstimated
212 if truthEstimatedSeeded
213 else SeedingAlgorithm.Default,
214 geoSelectionConfigFile=geometrySelection,
215 outputDirRoot=outputDir,
223 outputDirRoot=outputDir,
224 outputDirCsv=outputDir /
"csv" if outputCsv
else None,
230 if "__main__" == __name__:
233 Inputdir = options.indir
234 Outputdir = options.outdir
236 srcdir = Path(__file__).resolve().parent.parent.parent.parent
238 detector, trackingGeometry, decorators = GenericDetector.create()
240 field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T))
242 inputParticlePath = Path(Inputdir) /
"pythia8_particles.root"
243 if not inputParticlePath.exists():
244 inputParticlePath =
None
250 geometrySelection=srcdir
251 /
"Examples/Algorithms/TrackFinding/share/geoSelection-genericDetector.json",
252 digiConfigFile=srcdir
253 /
"Examples/Algorithms/Digitization/share/default-smearing-config-generic.json",
255 truthSmearedSeeded=
False,
256 truthEstimatedSeeded=
False,
257 inputParticlePath=inputParticlePath,
259 NumEvents=options.nEvts,
260 MaxSeedsPerSpM=options.sf_maxSeedsPerSpM,
261 CotThetaMax=options.sf_cotThetaMax,
262 SigmaScattering=options.sf_sigmaScattering,
263 RadLengthPerSeed=options.sf_radLengthPerSeed,
264 ImpactMax=options.sf_impactMax,
265 MaxPtScattering=options.sf_maxPtScattering,
266 DeltaRMin=options.sf_deltaRMin,
267 DeltaRMax=options.sf_deltaRMax,