Skip to content

Commit 28662e8

Browse files
committed
Corrected bug - ready
1 parent cfe5281 commit 28662e8

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

validphys2/src/validphys/theorycovariance/construction.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from validphys.checks import check_using_theory_covmat
1818
from validphys.results import results, results_central
1919
from validphys.core import PDF
20+
from validphys.process_options import _Process
2021
from validphys.theorycovariance.theorycovarianceutils import (
2122
check_correct_theory_combination,
2223
check_fit_dataset_order_matches_grouped,
@@ -175,12 +176,18 @@ def thcov_shifts_ht(ht_parameters,
175176
if group_proc.name in ht_included_proc and exp_set.name not in ht_excluded_exp:
176177
cd_table = exp_set.load_commondata().commondata_table
177178
process_type = cd_table['process'].iloc[0]
179+
180+
if isinstance(process_type, _Process):
181+
process_type = process_type.name
182+
178183
x = cd_table['kin1'].to_numpy()
179184
q2 = cd_table['kin2'].to_numpy()
180185
y = cd_table['kin3'].to_numpy()
186+
181187
if x.size != exp_ndata:
182188
raise ValueError("Problem with the number of data.")
183189

190+
# NMC_NC_NOTFIXED_DW_EM-F2
184191
if process_type == "DIS_F2R":
185192
HT_func['H2p'], HT_func['H2d'] = ht_func.DIS_F2R_ht(exp_set, pdf, HT["H2p"], HT["H2d"], x, q2)
186193

@@ -190,13 +197,16 @@ def thcov_shifts_ht(ht_parameters,
190197
elif process_type == "DIS_F2D":
191198
HT_func['H2d'] = ht_func.DIS_F2_ht(HT["H2d"], x, q2)
192199

193-
elif process_type == 'DIS_F2C':
194-
HT_func['H2p'], HT_func['H2d'] = ht_func.DIS_F2_ht(HT['H2p'], HT['H2d'], x, q2)
200+
# EMC
201+
elif process_type == "DIS_F2C":
202+
HT_func['H2p'], HT_func['H2d'] = ht_func.DIS_F2C_ht(HT['H2p'], HT['H2d'], x, q2)
195203

196-
elif process_type == "DIS_NCE" or "DIS_NCP":
204+
# HERA NC
205+
elif process_type in ["DIS_NCE", "DIS_NCP", "DIS_NCP_CH", "DIS_NCE_BT"]:
197206
HT_func['H2p'], HT_func["HLp"] = ht_func.DIS_NC_ht(HT['H2p'], HT['HLp'], x, q2, y)
198207

199-
elif process_type == "DIS_SNU_PB" or "DIS_SNB_PB": #CHORUS
208+
#CHORUS
209+
elif process_type in ["DIS_SNU_PB", "DIS_SNB_PB"]:
200210
# Lead target
201211
A = 208.0
202212
Z = 82
@@ -213,7 +223,8 @@ def thcov_shifts_ht(ht_parameters,
213223
HT_func["H3p"] = DIS_NU.PC_3_p
214224
HT_func["H3d"] = DIS_NU.PC_3_d
215225

216-
elif process_type == "DIS_DM_NU" or "DIS_DM_NB": #NuTeV
226+
#NuTeV
227+
elif process_type in ["DIS_DM_NU", "DIS_DM_NB"]:
217228
# Iron target
218229
Z = 23.403
219230
A = 49.618
@@ -230,7 +241,8 @@ def thcov_shifts_ht(ht_parameters,
230241
HT_func["H3p"] = DIS_NuTeV.PC_3_p
231242
HT_func["H3d"] = DIS_NuTeV.PC_3_d
232243

233-
elif process_type == "DIS_CCE" or "DIS_CCP": #HERA_CC
244+
#HERA_CC
245+
elif process_type in ["DIS_CCE", "DIS_CCP"]:
234246
if process_type == "DIS_CCE":
235247
l = 0
236248
elif process_type == "DIS_CCP":
@@ -243,7 +255,7 @@ def thcov_shifts_ht(ht_parameters,
243255
HT_func["H3p"] = DIS_CC_HERA.PC_3_p
244256
HT_func["H3d"] = DIS_CC_HERA.PC_3_d
245257
else:
246-
raise Exception(f"The process type `{process_type}` has not been implemented.")
258+
raise Exception(f"The process type `{process_type}` in `{exp_set.name} has not been implemented.")
247259

248260
for ht in HT.keys():
249261
for idx_node in range(len(HT[ht]['nodes'])):

0 commit comments

Comments
 (0)