From ee1a511ce53559b85362350e2abb851a13a1a6c0 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@tu-dortmund.de>
Date: Sat, 27 Apr 2019 21:52:14 -0300
Subject: [PATCH] fixed error in PDG/UrQMD conversion

---
 Processes/UrQMD/UrQMD.cc   | 9 ++++-----
 Processes/UrQMD/ityp2pdg.f | 3 ++-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Processes/UrQMD/UrQMD.cc b/Processes/UrQMD/UrQMD.cc
index 391986be6..9a88c8588 100644
--- a/Processes/UrQMD/UrQMD.cc
+++ b/Processes/UrQMD/UrQMD.cc
@@ -176,9 +176,6 @@ corsika::process::EProcessReturn UrQMD::DoInteraction(SetupProjectile& vProjecti
 
   std::cout << "UrQMD generated " << sys_.npart << " secondaries!" << std::endl;
 
-  if (sys_.npart > 0) // delete only in case of inelastic collision, otherwise keep
-    vProjectile.Delete();
-
   return process::EProcessReturn::eOk;
 }
 
@@ -206,13 +203,15 @@ corsika::particles::Code corsika::process::UrQMD::ConvertFromUrQMD(int vItyp, in
 std::pair<int, int> corsika::process::UrQMD::ConvertToUrQMD(
     corsika::particles::Code code) {
   static const std::map<int, std::pair<int, int>> mapPDGToUrQMD{
-      // data from github.com/afedynitch/ParticleDataTool
+      // data mostly from github.com/afedynitch/ParticleDataTool
       {22, {100, 0}},      // gamma
       {111, {101, 0}},     // pi0
       {211, {101, 2}},     // pi+
       {-211, {101, -2}},   // pi-
       {321, {106, 1}},     // K+
-      {-321, {106, -1}},   // K-
+      {-321, {-106, -1}},  // K-
+      {311, {106, -1}},    // K0
+      {-311, {-106, 1}},   // K0bar
       {2212, {1, 1}},      // p
       {2112, {1, -1}},     // n
       {221, {102, 0}},     // eta
diff --git a/Processes/UrQMD/ityp2pdg.f b/Processes/UrQMD/ityp2pdg.f
index 5a48225dc..aa8c2fff2 100644
--- a/Processes/UrQMD/ityp2pdg.f
+++ b/Processes/UrQMD/ityp2pdg.f
@@ -216,7 +216,8 @@ cl check if we found the correct values in IDTAB
             pdgid = idtab(3,next)
          endif
       else
-         call error ('pdgid','Error in tablelookup',dble(next),3)
+! M.R 2019-04-27, error to be handled in CORSIKA instead of here
+!         call error ('pdgid','Error in tablelookup',dble(next),3)
          pdgid = 0
       endif
 
-- 
GitLab