diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 8a18777..1fdd629 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,100 +1,103 @@ # 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 . ################################################################################ set(TARGETS_TO_BUILD) if(USE_MINIMIZER) add_executable(nuismin nuismin.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuismin) add_executable(nuissplines nuissplines.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuissplines) endif() include_directories(${RWENGINE_INCLUDE_DIRECTORIES}) include_directories(${CMAKE_SOURCE_DIR}/src/Routines) include_directories(${CMAKE_SOURCE_DIR}/src/InputHandler) include_directories(${CMAKE_SOURCE_DIR}/src/Genie) include_directories(${CMAKE_SOURCE_DIR}/src/FitBase) include_directories(${CMAKE_SOURCE_DIR}/src/Statistical) include_directories(${CMAKE_SOURCE_DIR}/src/Utils) include_directories(${CMAKE_SOURCE_DIR}/src/Config) include_directories(${CMAKE_SOURCE_DIR}/src/Logger) include_directories(${CMAKE_SOURCE_DIR}/src/Splines) include_directories(${CMAKE_SOURCE_DIR}/src/Reweight) include_directories(${CMAKE_SOURCE_DIR}/src/FCN) include_directories(${CMAKE_SOURCE_DIR}/src/MCStudies) include_directories(${CMAKE_SOURCE_DIR}/src/Smearceptance) include_directories(${EXP_INCLUDE_DIRECTORIES}) if (USE_NuWro AND NOT NUWRO_BUILT_FROM_FILE) add_executable(nuwro_nuisance nuwro_NUISANCE.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuwro_nuisance) endif() if (USE_GiBUU) add_executable(DumpGiBUUEvents DumpGiBUUEvents.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};DumpGiBUUEvents) endif() +add_executable(nuis_flat_tree_combiner nuis_flat_tree_combiner.cxx) +set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuis_flat_tree_combiner) + add_executable(nuiscomp nuiscomp.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuiscomp) add_executable(nuisflat nuisflat.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuisflat) add_executable(nuissmear nuissmear.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuissmear) add_executable(nuissyst nuissyst.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuissyst) add_executable(nuisbayes nuisbayes.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuisbayes) if(USE_GENIE) add_executable(PrepareGENIE PrepareGENIE.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};PrepareGENIE) endif() if(USE_NEUT) add_executable(PrepareNEUT PrepareNEUT.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};PrepareNEUT) endif() # PREPARE NUWRO # Commented out for the time being until it is finished.. if(USE_NuWro) add_executable(PrepareNuwro PrepareNuwroEvents.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};PrepareNuwro) endif() add_executable(nuisbac nuisbac.cxx) set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuisbac) foreach(targ ${TARGETS_TO_BUILD}) if(NOT "${CMAKE_LINK_FLAGS} ${NUIS_EXE_FLAGS}" STREQUAL " ") set_target_properties(${targ} PROPERTIES LINK_FLAGS "${CMAKE_LINK_FLAGS} ${NUIS_EXE_FLAGS}") endif() target_link_libraries(${targ} ${MODULETargets}) target_link_libraries(${targ} ${CMAKE_DEPENDLIB_FLAGS}) endforeach() install(TARGETS ${TARGETS_TO_BUILD} DESTINATION bin) \ No newline at end of file diff --git a/app/nuis_flat_tree_combiner.cxx b/app/nuis_flat_tree_combiner.cxx new file mode 100644 index 0000000..c8e9c02 --- /dev/null +++ b/app/nuis_flat_tree_combiner.cxx @@ -0,0 +1,112 @@ +#include +#include +#include + +#include "TChain.h" +#include "TFile.h" +#include "TTree.h" + +std::vector inputdescriptors; +std::string outputfilename; +std::string treename; +std::string branchname; +bool isdouble = true; + +void SayUsage(char const *argv[]) { + std::cout + << "[USAGE]: " << argv[0] << "\n" + << "\t-i : Input file list\n" + << "\t-o : Input file list\n" + << "\t-t : flat tree name\n" + << "\t-b : xsec weighting " + "branch name\n" + << "\t-f : xsec weighting " + "branch is float\n" + << std::endl; +} + +void handleOpts(int argc, char const *argv[]) { + int opt = 1; + while (opt < argc) { + if (std::string(argv[opt]) == "-?" || std::string(argv[opt]) == "--help") { + SayUsage(argv); + exit(0); + } else if (std::string(argv[opt]) == "-i") { + // Keep adding until run out of options or the next string starts with a - + while (((opt + 1) != argc) && (argv[opt + 1][0] != '-')) { + inputdescriptors.push_back(argv[++opt]); + } + } else if (std::string(argv[opt]) == "-o") { + outputfilename = argv[++opt]; + } else if (std::string(argv[opt]) == "-t") { + treename = argv[++opt]; + } else if (std::string(argv[opt]) == "-b") { + branchname = argv[++opt]; + } else if (std::string(argv[opt]) == "-f") { + isdouble = false; + } else { + std::cout << "[ERROR]: Unknown option: " << argv[opt] << std::endl; + SayUsage(argv); + exit(1); + } + opt++; + } +} + +int main(int argc, char const *argv[]) { + handleOpts(argc, argv); + + TChain ch(treename.c_str()); + for (size_t i = 0; i < inputdescriptors.size(); ++i) { + ch.Add(inputdescriptors[i].c_str()); + std::cout << "Added: " << inputdescriptors[i] << " to input file list." + << std::endl; + } + + TFile *outfile = new TFile(outputfilename.c_str(), "RECREATE"); + std::cout << "Writing to " << outputfilename << std::endl; + TTree *outtree = ch.CloneTree(0, ""); + outtree->SetDirectory(outfile); + + size_t nents = ch.GetEntries(); + double ntrees = ch.GetNtrees(); + + if (isdouble) { + double fScaleFactor; + ch.SetBranchAddress(branchname.c_str(), &fScaleFactor); + std::cout << "recalculating " << branchname << "(double) for " << ntrees + << " input trees." << std::endl; + + for (size_t ent_it = 0; ent_it < nents; ++ent_it) { + if (ent_it && !(ent_it % (ent_it/100))) { + std::cout << "Processed " << ent_it << "/" << nents << std::endl; + } + + ch.GetEntry(ent_it); + + fScaleFactor /= ntrees; + + outtree->Fill(); + } + } else { + float fScaleFactor; + ch.SetBranchAddress(branchname.c_str(), &fScaleFactor); + std::cout << "recalculating " << branchname << "(float) for " << ntrees + << " input trees." << std::endl; + + for (size_t ent_it = 0; ent_it < nents; ++ent_it) { + if (ent_it && !(ent_it % 10000)) { + std::cout << "Processed " << ent_it << "/" << nents << std::endl; + } + + ch.GetEntry(ent_it); + + fScaleFactor /= ntrees; + + outtree->Fill(); + } + } + + outfile->Write(); + outfile->Close(); +} \ No newline at end of file diff --git a/event_gen/nuis_genev_genie b/event_gen/nuis_genev_genie index 5650369..7c310c1 100644 --- a/event_gen/nuis_genev_genie +++ b/event_gen/nuis_genev_genie @@ -1,177 +1,179 @@ #!/bin/bash set -e if [ -z ${NUISANCE} ]; then echo "[ERROR]: We need to be in a NUISANCE environment (\$NUISANCE should be set)." exit 1 fi PROBE="14" FLUX="" TARG="" NEVENTS="" OUPNAME="" while [[ ${#} -gt 0 ]]; do key="$1" case $key in -p|--probe) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi PROBE="$2" echo "[OPT]: Using Probe PDG: ${PROBE}" shift # past argument ;; -t|--target) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi TARG="$2" echo "[OPT]: Using target declaration: ${TARG}" shift # past argument ;; -f|--flux) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi FLUX="$2" echo "[OPT]: Using flux declaration: ${FLUX}" shift # past argument ;; -n|--nevents) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi NEVENTS="$2" echo "[OPT]: Throwing ${NEVENTS} events." shift # past argument ;; -o|--output-file) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi OUPNAME="$2" echo "[OPT]: Writing to file: ${OUPNAME}" shift # past argument ;; -?|--help) # unknown option echo "Arguments:" echo -e "\tRequired:" echo -e "\t -t|--target : e.g. \"CH\"" echo -e "\t -f|--flux : hint: use nuis_get_flux_descriptor for a simple interface." echo -e "\t -n|--nevents <#num events>" echo -e "\tOptional:" echo -e "\t -p|--probe : defaults to 14" echo -e "\t -o|--output-file : defaults to GENIE.....ghep.root" echo -e "" echo -e "\t -?|--help" exit 0 ;; *) # unknown option echo "Unknown option $1" exit 1 ;; esac shift done if [ -z ${FLUX} ]; then echo "Please pass a flux declaration with the -f flag." exit 2 fi if [ -z ${NEVENTS} ]; then echo "Please pass a number of events to generate with the -n flag." exit 2 fi OLDIFS=${IFS} IFS="," set -- ${FLUX} IFS=${OLDIFS} FLUX_FILE=${1} FLUX_HIST=${2} if [ -z {$FLUX_FILE} ] || [ -z {$FLUX_HIST} ]; then echo -e "Please pass a flux declaration with the -f flag in the form \"-f file.root,histo_name\"" exit 2 fi FLUX_FILE_NAME=${FLUX_FILE##*/} -cp ${FLUX_FILE} ./ +if [ ! -e ./${FLUX_FILE} ]; then + cp ${FLUX_FILE} ./ +fi SEED=${RANDOM} if [ -z ${OUPNAME} ]; then OUPNAME=${GEN}.nu${PROBE}.${SEED}.${FLUX_HIST}.${FLUX_FILE_NAME%%.root}.root fi if [ -e ${OUPNAME} ]; then echo "Already have file: ${OUPNAME}, not overwriting." exit 1 fi TARG=$(nuis_get_GENIE_target_descriptor ${TARG}) if [ -z ${GENIE_XSEC_FILE} ]; then echo "Environment not set up correctly, GENIE_XSEC_FILE is empty" exit 1 fi if [ -z ${GENIE_XSEC_TUNE} ]; then echo "Environment not set up correctly, GENIE_XSEC_TUNE is empty" exit 1 fi gevgen \ -p ${PROBE} -t ${TARG} \ -r ${SEED} -e 0.1,10 \ -f ${FLUX_FILE},${FLUX_HIST} \ -n ${NEVENTS} --seed ${SEED} \ --cross-sections ${GENIE_XSEC_FILE} \ --tune ${GENIE_XSEC_TUNE} \ --event-generator-list Default \ --message-thresholds Messenger_whisper.xml if [ -e gntp.${SEED}.ghep.root ]; then rm -f input-flux.root rm -f genie-mcjob-${SEED}.status mv gntp.${SEED}.ghep.root ${OUPNAME} PrepareGENIE -i ${OUPNAME} \ -f ${FLUX_FILE},${FLUX_HIST} \ -t ${TARG} else echo "Failed to produce expected output file: gntp.${SEED}.ghep.root" exit 1 fi diff --git a/event_gen/nuis_genev_neut b/event_gen/nuis_genev_neut index 697a181..442291d 100755 --- a/event_gen/nuis_genev_neut +++ b/event_gen/nuis_genev_neut @@ -1,359 +1,373 @@ #!/bin/bash set -e if [ -z ${NUISANCE} ]; then echo "[ERROR]: We need to be in a NUISANCE environment (\$NUISANCE should be set)." exit 1 fi PROBE="14" FLUX_DESCRIPTOR="" TARG="" NEVENTS="" OUPNAME="" MDLQE="" MAQE="" FSIOFF="no" NUCEFFOFF="no" QEONLY="no" RESONLY="no" while [[ ${#} -gt 0 ]]; do key="$1" case $key in -p|--probe) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi PROBE="$2" echo "[OPT]: Using Probe PDG: ${PROBE}" shift # past argument ;; -t|--target) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi TARG="$2" echo "[OPT]: Using target declaration: ${TARG}" shift # past argument ;; -f|--flux) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi FLUX_DESCRIPTOR="$2" echo "[OPT]: Using flux declaration: ${FLUX_DESCRIPTOR}" shift # past argument ;; -n|--nevents) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi NEVENTS="$2" echo "[OPT]: Throwing ${NEVENTS} events." shift # past argument ;; -o|--output-file) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi OUPNAME="$2" echo "[OPT]: Writing to file: ${OUPNAME}" shift # past argument ;; --MDLQE) if [[ ${#} -lt 2 ]]; then echo "[ERROR]: ${1} expected a value." exit 1 fi MDLQE="$2" - echo "[OPT]: Writing to file: ${MDLQE}" + echo "[OPT]: Using MDLQE = ${MDLQE}" + shift # past argument + ;; + + --MAQE) + + if [[ ${#} -lt 2 ]]; then + echo "[ERROR]: ${1} expected a value." + exit 1 + fi + + MAQE="$2" + echo "[OPT]: Attempting to generate with MAQE = ${MAQE}" shift # past argument ;; --QE-only) echo "[OPT]: Only generating true QE events." QEONLY="yes" ;; --RES-only) echo "[OPT]: Only generating true RES 1pi events." RESONLY="yes" ;; --no-FSI) echo "[OPT]: Disabling hadronic FSI." FSIOFF="yes" ;; --no-nuc-eff) echo "[OPT]: Disabling nuclear effects." NUCEFFOFF="yes" ;; -?|--help) # unknown option echo "Arguments:" echo -e "\tRequired:" echo -e "\t -t|--target : e.g. \"CH\"" echo -e "\t -f|--flux : hint: use nuis_get_flux_descriptor for a simple interface." echo -e "\t -n|--nevents <#num events>" echo -e "\tOptional:" echo -e "\t -p|--probe : defaults to 14" echo -e "\t -o|--output-file : defaults to NEUT.....neutvect.root" echo -e "\tModel options:" echo -e "\t --MDLQE : If unspecified left up to NEUT default" echo -e "\t --MAQE : If unspecified left up to NEUT default" echo -e "\t --QE-only : Only generate QE events." echo -e "\t --RES-only : Only generate RES 1pi events." echo -e "\t --no-FSI : disable hadronic FSI" echo -e "\t --no-nuc-eff : try to disable all nuclear effects" echo -e "" echo -e "\t -?|--help" exit 0 ;; *) # unknown option echo "Unknown option $1" exit 1 ;; esac shift done if [ -z ${FLUX_DESCRIPTOR} ]; then echo "Please pass a flux declaration with the -f flag." exit 2 fi if [ -z ${NEVENTS} ]; then echo "Please pass a number of events to generate with the -n flag." exit 2 fi OLDIFS=${IFS} IFS="," set -- ${FLUX_DESCRIPTOR} IFS=${OLDIFS} FLUX_FILE=${1} FLUX_HIST=${2} if [ -z {$FLUX_FILE} ] || [ -z {$FLUX_HIST} ]; then echo -e "Please pass a flux declaration with the -f flag in the form \"-f file.root,histo_name\"" exit 2 fi FLUX_FILE_NAME=${FLUX_FILE##*/} -cp ${FLUX_FILE} ./ +if [ ! -e ./${FLUX_FILE} ]; then + cp ${FLUX_FILE} ./ +fi if [ -z ${NEVENTS} ] ; then echo "Please pass an integer number of events to run with the -n flag." exit 3 fi SEED=${RANDOM} if [ -z ${OUPNAME} ]; then OUPNAME=neutvect.${PROBE}.${FLUX_HIST}.${FLUX_FILE_NAME%%.root}.${SEED}.root fi if [ -e ${OUPNAME} ]; then echo "Already have file: ${OUPNAME}, not overwriting." exit 1 fi TARG_DESCRIPTOR=$(nuis_get_NEUT_target_descriptor ${TARG}) OLDIFS=${IFS} IFS=":" set -- ${TARG_DESCRIPTOR} IFS=${OLDIFS} TARG_N=${1} TARG_Z=${2} TARG_H=${3} TARG_A=${4} CARDNAME=neutvect.${PROBE}.${FLUX_HIST}.${FLUX_FILE_NAME%%.root}.${SEED}.card echo "EVCT-NEVT ${NEVENTS}" > ${CARDNAME} echo "EVCT-IDPT ${PROBE}" >> ${CARDNAME} echo "EVCT-MPOS 1" >> ${CARDNAME} echo "EVCT-POS 0. 0. 0." >> ${CARDNAME} echo "EVCT-MDIR 1" >> ${CARDNAME} echo "EVCT-DIR 0. 0. 1." >> ${CARDNAME} echo "EVCT-MPV 3" >> ${CARDNAME} echo -e "EVCT-FILENM '${FLUX_FILE_NAME}'" >> ${CARDNAME} echo -e "EVCT-HISTNM '${FLUX_HIST}'" >> ${CARDNAME} echo "EVCT-INMEV 0" >> ${CARDNAME} echo "NEUT-NUMBNDN ${TARG_N}" >> ${CARDNAME} echo "NEUT-NUMBNDP ${TARG_Z}" >> ${CARDNAME} echo "NEUT-NUMFREP ${TARG_H}" >> ${CARDNAME} echo "NEUT-NUMATOM ${TARG_A}" >> ${CARDNAME} if [ "${QEONLY}" == "yes" ] && [ "${RESONLY}" == "yes" ]; then echo "[ERROR]: Both --QE-only and --RES-only passed. Please pass one or neither." exit 1 fi if [ "${TARG}" = "H" ] || [ "${TARG}" = "D" ] || [ "${NUCEFFOFF}" = "yes" ]; then MDLQE="02" # nu nub # 1: CC Q.E. CC Q.E.( Free ) # 2-4: CC 1pi CC 1pi # 5: CC DIS 1320 CC DIS 1.3 < W < 2.0 # 6-9: NC 1pi NC 1pi # 10: NC DIS 1320 NC DIS 1.3 < W < 2.0 # 11: NC els CC Q.E.( Bound ) # 12: NC els NC els # 13: NC els NC els # 14: coherent NC els # 15: coherent coherent # 16: CC eta coherent # 17 NC eta CC eta # 18: NC eta NC eta # 19: CC K NC eta # 20 NC K CC K # 21: NC K NC K # 22: N/A NC K # 23: CC DIS CC DIS (W > 2.0) # 24: NC DIS NC DIS (W > 2.0) # 25: CC 1 gamma CC 1 gamma # 26,27: NC 1 gamma NC 1 gamma # 28 CC 2p2h CC 2p2h # 29 CC Difract. CC Difract # 30 NC Difract. NC Difract # # # CRS : Multiplied factor to cross section on each mode. ( neu ) # CSRB : Multiplied factor to cross section on each mode. ( neu-bar ) echo "NEUT-MODE -1" >> ${CARDNAME} if [ "${QEONLY}" == "yes" ]; then # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 echo "NEUT-CRS 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0." >> ${CARDNAME} echo "NEUT-CRSB 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0." >> ${CARDNAME} elif [ "${RESONLY}" == "yes" ];then # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 echo "NEUT-CRS 0. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0." >> ${CARDNAME} echo "NEUT-CRSB 0. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0." >> ${CARDNAME} else # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 echo "NEUT-CRS 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 0. 1. 1." >> ${CARDNAME} echo "NEUT-CRSB 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 0. 1. 1." >> ${CARDNAME} fi else if [ "${QEONLY}" == "yes" ]; then echo "NEUT-MODE -1" >> ${CARDNAME} # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 echo "NEUT-CRS 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0." >> ${CARDNAME} echo "NEUT-CRSB 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0." >> ${CARDNAME} elif [ "${RESONLY}" == "yes" ];then echo "NEUT-MODE -1" >> ${CARDNAME} # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 echo "NEUT-CRS 0. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0." >> ${CARDNAME} echo "NEUT-CRSB 0. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0." >> ${CARDNAME} fi fi echo "NEUT-MDL2P2H 1" >> ${CARDNAME} if [ ! -z "${MDLQE}" ]; then echo "NEUT-MDLQE ${MDLQE}" >> ${CARDNAME} fi if [ ! -z "${MAQE}" ]; then echo "NEUT-MAQE ${MAQE}" >> ${CARDNAME} fi #disable nuclear effects if running on H/D if [ "${TARG}" = "H" ] || [ "${TARG}" = "D" ] || [ "${NUCEFFOFF}" = "yes" ]; then echo "NEUT-PFSURF 0.000001" >> ${CARDNAME} echo "NEUT-PFMAX 0.000001" >> ${CARDNAME} echo "NEUT-VNUINI 0.000001" >> ${CARDNAME} echo "NEUT-VNUFIN 0.000001" >> ${CARDNAME} echo "NEUT-FERM 1" >> ${CARDNAME} echo "NEUT-PAUL 1" >> ${CARDNAME} echo "NEUT-NEFF 1" >> ${CARDNAME} echo "NEUT-IFORMLEN 0" >> ${CARDNAME} echo "NEUT-IPILESSDCY 0" >> ${CARDNAME} echo "NEUT-ABSPIEMIT 0" >> ${CARDNAME} fi if [ "${TARG}" = "H" ] || [ "${TARG}" = "D" ] || [ "${FSIOFF}" = "yes" ]; then echo "NUCRES-RESCAT 0" >> ${CARDNAME} echo "NEUT-FEFQE 0." >> ${CARDNAME} echo "NEUT-FEFQEH 0." >> ${CARDNAME} echo "NEUT-FEFINEL 0." >> ${CARDNAME} echo "NEUT-FEFABS 0." >> ${CARDNAME} echo "NEUT-FEFCOH 0." >> ${CARDNAME} echo "NEUT-FEFCX 0." >> ${CARDNAME} echo "NEUT-FEFCXH 0." >> ${CARDNAME} echo "NEUT-FEFQEHF 0." >> ${CARDNAME} echo "NEUT-FEFCXHF 0." >> ${CARDNAME} echo "NEUT-FEFCOHF 0." >> ${CARDNAME} echo "NEUT-FEFCOUL 0." >> ${CARDNAME} echo "NEUT-FEFALL 0." >> ${CARDNAME} fi echo "NEUT-RAND 1" >> ${CARDNAME} echo "Running neutroot2 ${CARDNAME} ${OUPNAME} for ${NEVS} events." neutroot2 ${CARDNAME} ${OUPNAME%%.root}.gen.root if [ -e ${OUPNAME%%.root}.gen.root ]; then rm -f fort.77 mv ${OUPNAME%%.root}.gen.root ${OUPNAME} PrepareNEUT -i ${OUPNAME} \ -f ${FLUX_FILE},${FLUX_HIST} -G else echo "Failed to produce expected output file: ${OUPNAME}" exit 1 fi \ No newline at end of file