From 3ccf9072b84f2e12dcec491d9078f13899bdd4f9 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Wed, 26 Jun 2024 17:38:26 +0200
Subject: [PATCH] DDG4.inputHandling: do not simulate rejectPDG particles even
 if they are called stable

---
 DDG4/src/Geant4InputHandling.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/DDG4/src/Geant4InputHandling.cpp b/DDG4/src/Geant4InputHandling.cpp
index d62a5d710..8cff4216e 100644
--- a/DDG4/src/Geant4InputHandling.cpp
+++ b/DDG4/src/Geant4InputHandling.cpp
@@ -392,7 +392,15 @@ getRelevant(std::set<int>& visited,
   visited.insert(p->id);
   PropertyMask status(p->status);
   if ( status.isSet(G4PARTICLE_GEN_STABLE) )  {
-    if ( prim.find(p->id) == prim.end() )  {
+    bool rejectParticle = false
+      or (primaryConfig.m_rejectPDGs.count(abs(p->pdgID)) != 0) // quarks, gluon, "strings", W, Z etc.
+      ;
+    printout(dd4hep::DEBUG, "Input",
+             "Checking rejection of stable: PDG(%-10d), Definition(%s), reject(%s)",
+             p->pdgID,
+             p.definition() ? "true" : "false",
+             rejectParticle ? "true" : "false");
+    if (not rejectParticle and prim.find(p->id) == prim.end() )  {
       G4PrimaryParticle* p4 = createG4Primary(p);
       prim[p->id] = p4;
       res.emplace_back(p,p4);
-- 
GitLab