Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
stognini committed Mar 18, 2024
1 parent 45aa50d commit 4c61165
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/celeritas/optical/ScintillationParams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ ScintillationParams::from_import(ImportData const& data,
= data.optical_params.scintillation_by_particle;
input.matid_to_optmatid.resize(data.materials.size());
input.pid_to_scintpid.resize(data.particles.size());

// Fill with uninitialized data
// The final arrays will be mostly uninitialized, and that will determine
// which MaterialIds and ParticleIds are scintillation particles.
std::fill(input.matid_to_optmatid.begin(),
input.matid_to_optmatid.end(),
OpticalMaterialId{});
Expand All @@ -68,12 +71,13 @@ ScintillationParams::from_import(ImportData const& data,
continue;
}

// Loop over particles and add all that are scintillation particles
auto const& iomsp = iom.scintillation.particles;
for (auto pid : range(data.particles.size()))
{
auto import_pdg = data.particles[pid].pdg;
if (auto iter = iomsp.find(import_pdg) != iomsp.end())
if (iomsp.find(data.particles[pid].pdg) != iomsp.end())
{
// Add new ScintillationParticleId
input.pid_to_scintpid[pid] = scintpid++;
}
}
Expand Down

0 comments on commit 4c61165

Please sign in to comment.