2828yaml .default_flow_style = False
2929yaml .indent (sequence = 4 , offset = 2 , mapping = 4 )
3030
31- HISTOGRAM_VARIABLES = {"y" , "etay" , "eta" , "pT" , "pT2" , "M2" }
31+ HISTOGRAM_VARIABLES = {"y" , "etay" , "eta" , "pT" , "pT2" , "M2" , "ET" }
3232
3333
3434def _legacy_nnpdf_translation (df , proc_type ):
@@ -88,23 +88,28 @@ def _1d_histogram(kin_df, hist_var):
8888def _nnlojet_observable (observable , process ):
8989 """Try to automatically understand the NNLOJET observables given the NNPDF process and obs."""
9090 observable = observable .lower ()
91+ process = process .upper ()
9192 if observable in ("eta" , "y" , "etay" ):
92- if process .upper (). startswith ("Z" ):
93+ if process .startswith ("Z" ):
9394 return "yz"
94- if process .upper (). startswith ("WP" ) and not process . upper () .endswith ("J" ):
95+ if process .startswith ("WP" ) and not process .endswith ("J" ):
9596 return "ylp"
96- if process .upper (). startswith ("WM" ) and not process . upper () .endswith ("J" ):
97+ if process .startswith ("WM" ) and not process .endswith ("J" ):
9798 return "ylm"
99+ if process .startswith ("GJ" ):
100+ return "y_gam"
98101 if observable == "pt" :
99- if process .upper (). startswith ("Z" ):
102+ if process .startswith ("Z" ):
100103 return "ptz"
101- if process .upper (). startswith ("W" ):
104+ if process .startswith ("W" ):
102105 return "ptw"
103- if observable == "m" and process .upper (). startswith ("Z" ):
106+ if observable == "m" and process .startswith ("Z" ):
104107 return "mll"
105108 if observable == "m2" :
106109 print ("\033 [91m [WARNING] \033 [0m Changed M2 to M in the selectors" )
107110 return "mll"
111+ if observable == "et" and process .startswith ("GJ" ):
112+ return "pt_gam"
108113
109114 raise ValueError (f"Observable { observable } not recognized for process { process } " )
110115
@@ -194,8 +199,15 @@ def _generate_nnlojet_pinecard(runname, process, energy, experiment, histograms)
194199 selectors = select_selectors (experiment , process )
195200 histograms = deepcopy (histograms )
196201
202+ # Digest the process variable
197203 if process .startswith ("Z0" ):
198204 process = process .replace ("Z0" , "Z" )
205+ if process .startswith ("G" ):
206+ # Defaults for: 2302.00510
207+ photon = {
208+ "photon_isolation" : "etsum[R=0.4, ETmax_const=4.8, ETmax_epsilon=0.0042, ET_threshold=0]" ,
209+ "photon_fragmentation" : "BFG2" ,
210+ }
199211
200212 # Digest the histogram variable
201213 for histo in histograms :
@@ -204,7 +216,7 @@ def _generate_nnlojet_pinecard(runname, process, energy, experiment, histograms)
204216
205217 ret = {
206218 "runname" : runname ,
207- "process" : {"proc" : process , "sqrts" : energy },
219+ "process" : {"proc" : process , "sqrts" : energy , ** photon },
208220 "pdf" : "NNPDF40_nnlo_as_01180" ,
209221 "techcut" : 1e-7 ,
210222 "histograms" : histograms ,
@@ -227,11 +239,21 @@ def _generate_nnlojet_pinecard(runname, process, energy, experiment, histograms)
227239 },
228240 "selectors" : selectors ,
229241 }
242+
243+ # Add the scale
244+ if process .startswith ("Z" ):
245+ ret ["scales" ] = {"mur" : "etz" , "muf" : "etz" }
246+ elif process .startswith ("W" ):
247+ ret ["scales" ] = {"mur" : "etw" , "muf" : "etw" }
248+ elif process .startswith ("G" ):
249+ # Defaults for: 2302.00510 R=0.4
250+ ret ["scales" ] = {"mur" : "pt_gam" , "muf" : "[pt_gam, 0.871*sqrt_pt_gam]" }
251+
230252 return ret
231253
232254
233255def generate_pinecard_from_nnpdf (
234- nnpdf_dataset , scale = "etz" , output_path = "." , observables = None
256+ nnpdf_dataset , scale = None , output_path = "." , observables = None
235257):
236258 """Generate a NNLOJET pinecard from an NNPDF dataset.
237259
@@ -277,6 +299,8 @@ def generate_pinecard_from_nnpdf(
277299 if "M2" in hist_vars :
278300 if len (kin_df ["M2" ]["mid" ].unique ()) == 1 :
279301 hist_vars .remove ("M2" )
302+ elif process .startswith ("PH" ):
303+ process = process .replace ("PH" , "GJ" )
280304
281305 # Create the histogram depending on whether this is a 1D or 2D distribution (or total)
282306 histograms = None
@@ -286,10 +310,10 @@ def generate_pinecard_from_nnpdf(
286310 elif len (hist_vars ) == 2 :
287311
288312 # Let's see whether we know how to do this 2D distribution
289- if "M2" in hist_vars :
290- svar = "M2"
291- elif "y" in hist_vars :
292- svar = "y"
313+ for var_i_know in [ "M2" , "y" , "eta" ] :
314+ if var_i_know in hist_vars :
315+ svar = var_i_know
316+ break
293317 else :
294318 raise NotImplementedError (f"Don't know how to do this 2D: { hist_vars } " )
295319 hist_vars .remove (svar )
@@ -349,7 +373,7 @@ def generate_pinecard_from_nnpdf(
349373 processes = [process ]
350374 if process .startswith ("WPWM" ):
351375 processes = [process .replace ("WP" , "" ), process .replace ("WM" , "" )]
352- if process == "DY" :
376+ elif process == "DY" :
353377 processes = ["Z0" , "WP" , "WM" ]
354378
355379 parent_folder = output_path .parent
@@ -360,7 +384,9 @@ def generate_pinecard_from_nnpdf(
360384 runname = nnpdf_dataset .replace (process , proc )
361385
362386 ret = _generate_nnlojet_pinecard (runname , proc , energy , experiment , histograms )
363- ret ["scales" ] = {"mur" : scale , "muf" : scale }
387+ if scale is not None :
388+ # Default to etz
389+ ret ["scales" ] = {"mur" : scale , "muf" : scale }
364390
365391 # Beautify before dumping
366392 data = CommentedMap (ret )
0 commit comments