From f1182f506deb22e2c3bc5287509deeb6f32f886b Mon Sep 17 00:00:00 2001
From: Frank Gaede <frank.gaede@desy.de>
Date: Thu, 17 May 2018 19:20:47 +0200
Subject: [PATCH] fix bug in input handling and relnotes v01-17-01

---
 DDG4/src/Geant4InputHandling.cpp | 4 +++-
 doc/ReleaseNotes.md              | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/DDG4/src/Geant4InputHandling.cpp b/DDG4/src/Geant4InputHandling.cpp
index 7e8731c52..9bc5e8a03 100644
--- a/DDG4/src/Geant4InputHandling.cpp
+++ b/DDG4/src/Geant4InputHandling.cpp
@@ -384,10 +384,12 @@ getRelevant(set<int>& visited,
     double proper_time_Precision = pow(10.,-DBL_DIG)*me*fmax(fabs(p->time),fabs(dp->time));
     bool isProperTimeZero = (proper_time <= proper_time_Precision);
 
+    const std::set<int> leptonPDGs{11,13,15,17};
     // -- remove original if ---
     bool rejectParticle = not p.definition() // completely unknown to geant4
       or (rejectPDGs.count(abs(p->pdgID)) != 0) // quarks, gluon, "strings", W, Z etc.
-      or (isProperTimeZero and p.definition()->GetPDGStable()); // initial state electrons, etc.
+      or (isProperTimeZero and p.definition()->GetPDGStable() ) // initial state electrons, etc.
+      or (isProperTimeZero and leptonPDGs.count(abs(p->pdgID)) != 0 ) ; // charged 'documentation' leptons, e.g. in lepton pairs w/ FSR
     if (not rejectParticle) {
       map<int,G4PrimaryParticle*>::iterator ip4 = prim.find(p->id);
       G4PrimaryParticle* p4 = (ip4 == prim.end()) ? 0 : (*ip4).second;
diff --git a/doc/ReleaseNotes.md b/doc/ReleaseNotes.md
index 2d09115ed..182f4b6de 100644
--- a/doc/ReleaseNotes.md
+++ b/doc/ReleaseNotes.md
@@ -1,3 +1,9 @@
+# v01-07-01
+
+* 2018-05-17 Frank Gaede
+   - fix bug in input handling, for details see discussion [#387](https://github.com/AIDASoft/DD4hep/issues/387)
+     - exclude leptons with zero lifetime from Geant4
+
 # v01-07
 
 * 2018-03-26 Javier Cervantes Villanueva ([PR#343](https://github.com/AIDASoft/DD4hep/pull/343))
-- 
GitLab