From fe7089290786d89966dab90c205e7d3ca5947d1c Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Wed, 2 Mar 2016 10:38:45 +0000
Subject: [PATCH] Add Phi Min/Max and Theta Min /Max to gun options.

If used isotropic is mandatory so we turn it on in  setup
Note different capitalisations for options,
keeping lower case starting char for ddsim options
---
 DDSim/DD4hepSimulation.py | 12 ++++++++++++
 DDSim/Helper/Gun.py       |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/DDSim/DD4hepSimulation.py b/DDSim/DD4hepSimulation.py
index 164d323b4..94f3b9726 100644
--- a/DDSim/DD4hepSimulation.py
+++ b/DDSim/DD4hepSimulation.py
@@ -439,6 +439,18 @@ class DD4hepSimulation(object):
       gun.position     = self.gun.position
       gun.isotrop      = self.gun.isotrop
       gun.direction    = self.gun.direction
+      if self.gun.thetaMin is not None:
+        gun.ThetaMin = self.gun.thetaMin
+        gun.isotrop = True
+      if self.gun.thetaMax is not None:
+        gun.ThetaMax = self.gun.thetaMax
+        gun.isotrop = True
+      if self.gun.phiMin is not None:
+        gun.PhiMin = self.gun.phiMin
+        gun.isotrop = True
+      if self.gun.phiMax is not None:
+        gun.PhiMax = self.gun.phiMax
+        gun.isotrop = True
     except Exception as e: #pylint: disable=W0703
       print "ERROR: parsing gun options:\n%s\nException: %s " % (self.gun, e )
       exit(1)
diff --git a/DDSim/Helper/Gun.py b/DDSim/Helper/Gun.py
index 8fb4db5ca..a4cce5d7d 100644
--- a/DDSim/Helper/Gun.py
+++ b/DDSim/Helper/Gun.py
@@ -13,6 +13,10 @@ class Gun( ConfigHelper ):
     self._position = (0.0,0.0,0.0)
     self._isotrop = False
     self._direction = (0,0,1)
+    self.phiMin = None
+    self.phiMax = None
+    self.thetaMin = None
+    self.thetaMax = None
 
   @property
   def isotrop( self ):
-- 
GitLab