Skip to content

Commit

Permalink
simplify numerics
Browse files Browse the repository at this point in the history
  • Loading branch information
mieskolainen committed Feb 5, 2024
1 parent e7e636b commit 3fd5895
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions icenet/algo/analytic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ def invmass(x, pt1: str, pt2: str, eta1: str, eta2: str, phi1: str, phi2: str, m
With awkward arrays
"""

px1,py1,pz1 = x[pt1]*np.cos(x[phi1]), x[pt1]*np.sin(x[phi1]), x[pt1]/np.tan(2.0*np.arctan(np.exp(-x[eta1])))
px2,py2,pz2 = x[pt2]*np.cos(x[phi2]), x[pt2]*np.sin(x[phi2]), x[pt2]/np.tan(2.0*np.arctan(np.exp(-x[eta2])))
px1,py1,pz1 = x[pt1]*np.cos(x[phi1]), x[pt1]*np.sin(x[phi1]), x[pt1]*np.sinh(x[eta1])
px2,py2,pz2 = x[pt2]*np.cos(x[phi2]), x[pt2]*np.sin(x[phi2]), x[pt2]*np.sinh(x[eta2])

E1 = np.sqrt(m1_const**2 + px1**2 + py1**2 + pz1**2)
E2 = np.sqrt(m2_const**2 + px2**2 + py2**2 + pz2**2)
Expand Down
4 changes: 2 additions & 2 deletions icenet/tools/icevec.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def setPt2RapPhiM2(self, pt2, rap, phi, m2):


def setPtEtaPhi(self, pt, eta, phi):
self.setXYZ(pt*np.cos(phi), pt*np.sin(phi), pt/np.tan(2.0*np.arctan(np.exp(-eta))))

self.setXYZ(pt*np.cos(phi), pt*np.sin(phi), pt*np.sinh(eta))


def setMagThetaPhi(self, mag, theta, phi):
self._x = mag * np.sin(theta) * np.cos(phi)
self._y = mag * np.sin(theta) * np.sin(phi)
Expand Down

0 comments on commit 3fd5895

Please sign in to comment.