Skip to content

Commit

Permalink
Fix celer-sim MC truth ROOT output file generation during tests (#1515)
Browse files Browse the repository at this point in the history
* Assign volume instance ids when there are no detector map entries
* Fix typo that prevented celer-sim tests to write root mctruth outputs
* Disable volume instance ids in RootStepWriter
  • Loading branch information
stognini authored Nov 19, 2024
1 parent 9995f71 commit 6b053cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/celer-sim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function(celer_sim_test test_ext gdml_inp_name hepmc3_inp_name mctruth_name)

add_test(NAME "app/celer-sim-${test_ext}:cpu"
COMMAND "${CELER_PYTHON}"
"${_driver}" "${_gdml_inp}" "${_hepmc3_inp}" "${mctruth_out}"
"${_driver}" "${_gdml_inp}" "${_hepmc3_inp}" "${_mctruth_out}"
)
set(_env
"CELERITAS_EXE=$<TARGET_FILE:celer-sim>"
Expand Down
6 changes: 6 additions & 0 deletions src/celeritas/user/RootStepWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ RootStepWriter::RootStepWriter(SPRootFileManager root_manager,
{
CELER_EXPECT(root_manager_);

// Disable volume instance id selections (not implemented by this class)
for (auto p : range(StepPoint::size_))
{
selection_.points[p].volume_instance_ids = false;
}

if (!filter_)
{
// Write all data by default
Expand Down
18 changes: 9 additions & 9 deletions src/celeritas/user/detail/StepParams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ StepParams::StepParams(AuxId aux_id,
temp_det.begin(), temp_det.end());

host_data.nonzero_energy_deposition = nonzero_energy_deposition;
}

if (selection.points[StepPoint::pre].volume_instance_ids
|| selection.points[StepPoint::post].volume_instance_ids)
{
host_data.volume_instance_depth = geo.max_depth();
CELER_VALIDATE(host_data.volume_instance_depth > 0,
<< "geometry type does not support volume "
"instance IDs: max depth is "
<< host_data.volume_instance_depth);
}
if (selection.points[StepPoint::pre].volume_instance_ids
|| selection.points[StepPoint::post].volume_instance_ids)
{
host_data.volume_instance_depth = geo.max_depth();
CELER_VALIDATE(host_data.volume_instance_depth > 0,
<< "geometry type does not support volume "
"instance IDs: max depth is "
<< host_data.volume_instance_depth);
}

return host_data;
Expand Down

0 comments on commit 6b053cd

Please sign in to comment.