Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove multiple scattering from Processes #631

Merged
merged 9 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/demo-geant-integration/NoFieldAlongStepFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
#include <memory>
#include <type_traits>

#include "celeritas/em/msc/UrbanMscParams.hh"
#include "celeritas/global/alongstep/AlongStepGeneralLinearAction.hh"
#include "celeritas/io/ImportData.hh"
#include "celeritas/phys/ImportedProcessAdapter.hh"

namespace demo_geant
{
Expand All @@ -22,12 +24,12 @@ namespace demo_geant
auto NoFieldAlongStepFactory::operator()(argument_type input) const
-> result_type
{
// Create along-step action
return celeritas::AlongStepGeneralLinearAction::from_params(
input.action_id,
*input.material,
*input.particle,
*input.physics,
celeritas::UrbanMscParams::from_import(
*input.particle, *input.material, *input.imported),
input.imported->em_params.energy_loss_fluct);
}

Expand Down
9 changes: 6 additions & 3 deletions app/demo-loop/LDemoIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "corecel/io/StringUtils.hh"
#include "corecel/sys/Device.hh"
#include "celeritas/Units.hh"
#include "celeritas/em/msc/UrbanMscParams.hh"
#include "celeritas/ext/GeantImporter.hh"
#include "celeritas/ext/GeantPhysicsOptionsIO.json.hh"
#include "celeritas/ext/GeantSetup.hh"
Expand Down Expand Up @@ -272,14 +273,16 @@ TransporterInput load_input(LDemoArgs const& args)
}

bool eloss = imported_data.em_params.energy_loss_fluct;
auto msc = UrbanMscParams::from_import(
*params.particle, *params.material, imported_data);
if (args.mag_field == LDemoArgs::no_field())
{
// Create along-step action
auto along_step = AlongStepGeneralLinearAction::from_params(
params.action_reg->next_id(),
*params.material,
*params.particle,
*params.physics,
msc,
eloss);
params.action_reg->insert(along_step);
}
Expand All @@ -298,8 +301,8 @@ TransporterInput load_input(LDemoArgs const& args)
f *= units::tesla;
}

auto along_step = AlongStepUniformMscAction::from_params(
params.action_reg->next_id(), *params.physics, field_params);
auto along_step = std::make_shared<AlongStepUniformMscAction>(
params.action_reg->next_id(), field_params, msc);
CELER_ASSERT(along_step->field() != LDemoArgs::no_field());
params.action_reg->insert(along_step);
}
Expand Down
3 changes: 1 addition & 2 deletions src/celeritas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ list(APPEND SOURCES
em/model/RayleighModel.cc
em/model/RelativisticBremModel.cc
em/model/SeltzerBergerModel.cc
em/model/UrbanMscModel.cc
em/msc/UrbanMscParams.cc
em/process/BremsstrahlungProcess.cc
em/process/ComptonProcess.cc
em/process/EIonizationProcess.cc
em/process/EPlusAnnihilationProcess.cc
em/process/GammaConversionProcess.cc
em/process/MultipleScatteringProcess.cc
em/process/PhotoelectricProcess.cc
em/process/RayleighProcess.cc
geo/GeoMaterialParams.cc
Expand Down
9 changes: 9 additions & 0 deletions src/celeritas/Types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ struct NoData
{
};

//! Within-kernel state for step limits and action
struct AlongStepLocalState
{
//! Final step limit (true path length) and action
StepLimit step_limit;
//! Smooth (straight/curved) step movement without accounting for MSC
real_type geo_step{};
};

//---------------------------------------------------------------------------//
// HELPER FUNCTIONS (HOST)
//---------------------------------------------------------------------------//
Expand Down
11 changes: 5 additions & 6 deletions src/celeritas/em/data/UrbanMscData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace celeritas
{
//---------------------------------------------------------------------------//
/*!
* UrbanMscModel settable parameters and default values.
* Settable parameters and default values for Urban multiple scattering.
*
* \f$ \tau = t/\lambda \f$ where t is the true path length and \f$ \lambda \f$
* is the mean free path of the multiple scattering. The range and safety
Expand Down Expand Up @@ -92,19 +92,18 @@ struct UrbanMscMaterialData
//---------------------------------------------------------------------------//
/*!
* Physics IDs for MSC.
*
* TODO these will probably be changed to a map over all particle IDs.
*/
struct UrbanMscIds
{
// TODO: remove when this is no longer a model
ActionId action;
// TODO: change to a bitset based on particle ID when we add muons, hadrons
ParticleId electron;
ParticleId positron;

//! Whether the IDs are assigned
explicit CELER_FUNCTION operator bool() const
{
return action && electron && positron;
return electron && positron;
}
};

Expand Down Expand Up @@ -151,7 +150,7 @@ struct UrbanMscData

//// DATA ////

//! Type-free IDs
//! Particle IDs
UrbanMscIds ids;
//! Mass of of electron in MeV
units::MevMass electron_mass;
Expand Down
88 changes: 0 additions & 88 deletions src/celeritas/em/model/UrbanMscModel.hh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/global/alongstep/detail/UrbanMsc.hh
//! \file celeritas/em/msc/UrbanMsc.hh
//---------------------------------------------------------------------------//
#pragma once

Expand All @@ -12,9 +12,10 @@
#include "corecel/Types.hh"
#include "celeritas/Types.hh"
#include "celeritas/em/data/UrbanMscData.hh"
#include "celeritas/em/distribution/UrbanMscScatter.hh"
#include "celeritas/em/distribution/UrbanMscStepLimit.hh"
#include "celeritas/global/alongstep/AlongStep.hh"
#include "celeritas/global/CoreTrackView.hh"

#include "UrbanMscScatter.hh"
#include "UrbanMscStepLimit.hh"

namespace celeritas
{
Expand Down Expand Up @@ -124,7 +125,7 @@ CELER_FUNCTION void UrbanMsc::calc_step(CoreTrackView const& track,
// TODO: this is already kinda sorta determined inside the
// UrbanMscStepLimit calculation
local->step_limit.step = msc_step_result.true_path;
local->step_limit.action = msc_params_.ids.action;
local->step_limit.action = phys.scalars().msc_action();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/em/distribution/UrbanMscHelper.hh
//! \file celeritas/em/msc/UrbanMscHelper.hh
//---------------------------------------------------------------------------//
#pragma once

Expand Down
Loading