From 3da948da0343a7b393181b4c56f338acd3e15c0f Mon Sep 17 00:00:00 2001 From: giacomomagni Date: Thu, 8 Aug 2024 16:29:14 +0200 Subject: [PATCH] make kin plot working --- validphys2/src/validphys/commondataparser.py | 12 +++++++----- validphys2/src/validphys/process_options.py | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/validphys2/src/validphys/commondataparser.py b/validphys2/src/validphys/commondataparser.py index 3fb3d3f22d..f9b70ff2cd 100644 --- a/validphys2/src/validphys/commondataparser.py +++ b/validphys2/src/validphys/commondataparser.py @@ -761,13 +761,15 @@ def folder(self): def cm_energy(self): """Return the center of mass energy as GeV if it can be understood from the name otherwise return None""" - energy_string = self.setname.split("_")[2] - if energy_string == "NOTFIXED": + + if "NOTFIXED" in self.setname: return None - if energy_string.endswith("GEV"): - factor = 1.0 - elif energy_string.endswith("TEV"): + if "GEV" in self.setname: + factor = 1 + energy_string = [a for a in self.setname.split("_") if "GEV" in a][0] + elif "TEV" in self.setname: factor = 1000 + energy_string = [a for a in self.setname.split("_") if "TEV" in a][0] else: return None return float(energy_string[:-3].replace("P", ".")) * factor diff --git a/validphys2/src/validphys/process_options.py b/validphys2/src/validphys/process_options.py index 421091ce00..373473421c 100644 --- a/validphys2/src/validphys/process_options.py +++ b/validphys2/src/validphys/process_options.py @@ -146,8 +146,9 @@ def _jets_xq2map(kin_info): # Then compute x, Q2 pT = kin_info[_Vars.pT] ratio = pT / kin_info[_Vars.sqrts] - x1 = 2 * ratio * np.exp(kin_info[_Vars.y]) - x2 = 2 * ratio * np.exp(-kin_info[_Vars.y]) + rap = kin_info.get_one_of(_Vars.y, _Vars.eta, _Vars.abs_eta) + x1 = 2 * ratio * np.exp(rap) + x2 = 2 * ratio * np.exp(-rap) q2 = pT * pT x = np.concatenate((x1, x2)) return np.clip(x, a_min=None, a_max=1, out=x), np.concatenate((q2, q2)) @@ -155,11 +156,12 @@ def _jets_xq2map(kin_info): def _dijets_xq2map(kin_info): # Here we can have either ystar or ydiff, but in either case we need to do the same - ylab = kin_info.get_one_of(_Vars.ystar, _Vars.ydiff) + ylab_1 = kin_info.get_one_of(_Vars.ystar, _Vars.ydiff, _Vars.eta_1, _Vars.abs_eta_1) + ylab_2 = kin_info.get_one_of(_Vars.ystar, _Vars.ydiff, _Vars.eta_2, _Vars.abs_eta_2) # Then compute x, Q2 ratio = kin_info[_Vars.m_jj] / kin_info[_Vars.sqrts] - x1 = ratio * np.exp(ylab) - x2 = ratio * np.exp(-ylab) + x1 = ratio * np.exp(ylab_1) + x2 = ratio * np.exp(-ylab_2) q2 = kin_info[_Vars.m_jj] * kin_info[_Vars.m_jj] x = np.concatenate((x1, x2)) return np.clip(x, a_min=None, a_max=1, out=x), np.concatenate((q2, q2))