IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 81082d9c authored by ralfulrich's avatar ralfulrich Committed by Ralf Ulrich
Browse files

fixed small problems and examples

parent 6519a4a3
No related branches found
No related tags found
No related merge requests found
...@@ -35,11 +35,12 @@ namespace corsika::sibyll { ...@@ -35,11 +35,12 @@ namespace corsika::sibyll {
inline bool Decay::canHandleDecay(const Code vParticleCode) { inline bool Decay::canHandleDecay(const Code vParticleCode) {
// if known to sibyll and not proton or neutrino it can decay // if known to sibyll and not proton or neutrino it can decay
if (vParticleCode == Code::Proton || vParticleCode == Code::AntiProton || if (is_nucleus(vParticleCode) || vParticleCode == Code::Proton ||
vParticleCode == Code::NuE || vParticleCode == Code::NuMu || vParticleCode == Code::AntiProton || vParticleCode == Code::NuE ||
vParticleCode == Code::NuTau || vParticleCode == Code::NuEBar || vParticleCode == Code::NuMu || vParticleCode == Code::NuTau ||
vParticleCode == Code::NuMuBar || vParticleCode == Code::NuTauBar || vParticleCode == Code::NuEBar || vParticleCode == Code::NuMuBar ||
vParticleCode == Code::Electron || vParticleCode == Code::Positron) vParticleCode == Code::NuTauBar || vParticleCode == Code::Electron ||
vParticleCode == Code::Positron)
return false; return false;
else if (corsika::sibyll::convertToSibyllRaw( else if (corsika::sibyll::convertToSibyllRaw(
vParticleCode)) // non-zero for particles known to sibyll vParticleCode)) // non-zero for particles known to sibyll
......
...@@ -48,13 +48,13 @@ namespace corsika::sibyll { ...@@ -48,13 +48,13 @@ namespace corsika::sibyll {
return corsikaCode; return corsikaCode;
} }
int constexpr convertToSibyllRaw(corsika::Code pCode) { int constexpr convertToSibyllRaw(Code const code) {
return static_cast<int>(convertToSibyll(pCode)); return static_cast<int>(convertToSibyll(code));
} }
int constexpr getSibyllXSCode(corsika::Code pCode) { int constexpr getSibyllXSCode(Code const code) {
return static_cast<SibyllXSClassIntType>( return static_cast<SibyllXSClassIntType>(
corsika2sibyllXStype[static_cast<corsika::CodeIntType>(pCode)]); corsika2sibyllXStype[static_cast<corsika::CodeIntType>(code)]);
} }
bool constexpr canInteract(corsika::Code pCode) { return getSibyllXSCode(pCode) > 0; } bool constexpr canInteract(corsika::Code pCode) { return getSibyllXSCode(pCode) > 0; }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <corsika/framework/core/Cascade.hpp> #include <corsika/framework/core/Cascade.hpp>
#include <corsika/framework/process/ProcessSequence.hpp> #include <corsika/framework/process/ProcessSequence.hpp>
#include <corsika/framework/process/SwitchProcessSequence.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/random/RNGManager.hpp> #include <corsika/framework/random/RNGManager.hpp>
#include <corsika/framework/geometry/Sphere.hpp> #include <corsika/framework/geometry/Sphere.hpp>
...@@ -146,8 +147,11 @@ int main() { ...@@ -146,8 +147,11 @@ int main() {
BetheBlochPDG eLoss{showerAxis}; BetheBlochPDG eLoss{showerAxis};
// assemble all processes into an ordered process list // assemble all processes into an ordered process list
auto sequence = auto sequence = make_sequence(
make_sequence(stackInspect, sibyll, sibyllNuc, decay, eLoss, cut, trackWriter); stackInspect,
make_select([](auto const& particle) { return is_nucleus(particle.getPID()); },
sibyllNuc, sibyll),
decay, eLoss, cut, trackWriter);
// define air shower object, run simulation // define air shower object, run simulation
Cascade EAS(env, tracking, sequence, output, stack); Cascade EAS(env, tracking, sequence, output, stack);
......
...@@ -292,7 +292,8 @@ int main(int argc, char** argv) { ...@@ -292,7 +292,8 @@ int main(int argc, char** argv) {
InteractionCounter sibyllCounted(sibyll); InteractionCounter sibyllCounted(sibyll);
corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env); corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env);
InteractionCounter sibyllNucCounted(sibyllNuc); InteractionCounter sibyllNucCounted(sibyllNuc);
auto heModelCounted = make_sequence(sibyllNucCounted, sibyllCounted); auto heModelCounted = make_select([](auto const& p) { return is_nucleus(p.getPID()); },
sibyllNucCounted, sibyllCounted);
corsika::pythia8::Decay decayPythia; corsika::pythia8::Decay decayPythia;
......
...@@ -158,10 +158,10 @@ int main(int argc, char** argv) { ...@@ -158,10 +158,10 @@ int main(int argc, char** argv) {
setup::Stack stack; setup::Stack stack;
stack.clear(); stack.clear();
unsigned short const A = std::stoi(std::string(argv[1])); unsigned short const A = std::stoi(std::string(argv[1]));
unsigned short Z = std::stoi(std::string(argv[2])); unsigned short const Z = std::stoi(std::string(argv[2]));
const Code beamCode = get_nucleus_code(A, Z); Code const beamCode = get_nucleus_code(A, Z);
auto const mass = get_mass(beamCode); auto const mass = get_mass(beamCode);
const HEPEnergyType E0 = 1_GeV * std::stof(std::string(argv[3])); HEPEnergyType const E0 = 1_GeV * std::stof(std::string(argv[3]));
double theta = 0.; double theta = 0.;
auto const thetaRad = theta / 180. * M_PI; auto const thetaRad = theta / 180. * M_PI;
......
...@@ -313,7 +313,8 @@ int main(int argc, char** argv) { ...@@ -313,7 +313,8 @@ int main(int argc, char** argv) {
InteractionCounter sibyllCounted(sibyll); InteractionCounter sibyllCounted(sibyll);
corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env); corsika::sibyll::NuclearInteraction sibyllNuc(sibyll, env);
InteractionCounter sibyllNucCounted(sibyllNuc); InteractionCounter sibyllNucCounted(sibyllNuc);
auto heModelCounted = make_sequence(sibyllNucCounted, sibyllCounted); auto heModelCounted = make_select([](auto const& p) { return is_nucleus(p.getPID()); },
sibyllNucCounted, sibyllCounted);
corsika::pythia8::Decay decayPythia; corsika::pythia8::Decay decayPythia;
......
...@@ -251,8 +251,10 @@ int main(int argc, char** argv) { ...@@ -251,8 +251,10 @@ int main(int argc, char** argv) {
: cutE_(cutE) {} : cutE_(cutE) {}
bool operator()(const Particle& p) { return (p.getEnergy() < cutE_); } bool operator()(const Particle& p) { return (p.getEnergy() < cutE_); }
}; };
auto hadronSequence = make_select(EnergySwitch(55_GeV), urqmdCounted, auto hadronSequence =
make_sequence(sibyllNucCounted, sibyllCounted)); make_select(EnergySwitch(55_GeV), urqmdCounted,
make_select([](auto const& p) { return is_nucleus(p.getPID()); },
sibyllNucCounted, sibyllCounted));
auto decaySequence = make_sequence(decayPythia, decaySibyll); auto decaySequence = make_sequence(decayPythia, decaySibyll);
// directory for outputs // directory for outputs
......
...@@ -60,7 +60,8 @@ TEST_CASE("Sibyll", "modules") { ...@@ -60,7 +60,8 @@ TEST_CASE("Sibyll", "modules") {
} }
SECTION("cross-section type") { SECTION("cross-section type") {
CHECK(corsika::sibyll::getSibyllXSCode(Code::Helium) == 0);
CHECK(corsika::sibyll::getSibyllXSCode(Code::Proton) == 1);
CHECK(corsika::sibyll::getSibyllXSCode(Code::Electron) == 0); CHECK(corsika::sibyll::getSibyllXSCode(Code::Electron) == 0);
CHECK(corsika::sibyll::getSibyllXSCode(Code::K0Long) == 3); CHECK(corsika::sibyll::getSibyllXSCode(Code::K0Long) == 3);
CHECK(corsika::sibyll::getSibyllXSCode(Code::SigmaPlus) == 1); CHECK(corsika::sibyll::getSibyllXSCode(Code::SigmaPlus) == 1);
......
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