IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 1d2fb269 authored by Maximilian Sackel's avatar Maximilian Sackel
Browse files

not using scoped enumeration because static_cast is required to specify the...

not using scoped enumeration because static_cast is required to specify the tuple position. Instead mark variable with an extra letter 'e' and use it only very scoped.
parent 75c50f10
No related branches found
No related tags found
1 merge request!245Include proposal process rebase
Pipeline #2283 failed
......@@ -69,7 +69,7 @@ namespace corsika::process::proposal {
for (auto& it : rnd) it = distr(fRNG);
// calculate deflection based on particle energy, loss
auto [mean_dir, final_dir] = get<SCATTERING>(c->second)->Scatter(
auto [mean_dir, final_dir] = get<eSCATTERING>(c->second)->Scatter(
grammage / 1_g * square(1_cm), vP.GetEnergy() / 1_MeV, E_f / 1_MeV, direction,
rnd);
......@@ -98,7 +98,7 @@ namespace corsika::process::proposal {
// Get or build corresponding track integral calculator and solve the
// integral
auto c = GetCalculator(vP, calc);
auto final_energy = get<DISPLACEMENT>(c->second)->UpperLimitTrackIntegral(
auto final_energy = get<eDISPLACEMENT>(c->second)->UpperLimitTrackIntegral(
vP.GetEnergy() / 1_MeV, dX / 1_g * 1_cm * 1_cm) *
1_MeV;
auto dE = vP.GetEnergy() - final_energy;
......@@ -142,7 +142,7 @@ namespace corsika::process::proposal {
// solving the track integral for giving energy lim
auto c = GetCalculator(vP, calc);
auto grammage = get<DISPLACEMENT>(c->second)->SolveTrackIntegral(
auto grammage = get<eDISPLACEMENT>(c->second)->SolveTrackIntegral(
vP.GetEnergy() / 1_MeV, energy_lim / 1_MeV) *
1_g / square(1_cm);
......
......@@ -27,7 +27,7 @@ namespace corsika::process::proposal {
class ContinuousProcess : public process::ContinuousProcess<ContinuousProcess>,
ProposalProcessBase {
enum { DISPLACEMENT, SCATTERING };
enum { eDISPLACEMENT, eSCATTERING };
using calc_t = std::tuple<std::unique_ptr<PROPOSAL::Displacement>,
std::unique_ptr<PROPOSAL::Scattering>>;
......
......@@ -61,13 +61,13 @@ namespace corsika::process::proposal {
std::uniform_real_distribution<double> distr(0., 1.);
// sample a interaction-type, loss and component
auto rates = get<INTERACTION>(c->second)->Rates(vP.GetEnergy() / 1_MeV);
auto [type, comp_ptr, v] = get<INTERACTION>(c->second)->SampleLoss(
auto rates = get<eINTERACTION>(c->second)->Rates(vP.GetEnergy() / 1_MeV);
auto [type, comp_ptr, v] = get<eINTERACTION>(c->second)->SampleLoss(
vP.GetEnergy() / 1_MeV, rates, distr(fRNG));
// Read how much random numbers are required to calculate the secondaries.
// Calculate the secondaries and deploy them on the corsika stack.
auto rnd = vector<double>(get<SECONDARIES>(c->second)->RequiredRandomNumbers(type));
auto rnd = vector<double>(get<eSECONDARIES>(c->second)->RequiredRandomNumbers(type));
for (auto& it : rnd) it = distr(fRNG);
auto point = PROPOSAL::Vector3D(vP.GetPosition().GetX() / 1_cm,
vP.GetPosition().GetY() / 1_cm,
......@@ -78,7 +78,7 @@ namespace corsika::process::proposal {
d.GetZ().magnitude());
auto loss = make_tuple(static_cast<int>(type), point, direction,
v * vP.GetEnergy() / 1_MeV, 0.);
auto sec = get<SECONDARIES>(c->second)->CalculateSecondaries(vP.GetEnergy() / 1_MeV,
auto sec = get<eSECONDARIES>(c->second)->CalculateSecondaries(vP.GetEnergy() / 1_MeV,
loss, *comp_ptr, rnd);
for (auto& s : sec) {
auto E = get<PROPOSAL::Loss::ENERGY>(s) * 1_MeV;
......@@ -102,7 +102,7 @@ namespace corsika::process::proposal {
if (CanInteract(vP.GetPID())) {
auto c = GetCalculator(vP, calc);
return get<INTERACTION>(c->second)->MeanFreePath(vP.GetEnergy() / 1_MeV) * 1_g /
return get<eINTERACTION>(c->second)->MeanFreePath(vP.GetEnergy() / 1_MeV) * 1_g /
(1_cm * 1_cm);
}
return std::numeric_limits<double>::infinity() * 1_g / (1_cm * 1_cm);
......
......@@ -27,7 +27,7 @@ namespace corsika::process::proposal {
//!
class Interaction : public InteractionProcess<Interaction>, ProposalProcessBase {
enum { SECONDARIES, INTERACTION };
enum { eSECONDARIES, eINTERACTION };
using calculator_t = tuple<unique_ptr<PROPOSAL::SecondariesCalculator>,
unique_ptr<PROPOSAL::Interaction>>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment