IAP GITLAB

Skip to content
Snippets Groups Projects
Commit e3db1b1d authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

NuclearCompostion: avg. mass number also for non-nuclei

(e.g. for p-composition instead of H)
parent 5c8f6e77
No related branches found
No related tags found
No related merge requests found
...@@ -64,9 +64,13 @@ namespace corsika::environment { ...@@ -64,9 +64,13 @@ namespace corsika::environment {
, fComponents(pComponents) , fComponents(pComponents)
, fAvgMassNumber(std::inner_product( , fAvgMassNumber(std::inner_product(
pComponents.cbegin(), pComponents.cend(), pFractions.cbegin(), 0., pComponents.cbegin(), pComponents.cend(), pFractions.cbegin(), 0.,
[](double x, double y) { return x + y; }, std::plus<double>(), [](auto const compID, auto const fraction) -> double {
[](auto const& compID, auto const& fraction) { if (particles::IsNucleus(compID)) {
return corsika::particles::GetNucleusA(compID) * fraction; return particles::GetNucleusA(compID) * fraction;
} else {
return particles::GetMass(compID) /
units::si::ConvertSIToHEP(units::constants::u) * fraction;
}
})) { })) {
assert(pComponents.size() == pFractions.size()); assert(pComponents.size() == pFractions.size());
auto const sumFractions = auto const sumFractions =
......
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