From 19c4dc72edc65119cdcf9540397d28a7212e31b7 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wdconinc@gmail.com> Date: Sun, 12 Mar 2023 19:45:04 -0500 Subject: [PATCH] feat: add etaMin and etaMax in ddsim (Helper/Gun.py) This adds the arguments `--gun.etaMin` and `--gun.etaMax`. If both `thetaMin` and `etaMax` are specified, `etaMax has precedence. --- DDG4/python/DDSim/Helper/Gun.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/DDG4/python/DDSim/Helper/Gun.py b/DDG4/python/DDSim/Helper/Gun.py index 8424e0718..80b42bbc6 100644 --- a/DDG4/python/DDSim/Helper/Gun.py +++ b/DDG4/python/DDSim/Helper/Gun.py @@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals from DDSim.Helper.ConfigHelper import ConfigHelper from g4units import GeV +from math import atan, exp import logging import ddsix as six @@ -22,9 +23,16 @@ class Gun(ConfigHelper): self._phiMin_EXTRA = {'help': "Minimal azimuthal angle for random distribution"} self.phiMin = None + self._phiMax_EXTRA = {'help': "Maximal azimuthal angle for random distribution"} self.phiMax = None + self._thetaMin_EXTRA = {'help': "Minimal polar angle for random distribution"} self.thetaMin = None + self._thetaMax_EXTRA = {'help': "Maximal polar angle for random distribution"} self.thetaMax = None + self._etaMin_EXTRA = {'help': "Minimal pseudorapidity for random distibution (overrides thetaMax)"} + self.etaMin = None + self._etaMax_EXTRA = {'help': "Maximal pseudorapidity for random distibution (overrides thetaMin)"} + self.etaMax = None self._momentumMin_EXTRA = {'help': "Minimal momentum when using distribution (default = 0.0)"} self.momentumMin = 0 * GeV self._momentumMax_EXTRA = {'help': "Maximal momentum when using distribution (default = 0.0)"} @@ -137,6 +145,12 @@ class Gun(ConfigHelper): if self.phiMax is not None: ddg4Gun.PhiMax = self.phiMax ddg4Gun.isotrop = True + if self.etaMin is not None: + ddg4Gun.ThetaMax = 2. * atan(exp(-float(self.etaMin))) + ddg4Gun.isotrop = True + if self.etaMax is not None: + ddg4Gun.ThetaMin = 2. * atan(exp(-float(self.etaMax))) + ddg4Gun.isotrop = True # this avoids issues if momentumMin is None because of previous default ddg4Gun.MomentumMin = self.momentumMin if self.momentumMin else 0.0 ddg4Gun.MomentumMax = self.momentumMax -- GitLab