Skip to content

Commit

Permalink
make kin plot working
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Aug 8, 2024
1 parent d8819bb commit 3da948d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions validphys2/src/validphys/commondataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions validphys2/src/validphys/process_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,22 @@ 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))


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))
Expand Down

0 comments on commit 3da948d

Please sign in to comment.