From 122e56a718db739eb894e4873336c7f35698a943 Mon Sep 17 00:00:00 2001
From: Klaus Rabbertz <klaus.rabbertz@cern.ch>
Date: Sun, 28 Apr 2024 19:14:40 +0200
Subject: [PATCH] Try unifying C++ and py printouts; work on enums, requires
 C++17

---
 tools/plotting/fastnnlo_kfactor.py            |  10 +-
 tools/plotting/fnlo-py-print.py               | 388 ++++++++++++++++++
 v2.5/toolkit/configure.ac                     |   2 +-
 v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc  |  50 ++-
 v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc  |  68 ++-
 v2.5/toolkit/fastnlotoolkit/fastNLOTable.cc   |  86 ++--
 v2.5/toolkit/fastnlotoolkit/fastNLOTools.cc   |  39 ++
 .../include/fastnlotk/fastNLOConstants.h.in   |  79 ++++
 .../include/fastnlotk/fastNLOLHAPDF.h         |  24 +-
 .../include/fastnlotk/fastNLOReader.h         |  19 +-
 .../include/fastnlotk/fastNLOTable.h          |   4 +-
 .../include/fastnlotk/fastNLOTools.h          |   6 +-
 .../include/fastnlotk/speaker.h               |  14 +-
 v2.5/toolkit/fastnlotoolkit/speaker.cc        |  35 +-
 v2.5/toolkit/m4/ax_cxx_compile_stdcxx_17.m4   |  35 ++
 v2.5/toolkit/src/fnlo-tk-yodaout.cc           | 135 +++---
 16 files changed, 804 insertions(+), 190 deletions(-)
 create mode 100755 tools/plotting/fnlo-py-print.py
 create mode 100644 v2.5/toolkit/m4/ax_cxx_compile_stdcxx_17.m4

diff --git a/tools/plotting/fastnnlo_kfactor.py b/tools/plotting/fastnnlo_kfactor.py
index 855c9856..850ca25e 100755
--- a/tools/plotting/fastnnlo_kfactor.py
+++ b/tools/plotting/fastnnlo_kfactor.py
@@ -169,7 +169,7 @@ def main():
             if reftab:
                 fref.SetContributionON(fastnlo.kFixedOrder, j, orders[n][j])
         print('\n')
-        print('Calc XS for order: %s' % n, '\n')
+        print('Calc XS for order: %s' % n, 'and scale settings mur,muf: ', args['mur'], args['mur'], '\n')
         fnlo.SetMuRFunctionalForm(args['mur'])
         fnlo.SetMuFFunctionalForm(args['muf'])
         fnlo.CalcCrossSection()
@@ -186,8 +186,8 @@ def main():
         if reftab:
             print('\n')
             print('Ref XS for order: %s' % n, '\n')
-            fnlo.SetMuRFunctionalForm(args['murref'])
-            fnlo.SetMuFFunctionalForm(args['mufref'])
+            fref.SetMuRFunctionalForm(args['murref'])
+            fref.SetMuFFunctionalForm(args['mufref'])
             fref.CalcCrossSection()
             xsunc = np.array(fref.GetAddUncertaintyVec(fastnlo.kAddStat))
             xs  = xsunc[0,:]
@@ -290,6 +290,10 @@ def main():
     if reftab:
         labels = ['LO/LO', 'NLO/NLO', 'NNLO LC/FC']
         colors_orders = {'LO/LO': 'g', 'NLO/NLO': 'r', 'NNLO LC/FC': 'b'}
+        #        labels = ['LO <pT> n/o merge', 'NLO <pT> n/o merge', 'NNLO <pT> n/o merge']
+        #        colors_orders = {'LO <pT> n/o merge': 'g', 'NLO <pT> n/o merge': 'r', 'NNLO <pT> n/o merge': 'b'}
+        #        labels = ['LO m12 n/o merge', 'NLO m12 n/o merge', 'NNLO m12 n/o merge']
+        #        colors_orders = {'LO m12 n/o merge': 'g', 'NLO m12 n/o merge': 'r', 'NNLO m12 n/o merge': 'b'}
 
     ### Plot all three graphs (if NNLO exists in table and) no specific order chosen ###
     # plot all the kfactors into one plot. can be changed to 3 plots by introducing some for-loop
diff --git a/tools/plotting/fnlo-py-print.py b/tools/plotting/fnlo-py-print.py
new file mode 100755
index 00000000..2d4cc671
--- /dev/null
+++ b/tools/plotting/fnlo-py-print.py
@@ -0,0 +1,388 @@
+#!/usr/bin/env python3
+#-*- coding:utf-8 -*-
+#
+########################################################################
+#
+# Read fastNLO grids and print cross section & uncertainty
+#
+# Created by K. Rabbertz, 22.04.2024
+#
+########################################################################
+#
+import argparse
+import glob
+import os
+import re
+import string
+import sys
+import timeit
+# numpy
+import numpy as np
+# fastNLO for direct evaluation of interpolation grids
+# ATTENTION: fastNLO python extension is required for Python 3!
+import fastnlo
+from fastnlo import fastNLOLHAPDF
+from fastnlo import SetGlobalVerbosity
+
+# Action class to allow comma-separated (or empty) list in options
+class SplitArgs(argparse.Action):
+    def __call__(self, parser, namespace, values, option_string=None):
+        if values:
+            setattr(namespace, self.dest, values[0].split(','))
+        else:
+            setattr(namespace, self.dest, [''])
+
+
+# Some global definitions
+_fntrans = str.maketrans({'[': '', ']': '', '(': '', ')': '', ',': ''}) # Filename translation table
+_sntrans = str.maketrans({'[': '', ']': '', '(': '', ')': '', ',': '', '/': '÷'}) # Scalename translation table
+_formats = {'eps': 0, 'pdf': 1, 'png': 2, 'svg': 3}
+_text_to_order = {'LO': 0, 'NLO': 1, 'NNLO': 2}
+_order_to_text = {0: 'LO', 1: 'NLO', 2: 'NNLO'}
+_order_color = {'LO': 'g', 'NLO': 'b', 'NNLO': 'r'}
+_order_symbol = {'LO': '^', 'NLO': 's', 'NNLO': 'o'}
+_colors = ['tab:orange', 'tab:green', 'tab:purple', 'tab:blue', 'tab:brown']
+_symbols = ['s', 'X', 'o', '^', 'v']
+_hatches = ['', '//', '\\', '|', '-']
+_scale_to_text = {0: 'kScale1', 1: 'kScale2', 2: 'kQuadraticSum', 3: 'kQuadraticMean', 4: 'kQuadraticSumOver4',
+                  5: 'kLinearMean', 6: 'kLinearSum', 7: 'kScaleMax', 8: 'kScaleMin', 9: 'kProd',
+                  10: 'kS2plusS1half', 11: 'kPow4Sum', 12: 'kWgtAvg', 13: 'kS2plusS1fourth', 14: 'kExpProd2', 15: 'kExtern'}
+_pdfbasenames = ['ABM11', 'ABMP15', 'ABMP16', 'CJ12', 'CJ15', 'CT10', 'CT14', 'HERAPDF20', 'JR14',
+                 'MMHT2014', 'MSTW2008', 'NNPDF23', 'NNPDF30', 'NNPDF31']
+_debug = False
+
+########################################################################
+
+def main():
+    # Start timer
+    # just for measuring wall clock time - not necessary
+    start_time = timeit.default_timer()
+    # Define arguments & options
+    parser = argparse.ArgumentParser(epilog='', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+    # Positional arguments
+    parser.add_argument('table', type=str, nargs='+',
+                        help='Filename glob of fastNLO tables to be evaluated. This must be specified!')
+    # Optional arguments
+    parser.add_argument('-m', '--member', default=0, type=int,
+                        help='Member of PDFset, default is 0.')
+    parser.add_argument('-o', '--order', required=False, nargs=1, type=str, action=SplitArgs,
+                        help='Comma-separated list of orders to show: LO, NLO, and/or NNLO. If nothing is chosen, show all orders available in table.')
+    parser.add_argument('-p', '--pdfset', default='CT14nlo', type=str,
+                        help='PDFset to evaluate fastNLO table.')
+    parser.add_argument('-s', '--scale', default=0, required=False, nargs='?', type=int,
+                        choices=list(range(16)), metavar='[0-15]',
+                        help='For flexible-scale tables define central scale choice for MuR and MuF by selection enum fastNLO::ScaleFunctionalForm ("0"=kScale1, "1"=kScale2, "2"=kQuadraticSum), ...')
+    parser.add_argument('-u', '--uncertainty', default=None, required=False, type=str,
+                        help='Type of uncertainty to be derived: 2P, 6P, L6, ST.')
+    parser.add_argument('-v', '--verbosity', default='WARNING', type=str,
+                        help="Set fastNLO output verbosity to one of SILENT, ERROR, WARNING, INFO, MANUAL, DEBUG")
+
+    # Print header
+    print("\n###########################################################################################")
+    print("# fnlo-py-print:")
+    print("# Read fastNLO grids and print cross section & uncertainty")
+    print("###########################################################################################\n")
+
+    # Parse arguments
+    args = vars(parser.parse_args())
+
+    # List of table names
+    files = args['table']
+    print('\n')
+    print('[fnlo-py-print]: Analysing table list:')
+    for file in files:
+        print('[fnlo-py-print]:   ', file)
+
+    # PDF set name
+    pdfset = os.path.basename(args['pdfset'])
+    print('[fnlo-py-print]: Using PDF set', pdfset)
+
+    # Orders to be shown
+    iorders = []
+    iordmin = _text_to_order['LO']
+    iordmax = _text_to_order['NNLO']
+    if args['order'] is None:
+        print('[fnlo-py-print]: Evaluate table up to highest available order.')
+    else:
+        for ord in args['order']:
+            if ord in _text_to_order:
+                iorders.append(_text_to_order[ord])
+            else:
+                print('[fnlo-py-print]: Illegal order specified, aborted!')
+                print('[fnlo-py-print]: Order list:', args['order'])
+                exit(1)
+        iordmin = min(iorders)
+        iordmax = max(iorders)
+        print('[fnlo-py-print]: Evaluate table up to order(s)', args['order'])
+
+    # Type of uncertainty (None, scale variation [2P,6P], PDF [L6], statistical [ST])
+    unc_type  = None
+    unc_style = None
+    unc_label = ''
+    if args['uncertainty']:
+        unc_type = args['uncertainty']
+        if unc_type == '2P':
+            unc_style = fastnlo.kSymmetricTwoPoint
+            unc_label = 'Scale uncertainty (2P)'
+        elif unc_type == '6P':
+            unc_style = fastnlo.kAsymmetricSixPoint
+            unc_label = 'Scale uncertainty (6P)'
+        elif unc_type == 'L6':
+            unc_style = fastnlo.kLHAPDF6
+            unc_label = 'PDF uncertainty (LHAPDF)'
+        elif unc_type == 'ST':
+            unc_style = fastnlo.kAddStat
+            unc_label = 'numerical uncertainty (theory)'
+        else:
+            print('[fnlo-py-print]: Illegal uncertainty specified, aborted!')
+            print('[fnlo-py-print]: Uncertainty:', args['uncertainty'])
+            exit(11)
+
+    # Scale choice
+    scale_choice = args['scale']
+
+    # Verbosity
+    verb = args['verbosity']
+
+    # Loop over table list
+    for table in files:
+        # Table name
+        tablepath = os.path.split(table)[0]
+        if not tablepath:
+            tablepath = '.'
+        tablename = os.path.split(table)[1]
+        if tablename.endswith('.tab.gz'):
+            tablename = tablename.replace('.tab.gz', '', 1)
+        elif tablename.endswith('.tab'):
+            tablename = tablename.replace('.tab', '', 1)
+        else:
+            print('[fnlo-py-print]: Error! Wrong extension for table: ', table)
+            exit(1)
+        print('[fnlo-py-print]: Analysing table: ', table)
+
+        ###################### Start EVALUATION with fastNLO library ###################################################
+        # SetGlobalVerbosity(0) # Does not work since changed to default in the following call
+        # Take the general information (bin_bounds, labels, order_existence, etc.) from given pdfset.
+        print("HHHHHHHHHHHHHHHHH: {}".format(verb))
+        fnlo = fastnlo.fastNLOLHAPDF(table, args['pdfset'], args['member'], args['verbosity'])
+
+        # Get labeling for the x-axis
+        # Dimensionality of the table:
+        ndim = fnlo.GetNumDiffBin()
+        if verb:
+            print('\n')
+            print('[fnlo-py-print]: Table Dimensions: ', ndim)
+
+        # Labels of all the dimensions:
+        labels = fnlo.GetDimLabels()
+        if verb:
+            print('[fnlo-py-print]: Labels:', labels)
+
+        # x label of first dimension from table:
+        xlabel = fnlo.GetDimLabel(0)
+        if verb:
+            print('[fnlo-py-print]: x-label:', xlabel)
+
+        # Generic y label
+        ylabel = '$\sigma \pm \Delta\sigma(\mu_R,\mu_F)$'
+
+        # Creating x-axis
+        bin_bounds = np.array(fnlo.GetObsBinsBounds(0))
+        #        bin_bounds = np.array(fnlo.GetDim1BinBounds(0)) Mods needed for 2D tables ...
+        if verb:
+            print('[fnlo-py-print]: bin_bounds.T: \n', bin_bounds.T, '\n')
+            print('[fnlo-py-print]: bin_bounds.flatten()',
+                  bin_bounds.flatten(), '\n')
+
+        x_axis = (bin_bounds.T[0]+bin_bounds.T[1]) / 2.  # this is a list of bin centers
+        xmin = 0.95*min(bin_bounds.ravel())
+        xmax = 1.05*max(bin_bounds.ravel())
+        if verb:
+            print('[fnlo-py-print]: xmin=%s, xmax=%s. \n' % (xmin, xmax))
+
+        # Preparing x-errors (via bin_bounds) --> x_errors[0, :] are initially negative (positive via -1*), x_errors[1, :] positive
+        x_errors = np.array(
+            [-1*(bin_bounds.T[0]-x_axis), bin_bounds.T[1]-x_axis])
+        if verb:
+            print('[fnlo-py-print]: \n x_errors: ', x_errors, '\n')
+
+        # Check existence of orders in table
+        lflex = fnlo.GetIsFlexibleScaleTable()
+        scale_name = 'scale1'
+        o_existence = [False, False, False]
+        cnt_order = -1
+        max_order = 0
+        for i in range(3):
+            o_existence[i] = fnlo.SetContributionON(
+                fastnlo.kFixedOrder, i, True)
+            if o_existence[i]:
+                max_order = i
+                if not lflex:
+                    if scale_choice != 0:
+                        print(
+                            '[fnlo-py-print]: Invalid choice of scale = ', scale_choice, ' Aborted!')
+                        print(
+                            '[fnlo-py-print]: For fixed-scale tables only the default=0 is allowed.')
+                        exit(1)
+                    else:
+                        scale_name = fnlo.GetScaleDescription(i, 0)
+                else:
+                    if scale_choice < 2:
+                        scale_name = fnlo.GetScaleDescription(i, scale_choice)
+                    else:
+                        scl0 = fnlo.GetScaleDescription(i, 0)
+                        scl1 = fnlo.GetScaleDescription(i, 1)
+                        scale_name = _scale_to_text[scale_choice] + \
+                            '_'+scl0+'_'+scl1
+                if cnt_order == i-1:
+                    cnt_order += 1
+        if verb:
+            print('[fnlo-py-print]: Table has continuous orders up to',
+                  cnt_order, 'and a maximal order of', max_order)
+
+        # If previously undefined set iordmax to maximum found in table
+        if args['order'] is None:
+            iordmax = max_order
+
+        if iordmax > cnt_order:
+            print('[fnlo-py-print]: Invalid choice of orders. Aborted!')
+            print('[fnlo-py-print]: Highest order requested is',
+                  _order_to_text[iordmax], 'but continuous orders are available only up to', _order_to_text[cnt_order])
+            exit(1)
+
+        order_list = []
+        if args['order'] is None:
+            for iord in range(cnt_order+1):
+                order_list.append(_order_to_text[iord])
+        else:
+            order_list = args['order']
+
+        print('[fnlo-py-print]: List of requested orders:', order_list)
+
+        # For flexible-scale tables set scale to user choice (default is 0)
+
+        if lflex:
+            print(
+                '[fnlo-py-print]: Setting requested scale choice for flexible-scale table:', scale_choice)
+            fnlo.SetMuRFunctionalForm(scale_choice)
+            fnlo.SetMuFFunctionalForm(scale_choice)
+        else:
+            if scale_choice == 0:
+                print(
+                    '[fnlo-py-print]: Evaluating fixed-scale table. Scale choice must be', scale_choice)
+            else:
+                print(
+                    '[fnlo-py-print]: No scale choice possible for fixed-scale table. Aborted!')
+                print('[fnlo-py-print]: scale_choice = ', scale_choice)
+                exit(1)
+
+        # Now evaluate fastNLO table having a look at the requested uncertainty
+        xs_list = []  # will contain total cross section for selected orders out of LO, NLO, NNLO
+        # list for relative scale uncertainties (low, high) for selected orders
+        rel_unc_list = []
+        for n in order_list:
+            for j in range(0, max_order+1):
+                if j <= _text_to_order[n]:
+                    fnlo.SetContributionON(fastnlo.kFixedOrder, j, True)
+                else:
+                    fnlo.SetContributionON(fastnlo.kFixedOrder, j, False)
+            if verb:
+                print('[fnlo-py-print]: \n')
+                print('[fnlo-py-print]: Calculate XS for order: %s' % n, '\n')
+                print(
+                    '[fnlo-py-print]: ----  ----  ----  ----  ----  ----  ----  ----')
+
+            fnlo.CalcCrossSection()
+            xs_list.append(fnlo.GetCrossSection())
+
+            ### Get requested uncertainty ###
+            if verb:
+                print('[fnlo-py-print]: Used scale factor MuF: ', fnlo.GetScaleFactorMuF())
+                print('[fnlo-py-print]: Used scale factor MuR: ', fnlo.GetScaleFactorMuR(), '\n')
+                print('[fnlo-py-print]: Calculate uncertainty for this central scale.\n')
+            # RELATIVE uncertainty for chosen uncertainty type and style
+            # Calculate this for all accessible orders just in case
+            lnorm  = False
+            iprint = 1
+            if unc_type == '2P' or unc_type == '6P':
+                #unc_name = " # Relative scale uncertainties (" + unc_type + ")"
+                #fnlo.PrintScaleUncertaintyVec(unc_style,unc_name)
+                rel_unc_item = np.array(fnlo.GetScaleUncertaintyVec(unc_style,lnorm,iprint))
+            elif unc_type == 'L6':
+                #unc_name = " # Relative PDF Uncertainties (" + n + " " + pdfset + " " + unc_type + ")"
+                #fnlo.PrintPDFUncertaintyVec(unc_style,unc_name)
+                rel_unc_item = np.array(fnlo.GetPDFUncertaintyVec(unc_style,lnorm,iprint))
+            elif unc_type == 'ST':
+                #unc_name = " # Relative statistical uncertainties (" + unc_type + ")";
+                #fnlo.PrintAddUncertaintyVec(unc_style,unc_name)
+                rel_unc_item = np.array(fnlo.GetAddUncertaintyVec(unc_style,lnorm,iprint))
+            else:
+                #unc_name = " # Without uncertainties";
+                #fnlo.PrintScaleUncertaintyVec('NN',unc_name)
+                rel_unc_item = np.array(fnlo.GetAddUncertaintyVec(fastnlo.kAddNone,lnorm,iprint))
+
+
+            exit(0)
+            rel_unc_list.append(rel_unc_item)
+            if verb:
+                print('[fnlo-py-print]: \n')
+                print('[fnlo-py-print]: Relative uncertainty in %s: \n' % n)
+                # 3 entries: central value (xs), unc_low, unc_high
+                print(rel_unc_item, '\n')
+                print(
+                    '---------------------------------------------------------------------------------------')
+                print(
+                    '---------------------------------------------------------------------------------------')
+
+        xs_all = np.array(xs_list)
+        rel_unc = np.array(rel_unc_list)
+        ##########
+        # structure of rel_unc:
+        # rel_unc[0,:,:] means LO, rel_unc[1,:,:] means NLO, and rel_unc[2,:,:] in NNLO
+        # rel_unc[0,0,:] means xs in LO
+        # rel_unc[0,1,:] means rel. uncertainty upwards (in LO)
+        # rel_unc[0,2,:] means rel. uncertainty downwards (in LO)
+        #########
+
+        if verb:
+            print('[fnlo-py-print]: Cross section xs_all uses ', order_list)
+
+        if verb:
+            print (xs_all, '\n \n')
+
+        # ABSOLUTE scale uncertainty
+        # length of axis 0 in xs_all equals number of orders
+        num_orders = np.size(xs_all, 0)
+        abs_scale_unc = np.empty([num_orders, 2, len(x_axis)])
+        for k in range(0, len(xs_all)):
+            abs_scale_unc[k, 0, :] = rel_unc[k, 2, :] * \
+                xs_all[k]  # absolute uncertainties downwards (low)
+            abs_scale_unc[k, 1, :] = rel_unc[k, 1, :] * \
+                xs_all[k]  # absolute uncertainties upwards (high)
+
+        if verb:
+            print(
+                '[fnlo-py-print]: Absolute Scale uncertainties downwards, upwards (order by order): \n')
+            print(abs_scale_unc, '\n')
+
+        ############################## Do the printing ####################################################
+
+        print(' ##################################################################################')
+        print(' # [fnlo-py-print]: Evaluating uncertainties')
+        print(' ##################################################################################')
+        print(' #=================================================================================')
+        print(' # {}'.format('BLUBBER'))
+        print(' #---------------------------------------------------------------------------------')
+        print(' # bin      cross_section           lower_uncertainty       upper_uncertainty')
+        print(' #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -')
+
+
+
+        stop_time = timeit.default_timer()
+        timediff = stop_time-start_time
+        print('fnlo-py-print: Elapsed time: %s sec = %s min' %
+              (timediff, round(timediff/60, 2)))
+
+
+if __name__ == '__main__':
+    main()
diff --git a/v2.5/toolkit/configure.ac b/v2.5/toolkit/configure.ac
index 5cc798a2..c84e754c 100644
--- a/v2.5/toolkit/configure.ac
+++ b/v2.5/toolkit/configure.ac
@@ -60,7 +60,7 @@ AC_C_INLINE
 # Require full C++11 functionality, which has been supported by gcc since version 4.8.1
 # If the following macro is not found, you might want to install the autoconf-archive
 # package and repeat the 'autoreconf -i' step.
-AX_CXX_COMPILE_STDCXX_11
+AX_CXX_COMPILE_STDCXX_17
 
 # Checks for library functions.
 AC_FUNC_ERROR_AT_LINE
diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc
index 126b6294..2ff3e905 100644
--- a/v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc
+++ b/v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc
@@ -22,6 +22,7 @@
 #include <iostream>
 #include "fastnlotk/fastNLOReader.h"
 #include "fastnlotk/fastNLOLHAPDF.h"
+#include "fastnlotk/fastNLOTools.h"
 
 using namespace std;
 
@@ -58,7 +59,7 @@ fastNLOLHAPDF::~fastNLOLHAPDF() {
 //______________________________________________________________________________
 
 
-fastNLOLHAPDF::fastNLOLHAPDF(string name, string LHAPDFFile, int PDFMember) : fastNLOReader(name), fnPDFs(0) , fiPDFMember(0) , fchksum(0.) {
+fastNLOLHAPDF::fastNLOLHAPDF(string name, string LHAPDFFile, int PDFMember, std::string verbosity) : fastNLOReader(name, verbosity), fnPDFs(0) , fiPDFMember(0) , fchksum(0.) {
    PDFSet = NULL;
    PDF = NULL;
    SetLHAPDFFilename(LHAPDFFile);
@@ -70,7 +71,7 @@ fastNLOLHAPDF::fastNLOLHAPDF(string name, string LHAPDFFile, int PDFMember) : fa
 //______________________________________________________________________________
 
 
-fastNLOLHAPDF::fastNLOLHAPDF(const fastNLOTable& table, string LHAPDFFile, int PDFMember) : fastNLOReader(table), fnPDFs(0) , fiPDFMember(0) , fchksum(0.) {
+fastNLOLHAPDF::fastNLOLHAPDF(const fastNLOTable& table, string LHAPDFFile, int PDFMember, std::string verbosity) : fastNLOReader(table, verbosity), fnPDFs(0) , fiPDFMember(0) , fchksum(0.) {
    PDFSet = NULL;
    PDF = NULL;
    SetLHAPDFFilename(LHAPDFFile);
@@ -345,13 +346,6 @@ vector<double>  fastNLOLHAPDF::CalcPDFUncertaintySymm(const vector<LHAPDF::PDFUn
 }
 
 
-//______________________________________________________________________________
-XsUncertainty fastNLOLHAPDF::GetPDFUncertainty(const fastNLO::EPDFUncertaintyStyle ePDFUnc) {
-   XsUncertainty XsUnc = GetPDFUncertainty(ePDFUnc, false);
-   return XsUnc;
-}
-
-
 //______________________________________________________________________________
 XsUncertainty fastNLOLHAPDF::GetPDFUncertainty(const fastNLO::EPDFUncertaintyStyle ePDFUnc, bool lNorm) {
    XsUncertainty XsUnc;
@@ -535,8 +529,16 @@ XsUncertainty fastNLOLHAPDF::GetPDFUncertainty(const fastNLO::EPDFUncertaintySty
 }
 
 
-std::vector< std::vector<double> > fastNLOLHAPDF::GetPDFUncertaintyVec(const fastNLO::EPDFUncertaintyStyle ePDFUnc) {
-   XsUncertainty xsUnc = GetPDFUncertainty(ePDFUnc);
+//______________________________________________________________________________
+std::vector< std::vector<double> > fastNLOLHAPDF::GetPDFUncertaintyVec(const fastNLO::EPDFUncertaintyStyle ePDFUnc, bool lNorm, int iprint) {
+   XsUncertainty xsUnc = GetPDFUncertainty(ePDFUnc, lNorm);
+   if (iprint > 0) {
+      string style{PDFUncertaintyStyle_to_string(ePDFUnc)};
+      string PDFFile = GetLHAPDFFilename();
+      cout << "PPPPPPPPPPPPPPPPPPPP " << PDFFile << endl;
+      string UncName = " # Relative PDF Uncertainties (" + style + " " + PDFFile + " " + "TODO" + ")";
+      fastNLOTools::PrintXSUncertainty(xsUnc, UncName);
+   }
    std::vector<std::vector<double> > xsUncVec;
    xsUncVec.resize(3);
    xsUncVec[0] = xsUnc.xs;
@@ -547,9 +549,9 @@ std::vector< std::vector<double> > fastNLOLHAPDF::GetPDFUncertaintyVec(const fas
 
 
 //______________________________________________________________________________
-XsUncertainty fastNLOLHAPDF::GetAsUncertainty(const fastNLO::EAsUncertaintyStyle eAsUnc) {
-   XsUncertainty XsUnc = GetAsUncertainty(eAsUnc, false);
-   return XsUnc;
+void fastNLOLHAPDF::PrintPDFUncertaintyVec(fastNLO::EPDFUncertaintyStyle ePDFUnc, std::string UncName, bool lNorm) {
+   XsUncertainty xsUnc = GetPDFUncertainty(ePDFUnc, lNorm);
+   fastNLOTools::PrintXSUncertainty(xsUnc, UncName);
 }
 
 
@@ -613,8 +615,16 @@ XsUncertainty fastNLOLHAPDF::GetAsUncertainty(const fastNLO::EAsUncertaintyStyle
    return XsUnc;
 }
 
-std::vector< std::vector<double> > fastNLOLHAPDF::GetAsUncertaintyVec(const fastNLO::EAsUncertaintyStyle eAsUnc) {
-   XsUncertainty xsUnc = fastNLOLHAPDF::GetAsUncertainty(eAsUnc);
+
+//______________________________________________________________________________
+
+std::vector< std::vector<double> > fastNLOLHAPDF::GetAsUncertaintyVec(const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm, int iprint) {
+   XsUncertainty xsUnc = fastNLOLHAPDF::GetAsUncertainty(eAsUnc, lNorm);
+   if (iprint > 0) {
+      string style{AsUncertaintyStyle_to_string(eAsUnc)};
+      string UncName = " # Relative a_s(M_Z) uncertainties (" + style + ")";
+      fastNLOTools::PrintXSUncertainty(xsUnc, UncName);
+   }
    std::vector<std::vector<double> > xsUncVec;
    xsUncVec.resize(3);
    xsUncVec[0] = xsUnc.xs;
@@ -622,3 +632,11 @@ std::vector< std::vector<double> > fastNLOLHAPDF::GetAsUncertaintyVec(const fast
    xsUncVec[2] = xsUnc.dxsl;
    return xsUncVec;
 }
+
+
+//______________________________________________________________________________
+
+void fastNLOLHAPDF::PrintAsUncertaintyVec(fastNLO::EAsUncertaintyStyle eAsUnc, std::string UncName, bool lNorm) {
+   XsUncertainty xsUnc = GetAsUncertainty(eAsUnc, lNorm);
+   fastNLOTools::PrintXSUncertainty(xsUnc, UncName);
+}
diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc
index b8f27330..e08f051c 100644
--- a/v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc
+++ b/v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc
@@ -455,16 +455,14 @@ fastNLOReader::fastNLOReader() : fastNLOTable() {
    fUseHoppet            = false;
 }
 
-
 //______________________________________________________________________________
 
-fastNLOReader::fastNLOReader(string filename) : fastNLOTable(filename) {
-   //SetGlobalVerbosity(DEBUG); // Temporary for debugging
+fastNLOReader::fastNLOReader(string filename, string verbosity) : fastNLOTable(filename, verbosity) {
+   cout << "AAAAAAAAAAAAAAAAAAA   " << GetGlobalVerbosity() << endl;
+   say::SetGlobalVerbosity(say::toVerbosity()[verbosity]);
+   cout << "BBBBBBBBBBBBBBBBBBB   " << GetGlobalVerbosity() << endl;
    logger.SetClassName("fastNLOReader");
    logger.debug["fastNLOReader"]<<"New fastNLOReader reading filename="<<filename<<endl;
-   //fCoeffData           = NULL;
-   //    Coeff_LO_Ref         = NULL;
-   //    Coeff_NLO_Ref        = NULL;
    fUnits               = fastNLO::kPublicationUnits;
    fMuRFunc             = fastNLO::kScale1;
    fMuFFunc             = fastNLO::kScale1;
@@ -477,12 +475,9 @@ fastNLOReader::fastNLOReader(string filename) : fastNLOTable(filename) {
 
 //______________________________________________________________________________
 
-fastNLOReader::fastNLOReader(const fastNLOTable& table) : fastNLOTable(table) {
-   //SetGlobalVerbosity(DEBUG); // Temporary for debugging
+fastNLOReader::fastNLOReader(const fastNLOTable& table, string verbosity) : fastNLOTable(table, verbosity) {
+   say::SetGlobalVerbosity(say::toVerbosity()[verbosity]);
    logger.SetClassName("fastNLOReader");
-   //fCoeffData           = NULL;
-   //    Coeff_LO_Ref         = NULL;
-   //    Coeff_NLO_Ref        = NULL;
    fUnits               = fastNLO::kPublicationUnits;
    fMuRFunc             = fastNLO::kScale1;
    fMuFFunc             = fastNLO::kScale1;
@@ -492,14 +487,13 @@ fastNLOReader::fastNLOReader(const fastNLOTable& table) : fastNLOTable(table) {
    fUseHoppet            = false;
    SetFilename("null");
 }
+
 //______________________________________________________________________________
 fastNLOReader::~fastNLOReader(void) {
 }
 
-
-
 //______________________________________________________________________________
-fastNLOReader::fastNLOReader(const fastNLOReader& other) :
+fastNLOReader::fastNLOReader(const fastNLOReader& other, string verbosity) :
    fastNLOTable(other),
    ffilename(other.ffilename), fScalevar(other.fScalevar), fScaleFacMuR(other.fScaleFacMuR),
    fUnits(other.fUnits), fPDFSuccess(other.fPDFSuccess), fPDFCached(other.fPDFCached),
@@ -509,6 +503,7 @@ fastNLOReader::fastNLOReader(const fastNLOReader& other) :
    XSectionRef_s1(other.XSectionRef_s1), XSectionRef_s2(other.XSectionRef_s2)
 {
    //! Copy constructor
+   say::SetGlobalVerbosity(say::toVerbosity()[verbosity]);
    OrderCoefficients(); // initialize pointers to fCoeff's
 }
 
@@ -3405,9 +3400,13 @@ double fastNLOReader::RescaleCrossSectionUnits(double binsize, int xunits) {
 
 //______________________________________________________________________________
 XsUncertainty fastNLOReader::GetScaleUncertainty(const EScaleUncertaintyStyle eScaleUnc, bool lNorm, double sclfac) {
-   // Get 2- or 6-point scale uncertainty around sclfac * central scale
+   // Get 2-, 6- or, 31-point scale uncertainty around sclfac * central scale (31 only for normalised x sections/ratios)
    const double xmur0[7] = {1.0, 0.5, 2.0, 0.5, 1.0, 1.0, 2.0};
    const double xmuf0[7] = {1.0, 0.5, 2.0, 1.0, 0.5, 2.0, 1.0};
+   // const double xmur0[7] = {1.0, 0.5, 2.0, 0.5, 1.0, 1.0, 2.0, 0.5, 2.0, 0.5, 1.0, 1.0, 2.0};
+   // const double xmuf0[7] = {1.0, 0.5, 2.0, 1.0, 0.5, 2.0, 1.0, 0.5, 2.0, 1.0, 0.5, 2.0, 1.0};
+   // const double xmurn[7] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5, 2.0, 0.5, 1.0, 1.0, 2.0};
+   // const double xmufn[7] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5, 2.0, 1.0, 0.5, 2.0, 1.0};
    if ( sclfac < 0.1 || sclfac > 10. ) {
       logger.error["GetScaleUncertainty"]<<"ERROR! Illegal value for sclfac, exiting. sclfac = "<< sclfac <<endl;
       exit(1);
@@ -3477,8 +3476,16 @@ XsUncertainty fastNLOReader::GetScaleUncertainty(const EScaleUncertaintyStyle eS
    return XsUnc;
 }
 
-std::vector< std::vector<double> > fastNLOReader::GetScaleUncertaintyVec(const EScaleUncertaintyStyle eScaleUnc) {
-   XsUncertainty xsUnc = fastNLOReader::GetScaleUncertainty(eScaleUnc);
+
+//______________________________________________________________________________
+
+std::vector< std::vector<double> > fastNLOReader::GetScaleUncertaintyVec(const EScaleUncertaintyStyle eScaleUnc, bool lNorm, int iprint, double sclfac) {
+   XsUncertainty xsUnc = fastNLOReader::GetScaleUncertainty(eScaleUnc, lNorm, sclfac);
+   if (iprint > 0) {
+      string style{ScaleUncertaintyStyle_to_string(eScaleUnc)};
+      string UncName = " # Relative scale uncertainties (" + style + ")";
+      fastNLOTools::PrintXSUncertainty(xsUnc, UncName);
+   }
    std::vector<std::vector<double> > xsUncVec;
    xsUncVec.resize(3);
    xsUncVec[0] = xsUnc.xs;
@@ -3488,6 +3495,14 @@ std::vector< std::vector<double> > fastNLOReader::GetScaleUncertaintyVec(const E
 }
 
 
+//______________________________________________________________________________
+
+void fastNLOReader::PrintScaleUncertaintyVec(fastNLO::EScaleUncertaintyStyle eScaleUnc, std::string UncName, bool lNorm, double sclfac) {
+   XsUncertainty xsUnc = GetScaleUncertainty(eScaleUnc, lNorm, sclfac);
+   fastNLOTools::PrintXSUncertainty(xsUnc, UncName);
+}
+
+
 // Added to include CoeffInfoBlocks
 //
 //______________________________________________________________________________
@@ -3539,8 +3554,15 @@ XsUncertainty fastNLOReader::GetAddUncertainty(const EAddUncertaintyStyle eAddUn
    return XsUnc;
 }
 
-std::vector< std::vector<double> > fastNLOReader::GetAddUncertaintyVec(const EAddUncertaintyStyle eAddUnc) {
-   XsUncertainty xsUnc = fastNLOReader::GetAddUncertainty(eAddUnc);
+
+//______________________________________________________________________________
+std::vector< std::vector<double> > fastNLOReader::GetAddUncertaintyVec(const EAddUncertaintyStyle eAddUnc, bool lNorm, int iprint) {
+   XsUncertainty xsUnc = fastNLOReader::GetAddUncertainty(eAddUnc, lNorm);
+   if (iprint > 0) {
+      string style{AddUncertaintyStyle_to_string(eAddUnc)};
+      string UncName = " # Relative statistical uncertainties (" + style + ")";
+      fastNLOTools::PrintXSUncertainty(xsUnc, UncName);
+   }
    std::vector<std::vector<double> > xsUncVec;
    xsUncVec.resize(3);
    xsUncVec[0] = xsUnc.xs;
@@ -3548,3 +3570,11 @@ std::vector< std::vector<double> > fastNLOReader::GetAddUncertaintyVec(const EAd
    xsUncVec[2] = xsUnc.dxsl;
    return xsUncVec;
 }
+
+
+//______________________________________________________________________________
+
+void fastNLOReader::PrintAddUncertaintyVec(fastNLO::EAddUncertaintyStyle eAddUnc, std::string UncName, bool lNorm) {
+   XsUncertainty xsUnc = GetAddUncertainty(eAddUnc, lNorm);
+   fastNLOTools::PrintXSUncertainty(xsUnc, UncName);
+}
diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOTable.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOTable.cc
index 5339a173..03e5ec92 100644
--- a/v2.5/toolkit/fastnlotoolkit/fastNLOTable.cc
+++ b/v2.5/toolkit/fastnlotoolkit/fastNLOTable.cc
@@ -12,6 +12,7 @@
 #include <set>
 #include "fastnlotk/fastNLOTable.h"
 #include "fastnlotk/fastNLOTools.h"
+#include "fastnlotk/read_steer.h"
 // zlib wrapper library
 #ifdef HAVE_LIBZ
 #include "fastnlotk/zstr.hpp"
@@ -35,8 +36,10 @@ fastNLOTable::fastNLOTable()
 
 
 // ___________________________________________________________________________________________________
-fastNLOTable::fastNLOTable(string name)  : ffilename(name), fPrecision(8), logger("fastNLOTable")  {
+fastNLOTable::fastNLOTable(string name, string verbosity)  : ffilename(name), fPrecision(8), logger("fastNLOTable")  {
    //logger.SetClassName("fastNLOTable");
+   say::SetGlobalVerbosity(say::toVerbosity()[verbosity]);
+   cout << "DDDDDDDDDDDDDDDDDDDDDDDD   " << say::GetGlobalVerbosity() << endl;
    if (!fWelcomeOnce) PrintWelcomeMessage();
    ReadTable();
 }
@@ -49,7 +52,7 @@ fastNLOTable::~fastNLOTable(){
 }
 
 // ___________________________________________________________________________________________________
-fastNLOTable::fastNLOTable(const fastNLOTable& other)
+fastNLOTable::fastNLOTable(const fastNLOTable& other, string verbosity)
    : ffilename(other.ffilename), fPrecision(other.fPrecision),
      ITabVersionRead(other.ITabVersionRead),
      ITabVersionWrite(other.ITabVersionRead),
@@ -64,6 +67,7 @@ fastNLOTable::fastNLOTable(const fastNLOTable& other)
      IDivUpPointer(other.IDivUpPointer)
 {
    //! Copy constructor
+   say::SetGlobalVerbosity(say::toVerbosity()[verbosity]);
    logger.SetClassName("fastNLOTable");
    for (size_t i = 0; i < other.fCoeff.size(); ++i) {
       fCoeff[i] = other.fCoeff[i]->Clone();
@@ -2577,7 +2581,7 @@ void fastNLOTable::PrintHeader(int iprint) const {
 
 //______________________________________________________________________________
 void fastNLOTable::PrintWelcomeMessage() {
-
+   //   say::SetGlobalVerbosity(say::toVerbosity()["WARNING"]);
    char fnlo[100];
    sprintf(fnlo,"%c[%d;%dmfast%c[%d;%dmNLO\033[0m",27,0,31,27,0,34);
    char subproject[100]      = FNLO_SUBPROJECT;
@@ -2591,43 +2595,43 @@ void fastNLOTable::PrintWelcomeMessage() {
    char quotev2[200]         = FNLO_QUOTEv2;
    char years[100]           = FNLO_YEARS;
 
-   cout  << endl;
-   cout  << fastNLO::_CSEPSC << endl;
-   speaker &shout = logger.shout;
-   cout << " #" << endl;
-   shout << fnlo << "_" << subproject << endl;
-   shout << "Version " << package_version << "_" << gitrev << endl;
-   cout << " #" << endl;
-   shout << "C++ program and toolkit to read and create fastNLO v2 tables and" << endl;
-   shout << "derive QCD cross sections using PDFs, e.g. from LHAPDF" << endl;
-   cout << " #" << endl;
-   cout  << fastNLO::_SSEPSC << endl;
-   cout << " #" << endl;
-   shout << "Copyright © " << years << " " << fnlo << " Collaboration" << endl;
-   shout << authors << endl;
-   cout << " #" << endl;
-   shout << "This program is free software: you can redistribute it and/or modify" << endl;
-   shout << "it under the terms of the GNU General Public License as published by" << endl;
-   shout << "the Free Software Foundation, either version 3 of the License, or" << endl;
-   shout << "(at your option) any later version." << endl;
-   cout << " #" << endl;
-   shout << "This program is distributed in the hope that it will be useful," << endl;
-   shout << "but WITHOUT ANY WARRANTY; without even the implied warranty of" << endl;
-   shout << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << endl;
-   shout << "GNU General Public License for more details." << endl;
-   cout << " #" << endl;
-   shout << "You should have received a copy of the GNU General Public License" << endl;
-   shout << "along with this program. If not, see <http://www.gnu.org/licenses/>." << endl;
-   cout << " #" << endl;
-   cout  << fastNLO::_SSEPSC << endl;
-   cout << " #" << endl;
-   shout << "The projects web page can be found at:" << endl;
-   shout << "  " << webpage << endl;
-   cout << " #" << endl;
-   shout << "If you use this code, please cite:" << endl;
-   shout << "  " << authorsv14 << ", " << quotev14 << endl;
-   shout << "  " << authorsv2 << ", " << quotev2 << endl;
-   cout << " #" << endl;
-   cout  << fastNLO::_CSEPSC << endl;
+   speaker &infosep = logger.infosep;
+   infosep << "" << endl;
+   infosep << fastNLO::_CSEPSC << endl;
+   infosep << " #" << endl;
+   infosep << " # " << fnlo << "_" << subproject << endl;
+   infosep << " # Version " << package_version << "_" << gitrev << endl;
+   infosep << " #" << endl;
+   infosep << " # " << "C++ program and toolkit to read and create fastNLO v2 tables and" << endl;
+   infosep << " # " << "derive QCD cross sections using PDFs, e.g. from LHAPDF" << endl;
+   infosep << " #" << endl;
+   infosep << fastNLO::_SSEPSC << endl;
+   infosep << " #" << endl;
+   infosep << " # " << "Copyright © " << years << " " << fnlo << " Collaboration" << endl;
+   infosep << " # " << authors << endl;
+   infosep << " #" << endl;
+   infosep << " # " << "This program is free software: you can redistribute it and/or modify" << endl;
+   infosep << " # " << "it under the terms of the GNU General Public License as published by" << endl;
+   infosep << " # " << "the Free Software Foundation, either version 3 of the License, or" << endl;
+   infosep << " # " << "(at your option) any later version." << endl;
+   infosep << " #" << endl;
+   infosep << " # " << "This program is distributed in the hope that it will be useful," << endl;
+   infosep << " # " << "but WITHOUT ANY WARRANTY; without even the implied warranty of" << endl;
+   infosep << " # " << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << endl;
+   infosep << " # " << "GNU General Public License for more details." << endl;
+   infosep << " #" << endl;
+   infosep << " # " << "You should have received a copy of the GNU General Public License" << endl;
+   infosep << " # " << "along with this program. If not, see <http://www.gnu.org/licenses/>." << endl;
+   infosep << " #" << endl;
+   infosep << fastNLO::_SSEPSC << endl;
+   infosep << " #" << endl;
+   infosep << " # " << "The projects web page can be found at:" << endl;
+   infosep << " #   " << webpage << endl;
+   infosep << " #" << endl;
+   infosep << " # " << "If you use this code, please cite:" << endl;
+   infosep << " #   " << authorsv14 << ", " << quotev14 << endl;
+   infosep << " #   " << authorsv2 << ", " << quotev2 << endl;
+   infosep << " #" << endl;
+   infosep << fastNLO::_CSEPSC << endl;
    fWelcomeOnce = true;
 }
diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOTools.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOTools.cc
index 287717f8..37560241 100644
--- a/v2.5/toolkit/fastnlotoolkit/fastNLOTools.cc
+++ b/v2.5/toolkit/fastnlotoolkit/fastNLOTools.cc
@@ -5,6 +5,7 @@
 #include <cmath>
 #include <sstream>
 #include <string>
+#include "fastnlotk/fastNLOReader.h"
 #include "fastnlotk/fastNLOTools.h"
 
 using namespace std;
@@ -616,4 +617,42 @@ namespace fastNLOTools {
    template void ExtendSigmaTildeX<fastNLO::v3d>(
       fastNLO::v4d&, unsigned int, unsigned int, unsigned int, unsigned int, int, fastNLO::v3d);
 
+
+   //______________________________________________________________________________
+   void PrintXSUncertainty(XsUncertainty XsUnc, string UncName) {
+      //
+      //  Print evaluated cross section and relative uncertainty stored in
+      //  struct XsUncertainty of fastNLOReader.h
+      //
+
+      if ( XsUnc.xs.size() ) {
+         cout << _CSEPSC << endl;
+         cout << " # fastNLOReader: Evaluating uncertainties" << endl;
+         cout << _CSEPSC << endl;
+         cout << _DSEPSC << endl;
+         cout << UncName << endl;
+         cout << _SSEPSC << endl;
+         cout << " # bin      cross_section           lower_uncertainty       upper_uncertainty" << endl;
+         cout << _TSEPSC << endl;
+         for ( unsigned int iobs=0;iobs<XsUnc.xs.size();iobs++ ) {
+            printf("%5.i      %#18.11E      %#18.11E      %#18.11E\n",iobs+1,XsUnc.xs[iobs],XsUnc.dxsl[iobs],XsUnc.dxsu[iobs]);
+         }
+         cout << _TSEPSC << endl;
+      }
+   }
+
+
+   //______________________________________________________________________________
+   void PrintXSUncertaintyVec(std::vector< std::vector<double> > xsUncVec, string UncName) {
+      //
+      //  Print evaluated cross section and relative uncertainty stored in
+      //  Tri-vector XsUncertaintyVec of fastNLOReader.h
+      //
+      XsUncertainty xsUnc;
+      xsUnc.xs   = xsUncVec[0];
+      xsUnc.dxsu = xsUncVec[1];
+      xsUnc.dxsl = xsUncVec[2];
+      PrintXSUncertainty(xsUnc, UncName);
+   }
+
 } // end namespace fastNLO
diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOConstants.h.in b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOConstants.h.in
index 7da38a19..ba7623cb 100644
--- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOConstants.h.in
+++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOConstants.h.in
@@ -4,6 +4,7 @@
 // NEVER EVER include a project's internal config.h in installable header files!
 // Use for conditional compilation only in .cc source code files.
 // Otherwise conflicts with other linked projects are to be expected.
+#include <optional>
 #include <set>
 #include <string>
 #include <unordered_map>
@@ -104,6 +105,14 @@ namespace fastNLO {
       kPublicationUnits         = 1     // calculate the cross section in units as given in the according publication
    };
 
+   enum EUncertaintyType { // TODO: KR to be further developed
+      kNoUncertainty            = 0,    // no uncertainty, only central cross section evaluated
+      kScaleUncertainty         = 1,    // scale uncertainty (as proxy for missing higher orders)
+      kPDFUncertainty           = 2,    // PDF uncertainty
+      kNumUncertainty           = 3,    // Statistical numerical uncertainty of integration
+      kNPUncertainty            = 4     // Nonperturbative uncertainty
+   };
+
    enum EScaleUncertaintyStyle {
       kScaleNone                = 0,    // no scale uncertainty, only central scale (mu_r,mu_f) = (1,1) evaluated
       kSymmetricTwoPoint        = 1,    // symmetric (mu_r,mu_f) scale variations by factors (1/2,1/2), (2,2)
@@ -111,11 +120,41 @@ namespace fastNLO {
                                         // (1/2,1), (1,1/2), (1,2), (2,1)
    };
 
+   constexpr std::string_view ScaleUncertaintyStyle_to_string(EScaleUncertaintyStyle estyle) {
+      switch (estyle) {
+         case kScaleNone:          return "NN";
+         case kSymmetricTwoPoint:  return "2P";
+         case kAsymmetricSixPoint: return "6P";
+         default:                  return "??";
+      }
+   }
+
+   constexpr std::optional<EScaleUncertaintyStyle> ScaleUncertaintyStyle_to_enum(std::string_view sstyle) {
+      if (sstyle == "NN") return kScaleNone;
+      if (sstyle == "2P") return kSymmetricTwoPoint;
+      if (sstyle == "6P") return kAsymmetricSixPoint;
+      return{kScaleNone};
+   }
+
    enum EAddUncertaintyStyle {
       kAddNone                  = 0,    // no additional uncertainty
       kAddStat                  = 1     // statistical/numerical uncertainty
    };
 
+   constexpr std::string_view AddUncertaintyStyle_to_string(EAddUncertaintyStyle estyle) {
+      switch (estyle) {
+         case kAddNone:            return "NN";
+         case kAddStat:            return "ST";
+         default:                  return "??";
+      }
+   }
+
+   constexpr std::optional<EAddUncertaintyStyle> AddUncertaintyStyle_to_enum(std::string_view sstyle) {
+      if (sstyle == "NN") return kAddNone;
+      if (sstyle == "ST") return kAddStat;
+      return{kAddNone};
+   }
+
    enum EPDFUncertaintyStyle {
       kPDFNone                  = 0,    // No PDF uncertainty, only averaged cross section result evaluated (Correct for NNPDF, wrong otherwise!)
       kLHAPDF6                  = 1,    // LHAPDF6 uncertainties (recommended if LHAPDF6 is available)
@@ -127,11 +166,51 @@ namespace fastNLO {
       kHeraPDF10                = 7     // HERAPDF 1.0 uncertainties
    };
 
+   constexpr std::string_view PDFUncertaintyStyle_to_string(EPDFUncertaintyStyle estyle) {
+      switch (estyle) {
+         case kPDFNone:              return "NN";
+         case kLHAPDF6:              return "L6";
+         case kHessianSymmetric:     return "HS";
+         case kHessianAsymmetric:    return "HA";
+         case kHessianAsymmetricMax: return "HP";
+         case kHessianCTEQCL68:      return "HC";
+         case kMCSampling:           return "MC";
+         case kHeraPDF10:            return "H1"; // not yet implemented
+         default:                    return "??";
+      }
+   }
+
+   constexpr std::optional<EPDFUncertaintyStyle> PDFUncertaintyStyle_to_enum(std::string_view sstyle) {
+      if (sstyle == "NN") return kPDFNone;
+      if (sstyle == "L6") return kLHAPDF6;
+      if (sstyle == "HS") return kHessianSymmetric;
+      if (sstyle == "HA") return kHessianAsymmetric;
+      if (sstyle == "HP") return kHessianAsymmetricMax;
+      if (sstyle == "HC") return kHessianCTEQCL68;
+      if (sstyle == "MC") return kMCSampling;
+      if (sstyle == "H1") return kHeraPDF10;
+      return{kPDFNone};
+   }
+
    enum EAsUncertaintyStyle {
       kAsNone                   = 0,    // no a_s uncertainty
       kAsGRV                    = 1,    // a_s(M_Z) uncertainty with GRV evolution
    };
 
+   constexpr std::string_view AsUncertaintyStyle_to_string(EAsUncertaintyStyle estyle) {
+      switch (estyle) {
+         case kAsNone:             return "NN";
+         case kAsGRV:              return "AS";
+         default:                  return "??";
+      }
+   }
+
+   constexpr std::optional<EAsUncertaintyStyle> AsUncertaintyStyle_to_enum(std::string_view sstyle) {
+      if (sstyle == "NN") return kAsNone;
+      if (sstyle == "AS") return kAsGRV;
+      return{kAsNone};
+   }
+
    enum EMerge {  //!< mergeing options.
       kMerge, //!< Calculate weighted average (default. Nevt usually set externally by generator code).
       kAdd, //!< Add (Append)! Do not merge, but add two tables together (fully unweighted) (1+1=2).
diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOLHAPDF.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOLHAPDF.h
index cba4a9a3..9f9a33b8 100644
--- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOLHAPDF.h
+++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOLHAPDF.h
@@ -32,8 +32,8 @@ public:
    fastNLOLHAPDF(std::string name);
    fastNLOLHAPDF(const fastNLOTable&);
    ~fastNLOLHAPDF();
-   fastNLOLHAPDF(std::string name, std::string LHAPDFfile, int PDFSet = 0);
-   fastNLOLHAPDF(const fastNLOTable&, std::string LHAPDFfile, int PDFSet = 0);
+   fastNLOLHAPDF(std::string name, std::string LHAPDFfile, int PDFSet = 0, std::string verbosity = "INFO");
+   fastNLOLHAPDF(const fastNLOTable&, std::string LHAPDFfile, int PDFSet = 0, std::string verbosity = "INFO");
 
    // Initializer. Necessary for some alternative evolutions.
    virtual void InitEvolveAlphas();
@@ -60,19 +60,15 @@ public:
 
    double GetAlphasMz() const;
 
-   //! Return struct with vectors containing the cross section values and the selected a_s(M_Z) uncertainty
-   XsUncertainty GetAsUncertainty( const fastNLO::EAsUncertaintyStyle eAsUnc );
-   XsUncertainty GetAsUncertainty( const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm );
-   //! Function for use with pyext (TODO: Clean this up)
-   std::vector< std::vector<double> > GetAsUncertaintyVec( const fastNLO::EAsUncertaintyStyle eAsUnc );
+   //! Return struct with vectors/vectors containing the cross section values and the selected uncertainty
+   XsUncertainty GetAsUncertainty( const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm = false);
+   std::vector< std::vector<double> > GetAsUncertaintyVec( const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm = false, int iprint = 0);
+   void PrintAsUncertaintyVec(fastNLO::EAsUncertaintyStyle, std::string UncName, bool lNorm = false);
+   //
+   XsUncertainty GetPDFUncertainty( const fastNLO::EPDFUncertaintyStyle ePDFUnc, bool lNorm = false);
+   std::vector<std::vector<double> > GetPDFUncertaintyVec(fastNLO::EPDFUncertaintyStyle, bool lNorm = false, int iprint = 0);
+   void PrintPDFUncertaintyVec(fastNLO::EPDFUncertaintyStyle, std::string UncName, bool lNorm = false);
 
-   //! Return struct with vectors containing the cross section values and the selected scale uncertainty
-   XsUncertainty GetPDFUncertainty( const fastNLO::EPDFUncertaintyStyle ePDFUnc );
-   XsUncertainty GetPDFUncertainty( const fastNLO::EPDFUncertaintyStyle ePDFUnc, bool lNorm );
-   std::vector<std::vector<double> > GetPDFUncertaintyVec(fastNLO::EPDFUncertaintyStyle);
-
-   // Deprecated: Replaced by struct as return object: Return vector of pairs with all cross section values first and pairs of PDF uncertainties second
-   //   vector < pair < double, pair <double, double> > > GetPDFUncertainty(const EPDFUncertaintyStyle ePDFUnc);
    std::vector<LHAPDF::PDFUncertainty>  GetPDFUncertaintyLHAPDF(double cl=100*erf(1/sqrt(2)), bool alternative=false); //!< return PDF uncertainty, formulae taken from LHAPDF6
    std::vector<double> CalcPDFUncertaintyMinus(const std::vector<LHAPDF::PDFUncertainty>& ) const; //!<get vector<double> for PDF-minus uncertainty. Uncertainties are POSITIVE!
    std::vector<double> CalcPDFUncertaintyPlus(const std::vector<LHAPDF::PDFUncertainty>& ) const; //!<get vector<double> for PDF-up uncertainty
diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOReader.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOReader.h
index 852c9f8d..3f57d4a3 100644
--- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOReader.h
+++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOReader.h
@@ -24,9 +24,9 @@ class fastNLOReader : public fastNLOTable , public fastNLOPDFLinearCombinations
 public:
    typedef double(*mu_func)(double,double);
 
-   fastNLOReader(std::string filename);
-   fastNLOReader(const fastNLOTable&);
-   fastNLOReader(const fastNLOReader&);
+   fastNLOReader(std::string filename, std::string verbosity = "INFO");
+   fastNLOReader(const fastNLOTable&, std::string verbosity = "INFO");
+   fastNLOReader(const fastNLOReader&, std::string verbosity = "INFO");
    virtual ~fastNLOReader();
    void SetFilename(std::string filename) ;
    void InitScalevariation();
@@ -94,13 +94,14 @@ public:
    std::vector < double > GetQScales();   //!< Order (power of alpha_s) rel. to LO: 0 --> LO, 1 --> NLO
    std::vector < std::vector < double > > GetCrossSection2Dim();
 
-
-   //! Return struct with vectors containing the cross section values and the selected uncertainty
-   XsUncertainty GetScaleUncertainty( const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, double sclfac = 1.);
+   //! Return struct with vectors/vectors containing the cross section values and the selected uncertainty
    XsUncertainty GetAddUncertainty( const fastNLO::EAddUncertaintyStyle eAddUnc, bool lNorm = false);
-   //! Function for use with pyext (TODO: Clean this up)
-   std::vector< std::vector<double> > GetScaleUncertaintyVec( const fastNLO::EScaleUncertaintyStyle eScaleUnc );
-   std::vector< std::vector<double> > GetAddUncertaintyVec( const fastNLO::EAddUncertaintyStyle eAddUnc );
+   std::vector< std::vector<double> > GetAddUncertaintyVec( const fastNLO::EAddUncertaintyStyle eAddUnc, bool lNorm = false, int iprint = 0);
+   void PrintAddUncertaintyVec(fastNLO::EAddUncertaintyStyle, std::string UncName, bool lNorm = false);
+   //
+   XsUncertainty GetScaleUncertainty( const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, double sclfac = 1.);
+   std::vector< std::vector<double> > GetScaleUncertaintyVec( const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, int iprint = 0, double sclfac = 1.);
+   void PrintScaleUncertaintyVec(fastNLO::EScaleUncertaintyStyle, std::string UncName, bool lNorm = false, double sclfac =1.);
 
    // ---- Getters for fastNLOReader member variables ---- //
    fastNLO::EScaleFunctionalForm GetMuRFunctionalForm() const { return fMuRFunc; };
diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTable.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTable.h
index 42c9049a..590fff5c 100644
--- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTable.h
+++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTable.h
@@ -21,9 +21,9 @@ class fastNLOTable {
 
  public:
    fastNLOTable();
-   fastNLOTable(std::string filename);
+   fastNLOTable(std::string filename, std::string verbosity = "INFO");
    virtual ~fastNLOTable();
-   fastNLOTable(const fastNLOTable&);
+   fastNLOTable(const fastNLOTable&, std::string verbosity = "INFO");
 
    virtual void ReadTable();
    virtual void WriteTable();
diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTools.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTools.h
index caa8341a..30717407 100644
--- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTools.h
+++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTools.h
@@ -3,7 +3,7 @@
 
 #include <string>
 #include <vector>
-#include "fastnlotk/fastNLOConstants.h"
+#include "fastNLOReader.h"
 #include "speaker.h"
 
 namespace fastNLOTools {
@@ -73,6 +73,10 @@ namespace fastNLOTools {
    //! - Printout of std::vectors
    template<typename T> void PrintVector( const std::vector<T>& v, std::string name, std::string prefix="");
 
+   //! - Printout of x section with uncertainty
+   void PrintXSUncertainty(XsUncertainty XsUnc, std::string UncName);
+   void PrintXSUncertaintyVec(std::vector< std::vector<double> > XsUncVec, std::string UncName);
+
    //! - useful i/o
    void PrintFastnloVersion(); //!< Print out fastNLO version
    bool CheckVersion(int version); //!< check version and exit if failed.
diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/speaker.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/speaker.h
index 7fdea3a7..48f57068 100644
--- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/speaker.h
+++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/speaker.h
@@ -77,6 +77,8 @@ public:
       fvol=volume;
    };
    static int SetGlobalVerbosity(say::Verbosity volume);
+   say::Verbosity GetGlobalVerbosity();
+   static say::Verbosity fverb;
    static void ErrorToErrStream(bool ToCerr) {
       fe2cerr=ToCerr;
    };
@@ -90,7 +92,6 @@ protected:
    unsigned long fii;
    static unsigned long ct;
    static bool fe2cerr;
-   static say::Verbosity fverb;
    static std::map<unsigned long,speaker*>* list;
    std::string cn;
 };
@@ -101,9 +102,15 @@ namespace say {
    extern speaker info;
    extern speaker warn;
    extern speaker error;
+   extern speaker debugsep;
+   extern speaker mansep;
+   extern speaker infosep;
+   extern speaker warnsep;
+   extern speaker errorsep;
    extern speaker shout; // same as error but streamed to cout
    extern speaker yell;  // same as error but streamed to cout without prefix
    extern int SetGlobalVerbosity(Verbosity verbosity);
+   extern Verbosity GetGlobalVerbosity(void);
 }
 
 
@@ -117,6 +124,11 @@ public:
    speaker info;
    speaker warn;
    speaker error;
+   speaker debugsep;
+   speaker mansep;
+   speaker infosep;
+   speaker warnsep;
+   speaker errorsep;
    speaker shout;
    speaker yell;
 private:
diff --git a/v2.5/toolkit/fastnlotoolkit/speaker.cc b/v2.5/toolkit/fastnlotoolkit/speaker.cc
index afb9e6c5..d82977ed 100644
--- a/v2.5/toolkit/fastnlotoolkit/speaker.cc
+++ b/v2.5/toolkit/fastnlotoolkit/speaker.cc
@@ -15,7 +15,6 @@ std::ostream* speaker::weg = NULL;
 // SetGlobalVerbosity(say::Verbosity volume)
 // can be called from within the program.
 say::Verbosity speaker::fverb = say::INFO;
-//say::Verbosity speaker::fverb = say::DEBUG;
 unsigned long speaker::ct = 0;
 bool speaker::fe2cerr = true;
 
@@ -100,7 +99,6 @@ const speaker& speaker::prefix(const std::string& fct) const {
    return *this;
 }
 
-
 int speaker::SetGlobalVerbosity(say::Verbosity volume) {
    fverb=volume;
    int c=0;
@@ -111,18 +109,24 @@ int speaker::SetGlobalVerbosity(say::Verbosity volume) {
    return c;
 }
 
-PrimalScream::PrimalScream(std::string classname) { //,std::string prefix=""){
+say::Verbosity speaker::GetGlobalVerbosity() {
+   return fverb;
+}
+
+PrimalScream::PrimalScream(std::string classname) {
    debug = speaker(" # DEBUG.   ",say::DEBUG);
    man   = speaker(" # USAGE.   ",say::MANUAL);
    info  = speaker(" # INFO.    ",say::INFO);
    warn  = speaker(" # WARNING! ",say::WARNING);
    error = speaker(" # ERROR!   ",say::ERROR,true);
+   debugsep = speaker("",say::DEBUG);
+   mansep   = speaker("",say::MANUAL);
+   infosep  = speaker("",say::INFO);
+   warnsep  = speaker("",say::WARNING);
+   errorsep = speaker("",say::ERROR,true);
    shout = speaker(" # ",say::ERROR,false);
-   shout.SetClassName(___cn);
    yell = speaker("",say::ERROR,false);
-   yell.SetClassName(___cn);
    SetClassName(classname);
-   //debug["PrimalScream"]<<"Primal Scream initialized."<<std::endl;
 }
 
 void PrimalScream::SetClassName(const std::string classname){
@@ -132,6 +136,11 @@ void PrimalScream::SetClassName(const std::string classname){
    info.SetClassName(___cn);
    warn.SetClassName(___cn);
    error.SetClassName(___cn);
+   debugsep.SetClassName(___cn);
+   mansep.SetClassName(___cn);
+   infosep.SetClassName(___cn);
+   warnsep.SetClassName(___cn);
+   errorsep.SetClassName(___cn);
    shout.SetClassName(___cn);
    yell.SetClassName(___cn);
 }
@@ -142,6 +151,11 @@ void PrimalScream::SetVerbosity(say::Verbosity volume) {
    info.DoSpeak(info.GetVolume() >= volume);
    warn.DoSpeak(warn.GetVolume() >= volume);
    error.DoSpeak(error.GetVolume() >= volume);
+   debugsep.DoSpeak(debug.GetVolume() >= volume);
+   mansep.DoSpeak(man.GetVolume() >= volume);
+   infosep.DoSpeak(info.GetVolume() >= volume);
+   warnsep.DoSpeak(warn.GetVolume() >= volume);
+   errorsep.DoSpeak(error.GetVolume() >= volume);
    shout.DoSpeak(shout.GetVolume() >= volume);
    yell.DoSpeak(yell.GetVolume() >= volume);
 }
@@ -152,10 +166,17 @@ namespace say {
    speaker info (" # INFO.    ",say::INFO);
    speaker warn (" # WARNING! ",say::WARNING);
    speaker error(" # ERROR!   ",say::ERROR,true);
+   speaker debugsep("",say::DEBUG);
+   speaker mansep  ("",say::MANUAL);
+   speaker infosep ("",say::INFO);
+   speaker warnsep ("",say::WARNING);
+   speaker errorsep("",say::ERROR,true);
    speaker shout(" # ",say::ERROR,false);
    speaker yell("",say::ERROR,false);
-   //debug["namespace say"]<<"speakers initialized."<<std::endl;
    int SetGlobalVerbosity(Verbosity verbosity) {
       return speaker::SetGlobalVerbosity(verbosity);
    };
+   Verbosity GetGlobalVerbosity() {
+      return speaker::fverb;
+   }
 }
diff --git a/v2.5/toolkit/m4/ax_cxx_compile_stdcxx_17.m4 b/v2.5/toolkit/m4/ax_cxx_compile_stdcxx_17.m4
new file mode 100644
index 00000000..a6834171
--- /dev/null
+++ b/v2.5/toolkit/m4/ax_cxx_compile_stdcxx_17.m4
@@ -0,0 +1,35 @@
+# =============================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_17.html
+# =============================================================================
+#
+# SYNOPSIS
+#
+#   AX_CXX_COMPILE_STDCXX_17([ext|noext], [mandatory|optional])
+#
+# DESCRIPTION
+#
+#   Check for baseline language coverage in the compiler for the C++17
+#   standard; if necessary, add switches to CXX and CXXCPP to enable
+#   support.
+#
+#   This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
+#   macro with the version set to C++17.  The two optional arguments are
+#   forwarded literally as the second and third argument respectively.
+#   Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
+#   more information.  If you want to use this macro, you also need to
+#   download the ax_cxx_compile_stdcxx.m4 file.
+#
+# LICENSE
+#
+#   Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
+#   Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 2
+
+AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_17], [AX_CXX_COMPILE_STDCXX([17], [$1], [$2])])
diff --git a/v2.5/toolkit/src/fnlo-tk-yodaout.cc b/v2.5/toolkit/src/fnlo-tk-yodaout.cc
index 5ad715bf..a12c8c54 100644
--- a/v2.5/toolkit/src/fnlo-tk-yodaout.cc
+++ b/v2.5/toolkit/src/fnlo-tk-yodaout.cc
@@ -38,7 +38,17 @@ int main(int argc, char** argv) {
    using namespace fastNLO;   //! namespace for fastNLO constants
 
    //! --- Set initial verbosity level
-   SetGlobalVerbosity(INFO);
+   SetGlobalVerbosity(WARNING);
+   say::Verbosity fvol = toVerbosity()["WARNING"];
+
+   //--- Set verbosity level of table evaluation from command line argument if existing
+   string VerbosityLevel;
+   if (argc > 11) {
+      VerbosityLevel  = (const char*) argv[11];
+      //! --- Reset verbosity level from here on
+      fvol = toVerbosity()[VerbosityLevel];
+      SetGlobalVerbosity(fvol);
+   }
 
    //! --- Parse commmand line
    char buffer[1024];
@@ -66,16 +76,16 @@ int main(int argc, char** argv) {
       info["fnlo-tk-yodaout"] << "Program to read fastNLO tables and write out" << endl;
       info["fnlo-tk-yodaout"] << "QCD cross sections in YODA format for use with Rivet" << endl;
       info["fnlo-tk-yodaout"] << "(If compiled without YODA support only text printout is given)" << endl;
-      yell << _SSEPSC << endl;
+      infosep << _SSEPSC << endl;
       info["fnlo-tk-yodaout"] << "For more explanations type:" << endl;
       info["fnlo-tk-yodaout"] << "./fnlo-tk-yodaout -h" << endl;
       info["fnlo-tk-yodaout"] << "For version number printout type:" << endl;
       info["fnlo-tk-yodaout"] << "./fnlo-tk-yodaout -v" << endl;
-      yell << _CSEPSC << endl;
-      yell << "" << endl;
+      infosep << _CSEPSC << endl;
+      infosep << "" << endl;
+      infosep << _CSEPSC << endl;
       //! --- Usage info
       if (tablename == "-h") {
-         yell << _CSEPSC << endl;
          info["fnlo-tk-yodaout"] << "fastNLO YODA Writer" << endl;
          yell << _SSEPSC << endl;
          yell << " #" << endl;
@@ -136,8 +146,8 @@ int main(int argc, char** argv) {
    }
 
    //! --- PDF choice
-   string chtmp = "X";
-   string PDFFile = "X";
+   string chtmp;
+   string PDFFile;
    if (argc > 2) {
       PDFFile = (const char*) argv[2];
    }
@@ -153,7 +163,7 @@ int main(int argc, char** argv) {
    EPDFUncertaintyStyle   ePDFUnc   = kPDFNone;
    EAsUncertaintyStyle    eAsUnc    = kAsNone;
    EAddUncertaintyStyle   eAddUnc   = kAddNone;
-   string chunc = "none";
+   string chunc;
    if (argc > 3) {
       chunc = (const char*) argv[3];
    }
@@ -201,7 +211,7 @@ int main(int argc, char** argv) {
 
    //! --- Fixed-order choice
    ESMOrder eOrder = kNextToLeading;
-   string chord = "NLO";
+   string chord;
    bool bonly = false;
    if (argc > 4) {
       chord = (const char*) argv[4];
@@ -234,35 +244,37 @@ int main(int argc, char** argv) {
    }
 
    //! --- Normalization
-   string chnorm = "no";
+   string chnorm;
    if (argc > 5) {
       chnorm = (const char*) argv[5];
    }
-   if (argc <= 5 || chnorm == "_") {
+   if (argc <= 5 || chnorm == "_" || chnorm == "no") {
+      chnorm = "no";
       shout["fnlo-tk-yodaout"] << "Preparing unnormalized cross sections." << endl;
    } else {
       shout["fnlo-tk-yodaout"] << "Normalizing cross sections. " << endl;
    }
 
    //--- Scale choice (flex-scale tables only; ignored for fix-scale tables)
-   string chflex = "kScale1";
+   string chflex;
    if (argc > 6) {
       chflex = (const char*) argv[6];
    }
    if (argc <= 6 || chflex == "_") {
+      chflex = "kScale1";
       shout["fnlo-tk-yodaout"] << "Using default mur=muf=scale 1." << endl;
    } else {
       shout["fnlo-tk-yodaout"] << "Using scale definition "+chflex+"." << endl;
    }
 
    //--- Central scale factor (e.g. to change from pT to 2*pT or m12 to m12/2)
-   double sclfac = 1.0;
+   double sclfac;
    if (argc > 7) {
       chtmp = (const char*) argv[7];
    }
    if (argc <= 7 || chtmp == "_") {
-      shout["fnlo-tk-yodaout"] << "No request given for central scale factor," << endl;
-      shout << "                  using unmodified central scale." << endl;
+      sclfac = 1.0;
+      shout["fnlo-tk-yodaout"] << "No request given for central scale factor, using unmodified central scale." << endl;
    } else {
       sclfac = atof(argv[7]);
       if ( sclfac < 0.1 || sclfac > 10. ) {
@@ -275,11 +287,11 @@ int main(int argc, char** argv) {
    }
 
    //! --- Nonperturbative correction
-   string chnp = "no";
+   string chnp;
    if (argc > 8) {
       chnp = (const char*) argv[8];
    }
-   if (argc <= 8 || chnp == "_") {
+   if (argc <= 8 || chnp == "_" || chnp == "no") {
       chnp = "no";
       shout["fnlo-tk-yodaout"] << "Do not apply nonperturbative corrections." << endl;
    } else {
@@ -287,11 +299,12 @@ int main(int argc, char** argv) {
    }
 
    //--- Set x axis rescale velue
-   double xrescale = 1;
+   double xrescale;
    if (argc > 9) {
       chtmp = (const char*) argv[9];
    }
    if (argc <= 9 || chtmp == "_") {
+      xrescale = 1;
       shout["fnlo-tk-yodaout"] << "No request given for x-axis rescale factor, using default value of unity." << endl;
    } else {
       xrescale = atof(argv[9]);
@@ -299,26 +312,20 @@ int main(int argc, char** argv) {
    }
 
    //--- Set uncertainty rescale velue
-   double dxsrescale = 1;
+   double dxsrescale;
    if (argc > 10) {
       chtmp = (const char*) argv[10];
    }
    if (argc <= 10 || chtmp == "_") {
+      dxsrescale = 1;
       shout["fnlo-tk-yodaout"] << "No request given for uncertainty rescale factor, using default value of unity." << endl;
    } else {
       dxsrescale = atof(argv[10]);
       shout["fnlo-tk-yodaout"] << "Using uncertainty rescale factor: " << dxsrescale << endl;
    }
 
-   //--- Set verbosity level of table evaluation
-   string VerbosityLevel = "WARNING";
-   if (argc > 11) {
-      VerbosityLevel  = (const char*) argv[11];
-   }
-   if (argc <= 11 || VerbosityLevel == "_") {
-      VerbosityLevel = "WARNING";
-      shout["fnlo-tk-yodaout"] << "No request given for verbosity level, using WARNING default." << endl;
-   } else {
+   //--- Report about changed verbosity level at the beginning
+   if (!VerbosityLevel.empty()) {
       shout["fnlo-tk-yodaout"] << "Using verbosity level: " << VerbosityLevel << endl;
    }
 
@@ -330,15 +337,14 @@ int main(int argc, char** argv) {
    yell << _CSEPSC << endl;
    //---  End of parsing arguments
 
-   //! --- Reset verbosity level from here on
-   SetGlobalVerbosity(toVerbosity()[VerbosityLevel]);
-
    //! --- fastNLO initialisation, attach table
    fastNLOTable table = fastNLOTable(tablename);
 
    //! Print essential table information
-   table.PrintContributionSummary(0);
-   table.Print(0);
+   if (fvol < 1) {
+      table.PrintContributionSummary(0);
+      table.Print(0);
+   }
 
    //! Initialise a fastNLO reader instance
    //! Note: This also initializes the cross section to the LO/NLO one!
@@ -472,59 +478,36 @@ int main(int argc, char** argv) {
 
    //! Re-calculate cross sections to potentially include the above-selected non-perturbative factors
    fnlo->CalcCrossSection();
-   //! Get cross sections
-   vector < double > xs = fnlo->GetCrossSection(lNorm);
    //! If required get uncertainties (only for additive perturbative contributions)
    XsUncertainty XsUnc;
+   std::vector< std::vector<double> > xsvec; // TEST
    string LineName;
+   string UncName;
    if ( chunc == "2P" || chunc == "6P" ) {
       XsUnc = fnlo->GetScaleUncertainty(eScaleUnc, lNorm, sclfac);
-      snprintf(buffer, sizeof(buffer), " # Relative scale uncertainties (%s)",chunc.c_str());
+      UncName = " # Relative scale uncertainties (" + chunc + ")";
       LineName += "_dxscl";
+      xsvec = fnlo->GetScaleUncertaintyVec(eScaleUnc, lNorm, sclfac);
    } else if ( chunc == "AS" ) {
       XsUnc = fnlo->GetAsUncertainty(eAsUnc, lNorm);
-      snprintf(buffer, sizeof(buffer), " # Relative a_s(M_Z) uncertainties (%s)",chunc.c_str());
+      UncName = " # Relative a_s(M_Z) uncertainties (" + chunc + ")";
       LineName += "_dxa_s";
    } else if ( chunc == "ST" ) {
       XsUnc = fnlo->GetAddUncertainty(eAddUnc, lNorm);
-      snprintf(buffer, sizeof(buffer), " # Relative statistical uncertainties (%s)",chunc.c_str());
+      UncName = " # Relative statistical uncertainties (" + chunc + ")";
       LineName += "_dxst";
    } else if ( chunc != "none" ) {
       XsUnc = fnlo->GetPDFUncertainty(ePDFUnc, lNorm);
-      snprintf(buffer, sizeof(buffer), " # Relative PDF Uncertainties (%s %s %s)",chord.c_str(),PDFFile.c_str(),chunc.c_str());
+      UncName = " # Relative PDF Uncertainties (" + chord + " " + PDFFile + " " + chunc + ")";
       LineName += "_dxpdf";
    } else {
       XsUnc = fnlo->GetScaleUncertainty(kScaleNone, lNorm);
-      snprintf(buffer, sizeof(buffer), " # Without uncertainties");
+      UncName = " # Without uncertainties";
       LineName += "_dxnone";
    }
-
-   if ( XsUnc.xs.size() ) {
-      yell << _CSEPSC << endl;
-      shout << "fnlo-tk-yodaout: Evaluating uncertainties" << endl;
-      yell << _CSEPSC << endl;
-      yell << _DSEPSC << endl;
-      yell <<  buffer << endl;
-      yell << _SSEPSC << endl;
-      shout << "bin      cross_section           lower_uncertainty       upper_uncertainty" << endl;
-      yell << _TSEPSC << endl;
-   }
-   vector < double > dxsu;
-   vector < double > dxsl;
-   for ( unsigned int iobs=0;iobs<xs.size();iobs++ ) {
-      if ( XsUnc.xs.size() ) {
-         printf("%5.i      %#18.11E      %#18.11E      %#18.11E\n",iobs+1,XsUnc.xs[iobs],XsUnc.dxsl[iobs],XsUnc.dxsu[iobs]);
-         xs[iobs] = XsUnc.xs[iobs];
-         dxsu.push_back(XsUnc.xs[iobs]*XsUnc.dxsu[iobs]);
-         dxsl.push_back(XsUnc.xs[iobs]*XsUnc.dxsl[iobs]);
-      } else {
-         dxsu.push_back(0);
-         dxsl.push_back(0);
-      }
-   }
-   if ( XsUnc.xs.size() ) {
-      yell << _TSEPSC << endl;
-   }
+   fastNLOTools::PrintXSUncertainty(XsUnc, UncName);
+   cout << "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV" << endl;
+   fastNLOTools::PrintXSUncertaintyVec(xsvec, UncName);
 
    //! --- Get RivetID
    //!     For 2+-dimensions determine running number in Rivet plot name by spotting the capital letter in "RIVET_ID=" in the fnlo table
@@ -603,9 +586,9 @@ int main(int argc, char** argv) {
          x.push_back((bins[iobs].second + bins[iobs].first)/2.0*xrescale);
          explus.push_back((bins[iobs].second - bins[iobs].first)/2.0*xrescale);
          exminus.push_back((bins[iobs].second - bins[iobs].first)/2.0*xrescale);
-         y.push_back(xs[iobs]);
-         eyplus.push_back(dxsu[iobs]*dxsrescale);
-         eyminus.push_back(std::abs(dxsl[iobs])*dxsrescale);
+         y.push_back(XsUnc.xs[iobs]);
+         eyplus.push_back(XsUnc.xs[iobs]*XsUnc.dxsu[iobs]*dxsrescale);
+         eyminus.push_back(std::abs(XsUnc.xs[iobs]*XsUnc.dxsl[iobs])*dxsrescale);
          iobs++;
       }
 #ifdef WITH_YODA
@@ -634,9 +617,9 @@ int main(int argc, char** argv) {
             x.push_back((bins[iobs].second + bins[iobs].first)/2.0*xrescale);
             explus.push_back((bins[iobs].second - bins[iobs].first)/2.0*xrescale);
             exminus.push_back((bins[iobs].second - bins[iobs].first)/2.0*xrescale);
-            y.push_back(xs[iobs]);
-            eyplus.push_back(dxsu[iobs]*dxsrescale);
-            eyminus.push_back(std::abs(dxsl[iobs])*dxsrescale);
+            y.push_back(XsUnc.xs[iobs]);
+            eyplus.push_back(XsUnc.xs[iobs]*XsUnc.dxsu[iobs]*dxsrescale);
+            eyminus.push_back(std::abs(XsUnc.xs[iobs]*XsUnc.dxsl[iobs])*dxsrescale);
             iobs++;
          }
          /// Derive histogram counter
@@ -681,9 +664,9 @@ int main(int argc, char** argv) {
                x.push_back((bins[iobs].second + bins[iobs].first)/2.0*xrescale);
                explus.push_back((bins[iobs].second - bins[iobs].first)/2.0*xrescale);
                exminus.push_back((bins[iobs].second - bins[iobs].first)/2.0*xrescale);
-               y.push_back(xs[iobs]);
-               eyplus.push_back(dxsu[iobs]*dxsrescale);
-               eyminus.push_back(std::abs(dxsl[iobs])*dxsrescale);
+               y.push_back(XsUnc.xs[iobs]);
+               eyplus.push_back(XsUnc.xs[iobs]*XsUnc.dxsu[iobs]*dxsrescale);
+               eyminus.push_back(std::abs(XsUnc.xs[iobs]*XsUnc.dxsl[iobs])*dxsrescale);
                iobs++;
             }
             /// Derive histogram counter
-- 
GitLab