diff --git a/tools/plotting/fastnnlo_runtime.py b/tools/plotting/fastnnlo_runtime.py index 39ef415a51a2b834a5df92f2d03fb8582020049f..642336937d52631be753d46cbd42b974243c703c 100755 --- a/tools/plotting/fastnnlo_runtime.py +++ b/tools/plotting/fastnnlo_runtime.py @@ -360,7 +360,12 @@ def plot_events_per_hour(infodict, out_path, out_name, formats): ax.vlines(median, 0, max(n), colors='green', linestyles='dashdot', label=r'Median: {0:0.2e}$\pm${1:0.2e} events/hour'.format(median, iqd)) ax.ticklabel_format(axis='x', style='plain', useOffset=False) else: - n, batches, _ = ax.hist(evrs, histtype='barstacked', log=True, stacked=True, bins=logbins, edgecolor='black', color=_channel_colors, label=_channels) + chnlab = [] + chncol = [] + for chn in unique_channels: + chnlab.append(chn) + chncol.append(_channel_colors[_channel_number[chn]]) + n, batches, _ = ax.hist(evrs, histtype='barstacked', log=True, stacked=True, bins=logbins, edgecolor='black', color=chncol, label=chnlab) ax.set_xlim(0.9*ephmin, 1.1*ephmax) ax.set_xscale('log') diff --git a/tools/plotting/fastnnlo_statunc.py b/tools/plotting/fastnnlo_statunc.py index 2141eadf05567f266fb762d95f5ac2a7868a7cd8..f8bd699562d571dbe4dfb8f14b5264d954c54a2e 100755 --- a/tools/plotting/fastnnlo_statunc.py +++ b/tools/plotting/fastnnlo_statunc.py @@ -92,7 +92,9 @@ class SplitArgs(argparse.Action): # Some global definitions _channels = [ 'LO', 'R', 'V', 'RRa', 'RRb', 'RV', 'VV' ] +_channel_lists = { 'LO': [ 'LO' ], 'NLO': [ 'LO', 'R', 'V' ], 'NNLO': [ 'LO', 'R', 'V', 'RRa', 'RRb', 'RV', 'VV' ] } _orders = [ 'LO', 'NLO', 'NNLO', 'NLO_only', 'NNLO_only' ] +_order_lists = { 'LO': [ 'LO' ], 'NLO': [ 'LO', 'NLO', 'NLO_only' ], 'NNLO': [ 'LO', 'NLO', 'NNLO', 'NLO_only', 'NNLO_only' ] } _fntrans = str.maketrans({'[': '', ']': '', '(': '', ')': '', ',': ''}) # Filename translation table _formats = {'eps': 0, 'pdf': 1, 'png': 2, 'svg': 3} _text_to_order = {'LO': 0, 'NLO': 1, 'NNLO': 2, 'NLO_only': 3, 'NNLO_only': 4} @@ -141,7 +143,7 @@ def plotting(x_axis, xmin, xmax, dxsr_ch, dxsr_or, xlabel, ylabel, title, tablen # Plot all normalised statistical uncertainties in channel list xs_index = -1 - for channel_item, shift in zip(_channels, shift_list): + for channel_item, shift in zip(_channel_lists[order], shift_list): xs_index += 1 yerror = 0*dxsr_ch[xs_index, :] ax1.errorbar(x_axis*shift, dxsr_ch[xs_index], yerr=yerror, elinewidth=1, linewidth=0.0, @@ -184,7 +186,7 @@ def plotting(x_axis, xmin, xmax, dxsr_ch, dxsr_or, xlabel, ylabel, title, tablen # Plot signed cross-section shares per channel xs_index = -1 - for channel_item, shift in zip(_channels, shift_list): + for channel_item, shift in zip(_channel_lists[order], shift_list): xs_index += 1 yerror = 0*xsr_ch[xs_index, :] ax2.errorbar(x_axis*shift, xsr_ch[xs_index], yerr=yerror, elinewidth=1, linewidth=0.0, @@ -446,7 +448,7 @@ def main(): xsr_or = [] dxs_or = [] dxsr_or = [] - for lorder in _orders: + for lorder in _order_lists[order]: parts = tablename.split(sep) parts[1] = lorder datfile = tablepath + '/' + sep.join(parts) + '.dat' @@ -470,14 +472,14 @@ def main(): dxs_ch = [] dxsr_ch = [] if args['datfiles'] is None or args['datfiles'][0] == '': - for channel in _channels: + for channel in _channel_lists[order]: parts = tablename.split(sep) parts[1] = channel datfile = tablepath + '/' + sep.join(parts) + '.dat' datfilenames.append(datfile) lstat = (len(datfilenames) > 0) - if lstat and len(datfilenames) != len(_channels): + if lstat and len(datfilenames) != len(_channel_lists[order]): print('[fastnnlo_statunc]: Mismatch between required channels and no. of filenames for statistical uncertainties, aborted!') exit(1)