diff --git a/Processes/Sibyll/Interaction.cc b/Processes/Sibyll/Interaction.cc index ed550a012d63df6b89586198933ce10c4d01b8d2..1fa35e59ed010eecc28f381ce1614c4da2183d8d 100644 --- a/Processes/Sibyll/Interaction.cc +++ b/Processes/Sibyll/Interaction.cc @@ -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: "