Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
full_chain_itk.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file full_chain_itk.py
1 #!/usr/bin/env python3
2 import pathlib, acts, acts.examples, acts.examples.itk
3 from acts.examples.simulation import (
4  addParticleGun,
5  MomentumConfig,
6  EtaConfig,
7  ParticleConfig,
8  addPythia8,
9  addFatras,
10  ParticleSelectorConfig,
11  addDigitization,
12 )
13 from acts.examples.reconstruction import (
14  addSeeding,
15  SeedingAlgorithm,
16  TruthSeedRanges,
17  addCKFTracks,
18  TrackSelectorConfig,
19  addAmbiguityResolution,
20  AmbiguityResolutionConfig,
21  addVertexFitting,
22  VertexFinder,
23 )
24 
25 ttbar_pu200 = False
26 u = acts.UnitConstants
27 geo_dir = pathlib.Path("acts-itk")
28 outputDir = pathlib.Path.cwd() / "itk_output"
29 # acts.examples.dump_args_calls(locals()) # show acts.examples python binding calls
30 
31 detector, trackingGeometry, decorators = acts.examples.itk.buildITkGeometry(geo_dir)
32 field = acts.examples.MagneticFieldMapXyz(str(geo_dir / "bfield/ATLAS-BField-xyz.root"))
33 rnd = acts.examples.RandomNumbers(seed=42)
34 
35 s = acts.examples.Sequencer(events=100, numThreads=-1, outputDir=str(outputDir))
36 
37 if not ttbar_pu200:
39  s,
40  MomentumConfig(1.0 * u.GeV, 10.0 * u.GeV, transverse=True),
41  EtaConfig(-4.0, 4.0, uniform=True),
42  ParticleConfig(2, acts.PdgParticle.eMuon, randomizeCharge=True),
43  rnd=rnd,
44  )
45 else:
46  addPythia8(
47  s,
48  hardProcess=["Top:qqbar2ttbar=on"],
49  npileup=200,
50  vtxGen=acts.examples.GaussianVertexGenerator(
51  stddev=acts.Vector4(0.0125 * u.mm, 0.0125 * u.mm, 55.5 * u.mm, 5.0 * u.ns),
52  mean=acts.Vector4(0, 0, 0, 0),
53  ),
54  rnd=rnd,
55  outputDirRoot=outputDir,
56  )
57 
58 addFatras(
59  s,
60  trackingGeometry,
61  field,
62  rnd=rnd,
63  preSelectParticles=ParticleSelectorConfig(
64  rho=(0.0 * u.mm, 28.0 * u.mm),
65  absZ=(0.0 * u.mm, 1.0 * u.m),
66  eta=(-4.0, 4.0),
67  pt=(150 * u.MeV, None),
68  removeNeutral=True,
69  )
70  if ttbar_pu200
72  outputDirRoot=outputDir,
73 )
74 
76  s,
77  trackingGeometry,
78  field,
79  digiConfigFile=geo_dir / "itk-hgtd/itk-smearing-config.json",
80  outputDirRoot=outputDir,
81  rnd=rnd,
82 )
83 
85  s,
86  trackingGeometry,
87  field,
88  TruthSeedRanges(pt=(1.0 * u.GeV, None), eta=(-4.0, 4.0), nHits=(9, None))
89  if ttbar_pu200
90  else TruthSeedRanges(),
91  seedingAlgorithm=SeedingAlgorithm.Default,
93  acts.examples.itk.InputSpacePointsType.PixelSpacePoints
94  ),
95  geoSelectionConfigFile=geo_dir / "itk-hgtd/geoSelection-ITk.json",
96  outputDirRoot=outputDir,
97 )
98 
100  s,
101  trackingGeometry,
102  field,
104  pt=(1.0 * u.GeV if ttbar_pu200 else 0.0, None),
105  absEta=(None, 4.0),
106  nMeasurementsMin=6,
107  ),
108  outputDirRoot=outputDir,
109 )
110 
112  s,
113  AmbiguityResolutionConfig(maximumSharedHits=3),
114  outputDirRoot=outputDir,
115 )
116 
118  s,
119  field,
120  vertexFinder=VertexFinder.Iterative,
121  outputDirRoot=outputDir,
122 )
123 
124 s.run()