IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 24bc10e4 authored by Felix Riehn's avatar Felix Riehn
Browse files

read target components from environment

parent 6552cb6e
No related branches found
No related tags found
No related merge requests found
...@@ -252,8 +252,10 @@ int main() { ...@@ -252,8 +252,10 @@ int main() {
if (auto const mp = vtn.GetModelPropertiesPtr(); if (auto const mp = vtn.GetModelPropertiesPtr();
mp != nullptr) { // do not query Universe it self, it has no ModelProperties mp != nullptr) { // do not query Universe it self, it has no ModelProperties
auto const& comp = mp->GetNuclearComposition().GetComponents(); auto const& comp = mp->GetNuclearComposition().GetComponents();
std::for_each(comp.cbegin(), comp.cend(), for (auto const c : comp)
[&](particles::Code c) { allElementsInUniverse.insert(c); }); allElementsInUniverse.insert(c);
// std::for_each(comp.cbegin(), comp.cend(),
// [&](particles::Code c) { allElementsInUniverse.insert(c); });
} }
}; };
universe.walk(collectElements); universe.walk(collectElements);
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <corsika/setup/SetupStack.h> #include <corsika/setup/SetupStack.h>
#include <corsika/setup/SetupTrajectory.h> #include <corsika/setup/SetupTrajectory.h>
#include <set>
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::tuple; using std::tuple;
...@@ -69,15 +71,31 @@ namespace corsika::process::sibyll { ...@@ -69,15 +71,31 @@ namespace corsika::process::sibyll {
{ {
using namespace corsika::particles; using namespace corsika::particles;
using namespace units::si; using namespace units::si;
// TODO: get composition of target volumes from environment
// now: hard coded list for air
constexpr Code target_nuclei[] = { Code::Oxygen, Code::Nitrogen };
auto& universe = *(fEnvironment.GetUniverse());
auto const allElementsInUniverse = std::invoke([&]() {
std::set<particles::Code> allElementsInUniverse;
auto collectElements = [&](auto& vtn) {
if (auto const mp = vtn.GetModelPropertiesPtr();
mp != nullptr) { // do not query Universe it self, it has no ModelProperties
auto const& comp = mp->GetNuclearComposition().GetComponents();
for (auto const c : comp)
allElementsInUniverse.insert(c);
// std::for_each(comp.cbegin(), comp.cend(),
// [&](particles::Code c) { allElementsInUniverse.insert(c); });
}
};
universe.walk(collectElements);
return allElementsInUniverse;
});
cout << "NuclearInteraction: initializing nuclear cross sections..." << endl; cout << "NuclearInteraction: initializing nuclear cross sections..." << endl;
// loop over target components, at most 4!! // loop over target components, at most 4!!
int k =-1; int k =-1;
for(auto &ptarg: target_nuclei){ for(auto &ptarg: allElementsInUniverse){
++k; ++k;
cout << "NuclearInteraction: init target component: " << ptarg << endl; cout << "NuclearInteraction: init target component: " << ptarg << endl;
const int ib = GetNucleusA( ptarg ); const int ib = GetNucleusA( ptarg );
...@@ -109,7 +127,7 @@ namespace corsika::process::sibyll { ...@@ -109,7 +127,7 @@ namespace corsika::process::sibyll {
} }
} }
cout << "NuclearInteraction: cross sections for " << fTargetComponentsIndex.size() << " components initialized!" << endl; cout << "NuclearInteraction: cross sections for " << fTargetComponentsIndex.size() << " components initialized!" << endl;
for(auto &ptarg: target_nuclei){ for(auto &ptarg: allElementsInUniverse){
cout << "cross section table: " << ptarg << endl; cout << "cross section table: " << ptarg << endl;
PrintCrossSectionTable( ptarg ); PrintCrossSectionTable( ptarg );
} }
...@@ -120,7 +138,8 @@ namespace corsika::process::sibyll { ...@@ -120,7 +138,8 @@ namespace corsika::process::sibyll {
{ {
using namespace corsika::particles; using namespace corsika::particles;
const int k = fTargetComponentsIndex.at( pCode ); const int k = fTargetComponentsIndex.at( pCode );
Code pNuclei [] = {Code::Helium, Code::Lithium7, Code::Oxygen, Code::Neon, Code::Argon, Code::Iron}; Code pNuclei [] = {Code::Helium, Code::Lithium7, Code::Oxygen,
Code::Neon, Code::Argon, Code::Iron};
cout << "en/A "; cout << "en/A ";
for(auto &j: pNuclei) for(auto &j: pNuclei)
cout << std::setw(9) << j; cout << std::setw(9) << j;
......
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