From 9c897213977817778e91fd8a1ad6fc7ff923cb83 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Tue, 2 Feb 2016 17:55:00 +0000
Subject: [PATCH] DDSim: add property for minimal distance between vertex and
 endpoint of parent to set the flag

needs dd4hep revision 2071
---
 DDSim/DD4hepSimulation.py       |  1 +
 DDSim/Helper/ParticleHandler.py | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/DDSim/DD4hepSimulation.py b/DDSim/DD4hepSimulation.py
index 566073787..86a1f01a1 100644
--- a/DDSim/DD4hepSimulation.py
+++ b/DDSim/DD4hepSimulation.py
@@ -365,6 +365,7 @@ class DD4hepSimulation(object):
     part.KeepAllParticles     = self.part.keepAllParticles
     part.PrintEndTracking     = self.part.printEndTracking
     part.PrintStartTracking   = self.part.printStartTracking
+    part.MinDistToParentVertex= self.part.minDistToParentVertex
     part.OutputLevel = self.output.part
     part.enableUI()
     user = DDG4.Action(kernel,"Geant4TCUserParticleHandler/UserParticleHandler")
diff --git a/DDSim/Helper/ParticleHandler.py b/DDSim/Helper/ParticleHandler.py
index 4f251ddaf..9b91c0521 100644
--- a/DDSim/Helper/ParticleHandler.py
+++ b/DDSim/Helper/ParticleHandler.py
@@ -1,5 +1,5 @@
 """Configuration Helper for ParticleHandler"""
-from SystemOfUnits import MeV
+from SystemOfUnits import MeV, mm
 
 from DDSim.Helper.ConfigHelper import ConfigHelper
 
@@ -12,6 +12,17 @@ class ParticleHandler( ConfigHelper ):
     self._keepAllParticles = False
     self._printEndTracking = False
     self._printStartTracking = False
+    self._minDistToParentVertex = 2.2e-14*mm
+
+  @property
+  def minDistToParentVertex( self ):
+    """Minimal distance between particle vertex and endpoint of parent after
+    which the vertexIsNotEndpointOfParent flag is set
+    """
+    return self._minDistToParentVertex
+  @minDistToParentVertex.setter
+  def minDistToParentVertex( self, val ):
+    self._minDistToParentVertex = val
 
   @property
   def saveProcesses(self):
-- 
GitLab