diff --git a/scripts/to_configure/setup.sh.in b/scripts/to_configure/setup.sh.in
index a1353ae..e17e0a3 100644
--- a/scripts/to_configure/setup.sh.in
+++ b/scripts/to_configure/setup.sh.in
@@ -1,154 +1,155 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NUISANCE.
#
# NUISANCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NUISANCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NUISANCE. If not, see .
################################################################################
#!/bin/sh
### Adapted from https://unix.stackexchange.com/questions/4965/keep-duplicates-out-of-path-on-source
function add_to_PATH () {
for d; do
d=$(cd -- "$d" && { pwd -P || pwd; }) 2>/dev/null # canonicalize symbolic links
if [ -z "$d" ]; then continue; fi # skip nonexistent directory
if [ "$d" == "/usr/bin" ] || [ "$d" == "/usr/bin64" ] || [ "$d" == "/usr/local/bin" ] || [ "$d" == "/usr/local/bin64" ]; then
case ":$PATH:" in
*":$d:"*) :;;
*) export PATH=$PATH:$d;;
esac
else
case ":$PATH:" in
*":$d:"*) :;;
*) export PATH=$d:$PATH;;
esac
fi
done
}
function add_to_LD_LIBRARY_PATH () {
for d; do
d=$(cd -- "$d" && { pwd -P || pwd; }) 2>/dev/null # canonicalize symbolic links
if [ -z "$d" ]; then continue; fi # skip nonexistent directory
if [ "$d" == "/usr/lib" ] || [ "$d" == "/usr/lib64" ] || [ "$d" == "/usr/local/lib" ] || [ "$d" == "/usr/local/lib64" ]; then
case ":$LD_LIBRARY_PATH:" in
*":$d:"*) :;;
*) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$d;;
esac
else
case ":$LD_LIBRARY_PATH:" in
*":$d:"*) :;;
*) export LD_LIBRARY_PATH=$d:$LD_LIBRARY_PATH;;
esac
fi
done
}
if [ "@EXTRA_SETUP_SCRIPT@" ]; then
if [ ! -e @EXTRA_SETUP_SCRIPT@ ]; then
echo "[WARN]: Extra setup script \"@EXTRA_SETUP_SCRIPT@\" requested, but could not be found. Skipping..."
else
echo "[INFO]: Sourcing extra setup from \"@EXTRA_SETUP_SCRIPT@\"."
. @EXTRA_SETUP_SCRIPT@
fi
fi
add_to_PATH "@CMAKE_INSTALL_PREFIX@/bin"
add_to_LD_LIBRARY_PATH "@CMAKE_INSTALL_PREFIX@/lib"
if [ ! "${ROOTSYS}" ]; then
echo "[INFO]: Sourcing ROOT from: @CMAKE_ROOTSYS@"
source "@CMAKE_ROOTSYS@/bin/thisroot.sh"
fi
if [ "@USE_NEUT@" != "FALSE" ]; then
echo "[INFO]: Adding NEUT library paths to the environment."
export NEUT_ROOT=@NEUT_ROOT@
export CERN=@CERN@
export CERN_LEVEL=@CERN_LEVEL@
add_to_LD_LIBRARY_PATH "${NEUT_LIB_DIR}" "${NEUT_ROOT}/src/reweight"
fi
if [ "@USE_NUWRO@" != "FALSE" ]; then
echo "[INFO]: Adding NuWro library paths to the environment."
export NUWRO="@NUWRO@"
add_to_PATH "@NUWRO@/bin"
- add_to_LD_LIBRARY_PATH "@NUWRO@/build/@CMAKE_SYSTEM_NAME@/lib"
+ # NuWro puts event1.so into the bin directoy.
+ add_to_LD_LIBRARY_PATH "@NUWRO@/bin"
if [ "@NUWRO_INC@" ]; then
export NUWRO_INC=@NUWRO_INC@
fi
fi
if [ "@NEED_PYTHIA6@" != "FALSE" ]; then
echo "[INFO]: Adding PYTHIA6 library paths to the environment."
export PYTHIA6="@PYTHIA6@"
add_to_LD_LIBRARY_PATH "@PYTHIA6@"
fi
if [ "@USE_GENIE@" != "FALSE" ]; then
echo "[INFO]: Adding GENIE paths to the environment."
export GENIE="@GENIE@"
export LHAPDF_LIB="@LHAPDF_LIB@"
export LHAPDF_INC="@LHAPDF_INC@"
export LIBXML2_LIB="@LIBXML2_LIB@"
export LIBXML2_INC="@LIBXML2_INC@"
export LOG4CPP_LIB="@LOG4CPP_LIB@"
export LOG4CPP_INC="@LOG4CPP_INC@"
if [ "@GSL_INC@" ]; then
export GSL_INC="@GSL_INC@"
fi
if [ "@GSL_LIB@" ]; then
export GSL_LIB="@GSL_LIB@"
fi
if [ "@LHAPATH@" ]; then
export LHAPATH="@LHAPATH@"
fi
add_to_PATH "@GENIE@/bin"
add_to_LD_LIBRARY_PATH "@GENIE@/lib" "@LHAPDF_LIB@" "@LIBXML2_LIB@" "@LOG4CPP_LIB@"
if [ "@GENIE_REWEIGHT@" ]; then
echo "[INFO]: Adding GENIE ReWeight library paths to the environment."
export GENIE_REWEIGHT="@GENIE_REWEIGHT@"
add_to_LD_LIBRARY_PATH "@GENIE_REWEIGHT@/lib"
fi
if [ "@GSL_LIB@" ]; then
add_to_LD_LIBRARY_PATH "@GSL_LIB@"
fi
fi
source @CMAKE_INSTALL_PREFIX@/fhiclcpp.setup.sh
add_to_FHICL_FILE_PATH @CMAKE_INSTALL_PREFIX@/fcl
export NUISANCE="@CMAKE_SOURCE_DIR@"
diff --git a/src/generator/GeneratorManager.hxx b/src/generator/GeneratorManager.hxx
index 0891c4e..6eb8511 100644
--- a/src/generator/GeneratorManager.hxx
+++ b/src/generator/GeneratorManager.hxx
@@ -1,56 +1,57 @@
// Copyright 2018 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NUISANCE.
*
* NUISANCE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NUISANCE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NUISANCE. If not, see .
*******************************************************************************/
#pragma once
#include "exception/exception.hxx"
#include
#include
+#include
namespace nuis {
/// Singleton class used to register generator compatibilty by string.
///
/// Used for
class GeneratorManager {
GeneratorManager();
static GeneratorManager *_global_inst;
std::vector Generators;
public:
static GeneratorManager &Get();
NEW_NUIS_EXCEPT(unknown_generator);
using Generator_id_t = size_t;
static Generator_id_t const kAll = std::numeric_limits::max();
Generator_id_t EnsureGeneratorRegistered(std::string const &);
Generator_id_t GetGeneratorId(std::string const &) const;
/// Checks whether two generator ids are compatible
///
/// Generator id's are compatible if either one is equal to kAll (i.e. that an
/// event plugin doesn't need any generator-specific information) or they are
/// equal.
static bool AreCompatible(Generator_id_t, Generator_id_t);
};
} // namespace nuis
diff --git a/src/generator/utility/NuWroUtility.cxx b/src/generator/utility/NuWroUtility.cxx
index d42456e..a081499 100644
--- a/src/generator/utility/NuWroUtility.cxx
+++ b/src/generator/utility/NuWroUtility.cxx
@@ -1,400 +1,400 @@
#include "generator/utility/NuWroUtility.hxx"
#include "exception/exception.hxx"
using namespace nuis::event;
namespace nuis {
namespace nuwrotools {
NEW_NUIS_EXCEPT(invalid_channel_to_NuWro);
NEW_NUIS_EXCEPT(invalid_NuWro_dyn_found);
std::pair GetFlagsDynEquivalent(Channel_t chan) {
std::pair NuMode;
NuMode.first.qel = false;
NuMode.first.res = false;
NuMode.first.dis = false;
NuMode.first.coh = false;
NuMode.first.mec = false;
- NuMode.first.hip = false;
+// NuMode.first.hip = false;
NuMode.first.nc = false;
NuMode.first.cc = false;
NuMode.first.anty = false;
NuMode.first.res_delta = false;
switch (chan) {
case Channel_t::kCCQE: {
NuMode.first.qel = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCC2p2h: {
NuMode.first.mec = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCCSPP_PPip: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCCSPP_PPi0: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCCSPP_NPip: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCCCohPi: {
NuMode.first.coh = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCCResGamma: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCCTransitionMPi: {
NuMode.first.res = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCCResEta0: {
NuMode.first.res = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCCResK: {
NuMode.first.res = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kCCDIS: {
NuMode.first.dis = true;
NuMode.first.cc = true;
break;
}
case Channel_t::kNCSPP_NPi0: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCSPP_PPi0: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCSPP_PPim: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCSPP_NPip: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCCohPi: {
NuMode.first.coh = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCResNGamma: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCResPGamma: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCTransitionMPi: {
NuMode.first.res = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCResNEta0: {
NuMode.first.res = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCResPEta0: {
NuMode.first.res = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCResK0: {
NuMode.first.res = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCResKp: {
NuMode.first.res = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCDIS: {
NuMode.first.dis = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCELP: {
NuMode.first.qel = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kNCELN: {
NuMode.first.qel = true;
NuMode.first.nc = true;
break;
}
case Channel_t::kCCQE_nub: {
NuMode.first.qel = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCC2p2h_nub: {
NuMode.first.mec = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCCSPP_NPim_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCCSPP_NPi0_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCCSPP_PPim_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCCCohPi_nub: {
NuMode.first.coh = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCCResGamma_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCCTransitionMPi_nub: {
NuMode.first.res = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCCResEta0_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCCResK_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.cc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kCCDIS_nub: {
NuMode.first.dis = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCSPP_NPi0_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCSPP_PPi0_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCSPP_PPim_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCSPP_NPip_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCCohPi_nub: {
NuMode.first.coh = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCResNGamma_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCResPGamma_nub: {
NuMode.first.res = true;
NuMode.first.res_delta = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCTransitionMPi_nub: {
NuMode.first.res = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCResNEta0_nub: {
NuMode.first.res = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCResPEta0_nub: {
NuMode.first.res = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCResK0_nub: {
NuMode.first.res = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCResKp_nub: {
NuMode.first.res = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCDIS_nub: {
NuMode.first.dis = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCELP_nub: {
NuMode.first.qel = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kNCELN_nub: {
NuMode.first.qel = true;
NuMode.first.nc = true;
NuMode.first.anty = true;
break;
}
case Channel_t::kUndefined:
default: {
throw invalid_channel_to_NuWro()
<< "[ERROR]: Encountered unhandled Channel_t: " << chan
<< " when build Nuwro-equivalent dyn and flags.";
}
}
NuMode.second = 0;
if (NuMode.first.qel) {
NuMode.second = NuMode.first.cc ? 0 : 1;
}
if (NuMode.first.res) {
NuMode.second = NuMode.first.cc ? 2 : 3;
}
if (NuMode.first.dis) {
NuMode.second = NuMode.first.cc ? 4 : 5;
}
if (NuMode.first.coh) {
NuMode.second = NuMode.first.cc ? 6 : 7;
}
if (NuMode.first.mec) {
NuMode.second = NuMode.first.cc ? 8 : 9;
}
return NuMode;
}
Channel_t NuWroEventChannel(NuWroEvent const &ev) {
switch (ev.dyn) {
case 0: {
return ev.flag.anty ? Channel_t::kCCQE_nub : Channel_t::kCCQE;
}
case 1: {
return ev.flag.anty ? Channel_t::kNCELN_nub : Channel_t::kNCELN;
}
case 2: {
return ev.flag.anty ? Channel_t::kCCSPP_NPi0_nub : Channel_t::kCCSPP_NPip;
}
case 3: {
return ev.flag.anty ? Channel_t::kNCSPP_NPi0_nub : Channel_t::kNCSPP_NPi0;
}
case 4: {
return ev.flag.anty ? Channel_t::kCCDIS_nub : Channel_t::kCCDIS;
}
case 5: {
return ev.flag.anty ? Channel_t::kNCDIS_nub : Channel_t::kNCDIS;
}
case 6: {
return ev.flag.anty ? Channel_t::kCCCohPi_nub : Channel_t::kCCCohPi;
}
case 7: {
return ev.flag.anty ? Channel_t::kNCCohPi_nub : Channel_t::kNCCohPi;
}
case 8: {
return ev.flag.anty ? Channel_t::kCC2p2h_nub : Channel_t::kCC2p2h;
}
default:
throw invalid_NuWro_dyn_found() << "[ERROR]: Found NuWro dyn: " << ev.dyn;
}
}
} // namespace nuwrotools
} // namespace nuis