From d53680cc035b4d604ec35dd8a5d025acbebe6eab Mon Sep 17 00:00:00 2001 From: Lindsey Gray Date: Sun, 18 Aug 2024 19:38:32 -0500 Subject: [PATCH 1/2] fix: remove bad accessors for cylindrical pt/eta/phi vectors --- src/coffea/nanoevents/methods/vector.py | 160 ------------------------ 1 file changed, 160 deletions(-) diff --git a/src/coffea/nanoevents/methods/vector.py b/src/coffea/nanoevents/methods/vector.py index aff9dd2d2..f1584c8a5 100644 --- a/src/coffea/nanoevents/methods/vector.py +++ b/src/coffea/nanoevents/methods/vector.py @@ -513,90 +513,6 @@ class PtEtaPhiMLorentzVector(LorentzVector): Some additional properties are overridden for performance """ - @property - def E(self): - """Alias for `t`""" - return self.t - - @property - def pt(self): - """Alias for `r`""" - return self["pt"] - - @property - def eta(self): - r"""Pseudorapidity - - :math:`-\ln\tan(\theta/2) = \text{arcsinh}(z/r)` - """ - return self["eta"] - - @property - def phi(self): - r"""Azimuthal angle relative to X axis in XY plane - - :math:`\text{arctan2}(y, x)` - """ - return self["phi"] - - @property - def mass(self): - r"""Invariant mass (+, -, -, -) - - :math:`\sqrt{t^2-x^2-y^2-z^2}` - """ - return self["mass"] - - @property - def rho(self): - r"""Distance from origin in 3D - - :math:`\sqrt{x^2+y^2+z^2} = \sqrt{r^2+z^2}` - """ - return self.pt * numpy.cosh(self.eta) - - @property - def theta(self): - r"""Inclination angle from XY plane - - :math:`\text{arctan2}(r, z) = 2\text{arctan}(e^{-\eta})` - """ - return 2 * numpy.arctan(numpy.exp(-self.eta)) - - @property - def r(self): - r"""Distance from origin in XY plane - - :math:`\sqrt{x^2+y^2} = \rho \sin(\theta)` - """ - return self.pt - - @property - def z(self): - r"""Cartesian z value - - :math:`\rho \cos(\theta) = r \sinh(\eta)` - """ - return self.pt * numpy.sinh(self.eta) - - @property - def t(self): - r"""Cartesian time component - - :math:`\sqrt{\rho^2+m^2}` - """ - return numpy.hypot(self.rho, self.mass) - - @property - def rho2(self): - """Squared `rho`""" - return self.rho * self.rho - - @property - def mass2(self): - """Squared `mass`""" - return self.mass * self.mass - @awkward.mixin_class_method(numpy.multiply, {numbers.Number}) def multiply(self, other): """Multiply this vector by a scalar elementwise using `x`, `y`, `z`, and `t` components @@ -644,82 +560,6 @@ class PtEtaPhiELorentzVector(LorentzVector): Some additional properties are overridden for performance """ - @property - def E(self): - """Alias for `t`""" - return self.t - - @property - def pt(self): - """Alias for `r`""" - return self["pt"] - - @property - def eta(self): - r"""Pseudorapidity - - :math:`-\ln\tan(\theta/2) = \text{arcsinh}(z/r)` - """ - return self["eta"] - - @property - def phi(self): - r"""Azimuthal angle relative to X axis in XY plane - - :math:`\text{arctan2}(y, x)` - """ - return self["phi"] - - @property - def energy(self): - """Alias for `t`""" - return self["energy"] - - @property - def t(self): - r"""Cartesian time component - - :math:`\sqrt{\rho^2+m^2}` - """ - return self["energy"] - - @property - def rho(self): - r"""Distance from origin in 3D - - :math:`\sqrt{x^2+y^2+z^2} = \sqrt{r^2+z^2}` - """ - return self.pt * numpy.cosh(self.eta) - - @property - def theta(self): - r"""Inclination angle from XY plane - - :math:`\text{arctan2}(r, z) = 2\text{arctan}(e^{-\eta})` - """ - return 2 * numpy.arctan(numpy.exp(-self.eta)) - - @property - def r(self): - r"""Distance from origin in XY plane - - :math:`\sqrt{x^2+y^2} = \rho \sin(\theta)` - """ - return self.pt - - @property - def z(self): - r"""Cartesian z value - - :math:`r \sinh(\eta)` - """ - return self.pt * numpy.sinh(self.eta) - - @property - def rho2(self): - """Squared `rho`""" - return self.rho * self.rho - @awkward.mixin_class_method(numpy.multiply, {numbers.Number}) def multiply(self, other): """Multiply this vector by a scalar elementwise using `x`, `y`, `z`, and `t` components From 00c43b34d2e301f9614f4056a8ecb8347ad79945 Mon Sep 17 00:00:00 2001 From: Lindsey Gray Date: Sun, 18 Aug 2024 19:56:33 -0500 Subject: [PATCH 2/2] update tutorial notebooks --- binder/applying_corrections.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binder/applying_corrections.ipynb b/binder/applying_corrections.ipynb index 7f3d93ee7..c8b62c010 100644 --- a/binder/applying_corrections.ipynb +++ b/binder/applying_corrections.ipynb @@ -439,11 +439,11 @@ "jets['pt_raw'] = (1 - jets['rawFactor']) * jets['pt']\n", "jets['mass_raw'] = (1 - jets['rawFactor']) * jets['mass']\n", "jets['pt_gen'] = ak.values_astype(ak.fill_none(jets.matched_gen.pt, 0), np.float32)\n", - "jets['rho'] = ak.broadcast_arrays(events.fixedGridRhoFastjetAll, jets.pt)[0]\n", + "jets['PU_rho'] = ak.broadcast_arrays(events.fixedGridRhoFastjetAll, jets.pt)[0]\n", "name_map['ptGenJet'] = 'pt_gen'\n", "name_map['ptRaw'] = 'pt_raw'\n", "name_map['massRaw'] = 'mass_raw'\n", - "name_map['Rho'] = 'rho'\n", + "name_map['Rho'] = 'PU_rho'\n", " \n", "corrector = FactorizedJetCorrector(\n", " Fall17_17Nov2017_V32_MC_L2Relative_AK4PFPuppi=evaluator['Fall17_17Nov2017_V32_MC_L2Relative_AK4PFPuppi'],\n",