Skip to content

Commit

Permalink
refactor: rename sim output files (#1862)
Browse files Browse the repository at this point in the history
change sim output names and remove fatras prefix as we also use geant 4

also simplify sim writer logic
  • Loading branch information
andiwand authored Feb 14, 2023
1 parent ff31ee5 commit 5f2cad4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 47 deletions.
40 changes: 15 additions & 25 deletions Examples/Python/python/acts/examples/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,53 +454,45 @@ def addSimWriters(
acts.examples.CsvParticleWriter(
level=customLogLevel(),
outputDir=str(outputDirCsv),
inputParticles="particles_final",
outputStem="particles_final",
inputParticles="particles_initial",
outputStem="particles_initial",
)
)

if outputDirRoot is not None:
outputDirRoot = Path(outputDirRoot)
if not outputDirRoot.exists():
outputDirRoot.mkdir()
s.addWriter(
acts.examples.RootParticleWriter(
acts.examples.CsvParticleWriter(
level=customLogLevel(),
outputDir=str(outputDirCsv),
inputParticles="particles_final",
filePath=str(outputDirRoot / "fatras_particles_final.root"),
outputStem="particles_final",
)
)

if outputDirCsv is not None:
s.addWriter(
acts.examples.CsvParticleWriter(
acts.examples.CsvSimHitWriter(
level=customLogLevel(),
inputSimHits=inputSimHits,
outputDir=str(outputDirCsv),
inputParticles="particles_initial",
outputStem="particles_initial",
outputStem="hits",
)
)

if outputDirRoot is not None:
outputDirRoot = Path(outputDirRoot)
if not outputDirRoot.exists():
outputDirRoot.mkdir()
s.addWriter(
acts.examples.RootParticleWriter(
level=customLogLevel(),
inputParticles="particles_initial",
filePath=str(outputDirRoot / "fatras_particles_initial.root"),
filePath=str(outputDirRoot / "particles_initial.root"),
)
)

if outputDirCsv is not None:
s.addWriter(
acts.examples.CsvSimHitWriter(
acts.examples.RootParticleWriter(
level=customLogLevel(),
inputSimHits=inputSimHits,
outputDir=str(outputDirCsv),
outputStem="hits",
inputParticles="particles_final",
filePath=str(outputDirRoot / "particles_final.root"),
)
)

if outputDirRoot is not None:
s.addWriter(
acts.examples.RootSimHitWriter(
level=customLogLevel(),
Expand All @@ -509,8 +501,6 @@ def addSimWriters(
)
)

return s


def getG4DetectorContruction(
detector: Any,
Expand Down
20 changes: 10 additions & 10 deletions Examples/Python/tests/root_file_hashes.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
test_pythia8__pythia8_particles.root: 7bae8c6353d792ea2d54401334e2e57e486ec154ee4ed628f58d61cd5941b399
test_fatras__fatras_particles_final.root: 7ce243ae0e64b13d1f14c7b40f7d6a3bf9edd799f15bf0745b0b08c16ff11bf4
test_fatras__fatras_particles_initial.root: c72be956b187ea67cb5efe8fed6f7cdd6657631d25aa68105bcfe5af5baecc41
test_fatras__particles_final.root: 7ce243ae0e64b13d1f14c7b40f7d6a3bf9edd799f15bf0745b0b08c16ff11bf4
test_fatras__particles_initial.root: c72be956b187ea67cb5efe8fed6f7cdd6657631d25aa68105bcfe5af5baecc41
test_fatras__hits.root: 2f25d996715c6ed05e65a3f36df559de52e0a6c8ab9641fedd810474eaf5db11
test_geant4__fatras_particles_final.root: b6254065a9bf03fe538d8b39615bfb3936a5e3eef28c4ad67d59514b170d4f87
test_geant4__fatras_particles_initial.root: 077546f5598fbf32ea15dc1b2a4741c7bfe51d6d3b96421ff04b999aaf21c2fd
test_geant4__particles_final.root: b6254065a9bf03fe538d8b39615bfb3936a5e3eef28c4ad67d59514b170d4f87
test_geant4__particles_initial.root: 077546f5598fbf32ea15dc1b2a4741c7bfe51d6d3b96421ff04b999aaf21c2fd
test_geant4__hits.root: 507461900225433b2452c66db9a9712bfe431f157bff9f98115b30d2b0ac361e
test_seeding__estimatedparams.root: 3d181aeda75f4a030ab015c90291c21448c61e513ad1e7bfcaf56317b7af1a68
test_seeding__performance_seeding_trees.root: b53253e5549c09282d68cf11716ff53fa68ea340e25277571b4bc52d43804469
test_seeding__particles.root: 8c22c826bf7b46de59f479b00e1aa54871570ba85a09d0b221527499f84c4be3
test_seeding__fatras_particles_final.root: b29b9557bb7e01006bec9c2118948ad7abaf85cfa81f266bb287189272d8952c
test_seeding__fatras_particles_initial.root: 8c22c826bf7b46de59f479b00e1aa54871570ba85a09d0b221527499f84c4be3
test_seeding__particles_final.root: b29b9557bb7e01006bec9c2118948ad7abaf85cfa81f266bb287189272d8952c
test_seeding__particles_initial.root: 8c22c826bf7b46de59f479b00e1aa54871570ba85a09d0b221527499f84c4be3
test_seeding_orthogonal__estimatedparams.root: 4437d24087bf2abba859c21970adc347295fe61ac9f96d9780bfcd8d4932b2f7
test_seeding_orthogonal__performance_seeding_trees.root: e7f0e563edf80ac59da8939a3393a07493907c6655c87cf326a908c356d064e0
test_seeding_orthogonal__particles.root: 8c22c826bf7b46de59f479b00e1aa54871570ba85a09d0b221527499f84c4be3
test_seeding_orthogonal__fatras_particles_final.root: b29b9557bb7e01006bec9c2118948ad7abaf85cfa81f266bb287189272d8952c
test_seeding_orthogonal__fatras_particles_initial.root: 8c22c826bf7b46de59f479b00e1aa54871570ba85a09d0b221527499f84c4be3
test_seeding_orthogonal__particles_final.root: b29b9557bb7e01006bec9c2118948ad7abaf85cfa81f266bb287189272d8952c
test_seeding_orthogonal__particles_initial.root: 8c22c826bf7b46de59f479b00e1aa54871570ba85a09d0b221527499f84c4be3
test_itk_seeding__estimatedparams.root: 48ef0e2f71d5a075375800a5baab2a6fbb412a8e7742c79f57e457d45dd23221
test_itk_seeding__performance_seeding_trees.root: 849e026003ddbada6d72c4fe323adb739594eb9bda044351bcc1a1d8101f52d6
test_itk_seeding__particles.root: a294ff442940c8929bef67fb8921f21a69fe2645f0ce7828a54c2f8b4d7e1c90
test_itk_seeding__fatras_particles_final.root: b044d57a0e8e79673e40e362379d6fdc83e6305ee2c463ce6b9cc082db6e63d9
test_itk_seeding__fatras_particles_initial.root: a294ff442940c8929bef67fb8921f21a69fe2645f0ce7828a54c2f8b4d7e1c90
test_itk_seeding__particles_final.root: b044d57a0e8e79673e40e362379d6fdc83e6305ee2c463ce6b9cc082db6e63d9
test_itk_seeding__particles_initial.root: a294ff442940c8929bef67fb8921f21a69fe2645f0ce7828a54c2f8b4d7e1c90
test_propagation__propagation_steps.root: 174301b25784dbb881196b658f2d7f99c0a2ea688a0129e6110fc19aa5cf8e54
test_material_recording__geant4_material_tracks.root: a0b1c45d687041963aba359793ce7b67b8dde7f9a95cf34eb95f709bdb70ca64
test_truth_tracking_kalman[generic-0.0]__trackstates_fitter.root: cbaf0a29893eecec7a429fb74325a961eadb160346bd88933f7e481e3b3d24b6
Expand Down
22 changes: 10 additions & 12 deletions Examples/Python/tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def test_fatras(trk_geo, tmp_path, field, assert_root_hash):

root_files = [
(
"fatras_particles_final.root",
"particles_final.root",
"particles",
),
(
"fatras_particles_initial.root",
"particles_initial.root",
"particles",
),
(
Expand Down Expand Up @@ -157,8 +157,8 @@ def test_geant4(tmp_path, assert_root_hash):
csv.mkdir()

root_files = [
"fatras_particles_final.root",
"fatras_particles_initial.root",
"particles_final.root",
"particles_initial.root",
"hits.root",
]

Expand Down Expand Up @@ -222,11 +222,11 @@ def test_seeding(tmp_path, trk_geo, field, assert_root_hash):
"particles",
),
(
"fatras_particles_final.root",
"particles_final.root",
"particles",
),
(
"fatras_particles_initial.root",
"particles_initial.root",
"particles",
),
]
Expand Down Expand Up @@ -287,12 +287,12 @@ def test_seeding_orthogonal(tmp_path, trk_geo, field, assert_root_hash):
seq.config.events,
),
(
"fatras_particles_final.root",
"particles_final.root",
"particles",
seq.config.events,
),
(
"fatras_particles_initial.root",
"particles_initial.root",
"particles",
seq.config.events,
),
Expand Down Expand Up @@ -355,11 +355,11 @@ def test_itk_seeding(tmp_path, trk_geo, field, assert_root_hash):
"particles",
),
(
"fatras_particles_final.root",
"particles_final.root",
"particles",
),
(
"fatras_particles_initial.root",
"particles_initial.root",
"particles",
),
]
Expand Down Expand Up @@ -1017,8 +1017,6 @@ def test_ckf_tracks_example(

assert not csv.exists()

srcdir = Path(__file__).resolve().parent.parent.parent.parent

field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T))
events = 100
s = Sequencer(events=events, numThreads=1) # Digitization is not thread-safe
Expand Down

0 comments on commit 5f2cad4

Please sign in to comment.