IAP GITLAB

Skip to content
Snippets Groups Projects
Commit e5b751eb authored by ralfulrich's avatar ralfulrich
Browse files

allow all PDG codes as input

parent 9a7a8ab5
No related branches found
No related tags found
1 merge request!321Resolve "Weird LongitudinalProfile"
...@@ -153,11 +153,20 @@ int main(int argc, char** argv) { ...@@ -153,11 +153,20 @@ int main(int argc, char** argv) {
// setup particle stack, and add primary particle // setup particle stack, and add primary particle
setup::Stack stack; setup::Stack stack;
stack.clear(); stack.clear();
const Code beamCode = Code::Nucleus;
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])); Code beamCode;
auto const mass = get_nucleus_mass(A, Z); HEPEnergyType mass;
const HEPEnergyType E0 = 1_GeV * std::stof(std::string(argv[3])); unsigned short Z = 0;
if (A>0) {
beamCode = Code::Nucleus;
Z = std::stoi(std::string(argv[2]));
mass = get_nucleus_mass(A, Z);
} else {
unsigned int pdg = std::stoi(std::string(argv[2]));
beamCode = convert_from_PDG(PDGCode(pdg));
mass = get_mass(beamCode);
}
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;
...@@ -187,17 +196,21 @@ int main(int argc, char** argv) { ...@@ -187,17 +196,21 @@ int main(int argc, char** argv) {
std::cout << "point of injection: " << injectionPos.getCoordinates() << std::endl; std::cout << "point of injection: " << injectionPos.getCoordinates() << std::endl;
if (A != 1) { if (A > 1) {
stack.addParticle(std::make_tuple(beamCode, E0, plab, injectionPos, 0_ns, A, Z)); stack.addParticle(std::make_tuple(beamCode, E0, plab, injectionPos, 0_ns, A, Z));
} else { } else {
if (Z == 1) { if (A==1) {
stack.addParticle(std::make_tuple(Code::Proton, E0, plab, injectionPos, 0_ns)); if (Z == 1) {
} else if (Z == 0) { stack.addParticle(std::make_tuple(Code::Proton, E0, plab, injectionPos, 0_ns));
stack.addParticle(std::make_tuple(Code::Neutron, E0, plab, injectionPos, 0_ns)); } else if (Z == 0) {
stack.addParticle(std::make_tuple(Code::Neutron, E0, plab, injectionPos, 0_ns));
} else {
std::cerr << "illegal parameters" << std::endl;
return EXIT_FAILURE;
}
} else { } else {
std::cerr << "illegal parameters" << std::endl; stack.addParticle(std::make_tuple(beamCode, E0, plab, injectionPos, 0_ns));
return EXIT_FAILURE;
} }
} }
...@@ -210,8 +223,7 @@ int main(int argc, char** argv) { ...@@ -210,8 +223,7 @@ int main(int argc, char** argv) {
// setup processes, decays and interactions // setup processes, decays and interactions
corsika::qgsjetII::Interaction qgsjet; // corsika::qgsjetII::Interaction qgsjet;
corsika::sibyll::Interaction sibyll; corsika::sibyll::Interaction sibyll;
InteractionCounter sibyllCounted(sibyll); InteractionCounter sibyllCounted(sibyll);
......
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