From 5bb15e5b2cc3f1e78f44d2c68a0385ca88b88ab8 Mon Sep 17 00:00:00 2001
From: JohannesGaessler <johannesg@5d6.de>
Date: Wed, 12 Jul 2023 00:50:22 +0200
Subject: [PATCH] Fixed NLOJet++ distcheck paths

---
 v2.5/generators/nlojet++/interface/check/Makefile.am     | 2 +-
 .../nlojet++/interface/check/fnlo-compare-tables.py      | 9 +++++----
 .../nlojet++/interface/check/fnlo-nj-lotest.pl.in        | 2 +-
 .../nlojet++/interface/check/fnlo-nj-nlotest.pl.in       | 2 +-
 .../check}/InclusiveNJets_InclusiveJets_fix.wrm          | 0
 .../check}/InclusiveNJets_InclusiveJets_flex.wrm         | 0
 .../generators/nlojet++/interface/data/check/Makefile.am | 4 +++-
 .../interface/{ => data}/check/compare-table-helper.py   | 0
 .../{check/input => data/check}/fix_NodeDensity.str      | 0
 .../{check/input => data/check}/fix_NodesPerBin.str      | 0
 .../{check/input => data/check}/flex_NodeDensity.str     | 0
 .../{check/input => data/check}/flex_NodesPerBin.str     | 0
 12 files changed, 11 insertions(+), 8 deletions(-)
 rename v2.5/generators/nlojet++/interface/{check/input => data/check}/InclusiveNJets_InclusiveJets_fix.wrm (100%)
 rename v2.5/generators/nlojet++/interface/{check/input => data/check}/InclusiveNJets_InclusiveJets_flex.wrm (100%)
 rename v2.5/generators/nlojet++/interface/{ => data}/check/compare-table-helper.py (100%)
 rename v2.5/generators/nlojet++/interface/{check/input => data/check}/fix_NodeDensity.str (100%)
 rename v2.5/generators/nlojet++/interface/{check/input => data/check}/fix_NodesPerBin.str (100%)
 rename v2.5/generators/nlojet++/interface/{check/input => data/check}/flex_NodeDensity.str (100%)
 rename v2.5/generators/nlojet++/interface/{check/input => data/check}/flex_NodesPerBin.str (100%)

diff --git a/v2.5/generators/nlojet++/interface/check/Makefile.am b/v2.5/generators/nlojet++/interface/check/Makefile.am
index b5a7792f..e9a9c3cd 100644
--- a/v2.5/generators/nlojet++/interface/check/Makefile.am
+++ b/v2.5/generators/nlojet++/interface/check/Makefile.am
@@ -15,7 +15,7 @@ AUTOMAKE_OPTIONS = gnu
 # perl script targets to check the package (distributed, but not installed)
 #
 dist_check_SCRIPTS = fnlo-nj-wrmtest.pl fnlo-nj-lotest.pl fnlo-nj-nlotest.pl fnlo-compare-tables.py
-TESTS_ENVIRONMENT = LIBDIR=$(libdir) PYTHONPATH=$(shell fnlo-tk-config --pythondir)
+TESTS_ENVIRONMENT = LIBDIR=$(shell fnlo-tk-config --libdir) PYTHONPATH=$(shell fnlo-tk-config --pythondir)
 TESTS = $(dist_check_SCRIPTS)
 
 # Additional clean up for check targets
diff --git a/v2.5/generators/nlojet++/interface/check/fnlo-compare-tables.py b/v2.5/generators/nlojet++/interface/check/fnlo-compare-tables.py
index 7d2e6ba8..f00bbcce 100755
--- a/v2.5/generators/nlojet++/interface/check/fnlo-compare-tables.py
+++ b/v2.5/generators/nlojet++/interface/check/fnlo-compare-tables.py
@@ -10,6 +10,7 @@ except ModuleNotFoundError:
     sys.exit(77)
 
 LIBDIR = os.environ["LIBDIR"]
+DATADIR = f"{os.path.dirname(os.path.abspath(__file__))}/../data/check/"
 
 TYPES = ["fix", "flex"]
 NAMES = ["NodesPerBin", "NodeDensity"]
@@ -18,13 +19,13 @@ SEEDS = [1000, 2000]
 # fnlo.SetGlobalVerbosity(fnlo.DEBUG)
 
 os.system("rm -rf output")
-os.system("ln -s input/InclusiveNJets_InclusiveJets_fix.wrm")
-os.system("ln -s input/InclusiveNJets_InclusiveJets_flex.wrm")
+os.system(f"ln -sf {DATADIR}InclusiveNJets_InclusiveJets_fix.wrm")
+os.system(f"ln -sf {DATADIR}InclusiveNJets_InclusiveJets_flex.wrm")
 
 
 def generate_table(vartype: str, name: str, seed: int):
-    os.system(f"ln -sf input/{vartype}_{name}.str InclusiveNJets.str")
-    print(f"Asserting that steering file InclusiveNJets.str exists")
+    os.system(f"ln -sf {DATADIR}{vartype}_{name}.str InclusiveNJets.str")
+    print("Asserting that steering file InclusiveNJets.str exists")
     assert os.path.exists("InclusiveNJets.str")
     os.system(
         "nlojet++ "
diff --git a/v2.5/generators/nlojet++/interface/check/fnlo-nj-lotest.pl.in b/v2.5/generators/nlojet++/interface/check/fnlo-nj-lotest.pl.in
index 105bbc19..96b1ea93 100755
--- a/v2.5/generators/nlojet++/interface/check/fnlo-nj-lotest.pl.in
+++ b/v2.5/generators/nlojet++/interface/check/fnlo-nj-lotest.pl.in
@@ -69,7 +69,7 @@ $ret = system("$cmd");
 if ( $ret ) {die "fnlo-tk-nlotest: Ungzipping test table ${tabgz} failed: $ret, aborted!\n";}
 
 # Determine difference to default LO table
-$cmd = "./compare-table-helper.py ./${tabl} output/${tabl} > lodiff.log";
+$cmd = "${src}/../data/check/compare-table-helper.py ./${tabl} output/${tabl} > lodiff.log";
 print "Executing command: $cmd\n";
 $ret = system("$cmd");
 if ( $ret == 77 ) {
diff --git a/v2.5/generators/nlojet++/interface/check/fnlo-nj-nlotest.pl.in b/v2.5/generators/nlojet++/interface/check/fnlo-nj-nlotest.pl.in
index 2018db42..3ea7072a 100755
--- a/v2.5/generators/nlojet++/interface/check/fnlo-nj-nlotest.pl.in
+++ b/v2.5/generators/nlojet++/interface/check/fnlo-nj-nlotest.pl.in
@@ -69,7 +69,7 @@ $ret = system("$cmd");
 if ( $ret ) {die "fnlo-tk-nlotest: Ungzipping test table ${tabgz} failed: $ret, aborted!\n";}
 
 # Determine difference to default NLO table
-$cmd = "./compare-table-helper.py ./${tabn} output/${tabn} > lodiff.log";
+$cmd = "${src}/../data/check/compare-table-helper.py ./${tabn} output/${tabn} > lodiff.log";
 print "Executing command: $cmd\n";
 $ret = system("$cmd");
 if ( $ret == 77 ) {
diff --git a/v2.5/generators/nlojet++/interface/check/input/InclusiveNJets_InclusiveJets_fix.wrm b/v2.5/generators/nlojet++/interface/data/check/InclusiveNJets_InclusiveJets_fix.wrm
similarity index 100%
rename from v2.5/generators/nlojet++/interface/check/input/InclusiveNJets_InclusiveJets_fix.wrm
rename to v2.5/generators/nlojet++/interface/data/check/InclusiveNJets_InclusiveJets_fix.wrm
diff --git a/v2.5/generators/nlojet++/interface/check/input/InclusiveNJets_InclusiveJets_flex.wrm b/v2.5/generators/nlojet++/interface/data/check/InclusiveNJets_InclusiveJets_flex.wrm
similarity index 100%
rename from v2.5/generators/nlojet++/interface/check/input/InclusiveNJets_InclusiveJets_flex.wrm
rename to v2.5/generators/nlojet++/interface/data/check/InclusiveNJets_InclusiveJets_flex.wrm
diff --git a/v2.5/generators/nlojet++/interface/data/check/Makefile.am b/v2.5/generators/nlojet++/interface/data/check/Makefile.am
index f00b8519..d6d04cee 100644
--- a/v2.5/generators/nlojet++/interface/data/check/Makefile.am
+++ b/v2.5/generators/nlojet++/interface/data/check/Makefile.am
@@ -15,7 +15,9 @@ AUTOMAKE_OPTIONS = gnu
 #   warmup.txt  --> fnr0001midpHT_I723509_v23_fix_InclusiveNJets_warmup.txt
 #   born.tab.gz --> fnr0001midpHT_I723509_v23_fix-hhc-born-2jet.tab.gz
 #   nlo.tab.gz  --> fnr0001midpHT_I723509_v23_fix-hhc-nlo-2jet.tab.gz
-dist_check_DATA = steer.str warmup.txt born.tab.gz nlo.tab.gz
+dist_check_DATA = steer.str warmup.txt born.tab.gz nlo.tab.gz compare-table-helper.py \
+	fix_NodeDensity.str fix_NodesPerBin.str InclusiveNJets_InclusiveJets_fix.wrm \
+	flex_NodeDensity.str flex_NodesPerBin.str InclusiveNJets_InclusiveJets_flex.wrm
 
 # Files that are required to build the project but that can be
 # recreated IF the necessary autotools etc. are available by:
diff --git a/v2.5/generators/nlojet++/interface/check/compare-table-helper.py b/v2.5/generators/nlojet++/interface/data/check/compare-table-helper.py
similarity index 100%
rename from v2.5/generators/nlojet++/interface/check/compare-table-helper.py
rename to v2.5/generators/nlojet++/interface/data/check/compare-table-helper.py
diff --git a/v2.5/generators/nlojet++/interface/check/input/fix_NodeDensity.str b/v2.5/generators/nlojet++/interface/data/check/fix_NodeDensity.str
similarity index 100%
rename from v2.5/generators/nlojet++/interface/check/input/fix_NodeDensity.str
rename to v2.5/generators/nlojet++/interface/data/check/fix_NodeDensity.str
diff --git a/v2.5/generators/nlojet++/interface/check/input/fix_NodesPerBin.str b/v2.5/generators/nlojet++/interface/data/check/fix_NodesPerBin.str
similarity index 100%
rename from v2.5/generators/nlojet++/interface/check/input/fix_NodesPerBin.str
rename to v2.5/generators/nlojet++/interface/data/check/fix_NodesPerBin.str
diff --git a/v2.5/generators/nlojet++/interface/check/input/flex_NodeDensity.str b/v2.5/generators/nlojet++/interface/data/check/flex_NodeDensity.str
similarity index 100%
rename from v2.5/generators/nlojet++/interface/check/input/flex_NodeDensity.str
rename to v2.5/generators/nlojet++/interface/data/check/flex_NodeDensity.str
diff --git a/v2.5/generators/nlojet++/interface/check/input/flex_NodesPerBin.str b/v2.5/generators/nlojet++/interface/data/check/flex_NodesPerBin.str
similarity index 100%
rename from v2.5/generators/nlojet++/interface/check/input/flex_NodesPerBin.str
rename to v2.5/generators/nlojet++/interface/data/check/flex_NodesPerBin.str
-- 
GitLab