Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
physmon_track_finding_ttbar.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file physmon_track_finding_ttbar.py
1 #!/usr/bin/env python3
2 import tempfile
3 from pathlib import Path
4 import shutil
5 
6 import acts
7 from acts.examples.simulation import (
8  addPythia8,
9  addFatras,
10  addDigitization,
11 )
12 
13 from acts.examples.reconstruction import (
14  addSeeding,
15  TruthSeedRanges,
16  ParticleSmearingSigmas,
17  SeedFinderConfigArg,
18  SeedFinderOptionsArg,
19  SeedingAlgorithm,
20  TruthEstimatedSeedingAlgorithmConfigArg,
21  addCKFTracks,
22  addAmbiguityResolution,
23  AmbiguityResolutionConfig,
24  addVertexFitting,
25  VertexFinder,
26  TrackSelectorConfig,
27 )
28 
29 from physmon_common import makeSetup
30 
31 u = acts.UnitConstants
32 
33 setup = makeSetup()
34 
35 
36 with tempfile.TemporaryDirectory() as temp:
38  Path(__file__).parent.parent / "fpe_masks.yml"
39  ) + [
41  "Examples/Algorithms/Fatras/src/FatrasSimulation.cpp",
42  (172, 173),
43  acts.FpeType.FLTINV,
44  1,
45  ),
47  "Examples/Algorithms/Fatras/src/FatrasSimulation.cpp",
48  (235, 236),
49  acts.FpeType.FLTINV,
50  1,
51  ),
53  "Examples/Algorithms/Fatras/src/FatrasSimulation.cpp",
54  (235, 236),
55  acts.FpeType.FLTOVF,
56  1,
57  ),
59  "Examples/Io/Root/src/RootTrajectorySummaryWriter.cpp",
60  (371, 372),
61  acts.FpeType.FLTINV,
62  1,
63  ),
65  "Core/src/Utilities/AnnealingUtility.cpp",
66  (38, 39),
67  acts.FpeType.FLTUND,
68  1,
69  ),
71  "Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp",
72  (110, 111),
73  acts.FpeType.FLTINV,
74  1,
75  ),
77  "Fatras/include/ActsFatras/Kernel/Simulation.hpp",
78  (96, 97),
79  acts.FpeType.FLTOVF,
80  1,
81  ),
82  ]
84  events=3,
85  numThreads=-1,
86  logLevel=acts.logging.INFO,
87  fpeMasks=fpeMasks,
88  )
89 
90  tp = Path(temp)
91 
92  for d in setup.decorators:
93  s.addContextDecorator(d)
94 
95  rnd = acts.examples.RandomNumbers(seed=42)
96 
97  addPythia8(
98  s,
99  hardProcess=["Top:qqbar2ttbar=on"],
100  npileup=200,
101  vtxGen=acts.examples.GaussianVertexGenerator(
102  mean=acts.Vector4(0, 0, 0, 0),
103  stddev=acts.Vector4(0.0125 * u.mm, 0.0125 * u.mm, 55.5 * u.mm, 5.0 * u.ns),
104  ),
105  rnd=rnd,
106  )
107 
108  addFatras(
109  s,
110  setup.trackingGeometry,
111  setup.field,
112  rnd=rnd,
113  )
114 
116  s,
117  setup.trackingGeometry,
118  setup.field,
119  digiConfigFile=setup.digiConfig,
120  rnd=rnd,
121  )
122 
123  addSeeding(
124  s,
125  setup.trackingGeometry,
126  setup.field,
127  TruthSeedRanges(pt=(500.0 * u.MeV, None), nHits=(9, None)),
128  ParticleSmearingSigmas(pRel=0.01), # only used by SeedingAlgorithm.TruthSmeared
130  r=(None, 200 * u.mm), # rMin=default, 33mm
131  deltaR=(1 * u.mm, 60 * u.mm),
132  collisionRegion=(-250 * u.mm, 250 * u.mm),
133  z=(-2000 * u.mm, 2000 * u.mm),
134  maxSeedsPerSpM=1,
135  sigmaScattering=5,
136  radLengthPerSeed=0.1,
137  minPt=500 * u.MeV,
138  impactMax=3 * u.mm,
139  ),
140  SeedFinderOptionsArg(bFieldInZ=1.99724 * u.T, beamPos=(0.0, 0.0)),
141  TruthEstimatedSeedingAlgorithmConfigArg(deltaR=(10.0 * u.mm, None)),
142  seedingAlgorithm=SeedingAlgorithm.Default,
143  geoSelectionConfigFile=setup.geoSel,
144  rnd=rnd, # only used by SeedingAlgorithm.TruthSmeared
145  outputDirRoot=tp,
146  )
147 
148  addCKFTracks(
149  s,
150  setup.trackingGeometry,
151  setup.field,
153  pt=(500 * u.MeV, None),
154  loc0=(-4.0 * u.mm, 4.0 * u.mm),
155  nMeasurementsMin=6,
156  ),
157  outputDirRoot=tp,
158  )
159 
161  s,
162  AmbiguityResolutionConfig(maximumSharedHits=3),
163  outputDirRoot=tp,
164  )
165 
167  s,
168  setup.field,
169  seeder=acts.VertexSeedFinder.GaussianSeeder,
170  outputProtoVertices="amvf_protovertices",
171  outputVertices="amvf_fittedVertices",
172  vertexFinder=VertexFinder.AMVF,
173  outputDirRoot=tp / "amvf",
174  )
175 
177  s,
178  setup.field,
179  seeder=acts.VertexSeedFinder.AdaptiveGridSeeder,
180  outputProtoVertices="amvf_gridseeder_protovertices",
181  outputVertices="amvf_gridseeder_fittedVertices",
182  vertexFinder=VertexFinder.AMVF,
183  outputDirRoot=tp / "amvf_gridseeder",
184  )
185 
186  s.run()
187  del s
188 
189  for vertexing in ["amvf", "amvf_gridseeder"]:
190  shutil.move(
191  tp / f"{vertexing}/performance_vertexing.root",
192  tp / f"performance_{vertexing}.root",
193  )
194 
195  for stem in [
196  "performance_ckf",
197  "tracksummary_ckf",
198  "performance_amvf",
199  "performance_amvf_gridseeder",
200  ] + (["performance_seeding", "performance_ambi"]):
201  perf_file = tp / f"{stem}.root"
202  assert perf_file.exists(), "Performance file not found"
203  shutil.copy(perf_file, setup.outdir / f"{stem}_ttbar.root")