IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 6f2cd749 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by ralfulrich
Browse files

PYTHIA 8

parent afeb2e86
No related branches found
No related tags found
1 merge request!280Refactory 2020
...@@ -50,12 +50,12 @@ namespace corsika::pythia8 { ...@@ -50,12 +50,12 @@ namespace corsika::pythia8 {
void Decay::SetUnstable(const corsika::Code pCode) { void Decay::SetUnstable(const corsika::Code pCode) {
std::cout << "Pythia::Decay: setting " << pCode << " unstable.." << std::endl; std::cout << "Pythia::Decay: setting " << pCode << " unstable.." << std::endl;
fPythia.particleData.mayDecay(static_cast<int>(corsika::GetPDG(pCode)), true); fPythia.particleData.mayDecay(static_cast<int>(corsika::PDG(pCode)), true);
} }
void Decay::SetStable(const corsika::Code pCode) { void Decay::SetStable(const corsika::Code pCode) {
std::cout << "Pythia::Decay: setting " << pCode << " stable.." << std::endl; std::cout << "Pythia::Decay: setting " << pCode << " stable.." << std::endl;
fPythia.particleData.mayDecay(static_cast<int>(corsika::GetPDG(pCode)), false); fPythia.particleData.mayDecay(static_cast<int>(corsika::PDG(pCode)), false);
} }
template <typename TParticle> template <typename TParticle>
...@@ -66,7 +66,7 @@ namespace corsika::pythia8 { ...@@ -66,7 +66,7 @@ namespace corsika::pythia8 {
const double gamma = E / m; const double gamma = E / m;
const TimeType t0 = corsika::GetLifetime(p.GetPID()); const TimeType t0 = corsika::lifetime(p.GetPID());
auto const lifetime = gamma * t0; auto const lifetime = gamma * t0;
return lifetime; return lifetime;
...@@ -93,14 +93,14 @@ namespace corsika::pythia8 { ...@@ -93,14 +93,14 @@ namespace corsika::pythia8 {
Decay::SetUnstable(vP.GetPID()); Decay::SetUnstable(vP.GetPID());
// input particle PDG // input particle PDG
auto const pdgCode = static_cast<int>(corsika::GetPDG(vP.GetPID())); auto const pdgCode = static_cast<int>(corsika::PDG(vP.GetPID()));
auto const pcomp = vP.GetMomentum().GetComponents(); auto const pcomp = vP.GetMomentum().GetComponents();
double px = pcomp[0] / 1_GeV; double px = pcomp[0] / 1_GeV;
double py = pcomp[1] / 1_GeV; double py = pcomp[1] / 1_GeV;
double pz = pcomp[2] / 1_GeV; double pz = pcomp[2] / 1_GeV;
double en = vP.GetEnergy() / 1_GeV; double en = vP.GetEnergy() / 1_GeV;
double m = corsika::GetMass(vP.GetPID()) / 1_GeV; double m = corsika::mass(vP.GetPID()) / 1_GeV;
// add particle to pythia stack // add particle to pythia stack
event.append(pdgCode, 1, 0, 0, px, py, pz, en, m); event.append(pdgCode, 1, 0, 0, px, py, pz, en, m);
...@@ -117,7 +117,7 @@ namespace corsika::pythia8 { ...@@ -117,7 +117,7 @@ namespace corsika::pythia8 {
for (int i = 0; i < event.size(); ++i) for (int i = 0; i < event.size(); ++i)
if (event[i].isFinal()) { if (event[i].isFinal()) {
auto const pyId = auto const pyId =
corsika::ConvertFromPDG(static_cast<corsika::PDGCode>(event[i].id())); corsika::convert_from_PDG(static_cast<corsika::PDGCode>(event[i].id()));
HEPEnergyType pyEn = event[i].e() * 1_GeV; HEPEnergyType pyEn = event[i].e() * 1_GeV;
MomentumVector pyP(rootCS, {event[i].px() * 1_GeV, event[i].py() * 1_GeV, MomentumVector pyP(rootCS, {event[i].px() * 1_GeV, event[i].py() * 1_GeV,
event[i].pz() * 1_GeV}); event[i].pz() * 1_GeV});
......
...@@ -77,12 +77,12 @@ namespace corsika::pythia8 { ...@@ -77,12 +77,12 @@ namespace corsika::pythia8 {
void Interaction::SetUnstable(const corsika::Code pCode) { void Interaction::SetUnstable(const corsika::Code pCode) {
std::cout << "Pythia::Interaction: setting " << pCode << " unstable.." << std::endl; std::cout << "Pythia::Interaction: setting " << pCode << " unstable.." << std::endl;
fPythia.particleData.mayDecay(static_cast<int>(corsika::GetPDG(pCode)), true); fPythia.particleData.mayDecay(static_cast<int>(corsika::PDG(pCode)), true);
} }
void Interaction::SetStable(const corsika::Code pCode) { void Interaction::SetStable(const corsika::Code pCode) {
std::cout << "Pythia::Interaction: setting " << pCode << " stable.." << std::endl; std::cout << "Pythia::Interaction: setting " << pCode << " stable.." << std::endl;
fPythia.particleData.mayDecay(static_cast<int>(corsika::GetPDG(pCode)), false); fPythia.particleData.mayDecay(static_cast<int>(corsika::PDG(pCode)), false);
} }
void Interaction::ConfigureLabFrameCollision(const corsika::Code BeamId, void Interaction::ConfigureLabFrameCollision(const corsika::Code BeamId,
...@@ -93,15 +93,15 @@ namespace corsika::pythia8 { ...@@ -93,15 +93,15 @@ namespace corsika::pythia8 {
// set beam // set beam
// beam id for pythia // beam id for pythia
auto const pdgBeam = static_cast<int>(corsika::GetPDG(BeamId)); auto const pdgBeam = static_cast<int>(corsika::PDG(BeamId));
std::stringstream stBeam; std::stringstream stBeam;
stBeam << "Beams:idA = " << pdgBeam; stBeam << "Beams:idA = " << pdgBeam;
fPythia.readString(stBeam.str()); fPythia.readString(stBeam.str());
// set target // set target
auto pdgTarget = static_cast<int>(corsika::GetPDG(TargetId)); auto pdgTarget = static_cast<int>(corsika::PDG(TargetId));
// replace hydrogen with proton, otherwise pythia goes into heavy ion mode! // replace hydrogen with proton, otherwise pythia goes into heavy ion mode!
if (TargetId == corsika::Code::Hydrogen) if (TargetId == corsika::Code::Hydrogen)
pdgTarget = static_cast<int>(corsika::GetPDG(corsika::Code::Proton)); pdgTarget = static_cast<int>(corsika::PDG(corsika::Code::Proton));
std::stringstream stTarget; std::stringstream stTarget;
stTarget << "Beams:idB = " << pdgTarget; stTarget << "Beams:idB = " << pdgTarget;
fPythia.readString(stTarget.str()); fPythia.readString(stTarget.str());
...@@ -131,8 +131,8 @@ namespace corsika::pythia8 { ...@@ -131,8 +131,8 @@ namespace corsika::pythia8 {
if (TargetId == corsika::Code::Proton || TargetId == corsika::Code::Hydrogen) { if (TargetId == corsika::Code::Proton || TargetId == corsika::Code::Hydrogen) {
if (CanInteract(BeamId) && ValidCoMEnergy(CoMenergy)) { if (CanInteract(BeamId) && ValidCoMEnergy(CoMenergy)) {
// input particle PDG // input particle PDG
auto const pdgCodeBeam = static_cast<int>(corsika::GetPDG(BeamId)); auto const pdgCodeBeam = static_cast<int>(corsika::PDG(BeamId));
auto const pdgCodeTarget = static_cast<int>(corsika::GetPDG(TargetId)); auto const pdgCodeTarget = static_cast<int>(corsika::PDG(TargetId));
const double ecm = CoMenergy / 1_GeV; const double ecm = CoMenergy / 1_GeV;
// calculate cross section // calculate cross section
...@@ -236,7 +236,7 @@ namespace corsika::pythia8 { ...@@ -236,7 +236,7 @@ namespace corsika::pythia8 {
<< "DoInteraction: " << corsikaBeamId << " interaction? " << "DoInteraction: " << corsikaBeamId << " interaction? "
<< corsika::pythia8::Interaction::CanInteract(corsikaBeamId) << std::endl; << corsika::pythia8::Interaction::CanInteract(corsikaBeamId) << std::endl;
if (corsika::IsNucleus(corsikaBeamId)) { if (corsika::is_nucleus(corsikaBeamId)) {
// nuclei handled by different process, this should not happen // nuclei handled by different process, this should not happen
throw std::runtime_error("Nuclear projectile are not handled by PYTHIA!"); throw std::runtime_error("Nuclear projectile are not handled by PYTHIA!");
} }
...@@ -359,7 +359,7 @@ namespace corsika::pythia8 { ...@@ -359,7 +359,7 @@ namespace corsika::pythia8 {
if (!p8p.isFinal()) continue; if (!p8p.isFinal()) continue;
auto const pyId = auto const pyId =
corsika::ConvertFromPDG(static_cast<corsika::PDGCode>(p8p.id())); corsika::convert_from_PDG(static_cast<corsika::PDGCode>(p8p.id()));
const MomentumVector pyPlab( const MomentumVector pyPlab(
rootCS, {p8p.px() * 1_GeV, p8p.py() * 1_GeV, p8p.pz() * 1_GeV}); rootCS, {p8p.px() * 1_GeV, p8p.py() * 1_GeV, p8p.pz() * 1_GeV});
......
...@@ -111,7 +111,7 @@ TEST_CASE("pythia process") { ...@@ -111,7 +111,7 @@ TEST_CASE("pythia process") {
setup::Stack stack; setup::Stack stack;
const HEPEnergyType E0 = 10_GeV; const HEPEnergyType E0 = 10_GeV;
HEPMomentumType P0 = HEPMomentumType P0 =
sqrt(E0 * E0 - corsika::PiPlus::GetMass() * corsika::PiPlus::GetMass()); sqrt(E0 * E0 - corsika::PiPlus::mass() * corsika::PiPlus::mass());
auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0}); auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0});
corsika::Point pos(cs, 0_m, 0_m, 0_m); corsika::Point pos(cs, 0_m, 0_m, 0_m);
auto particle = stack.AddParticle( auto particle = stack.AddParticle(
...@@ -139,7 +139,7 @@ TEST_CASE("pythia process") { ...@@ -139,7 +139,7 @@ TEST_CASE("pythia process") {
setup::Stack stack; setup::Stack stack;
const HEPEnergyType E0 = 100_GeV; const HEPEnergyType E0 = 100_GeV;
HEPMomentumType P0 = HEPMomentumType P0 =
sqrt(E0 * E0 - corsika::PiPlus::GetMass() * corsika::PiPlus::GetMass()); sqrt(E0 * E0 - corsika::PiPlus::mass() * corsika::PiPlus::mass());
auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0}); auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0});
corsika::Point pos(cs, 0_m, 0_m, 0_m); corsika::Point pos(cs, 0_m, 0_m, 0_m);
auto particle = stack.AddParticle( auto particle = stack.AddParticle(
......
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