Skip to content

Commit

Permalink
feat: Add option to use odd with G4 (#1794)
Browse files Browse the repository at this point in the history
This add the option to use the G4 simulation with the Odd getting around the problem noticed in issue #1578.
Incidently it also fix a bug while using the odd full chain with only csv writting
  • Loading branch information
Corentin-Allaire committed Jan 24, 2023
1 parent 7953e14 commit 8aa0806
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Examples/Python/python/acts/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ def addTrajectoryWriters(
if not outputDirCsv.exists():
outputDirCsv.mkdir()

if trackSummaryWriter:
if writeSummary:
csvMTJWriter = acts.examples.CsvMultiTrajectoryWriter(
level=customLogLevel(),
inputTrajectories=trajectories,
Expand Down
44 changes: 33 additions & 11 deletions Examples/Scripts/Python/full_chain_odd.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from acts.examples.odd import getOpenDataDetector

ttbar_pu200 = False
g4_simulation = False
u = acts.UnitConstants
geoDir = getOpenDataDetectorDirectory()
outputDir = pathlib.Path.cwd() / "odd_output"
Expand Down Expand Up @@ -73,19 +74,40 @@
rnd=rnd,
outputDirRoot=outputDir,
)
if g4_simulation:
if s.config.numThreads != 1:
raise ValueError("Geant 4 simulation does not support multi-threading")

addFatras(
s,
trackingGeometry,
field,
ParticleSelectorConfig(
eta=(-3.0, 3.0), pt=(150 * u.MeV, None), removeNeutral=True
# Pythia can sometime simulate particles outside the world volume, a cut on the Z of the track help mitigate this effect
# Older version of G4 might not work, this as has been tested on version `geant4-11-00-patch-03`
# For more detail see issue #1578
addGeant4(
s,
detector,
trackingGeometry,
field,
preselectParticles=ParticleSelectorConfig(
eta=(-3.0, 3.0),
absZ=(0, 1e4),
pt=(150 * u.MeV, None),
removeNeutral=True,
),
outputDirCsv=outputDir,
rnd=rnd,
)
else:
addFatras(
s,
trackingGeometry,
field,
ParticleSelectorConfig(
eta=(-3.0, 3.0), pt=(150 * u.MeV, None), removeNeutral=True
)
if ttbar_pu200
else ParticleSelectorConfig(),
outputDirRoot=outputDir,
rnd=rnd,
)
if ttbar_pu200
else ParticleSelectorConfig(),
outputDirRoot=outputDir,
rnd=rnd,
)

addDigitization(
s,
Expand Down

0 comments on commit 8aa0806

Please sign in to comment.