IAP GITLAB

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

use WeightedSum in Sibyll GetInteractionLength

parent 79eb1423
No related branches found
No related tags found
1 merge request!116Some improvements here and there
......@@ -162,35 +162,21 @@ namespace corsika::process::sibyll {
ideally as full particle object so that the four momenta
and the boosts can be defined..
*/
auto const* currentNode = vP.GetNode();
const auto mediumComposition =
auto const* currentNode = p.GetNode();
const auto& mediumComposition =
currentNode->GetModelProperties().GetNuclearComposition();
// determine average interaction length
// weighted sum
int i = -1;
si::CrossSectionType weightedProdCrossSection = 0_mb;
// get weights of components from environment/medium
const auto& w = mediumComposition.GetFractions();
// loop over components in medium
for (auto const targetId : mediumComposition.GetComponents()) {
i++;
cout << "Interaction: get interaction length for target: " << targetId << endl;
auto const [productionCrossSection, elaCrossSection] =
GetCrossSection(corsikaBeamId, targetId, ECoM);
[[maybe_unused]] const auto& dummy_elaCX = elaCrossSection;
cout << "Interaction: "
<< " IntLength: sibyll return (mb): " << productionCrossSection / 1_mb
<< endl;
weightedProdCrossSection += w[i] * productionCrossSection;
}
si::CrossSectionType weightedProdCrossSection = mediumComposition.WeightedSum(
[=](particles::Code targetID) -> si::CrossSectionType {
return std::get<0>(this->GetCrossSection(corsikaBeamId, targetID, ECoM));
});
cout << "Interaction: "
<< "IntLength: weighted CrossSection (mb): " << weightedProdCrossSection / 1_mb
<< endl;
// calculate interaction length in medium
//#warning check interaction length units
GrammageType const int_length = mediumComposition.GetAverageMassNumber() *
units::constants::u / weightedProdCrossSection;
cout << "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