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 { ...@@ -162,35 +162,21 @@ namespace corsika::process::sibyll {
ideally as full particle object so that the four momenta ideally as full particle object so that the four momenta
and the boosts can be defined.. 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(); 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: " si::CrossSectionType weightedProdCrossSection = mediumComposition.WeightedSum(
<< " IntLength: sibyll return (mb): " << productionCrossSection / 1_mb [=](particles::Code targetID) -> si::CrossSectionType {
<< endl; return std::get<0>(this->GetCrossSection(corsikaBeamId, targetID, ECoM));
weightedProdCrossSection += w[i] * productionCrossSection; });
}
cout << "Interaction: " cout << "Interaction: "
<< "IntLength: weighted CrossSection (mb): " << weightedProdCrossSection / 1_mb << "IntLength: weighted CrossSection (mb): " << weightedProdCrossSection / 1_mb
<< endl; << endl;
// calculate interaction length in medium // calculate interaction length in medium
//#warning check interaction length units
GrammageType const int_length = mediumComposition.GetAverageMassNumber() * GrammageType const int_length = mediumComposition.GetAverageMassNumber() *
units::constants::u / weightedProdCrossSection; units::constants::u / weightedProdCrossSection;
cout << "Interaction: " 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