Page MenuHomeHEPForge

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f3d5b3..3a0988b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,175 +1,176 @@
cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
project(ExternalDataFitter)
enable_language(Fortran)
set (ExtFit_VERSION_MAJOR 1)
set (ExtFit_VERSION_MINOR 0) #The q+1'th letter of the alphabet
set (ExtFit_VERSION_REVISION 0)
set (ExtFit_VERSION_STRING "v${ExtFit_VERSION_MAJOR}r${ExtFit_VERSION_MINOR}")
if(${ExtFit_VERSION_REVISION} STRGREATER "0")
set (ExtFit_VERSION_STRING "${ExtFit_VERSION_STRING}p${ExtFit_VERSION_REVISION}")
endif()
set (VERBOSE TRUE)
set (CMAKE_SKIP_BUILD_RPATH TRUE)
if(NOT DEFINED NOTEST OR NOT NOTEST)
enable_testing()
endif()
include(${CMAKE_SOURCE_DIR}/cmake/cmessage.cmake)
if(NOT DEFINED USE_NEUT AND
NOT DEFINED USE_NuWro AND
NOT DEFINED USE_GENIE AND
NOT DEFINED USE_T2K AND
NOT DEFINED USE_NIWG AND
NOT DEFINED USE_GiBUU AND
NOT DEFINED USE_NUANCE)
cmessage(FATAL_ERROR "No reweight engines requested. Configure with at least "
"one of -DUSE_{NEUT,NuWro,GENIE,NIWG,T2K,GiBUU,NUANCE}.")
else()
cmessage(STATUS "Generator Input Support:
NEUT:${USE_NEUT},
NuWro:${USE_NuWro},
GENIE:${USE_GENIE},
NIWG:${USE_NIWG},
GiBUU:${USE_GiBUU},
NUANCE:${USE_NUANCE}")
endif()
#Changes default install path to be a subdirectory of the build dir.
#Can set build dir at configure time with -DCMAKE_INSTALL_PREFIX=/install/path
if(CMAKE_INSTALL_PREFIX STREQUAL "" OR CMAKE_INSTALL_PREFIX STREQUAL
"/usr/local")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
elseif(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
endif()
cmessage(STATUS "CMAKE_INSTALL_PREFIX: \"${CMAKE_INSTALL_PREFIX}\"")
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE DEBUG)
elseif(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG)
endif()
cmessage(STATUS "CMAKE_BUILD_TYPE: \"${CMAKE_BUILD_TYPE}\"")
################################################################################
# Check Dependencies
################################################################################
################################## ROOT ######################################
include(${CMAKE_SOURCE_DIR}/cmake/ROOTSetup.cmake)
############################ Reweight Engines ################################
include(${CMAKE_SOURCE_DIR}/cmake/ReweightEnginesSetup.cmake)
+############################### GiBUU + NUANCE ####################################
+
+if(DEFINED USE_EXP AND USE_EXP)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DINMEMORYEVENTCLASS")
+endif()
+
+if(DEFINED USE_GiBUU AND USE_GiBUU)
+ cmessage(STATUS "Included GiBUU")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GiBUU_ENABLED__")
+ include(${CMAKE_SOURCE_DIR}/cmake/GiBUUSetup.cmake)
+endif()
+
+if(DEFINED USE_NUANCE AND USE_NUANCE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__NUANCE_ENABLED__")
+endif()
+
################################# Pythia6 ####################################
include(${CMAKE_SOURCE_DIR}/cmake/pythia6Setup.cmake)
################################## COMPILER ####################################
include(${CMAKE_SOURCE_DIR}/cmake/c++CompilerSetup.cmake)
################################################################################
################################# gperftools ###################################
include(${CMAKE_SOURCE_DIR}/cmake/gperfSetup.cmake)
################################### doxygen ###################################
include(${CMAKE_SOURCE_DIR}/cmake/docsSetup.cmake)
-################################################################################
-
-if(DEFINED USE_EXP AND USE_EXP)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DINMEMORYEVENTCLASS")
-endif()
-
-if(DEFINED USE_GiBUU AND USE_GiBUU)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GiBUU_ENABLED__")
- include(${CMAKE_SOURCE_DIR}/cmake/GiBUUSetup.cmake)
-endif()
-
-if(DEFINED USE_NUANCE AND USE_NUANCE)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__NUANCE_ENABLED__")
-endif()
-
-################################################################################
+###############################################################################
set(MINCODE
Routines
FCN)
set(CORE
MCStudies
FitBase
Splines
Reweight
Utils
#Devel
)
###############
# Allow compilation against single experiment folder
# Add later..
##############
set(EXPERIMENTS
ANL
ArgoNeuT
BEBC
BNL
Electron
FNAL
GGM
K2K
MINERvA
MiniBooNE
T2K)
set(EXP_INCLUDE_DIRECTORIES)
foreach(edir ${EXPERIMENTS})
set(EXP_INCLUDE_DIRECTORIES ${EXP_INCLUDE_DIRECTORIES};${CMAKE_SOURCE_DIR}/src/${edir})
endforeach()
cmessage(STATUS "Included experiments: ${EXP_INCLUDE_DIRECTORIES}")
foreach(mdir ${MINCODE})
cmessage (STATUS "Configuring directory: src/${mdir}")
add_subdirectory(src/${mdir})
endforeach()
foreach(edir ${EXPERIMENTS})
cmessage (STATUS "Configuring directory: src/${edir}")
add_subdirectory(src/${edir})
endforeach()
foreach(cdir ${CORE})
cmessage (STATUS "Configuring directory: src/${cdir}")
add_subdirectory(src/${cdir})
endforeach()
cmessage(STATUS "Module targets: ${MODULETargets}")
add_subdirectory(app)
add_subdirectory(src/Tests)
configure_file(cmake/setup.sh.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/setup.sh" @ONLY)
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/setup.sh" DESTINATION
${CMAKE_INSTALL_PREFIX})
install(PROGRAMS
"${PROJECT_SOURCE_DIR}/scripts/nuiscardgen" DESTINATION
bin)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 16b77c5..36fa5fe 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -1,132 +1,132 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
set(TARGETS_TO_BUILD)
if(USE_MINIMIZER)
add_executable(nuismin nuismin.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuismin)
target_link_libraries(nuismin ${MODULETargets})
target_link_libraries(nuismin ${CMAKE_DEPENDLIB_FLAGS})
target_link_libraries(nuismin ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuismin PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
add_executable(nuissplines nuissplines.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuissplines)
target_link_libraries(nuissplines ${MODULETargets})
target_link_libraries(nuissplines ${CMAKE_DEPENDLIB_FLAGS})
target_link_libraries(nuissplines ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuissplines PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
endif()
include_directories(${RWENGINE_INCLUDE_DIRECTORIES})
include_directories(${CMAKE_SOURCE_DIR}/src/Routines)
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
include_directories(${CMAKE_SOURCE_DIR}/src/Utils)
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(${EXP_INCLUDE_DIRECTORIES})
-if (USE_GENIE)
+if (BUILD_GEVGEN)
add_executable(gevgen_nuisance gEvGen_NUISANCE.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};gevgen_nuisance)
target_link_libraries(gevgen_nuisance ${MODULETargets})
target_link_libraries(gevgen_nuisance ${CMAKE_DEPENDLIB_FLAGS})
target_link_libraries(gevgen_nuisance ${ROOT_LIBS})
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
include_directories(${GENIE_INCLUDES}/Apps)
include_directories(${GENIE_INCLUDES}/FluxDrivers)
include_directories(${GENIE_INCLUDES}/EVGDrivers)
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(gevgen_nuisance PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
endif()
if (USE_GiBUU)
add_executable(DumpGiBUUEvents DumpGiBUUEvents.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};DumpGiBUUEvents)
target_link_libraries(DumpGiBUUEvents ${MODULETargets})
target_link_libraries(DumpGiBUUEvents ${CMAKE_DEPENDLIB_FLAGS})
target_link_libraries(DumpGiBUUEvents ${ROOT_LIBS})
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(DumpGiBUUEvents PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
endif()
add_executable(nuiscomp nuiscomp.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuiscomp)
target_link_libraries(nuiscomp ${MODULETargets})
target_link_libraries(nuiscomp ${CMAKE_DEPENDLIB_FLAGS})
target_link_libraries(nuiscomp ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuiscomp PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
add_executable(nuisflat nuisflat.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuisflat)
target_link_libraries(nuisflat ${MODULETargets})
target_link_libraries(nuisflat ${CMAKE_DEPENDLIB_FLAGS})
target_link_libraries(nuisflat ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuisflat PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
add_executable(nuissyst nuissyst.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuissyst)
target_link_libraries(nuissyst ${MODULETargets})
target_link_libraries(nuissyst ${CMAKE_DEPENDLIB_FLAGS})
target_link_libraries(nuissyst ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuissyst PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
if(USE_GENIE)
add_executable(PrepareGENIE PrepareGENIE.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};PrepareGENIE)
target_link_libraries(PrepareGENIE ${MODULETargets})
target_link_libraries(PrepareGENIE ${CMAKE_DEPENDLIB_FLAGS})
target_link_libraries(PrepareGENIE ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(PrepareGENIE PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
endif()
# PREPARE NUWRO
# Commented out for the time being until it is finished..
#if(USE_NuWro)
# add_executable(PrepareNuwro PrepareNuwro.cxx)
# set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};PrepareNuwro)
# target_link_libraries(PrepareNuwro ${MODULETargets})
# target_link_libraries(PrepareNuwro ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(PrepareNuwro ${ROOT_LIBS})
# if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
# set_target_properties(PrepareNuwro PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
# endif()
#endif()
install(TARGETS ${TARGETS_TO_BUILD} DESTINATION bin)
diff --git a/app/nuispreload.sh b/app/nuispreload.sh
index e66d166..bacb0cc 100644
--- a/app/nuispreload.sh
+++ b/app/nuispreload.sh
@@ -1,153 +1,239 @@
#!/bin/sh
opt=$1
-card=$2
+fullcard=$2
-if [[ card == "-copy" || card == "-clean" ]]
+if [[ card == "-copy" || card == "-clean" || card == "-make" ]]
then
echo "Switching"
opt=$2
- card=$1
+ fullcard=$1
+fi
+
+card=$(basename $fullcard)
+fulldir=$(dirname $fullcard)
+if [[ $card != ${fullcard} && $fulldir != $PWD ]]
+then
+ cp $fullcard $card
+fi
+
+allfiles=""
+if [[ $opt == "-make" ]]
+then
+ if [[ -e "$card" ]]
+ then
+ allfiles=""
+# echo "Copying files across from $card"
+ else
+ echo ""
+ return
+ fi
+
+ # Copy File
+ cp $card preload_${card}
+
+ # Strip out config replacers
+ for obj in $(\grep config $card);
+ do
+ for events in "NEUT_DIR" "GENIE_DIR" "NUWRO_DIR" "NUSANCE_DIR" "EVSPLN_DIR" "GIBUU_DIR"
+ do
+
+ if [[ $obj == ${events}"="* ]]
+ then
+ obj=${obj//\/\>/}
+ obj=${obj//${events}=/}
+ obj=${obj//\"/}
+
+# echo "Sedding : " sed -i -e "s#$events#$obj#g" preload_${card}
+ sed -i -e "s#@$events#$obj#g" preload_${card}
+ fi
+ done
+ done
+
+ # Make preload
+ for obj in $(\grep input preload_${card});
+ do
+
+ if [[ $obj != "input="* ]]
+ then
+ continue
+ fi
+
+ file=${obj//\"/}
+ file=${file//input=/}
+ file=${file//\/\>/}
+ file=${file//\.\//}
+
+ file=${file//\(/ }
+ file=${file//\)/ }
+ file=${file//\,/ }
+ file=${file//\;/ }
+
+ file=${file//GENIE:/ }
+ file=${file//NEUT:/ }
+ file=${file//NUWRO:/ }
+ file=${file//ROOT:/ }
+ file=${file//FEVENT:/ }
+
+ for newfile in $file;
+ do
+ base=$(basename $newfile)
+ if [[ "$base" != "$newfile" ]]
+ then
+ sed -i -e "s#$newfile#$base#g" preload_${card}
+ fi
+ allfiles=$newfile,$allfiles
+ done
+ done
+ echo $allfiles
fi
# Copy Files
if [[ $opt == "-copy" ]]
then
if [[ -e "$card" ]]
then
echo "Copying files across from $card"
else
echo "$card not found!"
return
fi
# Copy File
cp $card preload_${card}
# Strip out config replacers
- for obj in $(grep config $card);
+ for obj in $(\grep config $card);
do
for events in "NEUT_DIR" "GENIE_DIR" "NUWRO_DIR" "NUSANCE_DIR" "EVSPLN_DIR" "GIBUU_DIR"
do
if [[ $obj == ${events}"="* ]]
then
obj=${obj//\/\>/}
obj=${obj//${events}=/}
obj=${obj//\"/}
echo "Sedding : " sed -i -e "s#$events#$obj#g" preload_${card}
sed -i -e "s#@$events#$obj#g" preload_${card}
fi
done
done
# Make preload
- for obj in $(grep input preload_${card});
+ for obj in $(\grep input preload_${card});
do
+
if [[ $obj != "input="* ]]
then
continue
fi
file=${obj//\"/}
file=${file//input=/}
file=${file//\/\>/}
file=${file//\.\//}
file=${file//\(/ }
file=${file//\)/ }
file=${file//\,/ }
file=${file//\;/ }
file=${file//GENIE:/ }
file=${file//NEUT:/ }
file=${file//NUWRO:/ }
file=${file//ROOT:/ }
-
+ file=${file//FEVENT:/ }
+
for newfile in $file;
do
base=$(basename $newfile)
if [[ "$base" != "$newfile" ]]
then
- echo cp $newfile $base
- #cp -rvf $newfile $base
+ #echo cp $newfile $base
+ cp -rvf $newfile $base
sed -i -e "s#$newfile#$base#g" preload_${card}
else
echo "Not copying $base $newfile"
fi
done
done
fi
if [[ $opt == "-clean" ]]
then
if [[ -e "preload_${card}" ]]
then
echo "Cleaning from preload_${card}"
else
echo "No preload card found!"
return 0
fi
# Strip out config replacers
- for obj in $(grep config $card);
+ for obj in $(\grep config $card);
do
for events in "NEUT_DIR" "GENIE_DIR" "NUWRO_DIR" "NUSANCE_DIR" "EVSPLN_DIR" "GIBUU_DIR"
do
if [[ $obj == ${events}"="* ]]
then
obj=${obj//\/\>/}
obj=${obj//${events}=/}
obj=${obj//\"/}
echo "Sedding : " sed -i -e "s#$events#$obj#g" preload_${card}
sed -i -e "s#@$events#$obj#g" preload_${card}
fi
done
done
# Make preload
- for obj in $(grep input ${card});
+ for obj in $(\grep input ${card});
do
if [[ $obj != "input="* ]]
then
continue
fi
file=${obj//\"/}
file=${file//input=/}
file=${file//\/\>/}
file=${file//\.\//}
file=${file//\(/ }
file=${file//\)/ }
file=${file//\,/ }
file=${file//\;/ }
file=${file//GENIE:/ }
file=${file//NEUT:/ }
file=${file//NUWRO:/ }
file=${file//ROOT:/ }
+ file=${file//FEVENT:/ }
for newfile in $file;
do
base=$(basename $newfile)
if [[ "$base" != "$newfile" ]]
then
- echo rm $base
- #rm $base
+# echo rm $base
+ rm -v $base
else
echo "Not removing current folder file : $base $newfile"
fi
done
done
# Remove file
rm preload_${card}
+
+ if [[ $card != $fullcard ]]
+ then
+ rm $card
+ fi
fi
diff --git a/cmake/GENIESetup.cmake b/cmake/GENIESetup.cmake
index f67ba70..ec28dd6 100644
--- a/cmake/GENIESetup.cmake
+++ b/cmake/GENIESetup.cmake
@@ -1,161 +1,166 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
# TODO
# check system for libxml2
# check whether we need the includes
# check if we can use a subset of the GENIE libraries
################################################################################
# Check Dependencies
################################################################################
################################# GENIE ######################################
if(NOT DEFINED GENIE AND NOT DEFINED ENV{GENIE})
cmessage(FATAL_ERROR "Variable GENIE is not defined. "
"The location of a pre-built GENIE install must be defined either as"
" $ cmake -DGENIE=/path/to/GENIE or as and environment vairable"
" $ export GENIE=/path/to/GENIE")
endif()
if(NOT DEFINED GENIE AND DEFINED ENV{GENIE})
set(GENIE $ENV{GENIE})
endif()
+if (DEFINED BUILD_GEVGEN AND BUILD_GEVGEN)
+ cmessage(STATUS "Building custom gevgen")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GEVGEN_ENABLED__ ")
+endif()
+
execute_process (COMMAND genie-config
--libs OUTPUT_VARIABLE GENIE_LD_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND genie-config
--topsrcdir OUTPUT_VARIABLE GENIE_INCLUDES OUTPUT_STRIP_TRAILING_WHITESPACE)
################################ LHAPDF ######################################
if(NOT DEFINED LHAPDF_LIB AND NOT DEFINED ENV{LHAPDF_LIB})
cmessage(FATAL_ERROR "Variable LHAPDF_LIB is not defined. "
"The location of a pre-built lhapdf install must be defined either as"
" $ cmake -DLHAPDF_LIB=/path/to/LHAPDF_libraries or as and environment vairable"
" $ export LHAPDF_LIB=/path/to/LHAPDF_libraries")
endif()
if(NOT DEFINED LHAPDF_LIB AND DEFINED ENV{LHAPDF_LIB})
set(LHAPDF_LIB $ENV{LHAPDF_LIB})
endif()
if(NOT DEFINED LHAPDF_INC AND NOT DEFINED ENV{LHAPDF_INC})
cmessage(FATAL_ERROR "Variable LHAPDF_INC is not defined. "
"The location of a pre-built lhapdf install must be defined either as"
" $ cmake -DLHAPDF_INC=/path/to/LHAPDF_includes or as and environment vairable"
" $ export LHAPDF_INC=/path/to/LHAPDF_includes")
endif()
if(NOT DEFINED LHAPDF_INC AND DEFINED ENV{LHAPDF_INC})
set(LHAPDF_INC $ENV{LHAPDF_INC})
endif()
if(NOT DEFINED LHAPATH AND NOT DEFINED ENV{LHAPATH})
cmessage(FATAL_ERROR "Variable LHAPATH is not defined. "
"The location of a the LHAPATH directory must be defined either as"
" $ cmake -DLHAPATH=/path/to/LHAPATH or as and environment variable"
" $ export LHAPATH=/path/to/LHAPATH")
endif()
if(NOT DEFINED LHAPATH AND DEFINED ENV{LHAPATH})
set(LHAPATH $ENV{LHAPATH})
endif()
################################ LIBXML ######################################
if(NOT DEFINED LIBXML2_LIB AND NOT DEFINED ENV{LIBXML2_LIB})
cmessage(FATAL_ERROR "Variable LIBXML2_LIB is not defined. "
"The location of a pre-built libxml2 install must be defined either as"
" $ cmake -DLIBXML2_LIB=/path/to/LIBXML2_libraries or as and environment vairable"
" $ export LIBXML2_LIB=/path/to/LIBXML2_libraries")
endif()
if(NOT DEFINED LIBXML2_LIB AND DEFINED ENV{LIBXML2_LIB})
set(LIBXML2_LIB $ENV{LIBXML2_LIB})
endif()
if(NOT DEFINED LIBXML2_INC AND NOT DEFINED ENV{LIBXML2_INC})
cmessage(FATAL_ERROR "Variable LIBXML2_INC is not defined. "
"The location of a pre-built libxml2 install must be defined either as"
" $ cmake -DLIBXML2_INC=/path/to/LIBXML2_includes or as and environment vairable"
" $ export LIBXML2_INC=/path/to/LIBXML2_includes")
endif()
if(NOT DEFINED LIBXML2_INC AND DEFINED ENV{LIBXML2_INC})
set(LIBXML2_INC $ENV{LIBXML2_INC})
endif()
############################### log4cpp ######################################
if(NOT DEFINED LOG4CPP_LIB AND NOT DEFINED ENV{LOG4CPP_LIB})
cmessage(FATAL_ERROR "Variable LOG4CPP_LIB is not defined. "
"The location of a pre-built log4cpp install must be defined either as"
" $ cmake -DLOG4CPP_LIB=/path/to/LOG4CPP_libraries or as and environment vairable"
" $ export LOG4CPP_LIB=/path/to/LOG4CPP_libraries")
endif()
if(NOT DEFINED LOG4CPP_LIB AND DEFINED ENV{LOG4CPP_LIB})
set(LOG4CPP_LIB $ENV{LOG4CPP_LIB})
endif()
if(NOT DEFINED LOG4CPP_INC AND NOT DEFINED ENV{LOG4CPP_INC})
cmessage(FATAL_ERROR "Variable LOG4CPP_INC is not defined. "
"The location of a pre-built log4cpp install must be defined either as"
" $ cmake -DLOG4CPP_INC=/path/to/LOG4CPP_includes or as and environment vairable"
" $ export LOG4CPP_INC=/path/to/LOG4CPP_includes")
endif()
if(NOT DEFINED LOG4CPP_INC AND DEFINED ENV{LOG4CPP_INC})
set(LOG4CPP_INC $ENV{LOG4CPP_INC})
endif()
################################################################################
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GENIE_ENABLED__ ")
set(RWENGINE_INCLUDE_DIRECTORIES ${RWENGINE_INCLUDE_DIRECTORIES}
${GENIE_INCLUDES}
${GENIE_INCLUDES}/GHEP
${GENIE_INCLUDES}/Ntuple
${GENIE_INCLUDES}/ReWeight
${LHAPDF_INC}
${LIBXML2_INC}
${LOG4CPP_INC})
set(RWENGINE_LINKER_FLAGS "${RWENGINE_LINKER_FLAGS} ${GENIE_LD_FLAGS} -L${LHAPDF_LIB} -lLHAPDF -L${LIBXML2_LIB} -lxml2 -L${LOG4CPP_LIB} -llog4cpp")
set(NEED_PYTHIA6 TRUE)
set(NEED_ROOTPYTHIA6 TRUE)
set(NEED_ROOTEVEGEN TRUE)
diff --git a/cmake/HepMC.cmake b/cmake/HepMC.cmake
new file mode 100644
index 0000000..6133831
--- /dev/null
+++ b/cmake/HepMC.cmake
@@ -0,0 +1,36 @@
+# 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 <http://www.gnu.org/licenses/>.
+################################################################################
+
+
+
+if(NOT DEFINED ENV{HEPMC})
+
+ cmessage(FATAL_ERROR "Environment variable NUWRO is not defined. "
+ "This must be set to point to a prebuilt NuWro instance.")
+
+endif()
+
+set(HEPMC $ENV{HEPMC})
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__HEPMC_ENABLED__ ")
+
+LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES ${HEPMC}/include/HepMC/ ${HEPMC}/include/ ${HEPMC}/include/SimpleVector.h )
+
+set(RWENGINE_LINKER_FLAGS "${RWENGINE_LINKER_FLAGS} -L${HEPMC}/lib/ -lHepMC -lHepMCfio")
+
diff --git a/cmake/ReweightEnginesSetup.cmake b/cmake/ReweightEnginesSetup.cmake
index a36bcb3..8f99135 100644
--- a/cmake/ReweightEnginesSetup.cmake
+++ b/cmake/ReweightEnginesSetup.cmake
@@ -1,67 +1,83 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
set(RWENGINE_INCLUDE_DIRECTORIES "")
################################## NEUT ######################################
if(DEFINED USE_NEUT AND USE_NEUT)
include(${CMAKE_SOURCE_DIR}/cmake/NEUTSetup.cmake)
cmessage(STATUS "Using NEUT Reweight engine.")
else()
set(USE_NEUT 0)
endif()
################################# NuWro ######################################
if(DEFINED USE_NuWro AND USE_NuWro)
include(${CMAKE_SOURCE_DIR}/cmake/NuWroSetup.cmake)
cmessage(STATUS "Using NuWro Reweight engine.")
else()
set(USE_NuWro 0)
endif()
################################## GENIE #####################################
if(DEFINED USE_GENIE AND USE_GENIE)
include(${CMAKE_SOURCE_DIR}/cmake/GENIESetup.cmake)
cmessage(STATUS "Using GENIE Reweight engine.")
else()
set(USE_GENIE 0)
endif()
+
+if(DEFINED BUILD_GEVGEN AND BUILD_GEVGEN)
+ cmessage(STATUS "Building custom gevgen.")
+else()
+set(BUILD_GEVGEN 0)
+endif()
+
################################## NIWG ######################################
if(DEFINED USE_NIWG AND USE_NIWG)
include(${CMAKE_SOURCE_DIR}/cmake/NIWGSetup.cmake)
cmessage(STATUS "Using NIWG Reweight engine.")
else()
set(USE_NIWG 0)
endif()
################################## T2K ######################################
if(DEFINED USE_T2K AND USE_T2K)
include(${CMAKE_SOURCE_DIR}/cmake/T2KSetup.cmake)
cmessage(STATUS "Using T2K Reweight engine.")
else()
set(USE_T2K 0)
endif()
+################################# HEPMC ########################################
+if(DEFINED USE_HEPMC AND USE_HEPMC)
+ include(${CMAKE_SOURCE_DIR}/cmake/HepMC.cmake)
+ cmessage(STATUS "Using HepMC engine.")
+else()
+ set(USE_HEPMC 0)
+endif()
+
+
cmessage(STATUS "Reweight engine include directories: ${RWENGINE_INCLUDE_DIRECTORIES}")
if(DEFINED NEED_ROOTEVEGEN AND NEED_ROOTEVEGEN)
cmessage(STATUS "Require ROOT eve generation libraries")
set(ROOT_LIBS Eve;EG;TreePlayer;Geom;Ged;Gui;${ROOT_LIBS})
endif()
if(DEFINED NEED_ROOTPYTHIA6 AND NEED_ROOTPYTHIA6)
cmessage(STATUS "Require ROOT Pythia6 libraries")
set(ROOT_LIBS ${ROOT_LIBS};EGPythia6;Pythia6)
endif()
diff --git a/data/MiniBooNE/anti-ccqe/asqq_bkg_ccpim.txt~ b/data/MiniBooNE/anti-ccqe/asqq_bkg_ccpim.txt~
deleted file mode 100755
index f765fb9..0000000
--- a/data/MiniBooNE/anti-ccqe/asqq_bkg_ccpim.txt~
+++ /dev/null
@@ -1,36 +0,0 @@
-0.00 3.425e-39
-0.05 2.353e-39
-0.10 1.473e-39
-0.15 9.852e-40
-0.20 6.747e-40
-0.25 4.559e-40
-0.30 3.169e-40
-2.202e-40
-1.563e-40
-1.120e-40
-6.994e-41
-3.758e-41
-2.095e-41
-7.650e-42
-7.006e-43
-1.682e-44
-1.401e-45
-
-0.00
-0.05
-0.10
-0.15
-0.20
-0.25
-0.30
-0.35
-0.40
-0.45
-0.50
-0.60
-0.70
-0.80
-1.00
-1.20
-1.50
-2.00
diff --git a/data/MiniBooNE/anti-ccqe/asqq_bkg_ccqe.txt~ b/data/MiniBooNE/anti-ccqe/asqq_bkg_ccqe.txt~
deleted file mode 100755
index 85593c0..0000000
--- a/data/MiniBooNE/anti-ccqe/asqq_bkg_ccqe.txt~
+++ /dev/null
@@ -1,17 +0,0 @@
-4.400e-39
-3.023e-39
-1.920e-39
-1.297e-39
-8.972e-40
-6.183e-40
-4.397e-40
-3.126e-40
-2.260e-40
-1.661e-40
-1.081e-40
-6.207e-41
-3.882e-41
-2.119e-41
-9.146e-42
-2.368e-42
-1.037e-43
diff --git a/data/MiniBooNE/ccqe/asqq_bkg.txt~ b/data/MiniBooNE/ccqe/asqq_bkg.txt~
deleted file mode 100755
index ba586ff..0000000
--- a/data/MiniBooNE/ccqe/asqq_bkg.txt~
+++ /dev/null
@@ -1,18 +0,0 @@
-0 3.876E-39 0.0
-0.05 3.961E-39 0.0
-0.1 3.671E-39 0.0
-0.15 3.064E-39 0.0
-0.2 2.522E-39 0.0
-0.25 2.040E-39 0.0
-0.3 1.633E-39 0.0
-0.35 1.290E-39 0.0
-0.4 1.018E-39 0.0
-0.45 7.874E-40 0.0
-0.5 5.524E-40 0.0
-0.6 3.532E-40 0.0
-0.7 2.302E-40 0.0
-0.8 1.339E-40 0.0
-1.0 6.398E-41 0.0
-1.2 2.466E-41 0.0
-1.5 3.645E-42 0.0
-2.0 0.0 0.0
diff --git a/data/MiniBooNE/ccqe/asqq_con.txt.~1.1.~ b/data/MiniBooNE/ccqe/asqq_con.txt.~1.1.~
deleted file mode 100755
index d48b5f1..0000000
--- a/data/MiniBooNE/ccqe/asqq_con.txt.~1.1.~
+++ /dev/null
@@ -1,18 +0,0 @@
-0 7.681E-39 1.493E-39
-0.05 1.457E-38 1.18E-39
-0.1 1.684E-38 9.72E-40
-0.15 1.703E-38 8.216E-40
-0.2 1.589E-38 5.134E-40
-0.25 1.449E-38 3.983E-40
-0.3 1.329E-38 3.386E-40
-0.35 1.172E-38 2.629E-40
-0.4 1.03E-38 2.457E-40
-0.45 8.852E-39 2.975E-40
-0.5 7.164E-39 3.193E-40
-0.6 5.425E-39 3.212E-40
-0.7 4.032E-39 3.442E-40
-0.8 2.713E-39 2.885E-40
-1 1.62E-39 2.25E-40
-1.2 9.915E-40 1.407E-40
-1.5 5.474E-40 2.504E-40
-2 0 0
diff --git a/data/MiniBooNE/ccqe/asqq_cont_minbin.txt~ b/data/MiniBooNE/ccqe/asqq_cont_minbin.txt~
deleted file mode 100755
index fb27968..0000000
--- a/data/MiniBooNE/ccqe/asqq_cont_minbin.txt~
+++ /dev/null
@@ -1,20 +0,0 @@
-0 7.681E-39 1.493E-39
-0.05 1.457E-38 1.18E-39
-0.1 1.684E-38 9.72E-40
-0.15 1.703E-38 8.216E-40
-0.2 1.589E-38 5.134E-40
-0.25 1.449E-38 3.983E-40
-0.3 1.329E-38 3.386E-40
-0.35 1.172E-38 2.629E-40
-0.4 1.03E-38 2.457E-40
-0.45 8.852E-39 2.975E-40
-0.5 7.164E-39 3.193E-40
-0.6 5.425E-39 3.212E-40
-0.7 4.032E-39 3.442E-40
-0.8 2.713E-39 2.885E-40
-1 1.62E-39 2.25E-40
-1.2 9.915E-40 1.407E-40
-1.5 5.474E-40 2.504E-40
-2 0 0
-
-
diff --git a/data/MiniBooNE/ccqe/asqq_like.txt.~1.1.~ b/data/MiniBooNE/ccqe/asqq_like.txt.~1.1.~
deleted file mode 100755
index 6e2d649..0000000
--- a/data/MiniBooNE/ccqe/asqq_like.txt.~1.1.~
+++ /dev/null
@@ -1,18 +0,0 @@
-0 1.1557E-38 1.493E-39
-0.05 1.8531E-38 1.18E-39
-0.1 2.0511E-38 9.72E-40
-0.15 2.0094E-38 8.216E-40
-0.2 1.8412E-38 5.134E-40
-0.25 1.653E-38 3.983E-40
-0.3 1.4923E-38 3.386E-40
-0.35 1.301E-38 2.629E-40
-0.4 1.1318E-38 2.457E-40
-0.45 9.6394E-39 2.975E-40
-0.5 7.7164E-39 3.193E-40
-0.6 5.7782E-39 3.212E-40
-0.7 4.2622E-39 3.442E-40
-0.8 2.8469E-39 2.885E-40
-1 1.68398E-39 2.25E-40
-1.2 1.01616E-39 1.407E-40
-1.5 5.51045E-40 2.504E-40
-2 0 0
diff --git a/data/MiniBooNE/ncqe/Enriched-P.txt b/data/MiniBooNE/ncqe/Enriched-P.txt
new file mode 100644
index 0000000..6ee25b1
--- /dev/null
+++ b/data/MiniBooNE/ncqe/Enriched-P.txt
@@ -0,0 +1,2 @@
+4.600000e+02 4.570000e+02 4.390000e+02 4.310000e+02 3.800000e+02 3.830000e+02 3.530000e+02 3.630000e+02 3.710000e+02 3.960000e+02 2.750000e+02 2.760000e+02 2.220000e+02 2.030000e+02 2.170000e+02 2.240000e+02 2.000000e+02 1.840000e+02 1.970000e+02 1.590000e+02 1.550000e+02 1.620000e+02 1.370000e+02 1.520000e+02 1.260000e+02 1.180000e+02 1.330000e+02 1.170000e+02 1.380000e+02 1.230000e+02
+6.544238e+01 6.131658e+01 6.802268e+01 6.614949e+01 5.759906e+01 5.948360e+01 6.494799e+01 7.288111e+01 7.266334e+01 8.067760e+01 7.378685e+01 7.559236e+01 6.692164e+01 5.954329e+01 5.842109e+01 6.112299e+01 5.521307e+01 5.631305e+01 5.625658e+01 5.765196e+01 6.470708e+01 6.157652e+01 6.896612e+01 5.997896e+01 7.765791e+01 6.953401e+01 7.666214e+01 8.304232e+01 9.066559e+01 1.028902e+02
diff --git a/data/MiniBooNE/ncqe/bg1 b/data/MiniBooNE/ncqe/bg1
new file mode 100755
index 0000000..305f84f
--- /dev/null
+++ b/data/MiniBooNE/ncqe/bg1
@@ -0,0 +1,230 @@
+****************************************************************************************************
+This file includes true energy spectra and migration matrices for the high energy neutral current elastic sample proton (the numerator of the ratio)
+with reconstructed energy from 350 to 800 MeV
+****************************************************************************************************
+
+Table 1. True nucleon kinetic energy spectra before any cuts for different possible signal events.
+Histograms have 30 bins from 300.0 MeV to 900.0 MeV with the first underflow bin and the last overflow bin.
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ energy range(MeV)| Ttrue<300.0 300.0<Ttrue<321.4 321.4<Ttrue<342.9 342.9<Ttrue<364.3 364.3<Ttrue<385.7 385.7<Ttrue<407.1 407.1<Ttrue<428.6 428.6<Ttrue<450.0 450.0<Ttrue<471.4 471.4<Ttrue<492.9 492.9<Ttrue<514.3 514.3<Ttrue<535.7 535.7<Ttrue<557.1 557.1<Ttrue<578.6 578.6<Ttrue<600.0 600.0<Ttrue<621.4 621.4<Ttrue<642.9 642.9<Ttrue<664.3 664.3<Ttrue<685.7 685.7<Ttrue<707.1 707.1<Ttrue<728.6 728.6<Ttrue<750.0 750.0<Ttrue<771.4 771.4<Ttrue<792.9 792.9<Ttrue<814.3 814.3<Ttrue<835.7 835.7<Ttrue<857.1 857.1<Ttrue<878.6 878.6<Ttrue<900.0 Ttrue>900.0
+Event type |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Hydrogen proton | 3.188536e+04 9.420812e+02 8.211805e+02 7.449399e+02 6.663803e+02 5.860610e+02 5.338985e+02 4.707225e+02 4.162125e+02 3.756495e+02 3.456960e+02 3.169470e+02 2.793783e+02 2.359252e+02 2.196198e+02 2.077616e+02 1.857598e+02 1.623421e+02 1.444003e+02 1.353946e+02 1.197283e+02 1.074268e+02 1.000333e+02 8.884372e+01 7.125678e+01 6.624471e+01 6.212611e+01 5.807496e+01 5.198500e+01 4.785472e+02
+Carbon single proton | 5.080104e+04 2.087732e+03 1.874588e+03 1.657564e+03 1.534215e+03 1.340224e+03 1.211969e+03 1.098258e+03 9.719964e+02 8.773145e+02 7.931381e+02 6.931583e+02 6.018091e+02 5.343221e+02 5.017179e+02 4.361089e+02 3.916575e+02 3.482537e+02 3.197408e+02 2.786784e+02 2.440201e+02 2.195820e+02 2.039021e+02 1.822205e+02 1.512134e+02 1.347763e+02 1.311109e+02 1.110404e+02 9.281456e+01 8.753286e+02
+Carbon multiple proton | 1.673036e+04 7.758530e+02 7.200034e+02 6.677593e+02 5.818390e+02 5.377895e+02 4.927456e+02 4.718807e+02 4.141463e+02 3.786763e+02 3.533113e+02 3.347661e+02 2.952560e+02 2.780787e+02 2.589538e+02 2.292548e+02 2.176995e+02 1.968736e+02 1.803501e+02 1.693463e+02 1.615091e+02 1.464714e+02 1.372290e+02 1.301426e+02 1.199919e+02 1.133943e+02 1.051643e+02 9.543548e+01 9.260163e+01 1.635561e+03
+Carbon neutron | 8.352705e+04 3.356220e+03 3.035614e+03 2.745269e+03 2.469666e+03 2.254650e+03 1.999142e+03 1.824208e+03 1.614933e+03 1.468617e+03 1.328453e+03 1.188461e+03 1.053541e+03 9.434184e+02 8.665288e+02 7.738669e+02 6.971123e+02 6.482311e+02 5.639403e+02 5.276820e+02 4.747883e+02 4.112441e+02 3.717055e+02 3.435565e+02 3.223633e+02 2.878553e+02 2.548855e+02 2.412311e+02 2.182912e+02 2.746875e+03
+Irreducible | 1.732324e+03 9.586310e+02 1.204981e+03 1.401849e+03 1.506458e+03 1.575400e+03 1.598755e+03 1.582631e+03 1.543206e+03 1.495070e+03 1.431306e+03 1.300136e+03 1.235545e+03 1.206913e+03 1.109478e+03 1.036218e+03 9.363481e+02 8.711620e+02 8.197590e+02 7.586432e+02 7.026148e+02 6.515580e+02 5.948090e+02 5.515873e+02 5.110844e+02 4.731385e+02 4.315596e+02 4.156273e+02 3.654221e+02 4.277227e+03
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+
+
+Table 2. Reconstructed nucleon kinetic energy spectra for the data and the MC background prediction.
+The histogram has 30 bins from 350.0 MeV to 800.0 MeV.
+====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ energy range(MeV)| 350.0<Trec<365.0 365.0<Trec<380.0 380.0<Trec<395.0 395.0<Trec<410.0 410.0<Trec<425.0 425.0<Trec<440.0 440.0<Trec<455.0 455.0<Trec<470.0 470.0<Trec<485.0 485.0<Trec<500.0 500.0<Trec<515.0 515.0<Trec<530.0 530.0<Trec<545.0 545.0<Trec<560.0 560.0<Trec<575.0 575.0<Trec<590.0 590.0<Trec<605.0 605.0<Trec<620.0 620.0<Trec<635.0 635.0<Trec<650.0 650.0<Trec<665.0 665.0<Trec<680.0 680.0<Trec<695.0 695.0<Trec<710.0 710.0<Trec<725.0 725.0<Trec<740.0 740.0<Trec<755.0 755.0<Trec<770.0 770.0<Trec<785.0 785.0<Trec<800.0
+Event type |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Data | 4.600000e+02 4.570000e+02 4.390000e+02 4.310000e+02 3.800000e+02 3.830000e+02 3.530000e+02 3.630000e+02 3.710000e+02 3.960000e+02 2.750000e+02 2.760000e+02 2.220000e+02 2.030000e+02 2.170000e+02 2.240000e+02 2.000000e+02 1.840000e+02 1.970000e+02 1.590000e+02 1.550000e+02 1.620000e+02 1.370000e+02 1.520000e+02 1.260000e+02 1.180000e+02 1.330000e+02 1.170000e+02 1.380000e+02 1.230000e+02
+Backgrounds | 6.544238e+01 6.131658e+01 6.802268e+01 6.614949e+01 5.759906e+01 5.948360e+01 6.494799e+01 7.288111e+01 7.266334e+01 8.067760e+01 7.378685e+01 7.559236e+01 6.692164e+01 5.954329e+01 5.842109e+01 6.112299e+01 5.521307e+01 5.631305e+01 5.625658e+01 5.765196e+01 6.470708e+01 6.157652e+01 6.896612e+01 5.997896e+01 7.765791e+01 6.953401e+01 7.666214e+01 8.304232e+01 9.066559e+01 1.028902e+02
+====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+
+
+Table 3. Migration matrix (Ttrue vs Trec) for the neutral current elastic on hydrogen protons.
+The 2-dimensional histogram (true vs reconstructed energy) with 30 x 30 bins for the events that pass the cuts.
+True energy is from 300.0 MeV to 900.0 MeV with the first underflow bin and the last overflow bin; reconstructed energy from 350.0 MeV to 800.0 MeV.
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ energy range(MeV)| Ttrue<300.0 300.0<Ttrue<321.4 321.4<Ttrue<342.9 342.9<Ttrue<364.3 364.3<Ttrue<385.7 385.7<Ttrue<407.1 407.1<Ttrue<428.6 428.6<Ttrue<450.0 450.0<Ttrue<471.4 471.4<Ttrue<492.9 492.9<Ttrue<514.3 514.3<Ttrue<535.7 535.7<Ttrue<557.1 557.1<Ttrue<578.6 578.6<Ttrue<600.0 600.0<Ttrue<621.4 621.4<Ttrue<642.9 642.9<Ttrue<664.3 664.3<Ttrue<685.7 685.7<Ttrue<707.1 707.1<Ttrue<728.6 728.6<Ttrue<750.0 750.0<Ttrue<771.4 771.4<Ttrue<792.9 792.9<Ttrue<814.3 814.3<Ttrue<835.7 835.7<Ttrue<857.1 857.1<Ttrue<878.6 878.6<Ttrue<900.0 Ttrue>900.0
+energy range(MeV) |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+350.0<Trec<365.0 | 3.143109e-01 7.857774e-01 1.571555e+00 6.129064e+00 2.047963e+01 2.520700e+01 1.716288e+01 8.172085e+00 6.286219e+00 2.043021e+00 1.257244e+00 4.714664e-01 4.714664e-01 3.143109e-01 7.857774e-01 0.000000e+00 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01
+365.0<Trec<380.0 | 1.744198e-01 3.143109e-01 6.286219e-01 2.985954e+00 1.367253e+01 2.671643e+01 2.404479e+01 1.401282e+01 8.486396e+00 4.243198e+00 2.985954e+00 9.429328e-01 1.100088e+00 6.286219e-01 4.714664e-01 0.000000e+00 4.714664e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
+380.0<Trec<395.0 | 0.000000e+00 0.000000e+00 3.143109e-01 7.857774e-01 6.914841e+00 1.917297e+01 2.504022e+01 1.795277e+01 1.040909e+01 4.086042e+00 3.961867e+00 2.357332e+00 1.571555e+00 1.571555e+00 3.143109e-01 3.143109e-01 0.000000e+00 3.143109e-01 1.571555e-01 0.000000e+00 4.714664e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 0.000000e+00 0.000000e+00 1.624532e-01
+395.0<Trec<410.0 | 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 2.043021e+00 1.386875e+01 2.467341e+01 2.848254e+01 1.398684e+01 8.800707e+00 3.614576e+00 3.300265e+00 9.429328e-01 6.286219e-01 6.286219e-01 4.714664e-01 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01
+410.0<Trec<425.0 | 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 9.429328e-01 6.129064e+00 2.124178e+01 2.487771e+01 1.650133e+01 1.398684e+01 6.781117e+00 2.985954e+00 1.414399e+00 1.414399e+00 7.857774e-01 6.286219e-01 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
+425.0<Trec<440.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 2.828799e+00 1.084373e+01 2.074452e+01 2.278754e+01 1.576171e+01 9.467960e+00 6.757685e+00 7.857774e-01 1.571555e+00 9.429328e-01 1.100088e+00 1.100088e+00 1.571555e-01 3.143109e-01 1.571555e-01 0.000000e+00 0.000000e+00 3.143109e-01 0.000000e+00 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01
+440.0<Trec<455.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 6.286219e-01 4.400353e+00 1.353161e+01 2.498772e+01 2.074452e+01 1.198999e+01 5.814753e+00 4.557509e+00 1.100088e+00 1.728710e+00 9.429328e-01 1.571555e-01 4.714664e-01 1.571555e-01 3.143109e-01 1.571555e-01 1.571555e-01 0.000000e+00 1.865434e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00
+455.0<Trec<470.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 2.671643e+00 6.286219e+00 1.873052e+01 2.388763e+01 1.681564e+01 6.757685e+00 5.186131e+00 2.671643e+00 1.885866e+00 9.429328e-01 6.286219e-01 1.571555e-01 7.857774e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01
+470.0<Trec<485.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 2.828799e+00 8.329240e+00 1.699335e+01 2.231608e+01 1.433351e+01 6.600530e+00 3.457420e+00 2.585913e+00 8.198956e-01 9.429328e-01 4.714664e-01 1.571555e-01 1.571555e-01 4.714664e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00
+485.0<Trec<500.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 2.514488e+00 1.150095e+01 1.794933e+01 1.775857e+01 8.800707e+00 3.771731e+00 3.614576e+00 2.357332e+00 9.429328e-01 1.571555e-01 4.714664e-01 7.857774e-01 0.000000e+00 3.143109e-01 1.571555e-01 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01
+500.0<Trec<515.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 3.614576e+00 1.194382e+01 1.823004e+01 1.257244e+01 4.086042e+00 2.671643e+00 2.514488e+00 7.857774e-01 9.429328e-01 7.857774e-01 3.143109e-01 4.714664e-01 1.571555e-01 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 1.571555e-01
+515.0<Trec<530.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 6.286219e-01 4.400353e+00 1.667101e+01 1.524408e+01 5.657597e+00 2.514488e+00 2.043021e+00 9.429328e-01 1.257244e+00 1.100088e+00 7.857774e-01 1.571555e-01 1.100088e+00 4.714664e-01 3.143109e-01 1.571555e-01 1.571555e-01 0.000000e+00 1.571555e-01 1.571555e-01 3.143109e-01
+530.0<Trec<545.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.414399e+00 7.700618e+00 1.605332e+01 7.229152e+00 3.500324e+00 3.300265e+00 8.155019e-01 9.429328e-01 1.257244e+00 9.429328e-01 3.143109e-01 4.642729e-01 3.143109e-01 3.143109e-01 3.143109e-01 1.571555e-01 3.143109e-01 1.571555e-01 0.000000e+00 1.571555e-01
+545.0<Trec<560.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 3.457420e+00 1.058487e+01 1.179867e+01 4.086042e+00 2.200177e+00 6.286219e-01 9.429328e-01 7.857774e-01 6.286219e-01 4.714664e-01 4.714664e-01 3.143109e-01 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
+560.0<Trec<575.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.257244e+00 6.286219e+00 1.196658e+01 6.165328e+00 3.928887e+00 2.514488e+00 1.728710e+00 1.257244e+00 1.100088e+00 3.143109e-01 1.571555e-01 4.714664e-01 1.571555e-01 3.143109e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00
+575.0<Trec<590.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 4.086042e+00 9.272173e+00 1.041625e+01 7.407070e+00 3.614576e+00 2.985954e+00 1.571555e+00 6.620604e-01 4.714664e-01 4.714664e-01 3.143109e-01 6.286219e-01 1.571555e-01 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 1.571555e-01
+590.0<Trec<605.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 1.257244e+00 5.186131e+00 9.429328e+00 7.700618e+00 5.209603e+00 1.728710e+00 2.828799e+00 6.286219e-01 9.429328e-01 3.143109e-01 1.571555e-01 1.571555e-01 1.571555e-01 1.571555e-01 3.143109e-01 1.571555e-01 0.000000e+00 3.143109e-01
+605.0<Trec<620.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 2.200177e+00 8.014929e+00 8.643551e+00 5.500442e+00 2.985954e+00 2.828799e+00 2.076816e+00 7.857774e-01 1.728710e+00 1.273876e+00 4.714664e-01 7.857774e-01 1.571555e-01 3.143109e-01 3.143109e-01 0.000000e+00 3.143109e-01
+620.0<Trec<635.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 7.857774e-01 3.457420e+00 1.043518e+01 7.857774e+00 2.985954e+00 1.571555e+00 1.885866e+00 4.714664e-01 1.257244e+00 9.429328e-01 4.714664e-01 4.714664e-01 0.000000e+00 4.714664e-01 3.143109e-01 3.143109e-01 6.286219e-01
+635.0<Trec<650.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.881355e-01 0.000000e+00 0.000000e+00 3.454780e-01 0.000000e+00 6.286219e-01 3.928887e+00 6.935421e+00 3.143110e+00 2.200177e+00 1.885866e+00 1.100088e+00 6.286219e-01 3.143109e-01 1.571555e-01 6.286219e-01 3.143109e-01 1.571555e-01 0.000000e+00 6.286219e-01 7.857774e-01
+650.0<Trec<665.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 1.728710e+00 5.500442e+00 5.028975e+00 1.728710e+00 2.671643e+00 2.043021e+00 9.429328e-01 9.429328e-01 7.857774e-01 0.000000e+00 3.143109e-01 0.000000e+00 3.143109e-01 1.571555e-01 3.143109e-01
+665.0<Trec<680.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.100088e+00 3.928887e+00 6.600530e+00 3.457420e+00 2.514488e+00 1.257244e+00 1.100088e+00 7.857774e-01 3.143109e-01 6.286219e-01 1.571555e-01 3.143109e-01 0.000000e+00 3.143109e-01 7.857774e-01
+680.0<Trec<695.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e+00 4.086042e+00 3.339723e+00 1.885866e+00 1.728710e+00 1.728710e+00 7.857774e-01 6.286219e-01 6.286219e-01 4.714664e-01 6.286219e-01 3.143109e-01 1.571555e-01 1.257244e+00
+695.0<Trec<710.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 2.074188e+00 4.714664e+00 3.143110e+00 2.200177e+00 1.414399e+00 9.429328e-01 9.429328e-01 4.714664e-01 4.714664e-01 1.571555e-01 3.143109e-01 1.571555e-01 1.131068e+00
+710.0<Trec<725.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 1.728710e+00 1.414399e+00 3.143110e+00 1.257244e+00 1.414399e+00 1.100088e+00 3.143109e-01 7.857774e-01 4.714664e-01 4.714664e-01 4.714664e-01 0.000000e+00 3.143109e-01
+725.0<Trec<740.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 4.714664e-01 1.728710e+00 3.143110e+00 1.885866e+00 1.100088e+00 1.414399e+00 1.257244e+00 6.286219e-01 6.286219e-01 4.714664e-01 0.000000e+00 0.000000e+00 1.100088e+00
+740.0<Trec<755.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 9.697089e-01 2.514488e+00 2.200177e+00 7.857774e-01 1.257244e+00 1.100088e+00 4.714664e-01 4.714664e-01 1.257244e+00 0.000000e+00 4.714664e-01 1.571555e+00
+755.0<Trec<770.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e+00 1.571555e+00 2.200177e+00 1.571555e+00 1.257244e+00 1.100088e+00 3.143109e-01 9.429328e-01 6.286219e-01 4.714664e-01 1.571555e+00
+770.0<Trec<785.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.742724e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 3.143109e-01 2.043021e+00 1.257244e+00 1.257244e+00 6.286219e-01 6.286219e-01 9.429328e-01 4.714664e-01 1.571555e-01 1.571555e-01 7.857774e-01
+785.0<Trec<800.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 9.429328e-01 9.429328e-01 1.257244e+00 1.602836e+00 9.429328e-01 1.257244e+00 8.169444e-01 4.714664e-01 1.100088e+00 1.571555e-01 1.571555e+00
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+
+
+Table 4. Migration matrix (Ttrue vs Trec) for the neutral current elastic on Carbon protons and with no FSI.
+The 2-dimensional histogram (true vs reconstructed energy) with 30 x 30 bins for the events that pass the cuts.
+True energy is from 300.0 MeV to 900.0 MeV with the first underflow bin and the last overflow bin; reconstructed energy from 350.0 MeV to 800.0 MeV.
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ energy range(MeV)| Ttrue<300.0 300.0<Ttrue<321.4 321.4<Ttrue<342.9 342.9<Ttrue<364.3 364.3<Ttrue<385.7 385.7<Ttrue<407.1 407.1<Ttrue<428.6 428.6<Ttrue<450.0 450.0<Ttrue<471.4 471.4<Ttrue<492.9 492.9<Ttrue<514.3 514.3<Ttrue<535.7 535.7<Ttrue<557.1 557.1<Ttrue<578.6 578.6<Ttrue<600.0 600.0<Ttrue<621.4 621.4<Ttrue<642.9 642.9<Ttrue<664.3 664.3<Ttrue<685.7 685.7<Ttrue<707.1 707.1<Ttrue<728.6 728.6<Ttrue<750.0 750.0<Ttrue<771.4 771.4<Ttrue<792.9 792.9<Ttrue<814.3 814.3<Ttrue<835.7 835.7<Ttrue<857.1 857.1<Ttrue<878.6 878.6<Ttrue<900.0 Ttrue>900.0
+energy range(MeV) |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+350.0<Trec<365.0 | 3.143109e-01 2.200177e+00 6.600530e+00 1.665848e+01 4.970035e+01 5.307512e+01 3.837013e+01 1.933012e+01 1.021511e+01 6.443374e+00 5.028975e+00 1.257244e+00 1.728710e+00 9.429328e-01 6.286219e-01 3.143109e-01 3.143109e-01 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
+365.0<Trec<380.0 | 1.571555e-01 4.714664e-01 2.671643e+00 1.006854e+01 3.008980e+01 6.546876e+01 5.709493e+01 3.227182e+01 1.619372e+01 9.429328e+00 5.217144e+00 3.143110e+00 1.414399e+00 1.100088e+00 4.714664e-01 1.100088e+00 3.143109e-01 4.714664e-01 0.000000e+00 6.286219e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.386286e-01
+380.0<Trec<395.0 | 1.571555e-01 1.571555e-01 1.257244e+00 2.985954e+00 1.859709e+01 5.078796e+01 6.319400e+01 4.842062e+01 2.335249e+01 1.417922e+01 8.486396e+00 3.614576e+00 1.728710e+00 1.571555e+00 9.429328e-01 6.286219e-01 6.286219e-01 1.571555e-01 1.571555e-01 4.714664e-01 1.571555e-01 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00
+395.0<Trec<410.0 | 0.000000e+00 0.000000e+00 1.571555e-01 7.857774e-01 9.429328e+00 3.004492e+01 6.257623e+01 6.036700e+01 3.322394e+01 1.634417e+01 8.968615e+00 6.286219e+00 3.928887e+00 2.828799e+00 1.100088e+00 7.857774e-01 1.257244e+00 7.857774e-01 3.143109e-01 3.309427e-01 0.000000e+00 3.543093e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00
+410.0<Trec<425.0 | 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 3.457420e+00 1.764595e+01 4.786247e+01 5.726577e+01 4.595065e+01 2.658126e+01 1.492977e+01 6.600530e+00 4.243198e+00 3.485227e+00 1.571555e+00 1.414399e+00 1.100088e+00 6.286219e-01 4.714664e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.930176e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00
+425.0<Trec<440.0 | 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 1.257244e+00 6.286219e+00 2.547524e+01 5.454475e+01 5.783676e+01 3.630291e+01 1.602986e+01 8.513765e+00 3.771731e+00 3.143110e+00 2.357332e+00 1.414399e+00 6.286219e-01 3.143109e-01 3.143109e-01 3.143109e-01 0.000000e+00 3.143109e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.881355e-01
+440.0<Trec<455.0 | 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 4.714664e-01 1.728710e+00 1.137070e+01 4.266699e+01 6.578955e+01 5.032959e+01 2.531915e+01 1.229813e+01 6.443374e+00 4.086042e+00 2.357332e+00 9.429328e-01 9.429328e-01 6.286219e-01 7.857774e-01 0.000000e+00 1.571555e-01 0.000000e+00 4.714664e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01
+455.0<Trec<470.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 3.928887e+00 1.948728e+01 4.655684e+01 5.516157e+01 4.010199e+01 2.290297e+01 9.586484e+00 4.400353e+00 3.143110e+00 1.414399e+00 9.429328e-01 9.429328e-01 9.429328e-01 7.857774e-01 3.143109e-01 3.143109e-01 3.143109e-01 6.286219e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
+470.0<Trec<485.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 4.400353e+00 2.349082e+01 4.623083e+01 4.827125e+01 2.718790e+01 1.084373e+01 7.543463e+00 4.871819e+00 2.514488e+00 1.749543e+00 1.100088e+00 1.257244e+00 6.286219e-01 1.571555e-01 3.143109e-01 1.571555e-01 7.857774e-01 1.571555e-01 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
+485.0<Trec<500.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.728710e+00 5.186131e+00 2.420194e+01 4.667517e+01 3.775712e+01 1.777244e+01 1.071531e+01 5.500442e+00 4.086042e+00 2.514488e+00 1.414399e+00 9.429328e-01 7.857774e-01 1.100088e+00 1.571555e-01 1.571555e-01 3.143109e-01 0.000000e+00 1.571555e-01 1.386286e-01 1.571555e-01 1.571555e-01 4.714664e-01
+500.0<Trec<515.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.100088e+00 8.014929e+00 3.237403e+01 4.292722e+01 2.231608e+01 1.304390e+01 6.286219e+00 3.614576e+00 3.143110e+00 2.043021e+00 9.429328e-01 9.429328e-01 1.134139e+00 1.100088e+00 4.714664e-01 3.143109e-01 0.000000e+00 4.714664e-01 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00
+515.0<Trec<530.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 2.828799e+00 1.194382e+01 3.095963e+01 3.127394e+01 1.461546e+01 8.172085e+00 4.557509e+00 2.671643e+00 1.728710e+00 2.043021e+00 1.571555e+00 1.100088e+00 3.143109e-01 1.571555e-01 9.845653e-01 3.143109e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01
+530.0<Trec<545.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.742724e-01 0.000000e+00 1.571555e-01 3.300265e+00 2.044127e+01 2.817994e+01 1.964443e+01 1.100088e+01 5.073056e+00 3.457420e+00 3.166994e+00 1.414399e+00 1.885866e+00 9.429328e-01 1.257244e+00 4.941424e-01 6.286219e-01 1.571555e-01 1.571555e-01 1.571555e-01 3.143109e-01 0.000000e+00 6.286219e-01
+545.0<Trec<560.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 1.100088e+00 6.757685e+00 2.475723e+01 2.676260e+01 1.071737e+01 7.386307e+00 3.614576e+00 2.200177e+00 2.671643e+00 1.257244e+00 4.714664e-01 3.143109e-01 7.857774e-01 1.571555e-01 3.143109e-01 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 4.714664e-01
+560.0<Trec<575.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 2.828799e+00 1.434669e+01 2.687359e+01 1.823004e+01 1.040289e+01 6.993340e+00 2.983570e+00 2.200177e+00 2.043021e+00 4.714664e-01 4.714664e-01 8.133068e-01 6.286219e-01 4.714664e-01 0.000000e+00 3.143109e-01 1.571555e-01 0.000000e+00 1.571555e-01
+575.0<Trec<590.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 6.286219e-01 7.386307e+00 2.154482e+01 2.797367e+01 1.241528e+01 8.643551e+00 3.958098e+00 3.018622e+00 1.885866e+00 1.571555e+00 1.100088e+00 1.414399e+00 6.286219e-01 3.143109e-01 3.143109e-01 1.571555e-01 0.000000e+00 3.143109e-01 7.857774e-01
+590.0<Trec<605.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.885866e+00 1.211341e+01 2.424452e+01 1.461546e+01 1.084373e+01 5.657597e+00 3.614576e+00 2.514488e+00 2.200177e+00 1.414399e+00 1.414399e+00 4.714664e-01 3.143109e-01 3.143109e-01 4.714664e-01 3.143109e-01 1.571555e-01 6.286219e-01
+605.0<Trec<620.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 9.429328e-01 4.759181e+00 1.791572e+01 2.153030e+01 1.210097e+01 7.857774e+00 3.964424e+00 2.699313e+00 9.692346e-01 1.571555e+00 4.714664e-01 4.714664e-01 6.286219e-01 3.143109e-01 1.571555e-01 3.143109e-01 1.571555e-01 7.857774e-01
+620.0<Trec<635.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.257244e+00 5.841628e+00 2.013058e+01 1.683620e+01 8.643551e+00 5.186131e+00 3.300265e+00 2.043021e+00 1.571555e+00 2.043021e+00 1.257244e+00 9.429328e-01 3.143109e-01 4.714664e-01 3.143109e-01 3.143109e-01 7.857774e-01
+635.0<Trec<650.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 4.599476e+00 1.131519e+01 1.461546e+01 9.919061e+00 5.186131e+00 3.300265e+00 2.357332e+00 1.885866e+00 1.571555e+00 1.571555e+00 3.143109e-01 6.286219e-01 6.286219e-01 7.857774e-01 0.000000e+00 7.857774e-01
+650.0<Trec<665.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 7.857774e-01 6.129064e+00 1.147235e+01 1.293932e+01 6.600530e+00 4.243198e+00 2.985954e+00 1.571555e+00 1.257244e+00 1.257244e+00 9.429328e-01 1.100088e+00 7.857774e-01 3.457198e-01 3.143109e-01 1.100088e+00
+665.0<Trec<680.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.742724e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 9.429328e-01 7.229152e+00 1.021511e+01 7.857774e+00 5.186131e+00 4.243198e+00 1.414399e+00 2.828799e+00 7.857774e-01 6.286219e-01 9.429328e-01 9.429328e-01 6.286219e-01 0.000000e+00 1.414399e+00
+680.0<Trec<695.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 6.286219e-01 3.300265e+00 7.386307e+00 1.054936e+01 3.614576e+00 4.425785e+00 2.985954e+00 2.317294e+00 1.571555e+00 9.429328e-01 1.414399e+00 9.429328e-01 1.571555e-01 1.571555e-01 3.143109e-01
+695.0<Trec<710.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 1.571555e-01 4.714664e-01 3.771731e+00 1.005795e+01 6.805119e+00 3.645743e+00 2.671643e+00 2.200177e+00 1.257244e+00 1.571555e+00 4.714664e-01 6.286219e-01 1.414399e+00 0.000000e+00 2.200177e+00
+710.0<Trec<725.0 | 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 1.571555e-01 1.885866e+00 5.814753e+00 5.657597e+00 5.186131e+00 2.373049e+00 2.514488e+00 2.074188e+00 9.429328e-01 1.414399e+00 4.714664e-01 6.286219e-01 9.429328e-01 1.728710e+00
+725.0<Trec<740.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.742724e-01 0.000000e+00 0.000000e+00 1.571555e-01 3.168557e+00 5.028975e+00 5.343286e+00 2.985954e+00 2.200177e+00 2.066050e+00 1.414399e+00 6.286219e-01 4.714664e-01 3.143109e-01 3.143109e-01 2.715796e+00
+740.0<Trec<755.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.100088e+00 2.671643e+00 4.243198e+00 2.671643e+00 2.671643e+00 1.257244e+00 1.100088e+00 1.571555e+00 3.143109e-01 1.571555e-01 4.714664e-01 2.200177e+00
+755.0<Trec<770.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 2.357332e+00 3.928887e+00 2.828799e+00 2.043021e+00 1.728710e+00 1.100088e+00 1.414399e+00 4.714664e-01 7.857774e-01 3.143109e-01 2.514488e+00
+770.0<Trec<785.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.742724e-01 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 4.714664e-01 3.042741e+00 3.300265e+00 2.828799e+00 2.043021e+00 1.100088e+00 7.857774e-01 3.143109e-01 9.731126e-01 4.714664e-01 3.143110e+00
+785.0<Trec<800.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 1.883225e-01 0.000000e+00 1.883225e-01 1.881355e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.742724e-01 0.000000e+00 9.740999e-01 1.885866e+00 3.457420e+00 2.671643e+00 3.016934e+00 1.571555e+00 9.429328e-01 1.100088e+00 1.571555e-01 9.429328e-01 2.985954e+00
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+
+
+Table 5. Migration matrix (Ttrue vs Trec) for the neutral current elastic on Carbon protons and with FSI.
+The 2-dimensional histogram (true vs reconstructed energy) with 30 x 30 bins for the events that pass the cuts.
+True energy is from 300.0 MeV to 900.0 MeV with the first underflow bin and the last overflow bin; reconstructed energy from 350.0 MeV to 800.0 MeV.
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ energy range(MeV)| Ttrue<300.0 300.0<Ttrue<321.4 321.4<Ttrue<342.9 342.9<Ttrue<364.3 364.3<Ttrue<385.7 385.7<Ttrue<407.1 407.1<Ttrue<428.6 428.6<Ttrue<450.0 450.0<Ttrue<471.4 471.4<Ttrue<492.9 492.9<Ttrue<514.3 514.3<Ttrue<535.7 535.7<Ttrue<557.1 557.1<Ttrue<578.6 578.6<Ttrue<600.0 600.0<Ttrue<621.4 621.4<Ttrue<642.9 642.9<Ttrue<664.3 664.3<Ttrue<685.7 685.7<Ttrue<707.1 707.1<Ttrue<728.6 728.6<Ttrue<750.0 750.0<Ttrue<771.4 771.4<Ttrue<792.9 792.9<Ttrue<814.3 814.3<Ttrue<835.7 835.7<Ttrue<857.1 857.1<Ttrue<878.6 878.6<Ttrue<900.0 Ttrue>900.0
+energy range(MeV) |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+350.0<Trec<365.0 | 1.257244e+00 1.571555e-01 1.571555e-01 2.357332e+00 3.143110e+00 4.871819e+00 5.657597e+00 4.579905e+00 4.714664e+00 2.831502e+00 2.200177e+00 1.100088e+00 1.257244e+00 1.414399e+00 3.143109e-01 1.571555e-01 4.714664e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01
+365.0<Trec<380.0 | 1.571555e-01 3.143109e-01 1.571555e-01 6.286219e-01 1.275339e+00 3.457420e+00 5.028975e+00 5.028975e+00 3.928887e+00 3.928887e+00 2.200177e+00 1.571555e+00 1.571555e+00 6.286219e-01 9.429328e-01 6.316180e-01 6.286219e-01 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00
+380.0<Trec<395.0 | 3.143109e-01 4.714664e-01 1.571555e-01 4.714664e-01 1.257244e+00 1.728710e+00 4.557509e+00 4.571911e+00 5.814753e+00 4.086042e+00 2.671643e+00 2.200177e+00 1.414399e+00 9.429328e-01 1.100088e+00 7.857774e-01 4.714664e-01 4.714664e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00
+395.0<Trec<410.0 | 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 7.857774e-01 1.257244e+00 4.086042e+00 6.443374e+00 3.614576e+00 4.400353e+00 2.357332e+00 2.058969e+00 1.571555e+00 1.100088e+00 9.429328e-01 7.857774e-01 1.571555e-01 4.714664e-01 1.571555e-01 0.000000e+00 6.286219e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01
+410.0<Trec<425.0 | 6.286219e-01 3.143109e-01 1.571555e-01 1.571555e-01 0.000000e+00 6.286219e-01 2.357332e+00 4.400353e+00 4.400353e+00 3.928887e+00 2.514488e+00 2.828799e+00 2.822311e+00 1.100088e+00 7.857774e-01 1.100088e+00 4.714664e-01 4.714664e-01 1.571555e-01 0.000000e+00 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 1.571555e-01 4.714664e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01
+425.0<Trec<440.0 | 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 1.100088e+00 2.828799e+00 5.214816e+00 5.500442e+00 3.771731e+00 2.357332e+00 1.885866e+00 2.357332e+00 9.429328e-01 7.857774e-01 4.714664e-01 9.429328e-01 1.571555e-01 3.143109e-01 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 6.286219e-01
+440.0<Trec<455.0 | 3.143109e-01 0.000000e+00 0.000000e+00 3.143109e-01 0.000000e+00 0.000000e+00 3.143109e-01 7.857774e-01 2.200177e+00 3.156029e+00 3.771731e+00 3.771731e+00 2.200177e+00 1.728710e+00 1.257244e+00 7.857774e-01 6.286219e-01 7.857774e-01 4.714664e-01 6.286219e-01 6.286219e-01 3.143109e-01 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01
+455.0<Trec<470.0 | 3.143109e-01 1.571555e-01 1.752336e-01 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 6.286219e-01 2.357332e+00 2.828799e+00 4.243198e+00 4.557509e+00 3.457420e+00 1.414399e+00 1.100088e+00 1.257244e+00 7.857774e-01 4.714664e-01 4.714664e-01 3.143109e-01 6.286219e-01 3.143109e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 3.143109e-01 0.000000e+00 0.000000e+00 3.143109e-01
+470.0<Trec<485.0 | 1.571555e-01 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 3.143109e-01 4.714664e-01 1.100088e+00 2.671643e+00 2.530480e+00 3.143110e+00 5.028975e+00 2.218125e+00 2.368330e+00 6.286219e-01 7.857774e-01 9.429328e-01 1.257244e+00 3.143109e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 1.571555e-01 3.143109e-01 1.571555e-01 3.143109e-01
+485.0<Trec<500.0 | 3.143109e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 3.143109e-01 6.286219e-01 9.429328e-01 1.571555e+00 3.614576e+00 4.714664e+00 2.828799e+00 2.671643e+00 1.885866e+00 9.429328e-01 9.429328e-01 9.429328e-01 7.857774e-01 4.714664e-01 3.143109e-01 4.714664e-01 3.143109e-01 0.000000e+00 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01
+500.0<Trec<515.0 | 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 3.143109e-01 0.000000e+00 1.571555e-01 0.000000e+00 4.714664e-01 1.571555e-01 2.200177e+00 2.671643e+00 2.514488e+00 3.143110e+00 1.414399e+00 9.429328e-01 1.728710e+00 3.143109e-01 7.857774e-01 4.714664e-01 4.714664e-01 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 3.143109e-01 0.000000e+00 0.000000e+00 4.714664e-01
+515.0<Trec<530.0 | 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 3.143109e-01 2.200177e+00 2.671643e+00 1.728710e+00 9.429328e-01 1.571555e+00 7.857774e-01 4.714664e-01 3.143109e-01 3.143109e-01 4.714664e-01 3.143109e-01 3.143109e-01 3.143109e-01 0.000000e+00 7.857774e-01 0.000000e+00 1.571555e-01 6.286219e-01
+530.0<Trec<545.0 | 4.714664e-01 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 3.143109e-01 1.571555e-01 0.000000e+00 7.857774e-01 1.100088e+00 1.571555e+00 1.257244e+00 7.857774e-01 9.429328e-01 7.857774e-01 1.571555e-01 3.143109e-01 1.571555e-01 3.143109e-01 1.571555e-01 1.571555e-01 4.714664e-01 4.714664e-01 3.143109e-01 3.143109e-01 1.571555e-01 1.291708e+00
+545.0<Trec<560.0 | 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 3.143109e-01 1.257244e+00 1.414399e+00 1.100088e+00 1.571555e+00 7.857774e-01 7.857774e-01 9.429328e-01 6.286219e-01 7.857774e-01 3.143109e-01 0.000000e+00 3.143109e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 6.286219e-01
+560.0<Trec<575.0 | 1.571555e-01 3.143109e-01 1.571555e-01 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 7.857774e-01 1.257244e+00 1.885866e+00 1.571555e+00 9.429328e-01 6.286219e-01 6.286219e-01 7.857774e-01 1.571555e-01 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 7.857774e-01
+575.0<Trec<590.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 6.286219e-01 1.257244e+00 1.728710e+00 9.429328e-01 1.257244e+00 1.100088e+00 5.024465e-01 1.571555e-01 1.571555e-01 1.571555e-01 1.571555e-01 1.571555e-01 4.714664e-01 3.143109e-01 0.000000e+00 1.728710e+00
+590.0<Trec<605.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 3.143109e-01 1.571555e-01 3.143109e-01 9.429328e-01 1.414399e+00 1.257244e+00 6.286219e-01 4.714664e-01 7.857774e-01 7.857774e-01 1.100088e+00 4.714664e-01 3.143109e-01 3.143109e-01 1.571555e-01 0.000000e+00 1.571555e-01 2.357332e+00
+605.0<Trec<620.0 | 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 3.143109e-01 0.000000e+00 1.571555e-01 1.100088e+00 1.257244e+00 7.857774e-01 1.414399e+00 9.429328e-01 1.571555e-01 1.571555e-01 7.857774e-01 3.143109e-01 3.143109e-01 3.143109e-01 1.571555e-01 0.000000e+00 0.000000e+00 1.100088e+00
+620.0<Trec<635.0 | 3.454780e-01 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 1.571555e-01 3.143109e-01 1.414399e+00 1.571555e+00 7.857774e-01 6.286219e-01 7.857774e-01 6.286219e-01 1.571555e-01 6.286219e-01 0.000000e+00 0.000000e+00 1.571555e-01 3.143109e-01 1.571555e-01 1.571555e+00
+635.0<Trec<650.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 0.000000e+00 6.286219e-01 3.143109e-01 1.257244e+00 7.857774e-01 4.714664e-01 6.593191e-01 6.286219e-01 1.571555e-01 3.143109e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.917987e+00
+650.0<Trec<665.0 | 0.000000e+00 0.000000e+00 4.714664e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 3.143109e-01 1.571555e-01 1.571555e-01 0.000000e+00 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 9.429328e-01 9.429328e-01 9.429328e-01 3.143109e-01 1.571555e-01 0.000000e+00 1.571555e-01 3.143109e-01 1.571555e-01 3.143109e-01 0.000000e+00 9.429328e-01
+665.0<Trec<680.0 | 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 0.000000e+00 7.457388e-01 1.571555e-01 3.143109e-01 3.143109e-01 1.571555e-01 3.143109e-01 9.429328e-01 3.143109e-01 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 1.571555e-01 2.357332e+00
+680.0<Trec<695.0 | 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 4.714664e-01 9.429328e-01 1.571555e-01 7.857774e-01 4.714664e-01 7.457388e-01 1.571555e-01 0.000000e+00 0.000000e+00 4.714664e-01 3.143109e-01 1.414399e+00
+695.0<Trec<710.0 | 3.454780e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 1.571555e-01 0.000000e+00 0.000000e+00 4.714664e-01 6.286219e-01 1.571555e-01 4.714664e-01 4.714664e-01 1.571555e-01 3.143109e-01 0.000000e+00 0.000000e+00 1.768695e+00
+710.0<Trec<725.0 | 2.742724e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 1.100088e+00 1.060050e+00 3.143109e-01 4.714664e-01 9.429328e-01 3.143109e-01 1.571555e-01 1.571555e-01 3.143109e-01 2.671643e+00
+725.0<Trec<740.0 | 1.883225e-01 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 6.286219e-01 4.714664e-01 4.714664e-01 3.143109e-01 2.742724e-01 0.000000e+00 4.714664e-01 3.143109e-01 3.143109e-01 2.205474e+00
+740.0<Trec<755.0 | 1.883225e-01 0.000000e+00 3.766451e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 2.742724e-01 0.000000e+00 1.571555e-01 2.742724e-01 3.143109e-01 4.714664e-01 3.143109e-01 0.000000e+00 0.000000e+00 9.429328e-01
+755.0<Trec<770.0 | 3.764581e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 6.286219e-01 3.143109e-01 1.571555e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 1.619354e+00
+770.0<Trec<785.0 | 3.621098e-01 1.883225e-01 0.000000e+00 0.000000e+00 1.881355e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.625950e-01 0.000000e+00 0.000000e+00 2.742724e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 4.714664e-01 0.000000e+00 1.571555e-01 1.571555e-01 3.143109e-01 1.571555e+00
+785.0<Trec<800.0 | 0.000000e+00 0.000000e+00 3.766451e-01 1.883225e-01 0.000000e+00 4.314279e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 3.143109e-01 3.454780e-01 1.571555e-01 6.286219e-01 3.143109e-01 3.143109e-01 4.714664e-01 1.885866e+00
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+
+
+Table 6. Migration matrix (Ttrue vs Trec) for the neutral current elastic on Carbon neutrons.
+The 2-dimensional histogram (true vs reconstructed energy) with 30 x 30 bins for the events that pass the cuts.
+True energy is from 300.0 MeV to 900.0 MeV with the first underflow bin and the last overflow bin; reconstructed energy from 350.0 MeV to 800.0 MeV.
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ energy range(MeV)| Ttrue<300.0 300.0<Ttrue<321.4 321.4<Ttrue<342.9 342.9<Ttrue<364.3 364.3<Ttrue<385.7 385.7<Ttrue<407.1 407.1<Ttrue<428.6 428.6<Ttrue<450.0 450.0<Ttrue<471.4 471.4<Ttrue<492.9 492.9<Ttrue<514.3 514.3<Ttrue<535.7 535.7<Ttrue<557.1 557.1<Ttrue<578.6 578.6<Ttrue<600.0 600.0<Ttrue<621.4 621.4<Ttrue<642.9 642.9<Ttrue<664.3 664.3<Ttrue<685.7 685.7<Ttrue<707.1 707.1<Ttrue<728.6 728.6<Ttrue<750.0 750.0<Ttrue<771.4 771.4<Ttrue<792.9 792.9<Ttrue<814.3 814.3<Ttrue<835.7 835.7<Ttrue<857.1 857.1<Ttrue<878.6 878.6<Ttrue<900.0 Ttrue>900.0
+energy range(MeV) |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+350.0<Trec<365.0 | 1.257244e+00 1.414399e+00 2.200177e+00 3.771731e+00 6.286219e+00 1.009395e+01 1.194382e+01 1.100088e+01 8.014929e+00 7.543463e+00 5.028975e+00 5.343286e+00 4.086042e+00 2.205597e+00 2.200177e+00 1.885866e+00 1.453695e+00 1.728710e+00 6.286219e-01 9.429328e-01 7.857774e-01 6.286219e-01 4.714664e-01 0.000000e+00 3.143109e-01 0.000000e+00 1.571555e-01 1.571555e-01 1.571555e-01 3.143109e-01
+365.0<Trec<380.0 | 7.857774e-01 1.257244e+00 2.061663e+00 3.143110e+00 5.343286e+00 8.852232e+00 9.743639e+00 1.210097e+01 9.115018e+00 9.115018e+00 6.757685e+00 5.044682e+00 3.656028e+00 3.300265e+00 4.114686e+00 2.357332e+00 2.985954e+00 1.100088e+00 1.100088e+00 9.429328e-01 1.257244e+00 6.286219e-01 1.100088e+00 1.571555e-01 4.714664e-01 1.571555e-01 3.143109e-01 1.571555e-01 0.000000e+00 1.571555e-01
+380.0<Trec<395.0 | 6.286219e-01 4.714664e-01 6.286219e-01 1.257244e+00 2.200177e+00 6.443374e+00 8.841150e+00 1.052942e+01 8.329240e+00 6.778656e+00 7.700618e+00 5.971908e+00 4.400353e+00 2.985954e+00 3.300265e+00 2.357332e+00 1.885866e+00 1.257244e+00 3.143109e-01 1.414399e+00 6.286219e-01 6.286219e-01 6.286219e-01 3.143109e-01 4.714664e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.257244e+00
+395.0<Trec<410.0 | 3.143109e-01 1.571555e-01 4.714664e-01 3.143109e-01 9.429328e-01 1.728710e+00 6.286219e+00 8.184884e+00 7.543463e+00 8.643551e+00 5.971908e+00 6.757685e+00 5.500442e+00 5.186131e+00 3.771731e+00 2.200177e+00 1.257244e+00 2.043021e+00 1.885866e+00 3.143109e-01 7.857774e-01 1.571555e-01 3.143109e-01 1.571555e-01 6.286219e-01 1.571555e-01 1.571555e-01 3.143109e-01 0.000000e+00 9.028943e-01
+410.0<Trec<425.0 | 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 1.728710e+00 4.400353e+00 4.400353e+00 7.700618e+00 6.757685e+00 6.914841e+00 5.500442e+00 4.243198e+00 2.828799e+00 2.357332e+00 2.043021e+00 1.728710e+00 7.857774e-01 1.414399e+00 7.857774e-01 7.857774e-01 9.429328e-01 9.429328e-01 1.571555e-01 2.742724e-01 1.571555e-01 3.143109e-01 1.571555e-01 3.143109e-01 7.857774e-01
+425.0<Trec<440.0 | 4.714664e-01 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 4.714664e-01 1.885866e+00 5.028975e+00 5.657597e+00 8.349133e+00 6.443374e+00 5.343286e+00 4.871819e+00 2.828799e+00 2.043021e+00 1.885866e+00 1.885866e+00 1.100088e+00 1.571555e+00 1.728710e+00 1.100088e+00 6.286219e-01 3.143109e-01 6.286219e-01 3.143109e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 9.429328e-01
+440.0<Trec<455.0 | 1.571555e-01 0.000000e+00 1.571555e-01 0.000000e+00 1.571555e-01 3.143109e-01 1.257244e+00 3.457420e+00 4.945776e+00 6.757685e+00 7.543463e+00 7.857774e+00 4.243198e+00 3.457420e+00 2.881412e+00 3.143110e+00 2.043021e+00 1.728710e+00 7.857774e-01 4.714664e-01 1.571555e-01 4.714664e-01 9.429328e-01 1.571555e-01 7.857774e-01 4.662328e-01 3.143109e-01 1.571555e-01 1.571555e-01 6.286219e-01
+455.0<Trec<470.0 | 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.257244e+00 2.671643e+00 6.286219e+00 5.971908e+00 8.014929e+00 5.186131e+00 6.129064e+00 4.400353e+00 2.200177e+00 2.985954e+00 2.514488e+00 9.429328e-01 1.571555e+00 7.857774e-01 4.714664e-01 9.429328e-01 3.143109e-01 3.143109e-01 7.857774e-01 1.571555e-01 6.286219e-01 1.571555e-01 8.167574e-01
+470.0<Trec<485.0 | 3.143109e-01 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 3.143109e-01 3.143109e-01 2.200177e+00 3.457420e+00 5.500442e+00 7.117031e+00 5.343286e+00 3.300265e+00 5.500442e+00 3.143110e+00 2.828799e+00 1.885866e+00 2.043021e+00 9.429328e-01 1.571555e+00 9.429328e-01 9.429328e-01 1.100088e+00 6.286219e-01 1.571555e-01 4.714664e-01 3.143109e-01 1.571555e-01 1.414399e+00
+485.0<Trec<500.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 3.143109e-01 1.758596e+00 4.243198e+00 5.500442e+00 4.420914e+00 4.589070e+00 3.457420e+00 3.475897e+00 3.300265e+00 2.043021e+00 1.100088e+00 2.514488e+00 1.100088e+00 1.414399e+00 8.009896e-01 3.143109e-01 6.286219e-01 7.857774e-01 4.714664e-01 3.143109e-01 3.143109e-01 6.286219e-01
+500.0<Trec<515.0 | 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 0.000000e+00 1.571555e-01 4.714664e-01 1.571555e-01 1.919550e+00 2.985954e+00 5.657597e+00 3.143110e+00 2.828799e+00 3.143110e+00 2.514488e+00 3.614576e+00 1.257244e+00 1.571555e+00 1.885866e+00 1.414399e+00 4.714664e-01 1.257244e+00 6.286219e-01 1.100088e+00 6.286219e-01 1.571555e-01 4.714664e-01 1.885866e+00
+515.0<Trec<530.0 | 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 3.143109e-01 1.571555e+00 3.771731e+00 4.583092e+00 3.457420e+00 4.107672e+00 2.200177e+00 2.671643e+00 2.200177e+00 2.043021e+00 6.550589e-01 1.414399e+00 6.286219e-01 9.429328e-01 1.100088e+00 6.286219e-01 6.286219e-01 6.286219e-01 0.000000e+00 1.414399e+00
+530.0<Trec<545.0 | 1.571555e-01 3.143109e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 3.143109e-01 9.429328e-01 1.885866e+00 1.885866e+00 2.514488e+00 1.728710e+00 2.043021e+00 1.571555e+00 1.728710e+00 1.414399e+00 9.429328e-01 1.374361e+00 4.314279e-01 6.286219e-01 1.100088e+00 1.257244e+00 7.857774e-01 6.286219e-01 3.143109e-01 1.728710e+00
+545.0<Trec<560.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.257244e+00 3.143110e+00 2.357332e+00 1.885866e+00 1.571555e+00 1.728710e+00 7.857774e-01 1.571555e+00 1.257244e+00 1.100088e+00 1.571555e-01 9.429328e-01 3.143109e-01 4.714664e-01 6.286219e-01 1.571555e-01 3.143109e-01 2.200177e+00
+560.0<Trec<575.0 | 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 0.000000e+00 0.000000e+00 1.571555e-01 1.571555e-01 3.143109e-01 0.000000e+00 0.000000e+00 4.714664e-01 7.857774e-01 1.257244e+00 1.571555e+00 1.100088e+00 2.357332e+00 1.100088e+00 1.100088e+00 1.915195e+00 9.429328e-01 9.429328e-01 1.100088e+00 4.714664e-01 9.429328e-01 6.286219e-01 4.714664e-01 1.571555e-01 1.414399e+00
+575.0<Trec<590.0 | 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 3.143109e-01 1.571555e-01 0.000000e+00 1.571555e-01 1.571555e-01 3.143109e-01 1.414399e+00 2.828799e+00 1.100088e+00 1.414399e+00 1.414399e+00 1.292860e+00 4.714664e-01 7.857774e-01 3.456985e-01 1.100088e+00 6.286219e-01 1.571555e-01 3.143109e-01 7.857774e-01 4.314279e-01 1.100088e+00
+590.0<Trec<605.0 | 3.143109e-01 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.143109e-01 0.000000e+00 1.571555e-01 3.143109e-01 4.714664e-01 1.728710e+00 7.857774e-01 1.728710e+00 7.857774e-01 7.857774e-01 9.429328e-01 1.257244e+00 1.257244e+00 9.429328e-01 6.286219e-01 1.100088e+00 7.857774e-01 1.100088e+00 4.714664e-01 3.457420e+00
+605.0<Trec<620.0 | 0.000000e+00 1.571555e-01 0.000000e+00 1.883225e-01 1.883225e-01 0.000000e+00 2.742724e-01 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 4.714664e-01 1.374361e+00 9.429328e-01 2.043021e+00 1.728710e+00 1.571555e+00 1.257244e+00 1.100088e+00 6.286219e-01 4.714664e-01 6.286219e-01 4.714664e-01 3.143109e-01 3.143109e-01 1.571555e-01 3.614576e+00
+620.0<Trec<635.0 | 2.742724e-01 0.000000e+00 0.000000e+00 3.454780e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 2.742724e-01 1.571555e-01 0.000000e+00 1.571555e-01 3.454780e-01 0.000000e+00 1.571555e-01 1.414399e+00 6.286219e-01 2.043021e+00 1.257244e+00 1.414399e+00 1.414399e+00 1.100088e+00 6.286219e-01 3.143109e-01 1.100088e+00 7.857774e-01 3.143109e-01 4.714664e-01 4.714664e-01 2.357332e+00
+635.0<Trec<650.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.454780e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.742724e-01 3.454780e-01 0.000000e+00 1.881355e-01 3.766451e-01 1.571555e-01 1.414399e+00 5.026335e-01 1.100088e+00 1.131068e+00 6.286219e-01 9.429328e-01 6.286219e-01 4.714664e-01 1.571555e-01 7.857774e-01 4.714664e-01 4.714664e-01 1.571555e-01 1.885866e+00
+650.0<Trec<665.0 | 3.454780e-01 0.000000e+00 0.000000e+00 0.000000e+00 2.742724e-01 1.571555e-01 0.000000e+00 2.742724e-01 0.000000e+00 1.883225e-01 1.571555e-01 1.571555e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.196087e-01 4.714664e-01 1.288411e+00 9.429328e-01 7.857774e-01 1.445566e+00 1.564361e+00 3.143109e-01 1.100088e+00 4.714664e-01 6.286219e-01 1.571555e-01 1.571555e-01 1.571555e-01 2.978760e+00
+665.0<Trec<680.0 | 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 2.742724e-01 0.000000e+00 0.000000e+00 1.883225e-01 1.883225e-01 0.000000e+00 1.883225e-01 0.000000e+00 3.454780e-01 1.571555e-01 0.000000e+00 1.571555e-01 7.857774e-01 7.857774e-01 9.429328e-01 3.143109e-01 7.857774e-01 3.143109e-01 5.024465e-01 4.714664e-01 3.143109e-01 9.429328e-01 1.571555e-01 1.571555e-01 3.645556e+00
+680.0<Trec<695.0 | 2.742724e-01 3.454780e-01 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 4.625950e-01 0.000000e+00 1.883225e-01 4.625950e-01 1.571555e-01 0.000000e+00 0.000000e+00 3.454780e-01 3.143109e-01 5.026335e-01 0.000000e+00 1.571555e-01 4.714664e-01 6.286219e-01 4.714664e-01 6.286219e-01 7.857774e-01 4.714664e-01 1.571555e-01 1.571555e-01 1.885866e+00
+695.0<Trec<710.0 | 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.454780e-01 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 1.571555e-01 1.737872e-01 0.000000e+00 3.143109e-01 3.143109e-01 4.714664e-01 3.143109e-01 3.143109e-01 4.714664e-01 4.714664e-01 9.740999e-01 3.143109e-01 3.143109e-01 0.000000e+00 2.357332e+00
+710.0<Trec<725.0 | 3.454780e-01 0.000000e+00 7.532902e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.766451e-01 0.000000e+00 1.571555e-01 1.883225e-01 0.000000e+00 1.571555e-01 0.000000e+00 4.625950e-01 0.000000e+00 1.883225e-01 1.883225e-01 0.000000e+00 6.597890e-01 8.479245e-01 6.286219e-01 6.452537e-01 6.286219e-01 6.286219e-01 3.454780e-01 1.571555e-01 7.857774e-01 6.597890e-01 3.143109e-01 3.417382e+00
+725.0<Trec<740.0 | 3.766451e-01 8.392401e-01 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 2.742724e-01 4.625950e-01 0.000000e+00 3.764581e-01 0.000000e+00 0.000000e+00 3.766451e-01 0.000000e+00 0.000000e+00 4.625950e-01 0.000000e+00 1.571555e-01 1.883225e-01 3.309427e-01 0.000000e+00 3.143109e-01 3.143109e-01 0.000000e+00 3.143109e-01 3.143109e-01 0.000000e+00 1.571555e-01 7.857774e-01 2.514488e+00
+740.0<Trec<755.0 | 0.000000e+00 1.883225e-01 0.000000e+00 1.883225e-01 1.883225e-01 0.000000e+00 1.883225e-01 1.883225e-01 4.625950e-01 4.625950e-01 0.000000e+00 1.883225e-01 0.000000e+00 4.625950e-01 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 4.714664e-01 3.143109e-01 6.286219e-01 1.571555e-01 7.857774e-01 3.143109e-01 1.571555e-01 3.143109e-01 1.571555e-01 2.388499e+00
+755.0<Trec<770.0 | 1.113325e+00 0.000000e+00 1.883225e-01 1.883225e-01 5.485449e-01 5.338005e-01 2.742724e-01 4.625950e-01 4.625950e-01 8.392401e-01 0.000000e+00 1.883225e-01 3.764581e-01 1.883225e-01 3.766451e-01 8.080730e-01 1.883225e-01 0.000000e+00 1.624532e-01 4.714664e-01 1.499620e-01 1.571555e-01 1.571555e-01 1.883225e-01 6.286219e-01 1.571555e-01 5.026335e-01 0.000000e+00 3.143109e-01 1.728710e+00
+770.0<Trec<785.0 | 3.764581e-01 0.000000e+00 0.000000e+00 0.000000e+00 9.250030e-01 1.571555e-01 2.742724e-01 1.881355e-01 3.764581e-01 4.625950e-01 3.454780e-01 1.883225e-01 3.766451e-01 2.742724e-01 0.000000e+00 3.621098e-01 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.454780e-01 5.024465e-01 3.454780e-01 3.143109e-01 1.571555e-01 3.143109e-01 1.571555e-01 3.143109e-01 4.529395e-01 1.571555e+00
+785.0<Trec<800.0 | 1.113325e+00 0.000000e+00 0.000000e+00 2.742724e-01 1.883225e-01 7.368674e-01 4.625950e-01 1.881355e-01 0.000000e+00 3.454780e-01 6.509175e-01 6.509175e-01 1.883225e-01 0.000000e+00 6.509175e-01 5.649677e-01 3.507757e-01 5.647807e-01 1.883225e-01 0.000000e+00 0.000000e+00 1.883225e-01 4.714664e-01 1.571555e-01 4.714664e-01 4.714664e-01 3.143109e-01 0.000000e+00 3.143109e-01 2.631604e+00
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+
+
+Table 7. Migration matrix (Ttrue vs Trec) for irreducible background events.
+The 2-dimensional histogram (true vs reconstructed energy) with 30 x 30 bins for the events that pass the cuts.
+True energy is from 300.0 MeV to 900.0 MeV with the first underflow bin and the last overflow bin; reconstructed energy from 350.0 MeV to 800.0 MeV.
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ energy range(MeV)| Ttrue<300.0 300.0<Ttrue<321.4 321.4<Ttrue<342.9 342.9<Ttrue<364.3 364.3<Ttrue<385.7 385.7<Ttrue<407.1 407.1<Ttrue<428.6 428.6<Ttrue<450.0 450.0<Ttrue<471.4 471.4<Ttrue<492.9 492.9<Ttrue<514.3 514.3<Ttrue<535.7 535.7<Ttrue<557.1 557.1<Ttrue<578.6 578.6<Ttrue<600.0 600.0<Ttrue<621.4 621.4<Ttrue<642.9 642.9<Ttrue<664.3 664.3<Ttrue<685.7 685.7<Ttrue<707.1 707.1<Ttrue<728.6 728.6<Ttrue<750.0 750.0<Ttrue<771.4 771.4<Ttrue<792.9 792.9<Ttrue<814.3 814.3<Ttrue<835.7 835.7<Ttrue<857.1 857.1<Ttrue<878.6 878.6<Ttrue<900.0 Ttrue>900.0
+energy range(MeV) |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+350.0<Trec<365.0 | 1.488262e-01 1.571555e-01 1.058442e+00 1.075101e+00 3.026501e+00 4.415912e+00 9.567624e+00 9.716448e+00 1.004742e+01 9.146132e+00 7.947194e+00 5.987466e+00 5.185031e+00 4.283745e+00 2.728848e+00 2.605010e+00 2.001375e+00 1.844220e+00 8.929574e-01 1.066771e+00 1.521580e+00 9.262744e-01 1.066771e+00 6.231446e-01 1.215598e+00 6.036342e-01 4.631372e-01 3.143109e-01 3.059817e-01 1.687064e+00
+365.0<Trec<380.0 | 0.000000e+00 2.976525e-01 1.571555e-01 7.691189e-01 7.607896e-01 2.869345e+00 6.086318e+00 8.666336e+00 1.092372e+01 9.294958e+00 7.467398e+00 7.326901e+00 5.482684e+00 5.168374e+00 3.977763e+00 3.324153e+00 3.208644e+00 3.787291e+00 1.075101e+00 1.529909e+00 1.364424e+00 7.691189e-01 6.036342e-01 1.571555e-01 1.488262e-01 5.953050e-01 4.631372e-01 2.976525e-01 4.631372e-01 1.403920e+00
+380.0<Trec<395.0 | 1.571555e-01 0.000000e+00 0.000000e+00 3.059817e-01 1.223927e+00 2.431195e+00 4.986230e+00 5.656497e+00 5.937492e+00 9.460443e+00 6.077988e+00 5.325528e+00 5.193361e+00 4.837404e+00 5.755348e+00 3.506296e+00 1.984717e+00 3.175327e+00 2.447854e+00 2.588351e+00 1.058442e+00 1.050113e+00 1.571555e-01 6.036342e-01 4.464787e-01 4.631372e-01 3.059817e-01 7.607896e-01 0.000000e+00 1.687064e+00
+395.0<Trec<410.0 | 0.000000e+00 0.000000e+00 0.000000e+00 4.464787e-01 3.059817e-01 7.524604e-01 1.993046e+00 2.580022e+00 6.822119e+00 7.136429e+00 7.285255e+00 6.962615e+00 5.126727e+00 4.109931e+00 5.036205e+00 4.556410e+00 2.571692e+00 2.141872e+00 2.588351e+00 1.207268e+00 9.179451e-01 9.262744e-01 3.059817e-01 1.223927e+00 9.096159e-01 6.202927e-01 6.119634e-01 4.631372e-01 4.464787e-01 1.240585e+00
+410.0<Trec<425.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.976525e-01 1.571555e-01 4.464787e-01 1.513250e+00 3.969434e+00 5.614851e+00 5.491013e+00 6.053000e+00 6.788802e+00 5.160044e+00 4.159906e+00 3.531284e+00 2.439525e+00 3.026501e+00 2.422866e+00 1.372753e+00 9.262744e-01 1.207268e+00 1.976388e+00 0.000000e+00 4.548079e-01 7.691189e-01 1.571555e-01 1.488262e-01 6.119634e-01 1.255094e+00
+425.0<Trec<440.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.488262e-01 0.000000e+00 4.464787e-01 3.489638e+00 4.217111e+00 5.830311e+00 6.036342e+00 6.069659e+00 6.499479e+00 5.308870e+00 3.183656e+00 4.076614e+00 2.456183e+00 1.984717e+00 2.745506e+00 2.125214e+00 1.513250e+00 1.207268e+00 1.223927e+00 2.976525e-01 7.524604e-01 1.571555e-01 6.036342e-01 1.571555e-01 1.372753e+00
+440.0<Trec<455.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 6.119634e-01 1.381082e+00 4.548080e+00 5.011218e+00 6.979274e+00 8.616362e+00 6.987603e+00 4.829075e+00 6.201826e+00 3.175327e+00 4.225440e+00 3.646793e+00 1.802573e+00 1.984717e+00 1.827561e+00 1.521580e+00 6.119634e-01 1.083430e+00 1.347765e+00 1.223927e+00 3.059817e-01 1.488262e-01 2.133543e+00
+455.0<Trec<470.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 7.691189e-01 1.571555e-01 1.951400e+00 5.210020e+00 5.614851e+00 6.681622e+00 7.020920e+00 5.185031e+00 5.763678e+00 4.564739e+00 3.688439e+00 2.745507e+00 4.399254e+00 2.125214e+00 1.968058e+00 2.141872e+00 7.691189e-01 7.607896e-01 1.397741e+00 2.976525e-01 3.059817e-01 3.059817e-01 2.581539e+00
+470.0<Trec<485.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.488262e-01 5.953050e-01 2.869345e+00 5.945820e+00 7.285256e+00 6.566113e+00 6.111306e+00 6.400628e+00 5.143385e+00 6.069659e+00 3.026501e+00 4.581398e+00 3.820607e+00 3.952775e+00 1.968058e+00 1.662076e+00 1.372753e+00 2.009704e+00 9.012867e-01 4.464787e-01 1.066771e+00 3.378479e+00
+485.0<Trec<500.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.464787e-01 9.096159e-01 1.372753e+00 3.332482e+00 7.260268e+00 7.855572e+00 6.044672e+00 6.218485e+00 6.532796e+00 4.713565e+00 4.424242e+00 5.135057e+00 5.308870e+00 3.200315e+00 2.001375e+00 1.827561e+00 7.691189e-01 1.381082e+00 1.207268e+00 7.774481e-01 2.613339e+00
+500.0<Trec<515.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.548079e-01 1.198939e+00 1.678735e+00 4.051627e+00 4.713565e+00 7.161417e+00 4.399254e+00 3.481309e+00 6.664962e+00 5.176702e+00 3.828937e+00 4.994560e+00 3.497967e+00 3.200314e+00 1.810903e+00 1.083430e+00 1.232256e+00 1.827561e+00 1.381082e+00 2.470692e+00
+515.0<Trec<530.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 6.036342e-01 7.524604e-01 2.596680e+00 3.183656e+00 3.043159e+00 5.283883e+00 5.168374e+00 5.226677e+00 4.134918e+00 4.705236e+00 4.275415e+00 4.548080e+00 5.168374e+00 3.977763e+00 3.093472e+00 3.059818e+00 1.372753e+00 7.607896e-01 4.556409e+00
+530.0<Trec<545.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 1.488262e-01 1.190610e+00 1.381082e+00 2.910991e+00 4.895708e+00 4.250428e+00 3.919458e+00 4.109931e+00 4.721894e+00 3.812278e+00 3.514626e+00 3.208644e+00 3.059818e+00 3.547942e+00 3.200315e+00 2.605010e+00 1.802573e+00 7.151219e+00
+545.0<Trec<560.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.059817e-01 7.441312e-01 1.951400e+00 1.670406e+00 3.200315e+00 3.630135e+00 2.166860e+00 2.877674e+00 2.737177e+00 3.481309e+00 2.605010e+00 3.200315e+00 3.299166e+00 2.125214e+00 2.927649e+00 2.307357e+00 1.521580e+00 5.796995e+00
+560.0<Trec<575.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.687064e+00 2.274040e+00 2.737177e+00 2.580022e+00 2.745506e+00 2.720519e+00 3.191985e+00 3.977763e+00 2.728848e+00 1.827561e+00 2.406208e+00 2.116884e+00 2.439525e+00 1.678735e+00 1.810903e+00 6.847106e+00
+575.0<Trec<590.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 6.036342e-01 1.364424e+00 2.439525e+00 2.125214e+00 2.927649e+00 2.894333e+00 2.257382e+00 1.381082e+00 2.596680e+00 3.340811e+00 2.108555e+00 1.381082e+00 1.653747e+00 1.670406e+00 1.968058e+00 6.885440e+00
+590.0<Trec<605.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.488262e-01 7.524604e-01 1.819232e+00 1.943071e+00 2.886003e+00 3.349141e+00 2.588351e+00 3.977763e+00 2.299028e+00 2.869345e+00 3.952775e+00 3.472980e+00 3.349141e+00 1.513250e+00 1.976388e+00 1.008673e+01
+605.0<Trec<620.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 6.119634e-01 5.953050e-01 1.968058e+00 2.125214e+00 2.133543e+00 1.810903e+00 1.819232e+00 1.513250e+00 2.282369e+00 2.621668e+00 2.596680e+00 2.894333e+00 2.720519e+00 1.678735e+00 1.042836e+01
+620.0<Trec<635.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 4.631372e-01 7.607896e-01 2.265711e+00 1.827561e+00 1.066771e+00 1.521580e+00 1.959729e+00 2.225672e+00 1.827561e+00 2.150201e+00 1.959729e+00 2.125214e+00 1.852549e+00 1.097154e+01
+635.0<Trec<650.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.488262e-01 3.059817e-01 6.119634e-01 1.232256e+00 2.447854e+00 1.968058e+00 1.819232e+00 2.150201e+00 1.844220e+00 1.827561e+00 1.232256e+00 2.116884e+00 1.827561e+00 2.150201e+00 1.371919e+01
+650.0<Trec<665.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.059817e-01 2.976525e-01 1.488262e-01 1.695393e+00 1.075101e+00 7.607896e-01 2.141872e+00 9.179451e-01 7.607896e-01 1.215598e+00 1.827561e+00 2.439525e+00 1.236763e+01
+665.0<Trec<680.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.371488e-01 4.631372e-01 1.058442e+00 1.207268e+00 1.066771e+00 1.695393e+00 1.959729e+00 1.372753e+00 1.538238e+00 1.827561e+00 1.504921e+00 2.141872e+00 1.394898e+01
+680.0<Trec<695.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 6.119634e-01 5.953050e-01 7.524604e-01 6.119634e-01 1.058442e+00 1.372753e+00 1.091759e+00 1.066771e+00 1.043391e+00 1.381082e+00 1.280958e+01
+695.0<Trec<710.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.566829e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.571555e-01 3.143109e-01 7.691189e-01 1.488262e-01 6.119634e-01 9.262744e-01 7.774481e-01 1.207268e+00 9.096159e-01 1.504921e+00 1.309849e+00 1.180112e+01
+710.0<Trec<725.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 2.742724e-01 1.488262e-01 4.631372e-01 6.119634e-01 1.223927e+00 1.240585e+00 1.670406e+00 2.001375e+00 1.403920e+00 1.215598e+00 1.083430e+00 1.091079e+01
+725.0<Trec<740.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.783415e-01 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 3.766451e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.488262e-01 1.883225e-01 0.000000e+00 7.691189e-01 7.691189e-01 9.179451e-01 7.524604e-01 1.223927e+00 9.096159e-01 3.059817e-01 9.012867e-01 1.212525e+01
+740.0<Trec<755.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.783415e-01 0.000000e+00 0.000000e+00 3.354969e-01 4.464787e-01 2.976525e-01 4.759939e-01 6.119634e-01 1.356094e+00 6.036342e-01 1.678735e+00 1.455947e+01
+755.0<Trec<770.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.783415e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.883225e-01 1.883225e-01 4.230987e-01 1.488262e-01 1.488262e-01 1.571555e-01 6.119634e-01 7.607896e-01 1.198939e+00 6.119634e-01 1.187443e+01
+770.0<Trec<785.0 | 0.000000e+00 0.000000e+00 0.000000e+00 2.597360e-01 0.000000e+00 0.000000e+00 0.000000e+00 1.783415e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3.666640e-01 0.000000e+00 1.783415e-01 3.666640e-01 0.000000e+00 1.783415e-01 0.000000e+00 2.742724e-01 1.488262e-01 0.000000e+00 4.759939e-01 1.571555e-01 1.571555e-01 3.143109e-01 6.036342e-01 1.058442e+00 6.119634e-01 9.481453e+00
+785.0<Trec<800.0 | 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.783415e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.488262e-01 6.248202e-01 7.524604e-01 4.631372e-01 9.096159e-01 1.066771e+00 1.474370e+01
+=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+
+
diff --git a/data/MiniBooNE/ncqe/flux.txt b/data/MiniBooNE/ncqe/flux.txt
new file mode 100644
index 0000000..836cec3
--- /dev/null
+++ b/data/MiniBooNE/ncqe/flux.txt
@@ -0,0 +1,200 @@
+0.0 2.272e-12 0
+0.05 8.566e-12 0
+0.1 1.112e-11 0
+0.15 1.335e-11 0
+0.2 1.658e-11 0
+0.25 1.82e-11 0
+0.3 1.946e-11 0
+0.35 2.045e-11 0
+0.4 2.161e-11 0
+0.45 2.241e-11 0
+0.5 2.279e-11 0
+0.55 2.292e-11 0
+0.6 2.275e-11 0
+0.65 2.253e-11 0
+0.7 2.214e-11 0
+0.75 2.156e-11 0
+0.8 2.078e-11 0
+0.85 1.992e-11 0
+0.9 1.894e-11 0
+0.95 1.789e-11 0
+1.0 1.677e-11 0
+1.05 1.558e-11 0
+1.1 1.439e-11 0
+1.15 1.318e-11 0
+1.2 1.193e-11 0
+1.25 1.069e-11 0
+1.3 9.503e-12 0
+1.35 8.356e-12 0
+1.4 7.278e-12 0
+1.45 6.292e-12 0
+1.5 5.396e-12 0
+1.55 4.601e-12 0
+1.6 3.902e-12 0
+1.65 3.285e-12 0
+1.7 2.76e-12 0
+1.75 2.312e-12 0
+1.8 1.932e-12 0
+1.85 1.616e-12 0
+1.9 1.355e-12 0
+1.95 1.138e-12 0
+2.0 9.589e-13 0
+2.05 8.15e-13 0
+2.1 6.928e-13 0
+2.15 5.937e-13 0
+2.2 5.147e-13 0
+2.25 4.478e-13 0
+2.3 3.935e-13 0
+2.35 3.5e-13 0
+2.4 3.15e-13 0
+2.45 2.867e-13 0
+2.5 2.615e-13 0
+2.55 2.409e-13 0
+2.6 2.273e-13 0
+2.65 2.11e-13 0
+2.7 1.995e-13 0
+2.75 1.92e-13 0
+2.8 1.815e-13 0
+2.85 1.726e-13 0
+2.9 1.665e-13 0
+2.95 1.601e-13 0
+3.0 1.554e-13 0
+3.05 1.493e-13 0
+3.1 1.442e-13 0
+3.15 1.412e-13 0
+3.2 1.363e-13 0
+3.25 1.323e-13 0
+3.3 1.265e-13 0
+3.35 1.217e-13 0
+3.4 1.183e-13 0
+3.45 1.14e-13 0
+3.5 1.102e-13 0
+3.55 1.06e-13 0
+3.6 1.014e-13 0
+3.65 9.7e-14 0
+3.7 9.34e-14 0
+3.75 9.001e-14 0
+3.8 8.641e-14 0
+3.85 8.19e-14 0
+3.9 7.867e-14 0
+3.95 7.464e-14 0
+4.0 7.146e-14 0
+4.05 6.812e-14 0
+4.1 6.499e-14 0
+4.15 6.185e-14 0
+4.2 5.858e-14 0
+4.25 5.614e-14 0
+4.3 5.32e-14 0
+4.35 5.016e-14 0
+4.4 4.765e-14 0
+4.45 4.561e-14 0
+4.5 4.281e-14 0
+4.55 4.087e-14 0
+4.6 3.841e-14 0
+4.65 3.632e-14 0
+4.7 3.432e-14 0
+4.75 3.263e-14 0
+4.8 3.016e-14 0
+4.85 2.857e-14 0
+4.9 2.689e-14 0
+4.95 2.529e-14 0
+5.0 2.372e-14 0
+5.05 2.227e-14 0
+5.1 2.103e-14 0
+5.15 1.957e-14 0
+5.2 1.834e-14 0
+5.25 1.73e-14 0
+5.3 1.615e-14 0
+5.35 1.513e-14 0
+5.4 1.406e-14 0
+5.45 1.303e-14 0
+5.5 1.214e-14 0
+5.55 1.129e-14 0
+5.6 1.047e-14 0
+5.65 9.569e-15 0
+5.7 8.87e-15 0
+5.75 8.148e-15 0
+5.8 7.429e-15 0
+5.85 6.765e-15 0
+5.9 6.097e-15 0
+5.95 5.492e-15 0
+6.0 4.977e-15 0
+6.05 4.445e-15 0
+6.1 3.967e-15 0
+6.15 3.492e-15 0
+6.2 3.037e-15 0
+6.25 2.595e-15 0
+6.3 2.225e-15 0
+6.35 1.854e-15 0
+6.4 1.537e-15 0
+6.45 1.22e-15 0
+6.5 9.78e-16 0
+6.55 7.842e-16 0
+6.6 6.198e-16 0
+6.65 4.786e-16 0
+6.7 3.334e-16 0
+6.75 1.971e-16 0
+6.8 9.391e-17 0
+6.85 2.738e-17 0
+6.9 6.065e-18 0
+6.95 4.135e-18 0
+7.0 1.933e-18 0
+7.05 9.888e-19 0
+7.1 4.494e-20 0
+7.15 0.0 0
+7.2 0.0 0
+7.25 0.0 0
+7.3 0.0 0
+7.35 0.0 0
+7.4 0.0 0
+7.45 0.0 0
+7.5 0.0 0
+7.55 0.0 0
+7.6 0.0 0
+7.65 0.0 0
+7.7 0.0 0
+7.75 0.0 0
+7.8 0.0 0
+7.85 0.0 0
+7.9 0.0 0
+7.95 0.0 0
+8.0 0.0 0
+8.05 0.0 0
+8.1 0.0 0
+8.15 0.0 0
+8.2 0.0 0
+8.25 0.0 0
+8.3 0.0 0
+8.35 0.0 0
+8.4 0.0 0
+8.45 0.0 0
+8.5 0.0 0
+8.55 0.0 0
+8.6 0.0 0
+8.65 0.0 0
+8.7 0.0 0
+8.75 0.0 0
+8.8 0.0 0
+8.85 0.0 0
+8.9 0.0 0
+8.95 0.0 0
+9.0 0.0 0
+9.05 0.0 0
+9.1 0.0 0
+9.15 0.0 0
+9.2 0.0 0
+9.25 0.0 0
+9.3 0.0 0
+9.35 0.0 0
+9.4 0.0 0
+9.45 0.0 0
+9.5 0.0 0
+9.55 0.0 0
+9.6 0.0 0
+9.65 0.0 0
+9.7 0.0 0
+9.75 0.0 0
+9.8 0.0 0
+9.85 0.0 0
+9.9 0.0 0
+9.95 0.0 0
diff --git a/data/MiniBooNE/ncqe/pospolarity_fluxes.dat b/data/MiniBooNE/ncqe/pospolarity_fluxes.dat
new file mode 100644
index 0000000..95091a4
--- /dev/null
+++ b/data/MiniBooNE/ncqe/pospolarity_fluxes.dat
@@ -0,0 +1,201 @@
+# Elo Ehi numu numub nue nueb
+ 0.00 0.05 2.272e-12 2.560e-12 1.530e-14 5.047e-15
+ 0.05 0.10 8.566e-12 5.671e-12 5.722e-14 1.156e-14
+ 0.10 0.15 1.112e-11 3.300e-12 1.273e-13 1.705e-14
+ 0.15 0.20 1.335e-11 2.028e-12 1.231e-13 1.529e-14
+ 0.20 0.25 1.658e-11 1.623e-12 1.042e-13 1.002e-14
+ 0.25 0.30 1.820e-11 1.395e-12 1.078e-13 1.039e-14
+ 0.30 0.35 1.946e-11 1.301e-12 1.093e-13 9.661e-15
+ 0.35 0.40 2.045e-11 1.249e-12 1.086e-13 9.990e-15
+ 0.40 0.45 2.161e-11 1.171e-12 1.061e-13 9.711e-15
+ 0.45 0.50 2.241e-11 1.054e-12 1.034e-13 9.380e-15
+ 0.50 0.55 2.279e-11 9.580e-13 1.001e-13 9.049e-15
+ 0.55 0.60 2.292e-11 8.695e-13 9.654e-14 9.298e-15
+ 0.60 0.65 2.275e-11 8.098e-13 9.198e-14 8.340e-15
+ 0.65 0.70 2.253e-11 7.434e-13 8.800e-14 8.007e-15
+ 0.70 0.75 2.214e-11 6.910e-13 8.467e-14 7.769e-15
+ 0.75 0.80 2.156e-11 6.314e-13 8.008e-14 7.364e-15
+ 0.80 0.85 2.078e-11 5.905e-13 7.740e-14 6.980e-15
+ 0.85 0.90 1.992e-11 5.504e-13 7.390e-14 6.944e-15
+ 0.90 0.95 1.894e-11 5.079e-13 6.924e-14 6.564e-15
+ 0.95 1.00 1.789e-11 4.708e-13 6.618e-14 5.783e-15
+ 1.00 1.05 1.677e-11 4.347e-13 6.239e-14 6.041e-15
+ 1.05 1.10 1.558e-11 4.021e-13 6.037e-14 5.471e-15
+ 1.10 1.15 1.439e-11 3.703e-13 5.633e-14 5.113e-15
+ 1.15 1.20 1.318e-11 3.443e-13 5.446e-14 5.054e-15
+ 1.20 1.25 1.193e-11 3.173e-13 5.014e-14 4.918e-15
+ 1.25 1.30 1.069e-11 2.872e-13 4.838e-14 4.902e-15
+ 1.30 1.35 9.503e-12 2.597e-13 4.520e-14 4.552e-15
+ 1.35 1.40 8.356e-12 2.337e-13 4.350e-14 4.400e-15
+ 1.40 1.45 7.278e-12 2.101e-13 4.028e-14 4.388e-15
+ 1.45 1.50 6.292e-12 1.903e-13 3.933e-14 3.939e-15
+ 1.50 1.55 5.396e-12 1.718e-13 3.696e-14 3.598e-15
+ 1.55 1.60 4.601e-12 1.507e-13 3.455e-14 3.530e-15
+ 1.60 1.65 3.902e-12 1.341e-13 3.285e-14 3.588e-15
+ 1.65 1.70 3.285e-12 1.173e-13 3.059e-14 3.289e-15
+ 1.70 1.75 2.760e-12 1.053e-13 2.885e-14 3.112e-15
+ 1.75 1.80 2.312e-12 9.241e-14 2.803e-14 2.919e-15
+ 1.80 1.85 1.932e-12 8.188e-14 2.574e-14 2.733e-15
+ 1.85 1.90 1.616e-12 7.115e-14 2.431e-14 2.850e-15
+ 1.90 1.95 1.355e-12 6.349e-14 2.298e-14 2.564e-15
+ 1.95 2.00 1.138e-12 5.547e-14 2.165e-14 2.514e-15
+ 2.00 2.05 9.589e-13 4.799e-14 2.042e-14 2.387e-15
+ 2.05 2.10 8.150e-13 4.071e-14 1.867e-14 2.242e-15
+ 2.10 2.15 6.928e-13 3.592e-14 1.763e-14 2.093e-15
+ 2.15 2.20 5.937e-13 3.082e-14 1.656e-14 2.027e-15
+ 2.20 2.25 5.147e-13 2.638e-14 1.545e-14 1.812e-15
+ 2.25 2.30 4.478e-13 2.248e-14 1.485e-14 1.724e-15
+ 2.30 2.35 3.935e-13 1.878e-14 1.361e-14 1.665e-15
+ 2.35 2.40 3.500e-13 1.623e-14 1.281e-14 1.532e-15
+ 2.40 2.45 3.150e-13 1.391e-14 1.190e-14 1.470e-15
+ 2.45 2.50 2.867e-13 1.162e-14 1.130e-14 1.394e-15
+ 2.50 2.55 2.615e-13 1.010e-14 1.043e-14 1.305e-15
+ 2.55 2.60 2.409e-13 8.691e-15 9.800e-15 1.279e-15
+ 2.60 2.65 2.273e-13 7.382e-15 8.832e-15 1.140e-15
+ 2.65 2.70 2.110e-13 5.999e-15 8.607e-15 1.042e-15
+ 2.70 2.75 1.995e-13 5.004e-15 7.727e-15 9.795e-16
+ 2.75 2.80 1.920e-13 4.204e-15 7.285e-15 9.706e-16
+ 2.80 2.85 1.815e-13 3.571e-15 6.793e-15 8.481e-16
+ 2.85 2.90 1.726e-13 3.047e-15 6.371e-15 8.082e-16
+ 2.90 2.95 1.665e-13 2.597e-15 5.772e-15 7.190e-16
+ 2.95 3.00 1.601e-13 2.138e-15 5.490e-15 6.964e-16
+ 3.00 3.05 1.554e-13 1.956e-15 4.989e-15 6.877e-16
+ 3.05 3.10 1.493e-13 1.584e-15 4.656e-15 6.044e-16
+ 3.10 3.15 1.442e-13 1.227e-15 4.211e-15 5.312e-16
+ 3.15 3.20 1.412e-13 1.021e-15 4.071e-15 5.064e-16
+ 3.20 3.25 1.363e-13 8.356e-16 3.819e-15 4.558e-16
+ 3.25 3.30 1.323e-13 7.777e-16 3.496e-15 4.458e-16
+ 3.30 3.35 1.265e-13 6.812e-16 3.165e-15 3.910e-16
+ 3.35 3.40 1.217e-13 7.386e-16 2.922e-15 3.674e-16
+ 3.40 3.45 1.183e-13 6.128e-16 2.624e-15 3.457e-16
+ 3.45 3.50 1.140e-13 6.251e-16 2.489e-15 3.385e-16
+ 3.50 3.55 1.102e-13 5.519e-16 2.276e-15 2.937e-16
+ 3.55 3.60 1.060e-13 3.936e-16 2.078e-15 2.900e-16
+ 3.60 3.65 1.014e-13 4.141e-16 1.887e-15 2.523e-16
+ 3.65 3.70 9.700e-14 3.395e-16 1.716e-15 2.363e-16
+ 3.70 3.75 9.340e-14 3.002e-16 1.603e-15 2.107e-16
+ 3.75 3.80 9.001e-14 2.502e-16 1.448e-15 1.936e-16
+ 3.80 3.85 8.641e-14 2.273e-16 1.338e-15 1.801e-16
+ 3.85 3.90 8.190e-14 2.299e-16 1.215e-15 1.561e-16
+ 3.90 3.95 7.867e-14 1.429e-16 1.171e-15 1.465e-16
+ 3.95 4.00 7.464e-14 1.574e-16 9.923e-16 1.371e-16
+ 4.00 4.05 7.146e-14 1.218e-16 9.308e-16 1.249e-16
+ 4.05 4.10 6.812e-14 1.280e-16 8.357e-16 1.148e-16
+ 4.10 4.15 6.499e-14 1.612e-16 7.638e-16 1.079e-16
+ 4.15 4.20 6.185e-14 8.604e-17 6.755e-16 9.442e-17
+ 4.20 4.25 5.858e-14 9.270e-17 6.545e-16 8.323e-17
+ 4.25 4.30 5.614e-14 5.371e-17 5.973e-16 7.855e-17
+ 4.30 4.35 5.320e-14 5.495e-17 5.257e-16 6.963e-17
+ 4.35 4.40 5.016e-14 4.276e-17 4.645e-16 6.551e-17
+ 4.40 4.45 4.765e-14 3.693e-17 4.304e-16 5.711e-17
+ 4.45 4.50 4.561e-14 6.592e-17 3.828e-16 4.896e-17
+ 4.50 4.55 4.281e-14 6.261e-17 3.410e-16 4.631e-17
+ 4.55 4.60 4.087e-14 2.266e-17 3.141e-16 4.348e-17
+ 4.60 4.65 3.841e-14 3.924e-17 2.881e-16 3.697e-17
+ 4.65 4.70 3.632e-14 5.036e-17 2.498e-16 3.522e-17
+ 4.70 4.75 3.432e-14 3.051e-17 2.223e-16 3.216e-17
+ 4.75 4.80 3.263e-14 7.985e-17 2.055e-16 2.985e-17
+ 4.80 4.85 3.016e-14 1.630e-16 1.819e-16 2.577e-17
+ 4.85 4.90 2.857e-14 1.787e-16 1.592e-16 2.299e-17
+ 4.90 4.95 2.689e-14 5.729e-17 1.407e-16 2.077e-17
+ 4.95 5.00 2.529e-14 6.383e-18 1.242e-16 1.950e-17
+ 5.00 5.05 2.372e-14 5.257e-18 1.142e-16 1.843e-17
+ 5.05 5.10 2.227e-14 5.222e-18 1.028e-16 1.332e-17
+ 5.10 5.15 2.103e-14 4.369e-18 8.425e-17 1.044e-17
+ 5.15 5.20 1.957e-14 3.186e-18 7.409e-17 9.753e-18
+ 5.20 5.25 1.834e-14 3.915e-18 6.574e-17 8.689e-18
+ 5.25 5.30 1.730e-14 2.197e-18 5.592e-17 8.865e-18
+ 5.30 5.35 1.615e-14 1.690e-18 4.790e-17 7.198e-18
+ 5.35 5.40 1.513e-14 1.177e-18 4.200e-17 6.320e-18
+ 5.40 5.45 1.406e-14 9.963e-19 3.153e-17 5.182e-18
+ 5.45 5.50 1.303e-14 9.197e-19 2.980e-17 3.874e-18
+ 5.50 5.55 1.214e-14 6.790e-19 2.362e-17 3.370e-18
+ 5.55 5.60 1.129e-14 5.695e-19 2.218e-17 3.068e-18
+ 5.60 5.65 1.047e-14 5.234e-19 1.834e-17 2.157e-18
+ 5.65 5.70 9.569e-15 3.209e-19 1.757e-17 2.255e-18
+ 5.70 5.75 8.870e-15 2.809e-19 1.367e-17 1.785e-18
+ 5.75 5.80 8.148e-15 2.700e-19 1.136e-17 1.269e-18
+ 5.80 5.85 7.429e-15 1.624e-19 9.188e-18 1.316e-18
+ 5.85 5.90 6.765e-15 1.383e-19 7.469e-18 8.751e-19
+ 5.90 5.95 6.097e-15 1.192e-19 6.502e-18 8.883e-19
+ 5.95 6.00 5.492e-15 9.024e-20 5.513e-18 6.479e-19
+ 6.00 6.05 4.977e-15 9.442e-20 4.571e-18 5.714e-19
+ 6.05 6.10 4.445e-15 5.076e-20 4.365e-18 6.861e-19
+ 6.10 6.15 3.967e-15 6.390e-20 2.147e-18 4.251e-19
+ 6.15 6.20 3.492e-15 4.695e-20 2.322e-18 4.221e-19
+ 6.20 6.25 3.037e-15 2.734e-20 1.548e-18 3.999e-19
+ 6.25 6.30 2.595e-15 3.940e-20 1.282e-18 3.749e-19
+ 6.30 6.35 2.225e-15 2.067e-20 1.049e-18 1.223e-19
+ 6.35 6.40 1.854e-15 2.327e-20 8.226e-19 2.968e-19
+ 6.40 6.45 1.537e-15 2.294e-20 8.297e-19 7.318e-20
+ 6.45 6.50 1.220e-15 1.385e-20 6.143e-19 1.551e-20
+ 6.50 6.55 9.780e-16 1.932e-21 8.553e-19 3.392e-19
+ 6.55 6.60 7.842e-16 8.299e-21 4.705e-19 2.261e-19
+ 6.60 6.65 6.198e-16 5.854e-21 4.387e-19 1.258e-19
+ 6.65 6.70 4.786e-16 1.843e-21 5.170e-19 9.574e-20
+ 6.70 6.75 3.334e-16 0.000e+00 3.049e-19 8.005e-20
+ 6.75 6.80 1.971e-16 1.783e-21 1.612e-19 4.006e-20
+ 6.80 6.85 9.391e-17 4.490e-21 1.606e-19 1.595e-19
+ 6.85 6.90 2.738e-17 4.205e-21 1.181e-19 0.000e+00
+ 6.90 6.95 6.065e-18 0.000e+00 1.960e-19 3.208e-19
+ 6.95 7.00 4.135e-18 0.000e+00 7.793e-20 1.196e-19
+ 7.00 7.05 1.933e-18 0.000e+00 1.571e-19 1.993e-19
+ 7.05 7.10 9.888e-19 0.000e+00 1.169e-19 1.595e-19
+ 7.10 7.15 4.494e-20 0.000e+00 0.000e+00 3.987e-20
+ 7.15 7.20 0.000e+00 1.211e-21 0.000e+00 0.000e+00
+ 7.20 7.25 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.25 7.30 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.30 7.35 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.35 7.40 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.40 7.45 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.45 7.50 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.50 7.55 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.55 7.60 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.60 7.65 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.65 7.70 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.70 7.75 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.75 7.80 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.80 7.85 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.85 7.90 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.90 7.95 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 7.95 8.00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.00 8.05 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.05 8.10 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.10 8.15 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.15 8.20 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.20 8.25 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.25 8.30 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.30 8.35 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.35 8.40 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.40 8.45 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.45 8.50 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.50 8.55 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.55 8.60 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.60 8.65 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.65 8.70 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.70 8.75 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.75 8.80 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.80 8.85 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.85 8.90 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.90 8.95 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 8.95 9.00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.00 9.05 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.05 9.10 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.10 9.15 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.15 9.20 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.20 9.25 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.25 9.30 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.30 9.35 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.35 9.40 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.40 9.45 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.45 9.50 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.50 9.55 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.55 9.60 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.60 9.65 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.65 9.70 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.70 9.75 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.75 9.80 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.80 9.85 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.85 9.90 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.90 9.95 0.000e+00 0.000e+00 0.000e+00 0.000e+00
+ 9.95 10.00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
diff --git a/data/T2K/CC0pi/T2K_CC0PI_2DPmuCosmu_Data.root b/data/T2K/CC0pi/T2K_CC0PI_2DPmuCosmu_Data.root
index 5449bcb..e6d858f 100644
Binary files a/data/T2K/CC0pi/T2K_CC0PI_2DPmuCosmu_Data.root and b/data/T2K/CC0pi/T2K_CC0PI_2DPmuCosmu_Data.root differ
diff --git a/data/T2K/CC0pi/cross-section_analysisI_bin0.txt b/data/T2K/CC0pi/cross-section_analysisI_bin0.txt
new file mode 100644
index 0000000..1540a39
--- /dev/null
+++ b/data/T2K/CC0pi/cross-section_analysisI_bin0.txt
@@ -0,0 +1,77 @@
+0
+3
+8
+15
+22
+30
+39
+47
+58
+
+0 | -1 - 0 | 0 - 0.3 | 0.255394
+1 | -1 - 0 | 0.3 - 0.4 | 0.207948
+2 | -1 - 0 | 0.4 - 30 | 0.000271813
+3 | 0 - 0.6 | 0 - 0.3 | 0.208457
+4 | 0 - 0.6 | 0.3 - 0.4 | 0.724434
+5 | 0 - 0.6 | 0.4 - 0.5 | 0.551849
+6 | 0 - 0.6 | 0.5 - 0.6 | 0.234113
+7 | 0 - 0.6 | 0.6 - 30 | 0.000368685
+8 | 0.6 - 0.7 | 0 - 0.3 | 0.178667
+9 | 0.6 - 0.7 | 0.3 - 0.4 | 0.63844
+10 | 0.6 - 0.7 | 0.4 - 0.5 | 0.714696
+11 | 0.6 - 0.7 | 0.5 - 0.6 | 0.935747
+12 | 0.6 - 0.7 | 0.6 - 0.7 | 0.646835
+13 | 0.6 - 0.7 | 0.7 - 0.8 | 0.0715046
+14 | 0.6 - 0.7 | 0.8 - 30 | 0.000476125
+15 | 0.7 - 0.8 | 0 - 0.3 | 0.104217
+16 | 0.7 - 0.8 | 0.3 - 0.4 | 0.490643
+17 | 0.7 - 0.8 | 0.4 - 0.5 | 0.824596
+18 | 0.7 - 0.8 | 0.5 - 0.6 | 0.915528
+19 | 0.7 - 0.8 | 0.6 - 0.7 | 0.775158
+20 | 0.7 - 0.8 | 0.7 - 0.8 | 0.255488
+21 | 0.7 - 0.8 | 0.8 - 30 | 0.00219411
+22 | 0.8 - 0.85 | 0 - 0.3 | 0.130715
+23 | 0.8 - 0.85 | 0.3 - 0.4 | 0.494917
+24 | 0.8 - 0.85 | 0.4 - 0.5 | 0.76077
+25 | 0.8 - 0.85 | 0.5 - 0.6 | 0.92914
+26 | 0.8 - 0.85 | 0.6 - 0.7 | 0.605259
+27 | 0.8 - 0.85 | 0.7 - 0.8 | 0.478013
+28 | 0.8 - 0.85 | 0.8 - 1 | 0.330544
+29 | 0.8 - 0.85 | 1 - 30 | 0.001706
+30 | 0.85 - 0.9 | 0 - 0.3 | 0.0519623
+31 | 0.85 - 0.9 | 0.3 - 0.4 | 0.383728
+32 | 0.85 - 0.9 | 0.4 - 0.5 | 0.743677
+33 | 0.85 - 0.9 | 0.5 - 0.6 | 0.863931
+34 | 0.85 - 0.9 | 0.6 - 0.7 | 1.02885
+35 | 0.85 - 0.9 | 0.7 - 0.8 | 0.465526
+36 | 0.85 - 0.9 | 0.8 - 1 | 0.288899
+37 | 0.85 - 0.9 | 1 - 1.5 | 0.17484
+38 | 0.85 - 0.9 | 1.5 - 30 | 0.000506115
+39 | 0.9 - 0.94 | 0 - 0.4 | 0.11857
+40 | 0.9 - 0.94 | 0.4 - 0.5 | 0.652239
+41 | 0.9 - 0.94 | 0.5 - 0.6 | 0.821718
+42 | 0.9 - 0.94 | 0.6 - 0.7 | 0.474617
+43 | 0.9 - 0.94 | 0.7 - 0.8 | 0.584867
+44 | 0.9 - 0.94 | 0.8 - 1.25 | 0.351801
+45 | 0.9 - 0.94 | 1.25 - 2 | 0.113308
+46 | 0.9 - 0.94 | 2 - 30 | 0.00152386
+47 | 0.94 - 0.98 | 0 - 0.4 | 0.0971869
+48 | 0.94 - 0.98 | 0.4 - 0.5 | 0.361972
+49 | 0.94 - 0.98 | 0.5 - 0.6 | 0.618293
+50 | 0.94 - 0.98 | 0.6 - 0.7 | 0.814948
+51 | 0.94 - 0.98 | 0.7 - 0.8 | 0.51946
+52 | 0.94 - 0.98 | 0.8 - 1 | 0.554242
+53 | 0.94 - 0.98 | 1 - 1.25 | 0.390123
+54 | 0.94 - 0.98 | 1.25 - 1.5 | 0.258903
+55 | 0.94 - 0.98 | 1.5 - 2 | 0.310958
+56 | 0.94 - 0.98 | 2 - 3 | 0.115618
+57 | 0.94 - 0.98 | 3 - 30 | 0.00393359
+58 | 0.98 - 1 | 0 - 0.5 | 0.130586
+59 | 0.98 - 1 | 0.5 - 0.6 | 0.225854
+60 | 0.98 - 1 | 0.6 - 0.7 | 0.338863
+61 | 0.98 - 1 | 0.7 - 0.8 | 0.301963
+62 | 0.98 - 1 | 0.8 - 1.25 | 0.117946
+63 | 0.98 - 1 | 1.25 - 2 | 0.239808
+64 | 0.98 - 1 | 2 - 3 | 0.283177
+65 | 0.98 - 1 | 3 - 5 | 0.281044
+66 | 0.98 - 1 | 5 - 30 | 0.0128204
diff --git a/data/T2K/CC0pi/cross-section_analysisI_bin1.txt b/data/T2K/CC0pi/cross-section_analysisI_bin1.txt
new file mode 100644
index 0000000..ba12726
--- /dev/null
+++ b/data/T2K/CC0pi/cross-section_analysisI_bin1.txt
@@ -0,0 +1,70 @@
+Units: momentum (GeV), cross-section (10^-38 cm2/(nucleon x GeV))
+
+bin number | cosTheta min - cosTheta max | momentum min - momentum max | measured xsec
+0 | -1 - 0 | 0 - 0.3 | 0.255394
+1 | -1 - 0 | 0.3 - 0.4 | 0.207948
+2 | -1 - 0 | 0.4 - 30 | 0.000271813
+3 | 0 - 0.6 | 0 - 0.3 | 0.208457
+4 | 0 - 0.6 | 0.3 - 0.4 | 0.724434
+5 | 0 - 0.6 | 0.4 - 0.5 | 0.551849
+6 | 0 - 0.6 | 0.5 - 0.6 | 0.234113
+7 | 0 - 0.6 | 0.6 - 30 | 0.000368685
+8 | 0.6 - 0.7 | 0 - 0.3 | 0.178667
+9 | 0.6 - 0.7 | 0.3 - 0.4 | 0.63844
+10 | 0.6 - 0.7 | 0.4 - 0.5 | 0.714696
+11 | 0.6 - 0.7 | 0.5 - 0.6 | 0.935747
+12 | 0.6 - 0.7 | 0.6 - 0.7 | 0.646835
+13 | 0.6 - 0.7 | 0.7 - 0.8 | 0.0715046
+14 | 0.6 - 0.7 | 0.8 - 30 | 0.000476125
+15 | 0.7 - 0.8 | 0 - 0.3 | 0.104217
+16 | 0.7 - 0.8 | 0.3 - 0.4 | 0.490643
+17 | 0.7 - 0.8 | 0.4 - 0.5 | 0.824596
+18 | 0.7 - 0.8 | 0.5 - 0.6 | 0.915528
+19 | 0.7 - 0.8 | 0.6 - 0.7 | 0.775158
+20 | 0.7 - 0.8 | 0.7 - 0.8 | 0.255488
+21 | 0.7 - 0.8 | 0.8 - 30 | 0.00219411
+22 | 0.8 - 0.85 | 0 - 0.3 | 0.130715
+23 | 0.8 - 0.85 | 0.3 - 0.4 | 0.494917
+24 | 0.8 - 0.85 | 0.4 - 0.5 | 0.76077
+25 | 0.8 - 0.85 | 0.5 - 0.6 | 0.92914
+26 | 0.8 - 0.85 | 0.6 - 0.7 | 0.605259
+27 | 0.8 - 0.85 | 0.7 - 0.8 | 0.478013
+28 | 0.8 - 0.85 | 0.8 - 1 | 0.330544
+29 | 0.8 - 0.85 | 1 - 30 | 0.001706
+30 | 0.85 - 0.9 | 0 - 0.3 | 0.0519623
+31 | 0.85 - 0.9 | 0.3 - 0.4 | 0.383728
+32 | 0.85 - 0.9 | 0.4 - 0.5 | 0.743677
+33 | 0.85 - 0.9 | 0.5 - 0.6 | 0.863931
+34 | 0.85 - 0.9 | 0.6 - 0.7 | 1.02885
+35 | 0.85 - 0.9 | 0.7 - 0.8 | 0.465526
+36 | 0.85 - 0.9 | 0.8 - 1 | 0.288899
+37 | 0.85 - 0.9 | 1 - 1.5 | 0.17484
+38 | 0.85 - 0.9 | 1.5 - 30 | 0.000506115
+39 | 0.9 - 0.94 | 0 - 0.4 | 0.11857
+40 | 0.9 - 0.94 | 0.4 - 0.5 | 0.652239
+41 | 0.9 - 0.94 | 0.5 - 0.6 | 0.821718
+42 | 0.9 - 0.94 | 0.6 - 0.7 | 0.474617
+43 | 0.9 - 0.94 | 0.7 - 0.8 | 0.584867
+44 | 0.9 - 0.94 | 0.8 - 1.25 | 0.351801
+45 | 0.9 - 0.94 | 1.25 - 2 | 0.113308
+46 | 0.9 - 0.94 | 2 - 30 | 0.00152386
+47 | 0.94 - 0.98 | 0 - 0.4 | 0.0971869
+48 | 0.94 - 0.98 | 0.4 - 0.5 | 0.361972
+49 | 0.94 - 0.98 | 0.5 - 0.6 | 0.618293
+50 | 0.94 - 0.98 | 0.6 - 0.7 | 0.814948
+51 | 0.94 - 0.98 | 0.7 - 0.8 | 0.51946
+52 | 0.94 - 0.98 | 0.8 - 1 | 0.554242
+53 | 0.94 - 0.98 | 1 - 1.25 | 0.390123
+54 | 0.94 - 0.98 | 1.25 - 1.5 | 0.258903
+55 | 0.94 - 0.98 | 1.5 - 2 | 0.310958
+56 | 0.94 - 0.98 | 2 - 3 | 0.115618
+57 | 0.94 - 0.98 | 3 - 30 | 0.00393359
+58 | 0.98 - 1 | 0 - 0.5 | 0.130586
+59 | 0.98 - 1 | 0.5 - 0.6 | 0.225854
+60 | 0.98 - 1 | 0.6 - 0.7 | 0.338863
+61 | 0.98 - 1 | 0.7 - 0.8 | 0.301963
+62 | 0.98 - 1 | 0.8 - 1.25 | 0.117946
+63 | 0.98 - 1 | 1.25 - 2 | 0.239808
+64 | 0.98 - 1 | 2 - 3 | 0.283177
+65 | 0.98 - 1 | 3 - 5 | 0.281044
+66 | 0.98 - 1 | 5 - 30 | 0.0128204
diff --git a/data/T2K/CC0pi/cross-section_analysisI_bin2.txt b/data/T2K/CC0pi/cross-section_analysisI_bin2.txt
new file mode 100644
index 0000000..ba12726
--- /dev/null
+++ b/data/T2K/CC0pi/cross-section_analysisI_bin2.txt
@@ -0,0 +1,70 @@
+Units: momentum (GeV), cross-section (10^-38 cm2/(nucleon x GeV))
+
+bin number | cosTheta min - cosTheta max | momentum min - momentum max | measured xsec
+0 | -1 - 0 | 0 - 0.3 | 0.255394
+1 | -1 - 0 | 0.3 - 0.4 | 0.207948
+2 | -1 - 0 | 0.4 - 30 | 0.000271813
+3 | 0 - 0.6 | 0 - 0.3 | 0.208457
+4 | 0 - 0.6 | 0.3 - 0.4 | 0.724434
+5 | 0 - 0.6 | 0.4 - 0.5 | 0.551849
+6 | 0 - 0.6 | 0.5 - 0.6 | 0.234113
+7 | 0 - 0.6 | 0.6 - 30 | 0.000368685
+8 | 0.6 - 0.7 | 0 - 0.3 | 0.178667
+9 | 0.6 - 0.7 | 0.3 - 0.4 | 0.63844
+10 | 0.6 - 0.7 | 0.4 - 0.5 | 0.714696
+11 | 0.6 - 0.7 | 0.5 - 0.6 | 0.935747
+12 | 0.6 - 0.7 | 0.6 - 0.7 | 0.646835
+13 | 0.6 - 0.7 | 0.7 - 0.8 | 0.0715046
+14 | 0.6 - 0.7 | 0.8 - 30 | 0.000476125
+15 | 0.7 - 0.8 | 0 - 0.3 | 0.104217
+16 | 0.7 - 0.8 | 0.3 - 0.4 | 0.490643
+17 | 0.7 - 0.8 | 0.4 - 0.5 | 0.824596
+18 | 0.7 - 0.8 | 0.5 - 0.6 | 0.915528
+19 | 0.7 - 0.8 | 0.6 - 0.7 | 0.775158
+20 | 0.7 - 0.8 | 0.7 - 0.8 | 0.255488
+21 | 0.7 - 0.8 | 0.8 - 30 | 0.00219411
+22 | 0.8 - 0.85 | 0 - 0.3 | 0.130715
+23 | 0.8 - 0.85 | 0.3 - 0.4 | 0.494917
+24 | 0.8 - 0.85 | 0.4 - 0.5 | 0.76077
+25 | 0.8 - 0.85 | 0.5 - 0.6 | 0.92914
+26 | 0.8 - 0.85 | 0.6 - 0.7 | 0.605259
+27 | 0.8 - 0.85 | 0.7 - 0.8 | 0.478013
+28 | 0.8 - 0.85 | 0.8 - 1 | 0.330544
+29 | 0.8 - 0.85 | 1 - 30 | 0.001706
+30 | 0.85 - 0.9 | 0 - 0.3 | 0.0519623
+31 | 0.85 - 0.9 | 0.3 - 0.4 | 0.383728
+32 | 0.85 - 0.9 | 0.4 - 0.5 | 0.743677
+33 | 0.85 - 0.9 | 0.5 - 0.6 | 0.863931
+34 | 0.85 - 0.9 | 0.6 - 0.7 | 1.02885
+35 | 0.85 - 0.9 | 0.7 - 0.8 | 0.465526
+36 | 0.85 - 0.9 | 0.8 - 1 | 0.288899
+37 | 0.85 - 0.9 | 1 - 1.5 | 0.17484
+38 | 0.85 - 0.9 | 1.5 - 30 | 0.000506115
+39 | 0.9 - 0.94 | 0 - 0.4 | 0.11857
+40 | 0.9 - 0.94 | 0.4 - 0.5 | 0.652239
+41 | 0.9 - 0.94 | 0.5 - 0.6 | 0.821718
+42 | 0.9 - 0.94 | 0.6 - 0.7 | 0.474617
+43 | 0.9 - 0.94 | 0.7 - 0.8 | 0.584867
+44 | 0.9 - 0.94 | 0.8 - 1.25 | 0.351801
+45 | 0.9 - 0.94 | 1.25 - 2 | 0.113308
+46 | 0.9 - 0.94 | 2 - 30 | 0.00152386
+47 | 0.94 - 0.98 | 0 - 0.4 | 0.0971869
+48 | 0.94 - 0.98 | 0.4 - 0.5 | 0.361972
+49 | 0.94 - 0.98 | 0.5 - 0.6 | 0.618293
+50 | 0.94 - 0.98 | 0.6 - 0.7 | 0.814948
+51 | 0.94 - 0.98 | 0.7 - 0.8 | 0.51946
+52 | 0.94 - 0.98 | 0.8 - 1 | 0.554242
+53 | 0.94 - 0.98 | 1 - 1.25 | 0.390123
+54 | 0.94 - 0.98 | 1.25 - 1.5 | 0.258903
+55 | 0.94 - 0.98 | 1.5 - 2 | 0.310958
+56 | 0.94 - 0.98 | 2 - 3 | 0.115618
+57 | 0.94 - 0.98 | 3 - 30 | 0.00393359
+58 | 0.98 - 1 | 0 - 0.5 | 0.130586
+59 | 0.98 - 1 | 0.5 - 0.6 | 0.225854
+60 | 0.98 - 1 | 0.6 - 0.7 | 0.338863
+61 | 0.98 - 1 | 0.7 - 0.8 | 0.301963
+62 | 0.98 - 1 | 0.8 - 1.25 | 0.117946
+63 | 0.98 - 1 | 1.25 - 2 | 0.239808
+64 | 0.98 - 1 | 2 - 3 | 0.283177
+65 | 0.98 - 1 | 3 - 5 | 0.281044
+66 | 0.98 - 1 | 5 - 30 | 0.0128204
diff --git a/data/T2K/CC0pi/cross-section_analysisI_bin3.txt b/data/T2K/CC0pi/cross-section_analysisI_bin3.txt
new file mode 100644
index 0000000..ba12726
--- /dev/null
+++ b/data/T2K/CC0pi/cross-section_analysisI_bin3.txt
@@ -0,0 +1,70 @@
+Units: momentum (GeV), cross-section (10^-38 cm2/(nucleon x GeV))
+
+bin number | cosTheta min - cosTheta max | momentum min - momentum max | measured xsec
+0 | -1 - 0 | 0 - 0.3 | 0.255394
+1 | -1 - 0 | 0.3 - 0.4 | 0.207948
+2 | -1 - 0 | 0.4 - 30 | 0.000271813
+3 | 0 - 0.6 | 0 - 0.3 | 0.208457
+4 | 0 - 0.6 | 0.3 - 0.4 | 0.724434
+5 | 0 - 0.6 | 0.4 - 0.5 | 0.551849
+6 | 0 - 0.6 | 0.5 - 0.6 | 0.234113
+7 | 0 - 0.6 | 0.6 - 30 | 0.000368685
+8 | 0.6 - 0.7 | 0 - 0.3 | 0.178667
+9 | 0.6 - 0.7 | 0.3 - 0.4 | 0.63844
+10 | 0.6 - 0.7 | 0.4 - 0.5 | 0.714696
+11 | 0.6 - 0.7 | 0.5 - 0.6 | 0.935747
+12 | 0.6 - 0.7 | 0.6 - 0.7 | 0.646835
+13 | 0.6 - 0.7 | 0.7 - 0.8 | 0.0715046
+14 | 0.6 - 0.7 | 0.8 - 30 | 0.000476125
+15 | 0.7 - 0.8 | 0 - 0.3 | 0.104217
+16 | 0.7 - 0.8 | 0.3 - 0.4 | 0.490643
+17 | 0.7 - 0.8 | 0.4 - 0.5 | 0.824596
+18 | 0.7 - 0.8 | 0.5 - 0.6 | 0.915528
+19 | 0.7 - 0.8 | 0.6 - 0.7 | 0.775158
+20 | 0.7 - 0.8 | 0.7 - 0.8 | 0.255488
+21 | 0.7 - 0.8 | 0.8 - 30 | 0.00219411
+22 | 0.8 - 0.85 | 0 - 0.3 | 0.130715
+23 | 0.8 - 0.85 | 0.3 - 0.4 | 0.494917
+24 | 0.8 - 0.85 | 0.4 - 0.5 | 0.76077
+25 | 0.8 - 0.85 | 0.5 - 0.6 | 0.92914
+26 | 0.8 - 0.85 | 0.6 - 0.7 | 0.605259
+27 | 0.8 - 0.85 | 0.7 - 0.8 | 0.478013
+28 | 0.8 - 0.85 | 0.8 - 1 | 0.330544
+29 | 0.8 - 0.85 | 1 - 30 | 0.001706
+30 | 0.85 - 0.9 | 0 - 0.3 | 0.0519623
+31 | 0.85 - 0.9 | 0.3 - 0.4 | 0.383728
+32 | 0.85 - 0.9 | 0.4 - 0.5 | 0.743677
+33 | 0.85 - 0.9 | 0.5 - 0.6 | 0.863931
+34 | 0.85 - 0.9 | 0.6 - 0.7 | 1.02885
+35 | 0.85 - 0.9 | 0.7 - 0.8 | 0.465526
+36 | 0.85 - 0.9 | 0.8 - 1 | 0.288899
+37 | 0.85 - 0.9 | 1 - 1.5 | 0.17484
+38 | 0.85 - 0.9 | 1.5 - 30 | 0.000506115
+39 | 0.9 - 0.94 | 0 - 0.4 | 0.11857
+40 | 0.9 - 0.94 | 0.4 - 0.5 | 0.652239
+41 | 0.9 - 0.94 | 0.5 - 0.6 | 0.821718
+42 | 0.9 - 0.94 | 0.6 - 0.7 | 0.474617
+43 | 0.9 - 0.94 | 0.7 - 0.8 | 0.584867
+44 | 0.9 - 0.94 | 0.8 - 1.25 | 0.351801
+45 | 0.9 - 0.94 | 1.25 - 2 | 0.113308
+46 | 0.9 - 0.94 | 2 - 30 | 0.00152386
+47 | 0.94 - 0.98 | 0 - 0.4 | 0.0971869
+48 | 0.94 - 0.98 | 0.4 - 0.5 | 0.361972
+49 | 0.94 - 0.98 | 0.5 - 0.6 | 0.618293
+50 | 0.94 - 0.98 | 0.6 - 0.7 | 0.814948
+51 | 0.94 - 0.98 | 0.7 - 0.8 | 0.51946
+52 | 0.94 - 0.98 | 0.8 - 1 | 0.554242
+53 | 0.94 - 0.98 | 1 - 1.25 | 0.390123
+54 | 0.94 - 0.98 | 1.25 - 1.5 | 0.258903
+55 | 0.94 - 0.98 | 1.5 - 2 | 0.310958
+56 | 0.94 - 0.98 | 2 - 3 | 0.115618
+57 | 0.94 - 0.98 | 3 - 30 | 0.00393359
+58 | 0.98 - 1 | 0 - 0.5 | 0.130586
+59 | 0.98 - 1 | 0.5 - 0.6 | 0.225854
+60 | 0.98 - 1 | 0.6 - 0.7 | 0.338863
+61 | 0.98 - 1 | 0.7 - 0.8 | 0.301963
+62 | 0.98 - 1 | 0.8 - 1.25 | 0.117946
+63 | 0.98 - 1 | 1.25 - 2 | 0.239808
+64 | 0.98 - 1 | 2 - 3 | 0.283177
+65 | 0.98 - 1 | 3 - 5 | 0.281044
+66 | 0.98 - 1 | 5 - 30 | 0.0128204
diff --git a/data/T2K/CC0pi/cross-section_analysisI_bin4.txt b/data/T2K/CC0pi/cross-section_analysisI_bin4.txt
new file mode 100644
index 0000000..ba12726
--- /dev/null
+++ b/data/T2K/CC0pi/cross-section_analysisI_bin4.txt
@@ -0,0 +1,70 @@
+Units: momentum (GeV), cross-section (10^-38 cm2/(nucleon x GeV))
+
+bin number | cosTheta min - cosTheta max | momentum min - momentum max | measured xsec
+0 | -1 - 0 | 0 - 0.3 | 0.255394
+1 | -1 - 0 | 0.3 - 0.4 | 0.207948
+2 | -1 - 0 | 0.4 - 30 | 0.000271813
+3 | 0 - 0.6 | 0 - 0.3 | 0.208457
+4 | 0 - 0.6 | 0.3 - 0.4 | 0.724434
+5 | 0 - 0.6 | 0.4 - 0.5 | 0.551849
+6 | 0 - 0.6 | 0.5 - 0.6 | 0.234113
+7 | 0 - 0.6 | 0.6 - 30 | 0.000368685
+8 | 0.6 - 0.7 | 0 - 0.3 | 0.178667
+9 | 0.6 - 0.7 | 0.3 - 0.4 | 0.63844
+10 | 0.6 - 0.7 | 0.4 - 0.5 | 0.714696
+11 | 0.6 - 0.7 | 0.5 - 0.6 | 0.935747
+12 | 0.6 - 0.7 | 0.6 - 0.7 | 0.646835
+13 | 0.6 - 0.7 | 0.7 - 0.8 | 0.0715046
+14 | 0.6 - 0.7 | 0.8 - 30 | 0.000476125
+15 | 0.7 - 0.8 | 0 - 0.3 | 0.104217
+16 | 0.7 - 0.8 | 0.3 - 0.4 | 0.490643
+17 | 0.7 - 0.8 | 0.4 - 0.5 | 0.824596
+18 | 0.7 - 0.8 | 0.5 - 0.6 | 0.915528
+19 | 0.7 - 0.8 | 0.6 - 0.7 | 0.775158
+20 | 0.7 - 0.8 | 0.7 - 0.8 | 0.255488
+21 | 0.7 - 0.8 | 0.8 - 30 | 0.00219411
+22 | 0.8 - 0.85 | 0 - 0.3 | 0.130715
+23 | 0.8 - 0.85 | 0.3 - 0.4 | 0.494917
+24 | 0.8 - 0.85 | 0.4 - 0.5 | 0.76077
+25 | 0.8 - 0.85 | 0.5 - 0.6 | 0.92914
+26 | 0.8 - 0.85 | 0.6 - 0.7 | 0.605259
+27 | 0.8 - 0.85 | 0.7 - 0.8 | 0.478013
+28 | 0.8 - 0.85 | 0.8 - 1 | 0.330544
+29 | 0.8 - 0.85 | 1 - 30 | 0.001706
+30 | 0.85 - 0.9 | 0 - 0.3 | 0.0519623
+31 | 0.85 - 0.9 | 0.3 - 0.4 | 0.383728
+32 | 0.85 - 0.9 | 0.4 - 0.5 | 0.743677
+33 | 0.85 - 0.9 | 0.5 - 0.6 | 0.863931
+34 | 0.85 - 0.9 | 0.6 - 0.7 | 1.02885
+35 | 0.85 - 0.9 | 0.7 - 0.8 | 0.465526
+36 | 0.85 - 0.9 | 0.8 - 1 | 0.288899
+37 | 0.85 - 0.9 | 1 - 1.5 | 0.17484
+38 | 0.85 - 0.9 | 1.5 - 30 | 0.000506115
+39 | 0.9 - 0.94 | 0 - 0.4 | 0.11857
+40 | 0.9 - 0.94 | 0.4 - 0.5 | 0.652239
+41 | 0.9 - 0.94 | 0.5 - 0.6 | 0.821718
+42 | 0.9 - 0.94 | 0.6 - 0.7 | 0.474617
+43 | 0.9 - 0.94 | 0.7 - 0.8 | 0.584867
+44 | 0.9 - 0.94 | 0.8 - 1.25 | 0.351801
+45 | 0.9 - 0.94 | 1.25 - 2 | 0.113308
+46 | 0.9 - 0.94 | 2 - 30 | 0.00152386
+47 | 0.94 - 0.98 | 0 - 0.4 | 0.0971869
+48 | 0.94 - 0.98 | 0.4 - 0.5 | 0.361972
+49 | 0.94 - 0.98 | 0.5 - 0.6 | 0.618293
+50 | 0.94 - 0.98 | 0.6 - 0.7 | 0.814948
+51 | 0.94 - 0.98 | 0.7 - 0.8 | 0.51946
+52 | 0.94 - 0.98 | 0.8 - 1 | 0.554242
+53 | 0.94 - 0.98 | 1 - 1.25 | 0.390123
+54 | 0.94 - 0.98 | 1.25 - 1.5 | 0.258903
+55 | 0.94 - 0.98 | 1.5 - 2 | 0.310958
+56 | 0.94 - 0.98 | 2 - 3 | 0.115618
+57 | 0.94 - 0.98 | 3 - 30 | 0.00393359
+58 | 0.98 - 1 | 0 - 0.5 | 0.130586
+59 | 0.98 - 1 | 0.5 - 0.6 | 0.225854
+60 | 0.98 - 1 | 0.6 - 0.7 | 0.338863
+61 | 0.98 - 1 | 0.7 - 0.8 | 0.301963
+62 | 0.98 - 1 | 0.8 - 1.25 | 0.117946
+63 | 0.98 - 1 | 1.25 - 2 | 0.239808
+64 | 0.98 - 1 | 2 - 3 | 0.283177
+65 | 0.98 - 1 | 3 - 5 | 0.281044
+66 | 0.98 - 1 | 5 - 30 | 0.0128204
diff --git a/data/T2K/CC0pi/cross-section_analysisI_bin5.txt b/data/T2K/CC0pi/cross-section_analysisI_bin5.txt
new file mode 100644
index 0000000..ba12726
--- /dev/null
+++ b/data/T2K/CC0pi/cross-section_analysisI_bin5.txt
@@ -0,0 +1,70 @@
+Units: momentum (GeV), cross-section (10^-38 cm2/(nucleon x GeV))
+
+bin number | cosTheta min - cosTheta max | momentum min - momentum max | measured xsec
+0 | -1 - 0 | 0 - 0.3 | 0.255394
+1 | -1 - 0 | 0.3 - 0.4 | 0.207948
+2 | -1 - 0 | 0.4 - 30 | 0.000271813
+3 | 0 - 0.6 | 0 - 0.3 | 0.208457
+4 | 0 - 0.6 | 0.3 - 0.4 | 0.724434
+5 | 0 - 0.6 | 0.4 - 0.5 | 0.551849
+6 | 0 - 0.6 | 0.5 - 0.6 | 0.234113
+7 | 0 - 0.6 | 0.6 - 30 | 0.000368685
+8 | 0.6 - 0.7 | 0 - 0.3 | 0.178667
+9 | 0.6 - 0.7 | 0.3 - 0.4 | 0.63844
+10 | 0.6 - 0.7 | 0.4 - 0.5 | 0.714696
+11 | 0.6 - 0.7 | 0.5 - 0.6 | 0.935747
+12 | 0.6 - 0.7 | 0.6 - 0.7 | 0.646835
+13 | 0.6 - 0.7 | 0.7 - 0.8 | 0.0715046
+14 | 0.6 - 0.7 | 0.8 - 30 | 0.000476125
+15 | 0.7 - 0.8 | 0 - 0.3 | 0.104217
+16 | 0.7 - 0.8 | 0.3 - 0.4 | 0.490643
+17 | 0.7 - 0.8 | 0.4 - 0.5 | 0.824596
+18 | 0.7 - 0.8 | 0.5 - 0.6 | 0.915528
+19 | 0.7 - 0.8 | 0.6 - 0.7 | 0.775158
+20 | 0.7 - 0.8 | 0.7 - 0.8 | 0.255488
+21 | 0.7 - 0.8 | 0.8 - 30 | 0.00219411
+22 | 0.8 - 0.85 | 0 - 0.3 | 0.130715
+23 | 0.8 - 0.85 | 0.3 - 0.4 | 0.494917
+24 | 0.8 - 0.85 | 0.4 - 0.5 | 0.76077
+25 | 0.8 - 0.85 | 0.5 - 0.6 | 0.92914
+26 | 0.8 - 0.85 | 0.6 - 0.7 | 0.605259
+27 | 0.8 - 0.85 | 0.7 - 0.8 | 0.478013
+28 | 0.8 - 0.85 | 0.8 - 1 | 0.330544
+29 | 0.8 - 0.85 | 1 - 30 | 0.001706
+30 | 0.85 - 0.9 | 0 - 0.3 | 0.0519623
+31 | 0.85 - 0.9 | 0.3 - 0.4 | 0.383728
+32 | 0.85 - 0.9 | 0.4 - 0.5 | 0.743677
+33 | 0.85 - 0.9 | 0.5 - 0.6 | 0.863931
+34 | 0.85 - 0.9 | 0.6 - 0.7 | 1.02885
+35 | 0.85 - 0.9 | 0.7 - 0.8 | 0.465526
+36 | 0.85 - 0.9 | 0.8 - 1 | 0.288899
+37 | 0.85 - 0.9 | 1 - 1.5 | 0.17484
+38 | 0.85 - 0.9 | 1.5 - 30 | 0.000506115
+39 | 0.9 - 0.94 | 0 - 0.4 | 0.11857
+40 | 0.9 - 0.94 | 0.4 - 0.5 | 0.652239
+41 | 0.9 - 0.94 | 0.5 - 0.6 | 0.821718
+42 | 0.9 - 0.94 | 0.6 - 0.7 | 0.474617
+43 | 0.9 - 0.94 | 0.7 - 0.8 | 0.584867
+44 | 0.9 - 0.94 | 0.8 - 1.25 | 0.351801
+45 | 0.9 - 0.94 | 1.25 - 2 | 0.113308
+46 | 0.9 - 0.94 | 2 - 30 | 0.00152386
+47 | 0.94 - 0.98 | 0 - 0.4 | 0.0971869
+48 | 0.94 - 0.98 | 0.4 - 0.5 | 0.361972
+49 | 0.94 - 0.98 | 0.5 - 0.6 | 0.618293
+50 | 0.94 - 0.98 | 0.6 - 0.7 | 0.814948
+51 | 0.94 - 0.98 | 0.7 - 0.8 | 0.51946
+52 | 0.94 - 0.98 | 0.8 - 1 | 0.554242
+53 | 0.94 - 0.98 | 1 - 1.25 | 0.390123
+54 | 0.94 - 0.98 | 1.25 - 1.5 | 0.258903
+55 | 0.94 - 0.98 | 1.5 - 2 | 0.310958
+56 | 0.94 - 0.98 | 2 - 3 | 0.115618
+57 | 0.94 - 0.98 | 3 - 30 | 0.00393359
+58 | 0.98 - 1 | 0 - 0.5 | 0.130586
+59 | 0.98 - 1 | 0.5 - 0.6 | 0.225854
+60 | 0.98 - 1 | 0.6 - 0.7 | 0.338863
+61 | 0.98 - 1 | 0.7 - 0.8 | 0.301963
+62 | 0.98 - 1 | 0.8 - 1.25 | 0.117946
+63 | 0.98 - 1 | 1.25 - 2 | 0.239808
+64 | 0.98 - 1 | 2 - 3 | 0.283177
+65 | 0.98 - 1 | 3 - 5 | 0.281044
+66 | 0.98 - 1 | 5 - 30 | 0.0128204
diff --git a/data/T2K/CC0pi/makedatafile_t2kcc0pi.py b/data/T2K/CC0pi/makedatafile_t2kcc0pi.py
index a8710b7..acc5297 100644
--- a/data/T2K/CC0pi/makedatafile_t2kcc0pi.py
+++ b/data/T2K/CC0pi/makedatafile_t2kcc0pi.py
@@ -1,186 +1,294 @@
from ROOT import *
from array import *
def GetMiddle(mystr):
lims = mystr.strip().split(" - ")
val = (float(lims[0]) + float(lims[1]))/2.0
return val
def GetLowEdge(mystr):
lims = mystr.strip().split(" - ")
val = (float(lims[0]) + 0.00001)
return val
def GetHighEdge(mystr):
lims = mystr.strip().split(" - ")
val = (float(lims[1]) - 0.00001)
return val
def GetIndex(mystr):
lims = mystr.split("-")
return int(lims[0]), int(lims[1])
outfile = TFile("T2K_CC0PI_2DPmuCosmu_Data.root","RECREATE")
# ANALYSIS I
#______________________________
xedge = [0.0, 0.3, 0.4, 0.5, 0.65, 0.8, 0.95, 1.1, 1.25, 1.5, 2.0, 3.0, 5.0, 30.0]
yedge = [-1.0, 0.0, 0.6, 0.7, 0.8, 0.85, 0.9, 0.94, 0.98, 1.0]
datahist = TH2D("analysis1_data","analysis1_data",
len(xedge)-1, array('f',xedge),
len(yedge)-1, array('f',yedge))
maphist = datahist.Clone("analysis1_map")
maphist.SetTitle("analysis1_map")
counthist = datahist.Clone("analysis1_entrycount")
-
+
+datapoly = TH2Poly("datapoly","datapoly", 0.0,30.0, -1.0, 1.0)
+hist = None
+
+binedges = []
+histedgeslist = []
+xsecvals = []
+histxseclist = []
+
+binlimits = [3,8,15,22,30,39,47,58,67]
with open("cross-section_analysisI.txt") as f:
count = 0
for line in f:
count += 1
if (count < 4): continue
data = line.strip().split("|")
if (len(data) < 1): continue
ibin = int( data[0] ) + 1
- xval = GetLowEdge( data[2] )
- yval = GetLowEdge( data[1] )
- xhig = GetHighEdge( data[2] )
- yhig = GetHighEdge( data[1] )
+ xval = round(float(GetLowEdge( data[2] )),4)
+ yval = round(float(GetLowEdge( data[1] )),4)
+ xhig = round(float(GetHighEdge( data[2] )),4)
+ yhig = round(float(GetHighEdge( data[1] )),4)
xsec = float( data[3] ) * 1E-38
+ datapoly.AddBin( xval, yval, xhig, yhig )
+ datapoly.SetBinContent( datapoly.GetNumberOfBins(), xsec)
+
+ binedges.append( xval )
+ xsecvals.append( xsec )
+ if ibin in binlimits:
+ binedges.append( xhig )
+ histedgeslist.append(binedges)
+ histxseclist.append(xsecvals)
+ binedges = []
+ xsecvals = []
+
+
datahist.Fill(xval, yval, xsec)
counthist.Fill(xval, yval, 1.0)
for i in range(maphist.GetNbinsX()):
for j in range(maphist.GetNbinsY()):
xcent = maphist.GetXaxis().GetBinCenter(i+1)
ycent = maphist.GetYaxis().GetBinCenter(j+1)
if (xcent > xval and xcent < xhig and
ycent > yval and ycent < yhig):
maphist.SetBinContent(i+1,j+1, ibin)
+data1D = TH1D("datahist","datahist", datapoly.GetNumberOfBins(), 0.0, float(datapoly.GetNumberOfBins()));
+for i in range(datapoly.GetNumberOfBins()):
+ data1D.SetBinContent(i+1, datapoly.GetBinContent(i+1));
+
outfile.cd()
datahist.Write()
counthist.Write()
maphist.Write()
+datapoly.Write()
+data1D.Write()
+
+for i, obj in enumerate(histedgeslist):
+ print obj
+
+ hist = TH1D("dataslice_" + str(i), "dataslice_" + str(i), len(obj)-1, array('f',obj))
+ for j in range(hist.GetNbinsX()):
+ hist.SetBinContent(j+1, histxseclist[i][j])
+
+ hist.GetXaxis().SetRangeUser(obj[0], obj[len(obj)-2])
+ hist.Draw("HIST")
+ gPad.Update()
+
+ hist.SetNameTitle("dataslice_" + str(i),"dataslice_" + str(i))
+ hist.Write()
+
+# Get N Bins
+nbins = 67
+print "NBins I = ", nbins
+
+# Get Covariances (keep in 1E-38 cm^2)
+statcov = TH2D("analysis1_statcov","analysis1_statcov", nbins, 0.0, float(nbins), nbins, 0.0, float(nbins));
+systcov = TH2D("analysis1_systcov","analysis1_systcov", nbins, 0.0, float(nbins), nbins, 0.0, float(nbins));
+normcov = TH2D("analysis1_normcov","analysis1_normcov", nbins, 0.0, float(nbins), nbins, 0.0, float(nbins));
+totcov = TH2D("analysis1_totcov","analysis1_totcov", nbins, 0.0, float(nbins), nbins, 0.0, float(nbins));
+
+with open("covariance_statisticUncertainty_analysisI.txt") as f:
+ count = 0
+ for line in f:
+ count += 1
+
+ if (count < 4): continue
+ data = line.strip().split("|")
+ if (len(data) < 1): continue
+
+ xi, yi = GetIndex(data[0])
+ cov = float(data[1])
+
+ statcov.SetBinContent(xi, yi, cov)
+
+with open("covariance_shapeSystematics_analysisI.txt") as f:
+ count = 0
+ for line in f:
+ count += 1
+
+ if (count < 4): continue
+ data = line.strip().split("|")
+ if (len(data) < 1): continue
+
+ xi, yi = GetIndex(data[0])
+ cov = float(data[1])
+
+ systcov.SetBinContent(xi + 1, yi + 1, cov)
+
+with open("covariance_fluxNormalizationSystematics_analysisI.txt") as f:
+ count = 0
+ for line in f:
+ count += 1
+
+ if (count < 4): continue
+ data = line.strip().split("|")
+ if (len(data) < 1): continue
+
+ xi, yi = GetIndex(data[0])
+ cov = float(data[1])
+
+ normcov.SetBinContent(xi + 1, yi + 1, cov)
+
+totcov.Add(systcov)
+totcov.Add(statcov)
+totcov.Add(normcov)
+
+outfile.cd()
+statcov.Write()
+systcov.Write()
+totcov.Write()
+normcov.Write()
+
+
# ANALYSIS II
#______________________________
xedge = [0.2, 0.35, 0.5, 0.65, 0.8, 0.95, 1.1, 1.25, 1.5, 2.0, 3.0, 5.0, 30.0]
yedge = [0.6, 0.7, 0.8, 0.85, 0.9, 0.925, 0.95, 0.975, 1.0]
datahist = TH2D("analysis2_data","analysis2_data",
len(xedge)-1, array('f',xedge),
len(yedge)-1, array('f',yedge))
maphist = datahist.Clone("analysis2_map")
maphist.SetTitle("analysis2_map")
counthist = datahist.Clone("analysis2_entrycount")
# Get Data Entries
entries = []
count = 0
with open("rps_crossSection_analysis2.txt") as f:
for line in f:
count += 1
if (count < 4): continue
data = line.strip().split("|")
if (len(data) < 1): continue
ibin = int( data[0] ) + 1
xval = GetMiddle( data[2] )
yval = GetMiddle( data[1] )
xsec = float( data[3] ) * 1E-38
datahist.Fill(xval, yval, xsec)
maphist.Fill(xval, yval, ibin)
counthist.Fill(xval, yval, 1.0)
- print ibin, "Map Value"
+ # print ibin, "Map Value"
# Get N Bins
nbins = int(maphist.GetMaximum())
print "NBins I = ", nbins
# Get Covariances (keep in 1E-38 cm^2)
statcov = TH2D("analysis2_statcov","analysis2_statcov", nbins, 0.0, float(nbins), nbins, 0.0, float(nbins));
systcov = TH2D("analysis2_systcov","analysis2_systcov", nbins, 0.0, float(nbins), nbins, 0.0, float(nbins));
normcov = TH2D("analysis2_normcov","analysis2_normcov", nbins, 0.0, float(nbins), nbins, 0.0, float(nbins));
totcov = TH2D("analysis2_totcov","analysis2_totcov", nbins, 0.0, float(nbins), nbins, 0.0, float(nbins));
with open("rps_statsCov_analysis2.txt") as f:
count = 0
for line in f:
count += 1
if (count < 4): continue
data = line.strip().split("|")
if (len(data) < 1): continue
xi, yi = GetIndex(data[0])
cov = float(data[1])
statcov.SetBinContent(xi, yi, cov)
with open("rps_systCov_analysis2.txt") as f:
count = 0
for line in f:
count += 1
if (count < 4): continue
data = line.strip().split("|")
if (len(data) < 1): continue
xi, yi = GetIndex(data[0])
cov = float(data[1])
systcov.SetBinContent(xi + 1, yi + 1, cov)
with open("rps_fluxNormCov_analysis2.txt") as f:
count = 0
for line in f:
count += 1
if (count < 4): continue
data = line.strip().split("|")
if (len(data) < 1): continue
xi, yi = GetIndex(data[0])
cov = float(data[1])
normcov.SetBinContent(xi + 1, yi + 1, cov)
totcov.Add(systcov)
totcov.Add(statcov)
totcov.Add(normcov)
outfile.cd()
datahist.Write()
maphist.Write()
counthist.Write()
statcov.Write()
systcov.Write()
totcov.Write()
normcov.Write()
+
+# LocalWords: xval
diff --git a/parameters/config.xml b/parameters/config.xml
index 745ea7d..128a78c 100644
--- a/parameters/config.xml
+++ b/parameters/config.xml
@@ -1,167 +1,167 @@
<nuisance>
<!-- # ###################################################### -->
<!-- # NUISANCE CONFIGURATION OPTIONS -->
<!-- # This file is read in by default at runtime -->
<!-- # If you want to override on a case by case bases use -q at runtime -->
<!-- # ###################################################### -->
<!-- # MAIN Configs -->
<!-- # ###################################################### -->
<!-- # Logger goes from -->
<!-- # 1 Quiet -->
<!-- # 2 Fitter -->
<!-- # 3 Samples -->
<!-- # 4 Reconfigure Loops -->
<!-- # 5 Every Event print out (SHOUT) -->
<!-- # -1 DEBUGGING -->
<config verbosity='5'/>
<config VERBOSITY='5'/>
<!-- # ERROR goes from -->
<!-- # 0 NONE -->
<!-- # 1 FATAL -->
<!-- # 2 WARN -->
<config ERROR='2'/>
<config TRACE='1'/>
<config cores='2' />
<config spline_test_throws='50' />
<config spline_cores='6' />
<config spline_chunks='10' />
<config spline_procchunk='-1' />
<config Electron_NThetaBins='4' />
<config Electron_NEnergyBins='4' />
<config Electron_ThetaWidth='2.0' />
<config Electron_EnergyWidth='0.10' />
<!-- # Input Configs -->
<!-- # ###################################################### -->
<!-- # Default Requirements file for the externalDataFitter Package -->
<!-- # MAX Events : -1 is no cut. Events will be scaled automatically to give good xsec predictions. -->
<config input.maxevents='-1'/>
<config MAXEVENTS='-1'/>
<config input.MAXEVENTS='-1'/>
<config includeemptystackhists='0'/>
<!-- # Turn on/off event manager -->
<!-- # EventManager enables us to only loop number of events once for multiple projections of the same measurements -->
<!-- # e.g. MiniBooNE CC1pi+ Q2 and MiniBooNE CC1pi+ Tmu would ordinarily require 2 reconfigures, but with this enabled it requires only one -->
<config input.eventmanager='1'/>
<config EventManager='1'/>
<!-- # Event Directories -->
<!-- # Can setup default directories and use @EVENT_DIR/path to link to it -->
<config EVENT_DIR='/data2/stowell/NIWG/'/>
<config NEUT_EVENT_DIR='/data2/stowell/NIWG/neut/fit_samples_neut5.3.3/'/>
<config GENIE_EVENT_DIR='/data2/stowell/NIWG/genie/fit_samples_R.2.10.0/'/>
<config NUWRO_EVENT_DIR='/data2/stowell/NIWG/nuwro/fit_samples/'/>
<config GIBUU_EVENT_DIR='/data/GIBUU/DIR/'/>
<!-- # In PrepareGENIE the reconstructed splines can be saved into the file -->
<config save_genie_splines='1'/>
<!-- # In InputHandler the option to regenerate NuWro flux/xsec plots is available -->
<!-- # Going to move this to its own app soon -->
<config input.regen_nuwro_plots='0'/>
<!-- # DEVEL CONFIG OPTION, don't touch! -->
-<config CacheSize='1000000'/>
+<config CacheSize='50000000'/>
<!-- # ReWeighting Configuration Options -->
<!-- # ###################################################### -->
<!-- # Set absolute twkdial for parameters -->
<config params.setabstwk='0'/>
<!-- # Convert Dials in output statements using dial conversion card -->
<config convert_dials='0'/>
<!-- # Make RW Calculations be quiet -->
<config params.silentweighting='0'/>
<!-- # Vetos can be used to specify RW dials NOT to be loaded in -->
<!-- # Useful if one specific one has an issue -->
<config FitWeight.fNIWGRW_veto=''/>
<config FitWeight.fNuwroRW_veto=''/>
<config FitWeight.fNeutRW_veto=''/>
<config FitWeight.fGenieRW_veto=''/>
<!-- # Output Options -->
<!-- # ###################################################### -->
<!-- # Save Nominal prediction with all rw engines at default -->
<config savenominal='0'/>
<!-- # Save prefit with values at starting values -->
<config saveprefit='0'/>
<!-- # Here's the full list of drawing options -->
<!-- # See src/FitBase/Measurement1D::Write for more info -->
<!-- #config drawopts DATA/MC/EVT/FINE/RATIO/MODES/SHAPE/RESIDUAL/MATRIX/FLUX/MASK/MAP -->
<!-- #config drawopts DATA/MC -->
<config drawopts='DATA/MC/EVT/FINE/RATIO/MODES/SHAPE/FLUX/XSEC/MASK/COV/INCOV/DECOMP/CANVPDG/CANVMC'/>
<!-- # Save the shape scaling applied with option SHAPE into the main MC hist -->
<config saveshapescaling='0'/>
<!-- # Set style of 1D output histograms -->
<config linecolour='1'/>
<config linestyle='1'/>
<config linewidth='1'/>
<!-- # For GenericFlux -->
<config isLiteMode='0'/>
<!-- # Statistical Options -->
<!-- # ###################################################### -->
<!-- # Add MC Statistical error to likelihoods -->
<config statutils.addmcerror='0'/>
<!-- # NUISMIN Configurations -->
<!-- # ###################################################### -->
<config minimizer.maxcalls='1000000'/>
<config minimizer.maxiterations='1000000'/>
<config minimizer.tolerance='0.001'/>
<!-- # Number of events required in low stats routines -->
<config minimizer.lowstatevents='25000'/>
<!-- # Error band generator configs -->
<!-- # ###################################################### -->
<!-- # For -f ErrorBands creates error bands for given measurements -->
<!-- # How many throws do we want (The higher the better precision) -->
<config error_throws='250'/>
<!-- # Are we throwing uniform or according to Gaussian? -->
<!-- # Only use uniform if wanting to study the limits of a dial. -->
<config error_uniform='0'/>
<config WriteSeperateStacks='1'/>
<!-- # Other Individual Case Configs -->
<!-- # ###################################################### -->
<!-- # Covariance throw options for fake data studies with MiniBooNE data. -->
<config thrown_covariance='FULL'/>
<config throw_mc_stat='0.0'/>
<config throw_diag_syst='0'/>
<config throw_corr_syst='0'/>
<config throw_mc_stat='0'/>
<!-- # Apply a shift to the muon momentum before calculation of Q2 -->
<config muon_momentum_shift='0.0'/>
<config muon_momentum_throw='0'/>
<!-- # MINERvA Specific Configs -->
<config MINERvA_XSec_CCinc_2DEavq3_nu.hadron_cut='0'/>
<config MINERvA_CCinc_XSec_2DEavq3_nu.useq3true='0'/>
<config Modes.split_PN_NN='0'/>
<config SignalReconfigures='0'/>
</nuisance>
diff --git a/profiling/runprofiler.sh b/profiling/runprofiler.sh
new file mode 100755
index 0000000..3f5b9ca
--- /dev/null
+++ b/profiling/runprofiler.sh
@@ -0,0 +1,22 @@
+#!/bin/env sh
+
+# Read Inputs
+PROFILEOUT=$1
+PROGRAM=$(which $2)
+ARGUMENTS=${@:3}
+PPROF=$EXT_FIT/build/Ext/src/gperftools/src/pprof
+
+# Log
+echo "Profiling : $PROGRAM"
+echo "Saving to : $CPUPROFILE"
+echo "Running : $PROGRAM $ARGUMENTS"
+
+# Run PROFILING
+echo ""
+CPUPROFILE=$PROFILEOUT $2 $ARGUMENTS
+
+# Make PDF + TXT
+echo ""
+echo "Building outputs"
+$PPROF --pdf $PROGRAM $PROFILEOUT > ${PROFILEOUT}.pdf
+$PPROF --text $PROGRAM $PROFILEOUT > ${PROFILEOUT}.txt
diff --git a/src/FCN/SampleList.cxx b/src/FCN/SampleList.cxx
index 1873514..35e42cc 100644
--- a/src/FCN/SampleList.cxx
+++ b/src/FCN/SampleList.cxx
@@ -1,648 +1,647 @@
#include "SampleList.h"
//! Functions to make it easier for samples to be created and handled.
namespace SampleUtils {
//! Create a given sample given its name, file, type, fakdata(fkdt) file and the
//! current rw engine and push it back into the list fChain.
MeasurementBase* CreateSample(std::string name, std::string file,
std::string type, std::string fkdt, FitWeight* rw) {
nuiskey samplekey = Config::CreateKey("sample");
samplekey.AddS("name", name);
samplekey.AddS("input", file);
samplekey.AddS("type", type);
return CreateSample(samplekey);
}
MeasurementBase* CreateSample(nuiskey samplekey) {
FitWeight* rw = FitBase::GetRW();
std::string name = samplekey.GetS("name");
std::string file = samplekey.GetS("input");
std::string type = samplekey.GetS("type");
std::string fkdt = "";
/*
ANL CCQE Samples
*/
if (!name.compare("ANL_CCQE_XSec_1DEnu_nu") ||
!name.compare("ANL_CCQE_XSec_1DEnu_nu_PRD26") ||
!name.compare("ANL_CCQE_XSec_1DEnu_nu_PRL31") ||
!name.compare("ANL_CCQE_XSec_1DEnu_nu_PRD16")) {
return (new ANL_CCQE_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("ANL_CCQE_Evt_1DQ2_nu") ||
!name.compare("ANL_CCQE_Evt_1DQ2_nu_PRL31") ||
!name.compare("ANL_CCQE_Evt_1DQ2_nu_PRD26") ||
!name.compare("ANL_CCQE_Evt_1DQ2_nu_PRD16")) {
return (new ANL_CCQE_Evt_1DQ2_nu(samplekey));
/*
ANL CC1ppip samples
*/
} else if (!name.compare("ANL_CC1ppip_XSec_1DEnu_nu") ||
!name.compare("ANL_CC1ppip_XSec_1DEnu_nu_W14Cut") ||
!name.compare("ANL_CC1ppip_XSec_1DEnu_nu_Uncorr") ||
!name.compare("ANL_CC1ppip_XSec_1DEnu_nu_W14Cut_Uncorr") ||
!name.compare("ANL_CC1ppip_XSec_1DEnu_nu_W16Cut_Uncorr")) {
return (new ANL_CC1ppip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("ANL_CC1ppip_XSec_1DQ2_nu")) {
return (new ANL_CC1ppip_XSec_1DQ2_nu(samplekey));
} else if (!name.compare("ANL_CC1ppip_Evt_1DQ2_nu") ||
!name.compare("ANL_CC1ppip_Evt_1DQ2_nu_W14Cut")) {
return (new ANL_CC1ppip_Evt_1DQ2_nu(samplekey));
} else if (!name.compare("ANL_CC1ppip_Evt_1Dppi_nu")) {
return (new ANL_CC1ppip_Evt_1Dppi_nu(samplekey));
} else if (!name.compare("ANL_CC1ppip_Evt_1Dthpr_nu")) {
return (new ANL_CC1ppip_Evt_1Dthpr_nu(samplekey));
} else if (!name.compare("ANL_CC1ppip_Evt_1DcosmuStar_nu")) {
return (new ANL_CC1ppip_Evt_1DcosmuStar_nu(samplekey));
} else if (!name.compare("ANL_CC1ppip_Evt_1DcosthAdler_nu")) {
return (new ANL_CC1ppip_Evt_1DcosthAdler_nu(samplekey));
} else if (!name.compare("ANL_CC1ppip_Evt_1Dphi_nu")) {
return (new ANL_CC1ppip_Evt_1Dphi_nu(samplekey));
/*
ANL CC1npip sample
*/
} else if (!name.compare("ANL_CC1npip_XSec_1DEnu_nu") ||
!name.compare("ANL_CC1npip_XSec_1DEnu_nu_W14Cut") ||
!name.compare("ANL_CC1npip_XSec_1DEnu_nu_Uncorr") ||
!name.compare("ANL_CC1npip_XSec_1DEnu_nu_W14Cut_Uncorr") ||
!name.compare("ANL_CC1npip_XSec_1DEnu_nu_W16Cut_Uncorr")) {
return (new ANL_CC1npip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("ANL_CC1npip_Evt_1DQ2_nu") ||
!name.compare("ANL_CC1npip_Evt_1DQ2_nu_W14Cut")) {
return (new ANL_CC1npip_Evt_1DQ2_nu(samplekey));
} else if (!name.compare("ANL_CC1npip_Evt_1Dppi_nu")) {
return (new ANL_CC1npip_Evt_1Dppi_nu(samplekey));
} else if (!name.compare("ANL_CC1npip_Evt_1DcosmuStar_nu")) {
return (new ANL_CC1npip_Evt_1DcosmuStar_nu(samplekey));
/*
ANL CC1pi0 sample
*/
} else if (!name.compare("ANL_CC1pi0_XSec_1DEnu_nu") ||
!name.compare("ANL_CC1pi0_XSec_1DEnu_nu_W14Cut") ||
!name.compare("ANL_CC1pi0_XSec_1DEnu_nu_Uncorr") ||
!name.compare("ANL_CC1pi0_XSec_1DEnu_nu_W14Cut_Uncorr") ||
!name.compare("ANL_CC1pi0_XSec_1DEnu_nu_W16Cut_Uncorr")) {
return (new ANL_CC1pi0_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("ANL_CC1pi0_Evt_1DQ2_nu") ||
!name.compare("ANL_CC1pi0_Evt_1DQ2_nu_W14Cut")) {
return (new ANL_CC1pi0_Evt_1DQ2_nu(samplekey));
} else if (!name.compare("ANL_CC1pi0_Evt_1DcosmuStar_nu")) {
return (new ANL_CC1pi0_Evt_1DcosmuStar_nu(samplekey));
/*
ANL NC1npip sample
*/
} else if (!name.compare("ANL_NC1npip_Evt_1Dppi_nu")) {
return (new ANL_NC1npip_Evt_1Dppi_nu(samplekey));
/*
ANL NC1ppim sample
*/
} else if (!name.compare("ANL_NC1ppim_XSec_1DEnu_nu")) {
return (new ANL_NC1ppim_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("ANL_NC1ppim_Evt_1DcosmuStar_nu")) {
return (new ANL_NC1ppim_Evt_1DcosmuStar_nu(samplekey));
/*
ANL CC2pi sample
*/
} else if (!name.compare("ANL_CC2pi_1pim1pip_XSec_1DEnu_nu")) {
return (new ANL_CC2pi_1pim1pip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pim1pip_Evt_1Dpmu_nu")) {
return (new ANL_CC2pi_1pim1pip_Evt_1Dpmu_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pim1pip_Evt_1Dppip_nu")) {
return (new ANL_CC2pi_1pim1pip_Evt_1Dppip_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pim1pip_Evt_1Dppim_nu")) {
return (new ANL_CC2pi_1pim1pip_Evt_1Dppim_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pim1pip_Evt_1Dpprot_nu")) {
return (new ANL_CC2pi_1pim1pip_Evt_1Dpprot_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pip_XSec_1DEnu_nu")) {
return (new ANL_CC2pi_1pip1pip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pip_Evt_1Dpmu_nu")) {
return (new ANL_CC2pi_1pip1pip_Evt_1Dpmu_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pip_Evt_1Dpneut_nu")) {
return (new ANL_CC2pi_1pip1pip_Evt_1Dpneut_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pip_Evt_1DppipHigh_nu")) {
return (new ANL_CC2pi_1pip1pip_Evt_1DppipHigh_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pip_Evt_1DppipLow_nu")) {
return (new ANL_CC2pi_1pip1pip_Evt_1DppipLow_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pi0_XSec_1DEnu_nu")) {
return (new ANL_CC2pi_1pip1pi0_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pi0_Evt_1Dpmu_nu")) {
return (new ANL_CC2pi_1pip1pi0_Evt_1Dpmu_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pi0_Evt_1Dppip_nu")) {
return (new ANL_CC2pi_1pip1pi0_Evt_1Dppip_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pi0_Evt_1Dppi0_nu")) {
return (new ANL_CC2pi_1pip1pi0_Evt_1Dppi0_nu(samplekey));
} else if (!name.compare("ANL_CC2pi_1pip1pi0_Evt_1Dpprot_nu")) {
return (new ANL_CC2pi_1pip1pi0_Evt_1Dpprot_nu(samplekey));
/*
ArgoNeut Samples
*/
} else if (!name.compare("ArgoNeuT_CCInc_XSec_1Dpmu_antinu")) {
return (new ArgoNeuT_CCInc_XSec_1Dpmu_antinu(samplekey));
} else if (!name.compare("ArgoNeuT_CCInc_XSec_1Dpmu_nu")) {
return (new ArgoNeuT_CCInc_XSec_1Dpmu_nu(samplekey));
} else if (!name.compare("ArgoNeuT_CCInc_XSec_1Dthetamu_antinu")) {
return (new ArgoNeuT_CCInc_XSec_1Dthetamu_antinu(samplekey));
} else if (!name.compare("ArgoNeuT_CCInc_XSec_1Dthetamu_nu")) {
return (new ArgoNeuT_CCInc_XSec_1Dthetamu_nu(samplekey));
/*
BNL Samples
*/
} else if (!name.compare("BNL_CCQE_XSec_1DEnu_nu")) {
return (new BNL_CCQE_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("BNL_CCQE_Evt_1DQ2_nu")) {
return (new BNL_CCQE_Evt_1DQ2_nu(samplekey));
/*
BNL CC1ppip samples
*/
} else if (!name.compare("BNL_CC1ppip_XSec_1DEnu_nu") ||
!name.compare("BNL_CC1ppip_XSec_1DEnu_nu_Uncorr") ||
!name.compare("BNL_CC1ppip_XSec_1DEnu_nu_W14Cut") ||
!name.compare("BNL_CC1ppip_XSec_1DEnu_nu_W14Cut_Uncorr")) {
return (new BNL_CC1ppip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("BNL_CC1ppip_Evt_1DQ2_nu") ||
!name.compare("BNL_CC1ppip_Evt_1DQ2_nu_W14Cut")) {
return (new BNL_CC1ppip_Evt_1DQ2_nu(samplekey));
} else if (!name.compare("BNL_CC1ppip_Evt_1DcosthAdler_nu")) {
return (new BNL_CC1ppip_Evt_1DcosthAdler_nu(samplekey));
} else if (!name.compare("BNL_CC1ppip_Evt_1Dphi_nu")) {
return (new BNL_CC1ppip_Evt_1Dphi_nu(samplekey));
/*
BNL CC1npip samples
*/
} else if (!name.compare("BNL_CC1npip_XSec_1DEnu_nu") ||
!name.compare("BNL_CC1npip_XSec_1DEnu_nu_Uncorr")) {
return (new BNL_CC1npip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("BNL_CC1npip_Evt_1DQ2_nu")) {
return (new BNL_CC1npip_Evt_1DQ2_nu(samplekey));
/*
BNL CC1pi0 samples
*/
} else if (!name.compare("BNL_CC1pi0_XSec_1DEnu_nu")) {
return (new BNL_CC1pi0_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("BNL_CC1pi0_Evt_1DQ2_nu")) {
return (new BNL_CC1pi0_Evt_1DQ2_nu(samplekey));
/*
FNAL Samples
*/
} else if (!name.compare("FNAL_CCQE_Evt_1DQ2_nu")) {
return (new FNAL_CCQE_Evt_1DQ2_nu(samplekey));
/*
FNAL CC1ppip
*/
} else if (!name.compare("FNAL_CC1ppip_XSec_1DEnu_nu")) {
return (new FNAL_CC1ppip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("FNAL_CC1ppip_XSec_1DQ2_nu")) {
return (new FNAL_CC1ppip_XSec_1DQ2_nu(samplekey));
} else if (!name.compare("FNAL_CC1ppip_Evt_1DQ2_nu")) {
return (new FNAL_CC1ppip_Evt_1DQ2_nu(samplekey));
/*
FNAL CC1ppim
*/
} else if (!name.compare("FNAL_CC1ppim_XSec_1DEnu_antinu")) {
return (new FNAL_CC1ppim_XSec_1DEnu_antinu(samplekey));
/*
BEBC Samples
*/
} else if (!name.compare("BEBC_CCQE_XSec_1DQ2_nu")) {
return (new BEBC_CCQE_XSec_1DQ2_nu(samplekey));
/*
BEBC CC1ppip samples
*/
} else if (!name.compare("BEBC_CC1ppip_XSec_1DEnu_nu")) {
return (new BEBC_CC1ppip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("BEBC_CC1ppip_XSec_1DQ2_nu")) {
return (new BEBC_CC1ppip_XSec_1DQ2_nu(samplekey));
/*
BEBC CC1npip samples
*/
} else if (!name.compare("BEBC_CC1npip_XSec_1DEnu_nu")) {
return (new BEBC_CC1npip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("BEBC_CC1npip_XSec_1DQ2_nu")) {
return (new BEBC_CC1npip_XSec_1DQ2_nu(samplekey));
/*
BEBC CC1pi0 samples
*/
} else if (!name.compare("BEBC_CC1pi0_XSec_1DEnu_nu")) {
return (new BEBC_CC1pi0_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("BEBC_CC1pi0_XSec_1DQ2_nu")) {
return (new BEBC_CC1pi0_XSec_1DQ2_nu(samplekey));
/*
BEBC CC1npim samples
*/
} else if (!name.compare("BEBC_CC1npim_XSec_1DEnu_antinu")) {
return (new BEBC_CC1npim_XSec_1DEnu_antinu(samplekey));
} else if (!name.compare("BEBC_CC1npim_XSec_1DQ2_antinu")) {
return (new BEBC_CC1npim_XSec_1DQ2_antinu(samplekey));
/*
BEBC CC1ppim samples
*/
} else if (!name.compare("BEBC_CC1ppim_XSec_1DEnu_antinu")) {
return (new BEBC_CC1ppim_XSec_1DEnu_antinu(samplekey));
} else if (!name.compare("BEBC_CC1ppim_XSec_1DQ2_antinu")) {
return (new BEBC_CC1ppim_XSec_1DQ2_antinu(samplekey));
/*
GGM CC1ppip samples
*/
} else if (!name.compare("GGM_CC1ppip_XSec_1DEnu_nu")) {
return (new GGM_CC1ppip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("GGM_CC1ppip_Evt_1DQ2_nu")) {
return (new GGM_CC1ppip_Evt_1DQ2_nu(samplekey));
/*
MiniBooNE Samples
*/
/*
CCQE
*/
} else if (!name.compare("MiniBooNE_CCQE_XSec_1DQ2_nu") ||
!name.compare("MiniBooNE_CCQELike_XSec_1DQ2_nu")) {
return (new MiniBooNE_CCQE_XSec_1DQ2_nu(samplekey));
} else if (!name.compare("MiniBooNE_CCQE_XSec_1DQ2_antinu") ||
!name.compare("MiniBooNE_CCQELike_XSec_1DQ2_antinu") ||
!name.compare("MiniBooNE_CCQE_CTarg_XSec_1DQ2_antinu")) {
return (new MiniBooNE_CCQE_XSec_1DQ2_antinu(samplekey));
} else if (!name.compare("MiniBooNE_CCQE_XSec_2DTcos_nu") ||
!name.compare("MiniBooNE_CCQELike_XSec_2DTcos_nu")) {
return (new MiniBooNE_CCQE_XSec_2DTcos_nu(samplekey));
} else if (!name.compare("MiniBooNE_CCQE_XSec_2DTcos_antinu") ||
!name.compare("MiniBooNE_CCQELike_XSec_2DTcos_antinu")) {
return (new MiniBooNE_CCQE_XSec_2DTcos_antinu(samplekey));
/*
MiniBooNE CC1pi+
*/
// 1D
} else if (!name.compare("MiniBooNE_CC1pip_XSec_1DEnu_nu")) {
return (new MiniBooNE_CC1pip_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pip_XSec_1DQ2_nu")) {
return (new MiniBooNE_CC1pip_XSec_1DQ2_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pip_XSec_1DTpi_nu")) {
return (new MiniBooNE_CC1pip_XSec_1DTpi_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pip_XSec_1DTu_nu")) {
return (new MiniBooNE_CC1pip_XSec_1DTu_nu(samplekey));
// 2D
} else if (!name.compare("MiniBooNE_CC1pip_XSec_2DQ2Enu_nu")) {
return (new MiniBooNE_CC1pip_XSec_2DQ2Enu_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pip_XSec_2DTpiCospi_nu")) {
return (new MiniBooNE_CC1pip_XSec_2DTpiCospi_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pip_XSec_2DTpiEnu_nu")) {
return (new MiniBooNE_CC1pip_XSec_2DTpiEnu_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pip_XSec_2DTuCosmu_nu")) {
return (new MiniBooNE_CC1pip_XSec_2DTuCosmu_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pip_XSec_2DTuEnu_nu")) {
return (new MiniBooNE_CC1pip_XSec_2DTuEnu_nu(samplekey));
/*
MiniBooNE CC1pi0
*/
} else if (!name.compare("MiniBooNE_CC1pi0_XSec_1DEnu_nu")) {
return (new MiniBooNE_CC1pi0_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pi0_XSec_1DQ2_nu")) {
return (new MiniBooNE_CC1pi0_XSec_1DQ2_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pi0_XSec_1DTu_nu")) {
return (new MiniBooNE_CC1pi0_XSec_1DTu_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pi0_XSec_1Dcosmu_nu")) {
return (new MiniBooNE_CC1pi0_XSec_1Dcosmu_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pi0_XSec_1Dcospi0_nu")) {
return (new MiniBooNE_CC1pi0_XSec_1Dcospi0_nu(samplekey));
} else if (!name.compare("MiniBooNE_CC1pi0_XSec_1Dppi0_nu")) {
return (new MiniBooNE_CC1pi0_XSec_1Dppi0_nu(samplekey));
} else if (!name.compare("MiniBooNE_NC1pi0_XSec_1Dcospi0_antinu") ||
!name.compare("MiniBooNE_NC1pi0_XSec_1Dcospi0_rhc")) {
return (new MiniBooNE_NC1pi0_XSec_1Dcospi0_antinu(samplekey));
} else if (!name.compare("MiniBooNE_NC1pi0_XSec_1Dcospi0_nu") ||
!name.compare("MiniBooNE_NC1pi0_XSec_1Dcospi0_fhc")) {
return (new MiniBooNE_NC1pi0_XSec_1Dcospi0_nu(samplekey));
} else if (!name.compare("MiniBooNE_NC1pi0_XSec_1Dppi0_antinu") ||
!name.compare("MiniBooNE_NC1pi0_XSec_1Dppi0_rhc")) {
return (new MiniBooNE_NC1pi0_XSec_1Dppi0_antinu(samplekey));
} else if (!name.compare("MiniBooNE_NC1pi0_XSec_1Dppi0_nu") ||
!name.compare("MiniBooNE_NC1pi0_XSec_1Dppi0_fhc")) {
return (new MiniBooNE_NC1pi0_XSec_1Dppi0_nu(samplekey));
/*
MiniBooNE NCEL
*/
} else if (!name.compare("MiniBooNE_NCEL_XSec_Treco_nu")) {
- ERR(FTL)
- << "MiniBooNE_NCEL_XSec_Treco_nu not implemented in current interface."
- << std::endl;
- throw 5;
- // return (new MiniBooNE_NCEL_XSec_Treco_nu(file, rw, type,
- // fkdt));
+ return (new MiniBooNE_NCEL_XSec_Treco_nu(samplekey));
/*
MINERvA Samples
*/
} else if (!name.compare("MINERvA_CCQE_XSec_1DQ2_nu") ||
!name.compare("MINERvA_CCQE_XSec_1DQ2_nu_20deg") ||
!name.compare("MINERvA_CCQE_XSec_1DQ2_nu_oldflux") ||
!name.compare("MINERvA_CCQE_XSec_1DQ2_nu_20deg_oldflux")) {
return (
new MINERvA_CCQE_XSec_1DQ2_nu(samplekey));
} else if (!name.compare("MINERvA_CCQE_XSec_1DQ2_antinu") ||
!name.compare("MINERvA_CCQE_XSec_1DQ2_antinu_20deg") ||
!name.compare("MINERvA_CCQE_XSec_1DQ2_antinu_oldflux") ||
!name.compare("MINERvA_CCQE_XSec_1DQ2_antinu_20deg_oldflux")) {
return (
new MINERvA_CCQE_XSec_1DQ2_antinu(samplekey));
} else if (!name.compare("MINERvA_CCQE_XSec_1DQ2_joint_oldflux") ||
!name.compare("MINERvA_CCQE_XSec_1DQ2_joint_20deg_oldflux") ||
!name.compare("MINERvA_CCQE_XSec_1DQ2_joint") ||
!name.compare("MINERvA_CCQE_XSec_1DQ2_joint_20deg")) {
return (new MINERvA_CCQE_XSec_1DQ2_joint(samplekey));
} else if (!name.compare("MINERvA_CC0pi_XSec_1DEe_nue")) {
return (new MINERvA_CC0pi_XSec_1DEe_nue(samplekey));
} else if (!name.compare("MINERvA_CC0pi_XSec_1DQ2_nue")) {
return (new MINERvA_CC0pi_XSec_1DQ2_nue(samplekey));
} else if (!name.compare("MINERvA_CC0pi_XSec_1DThetae_nue")) {
return (
new MINERvA_CC0pi_XSec_1DThetae_nue(samplekey));
} else if (!name.compare("MINERvA_CC0pi_XSec_1DQ2_nu_proton")) {
return (
new MINERvA_CC0pi_XSec_1DQ2_nu_proton(samplekey));
} else if (!name.compare("MINERvA_CC0pi_XSec_1DQ2_TgtC_nu") ||
!name.compare("MINERvA_CC0pi_XSec_1DQ2_TgtFe_nu") ||
!name.compare("MINERvA_CC0pi_XSec_1DQ2_TgtPb_nu") ){
return ( new MINERvA_CC0pi_XSec_1DQ2_Tgt_nu(samplekey) );
} else if (!name.compare("MINERvA_CC0pi_XSec_1DQ2_TgtRatioC_nu") ||
!name.compare("MINERvA_CC0pi_XSec_1DQ2_TgtRatioFe_nu") ||
!name.compare("MINERvA_CC0pi_XSec_1DQ2_TgtRatioPb_nu") ){
return ( new MINERvA_CC0pi_XSec_1DQ2_TgtRatio_nu(samplekey) );
/*
CC1pi+
*/
// DONE
} else if (!name.compare("MINERvA_CC1pip_XSec_1DTpi_nu") ||
!name.compare("MINERvA_CC1pip_XSec_1DTpi_nu_20deg") ||
!name.compare("MINERvA_CC1pip_XSec_1DTpi_nu_fluxcorr") ||
!name.compare("MINERvA_CC1pip_XSec_1DTpi_nu_20deg_fluxcorr") ) {
return (new MINERvA_CC1pip_XSec_1DTpi_nu(samplekey));
// DONE
} else if (!name.compare("MINERvA_CC1pip_XSec_1Dth_nu") ||
!name.compare("MINERvA_CC1pip_XSec_1Dth_nu_20deg") ||
!name.compare("MINERvA_CC1pip_XSec_1Dth_nu_fluxcorr") ||
!name.compare("MINERvA_CC1pip_XSec_1Dth_nu_20deg_fluxcorr")) {
return (new MINERvA_CC1pip_XSec_1Dth_nu(samplekey));
/*
CCNpi+
*/
} else if (!name.compare("MINERvA_CCNpip_XSec_1Dth_nu") ||
!name.compare("MINERvA_CCNpip_XSec_1Dth_nu_2015") ||
!name.compare("MINERvA_CCNpip_XSec_1Dth_nu_2016") ||
!name.compare("MINERvA_CCNpip_XSec_1Dth_nu_2015_20deg") ||
!name.compare("MINERvA_CCNpip_XSec_1Dth_nu_2015_fluxcorr") ||
!name.compare("MINERvA_CCNpip_XSec_1Dth_nu_2015_20deg_fluxcorr")) {
return (new MINERvA_CCNpip_XSec_1Dth_nu(samplekey));
} else if (!name.compare("MINERvA_CCNpip_XSec_1DTpi_nu") ||
!name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_2015") ||
!name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_2016") ||
!name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_2015_20deg") ||
!name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_2015_fluxcorr") ||
!name.compare("MINERvA_CCNpip_XSec_1DTpi_nu_2015_20deg_fluxcorr")) {
return (new MINERvA_CCNpip_XSec_1DTpi_nu(samplekey));
// Done
} else if (!name.compare("MINERvA_CCNpip_XSec_1Dthmu_nu")) {
return (new MINERvA_CCNpip_XSec_1Dthmu_nu(samplekey));
// Done
} else if (!name.compare("MINERvA_CCNpip_XSec_1Dpmu_nu")) {
return (new MINERvA_CCNpip_XSec_1Dpmu_nu(samplekey));
// Done
} else if (!name.compare("MINERvA_CCNpip_XSec_1DQ2_nu")) {
return (new MINERvA_CCNpip_XSec_1DQ2_nu(samplekey));
// Done
} else if (!name.compare("MINERvA_CCNpip_XSec_1DEnu_nu")) {
return (new MINERvA_CCNpip_XSec_1DEnu_nu(samplekey));
/*
CC1pi0
*/
// Done
} else if (!name.compare("MINERvA_CC1pi0_XSec_1Dth_antinu") ||
!name.compare("MINERvA_CC1pi0_XSec_1Dth_antinu_2015") ||
!name.compare("MINERvA_CC1pi0_XSec_1Dth_antinu_2016") ||
!name.compare("MINERvA_CC1pi0_XSec_1Dth_antinu_fluxcorr") ||
!name.compare("MINERvA_CC1pi0_XSec_1Dth_antinu_2015_fluxcorr") ||
!name.compare("MINERvA_CC1pi0_XSec_1Dth_antinu_2016_fluxcorr")) {
return (new MINERvA_CC1pi0_XSec_1Dth_antinu(samplekey));
} else if (!name.compare("MINERvA_CC1pi0_XSec_1Dppi0_antinu") ||
!name.compare("MINERvA_CC1pi0_XSec_1Dppi0_antinu_fluxcorr")) {
return (new MINERvA_CC1pi0_XSec_1Dppi0_antinu(samplekey));
} else if (!name.compare("MINERvA_CC1pi0_XSec_1DTpi0_antinu")) {
return (new MINERvA_CC1pi0_XSec_1DTpi0_antinu(samplekey));
// Done
} else if (!name.compare("MINERvA_CC1pi0_XSec_1DQ2_antinu")) {
return (new MINERvA_CC1pi0_XSec_1DQ2_antinu(samplekey));
// Done
} else if (!name.compare("MINERvA_CC1pi0_XSec_1Dthmu_antinu")) {
return (new MINERvA_CC1pi0_XSec_1Dthmu_antinu(samplekey));
// Done
} else if (!name.compare("MINERvA_CC1pi0_XSec_1Dpmu_antinu")) {
return (new MINERvA_CC1pi0_XSec_1Dpmu_antinu(samplekey));
// Done
} else if (!name.compare("MINERvA_CC1pi0_XSec_1DEnu_antinu")) {
return (new MINERvA_CC1pi0_XSec_1DEnu_antinu(samplekey));
/*
CCINC
*/
} else if (!name.compare("MINERvA_CCinc_XSec_2DEavq3_nu")) {
return (new MINERvA_CCinc_XSec_2DEavq3_nu(samplekey));
} else if (!name.compare("MINERvA_CCinc_XSec_1Dx_ratio_C12_CH") ||
!name.compare("MINERvA_CCinc_XSec_1Dx_ratio_Fe56_CH") ||
!name.compare("MINERvA_CCinc_XSec_1Dx_ratio_Pb208_CH")) {
return (
new MINERvA_CCinc_XSec_1Dx_ratio(samplekey));
} else if (!name.compare("MINERvA_CCinc_XSec_1DEnu_ratio_C12_CH") ||
!name.compare("MINERvA_CCinc_XSec_1DEnu_ratio_Fe56_CH") ||
!name.compare("MINERvA_CCinc_XSec_1DEnu_ratio_Pb208_CH")) {
return (new MINERvA_CCinc_XSec_1DEnu_ratio(samplekey));
/*
T2K Samples
*/
} else if (!name.compare("T2K_CC0pi_XSec_2DPcos_nu") ||
!name.compare("T2K_CC0pi_XSec_2DPcos_nu_I") ||
!name.compare("T2K_CC0pi_XSec_2DPcos_nu_II")) {
return (new T2K_CC0pi_XSec_2DPcos_nu(samplekey));
+ } else if (!name.compare("T2K_CC0pi_XSec_2DPcos_nu_nonuniform")){
+
+ return (new T2K_CC0pi_XSec_2DPcos_nu_nonuniform(samplekey));
+
/*
T2K CC1pi+ CH samples
*/
// Comment these out for now because we don't have the proper data
/*
} else if (!name.compare("T2K_CC1pip_CH_XSec_1Dpmu_nu")) {
return (new T2K_CC1pip_CH_XSec_1Dpmu_nu(file, rw, type, fkdt));
} else if (!name.compare("T2K_CC1pip_CH_XSec_1Dppi_nu")) {
return (new T2K_CC1pip_CH_XSec_1Dppi_nu(file, rw, type, fkdt));
} else if (!name.compare("T2K_CC1pip_CH_XSec_1DQ2_nu")) {
return (new T2K_CC1pip_CH_XSec_1DQ2_nu(file, rw, type, fkdt));
} else if (!name.compare("T2K_CC1pip_CH_XSec_1Dq3_nu")) {
return (new T2K_CC1pip_CH_XSec_1Dq3_nu(file, rw, type, fkdt));
} else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthmupi_nu")) {
return (new T2K_CC1pip_CH_XSec_1Dthmupi_nu(file, rw, type, fkdt));
} else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthpi_nu")) {
return (new T2K_CC1pip_CH_XSec_1Dthpi_nu(file, rw, type, fkdt));
} else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthq3pi_nu")) {
return (new T2K_CC1pip_CH_XSec_1Dthq3pi_nu(file, rw, type, fkdt));
} else if (!name.compare("T2K_CC1pip_CH_XSec_1DWrec_nu")) {
return (new T2K_CC1pip_CH_XSec_1DWrec_nu(file, rw, type, fkdt));
*/
/*
T2K CC1pi+ H2O samples
*/
} else if (!name.compare("T2K_CC1pip_H2O_XSec_1DEnuDelta_nu")) {
return (new T2K_CC1pip_H2O_XSec_1DEnuDelta_nu(samplekey));
} else if (!name.compare("T2K_CC1pip_H2O_XSec_1DEnuMB_nu")) {
return (new T2K_CC1pip_H2O_XSec_1DEnuMB_nu(samplekey));
} else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dcosmu_nu")) {
return (new T2K_CC1pip_H2O_XSec_1Dcosmu_nu(samplekey));
} else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dcosmupi_nu")) {
return (new T2K_CC1pip_H2O_XSec_1Dcosmupi_nu(samplekey));
} else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dcospi_nu")) {
return (new T2K_CC1pip_H2O_XSec_1Dcospi_nu(samplekey));
} else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dpmu_nu")) {
return (new T2K_CC1pip_H2O_XSec_1Dpmu_nu(samplekey));
} else if (!name.compare("T2K_CC1pip_H2O_XSec_1Dppi_nu")) {
return (new T2K_CC1pip_H2O_XSec_1Dppi_nu(samplekey));
/*
T2K CC0pi + np CH samples
*/
} else if (!name.compare("T2K_CC0pinp_STV_XSec_1Ddpt_nu")) {
return (new T2K_CC0pinp_STV_XSec_1Ddpt_nu(samplekey));
/*
K2K Samples
*/
/*
NC1pi0
*/
} else if (!name.compare("K2K_NC1pi0_Evt_1Dppi0_nu")) {
return (new K2K_NC1pi0_Evt_1Dppi0_nu(samplekey));
/*
Fake Studies
*/
} else if (name.find("ExpMultDist_CCQE_XSec_1D") != std::string::npos &&
name.find("_FakeStudy") != std::string::npos) {
return (
new ExpMultDist_CCQE_XSec_1DVar_FakeStudy(name, file, rw, type, fkdt));
} else if (name.find("ExpMultDist_CCQE_XSec_2D") != std::string::npos &&
name.find("_FakeStudy") != std::string::npos) {
return (
new ExpMultDist_CCQE_XSec_2DVar_FakeStudy(name, file, rw, type, fkdt));
} else if (name.find("GenericFlux_") != std::string::npos) {
return (new GenericFlux_Tester(name, file, rw, type, fkdt));
} else if (!name.compare("T2K2017_FakeData")) {
return (new T2K2017_FakeData(samplekey));
} else if (!name.compare("MCStudy_CCQE")) {
return (new MCStudy_CCQEHistograms(name, file, rw, type, fkdt));
} else if (!name.compare("ElectronFlux_FlatTree")) {
return (new ElectronFlux_FlatTree(name, file, rw, type, fkdt));
} else if (name.find("ElectronData_") != std::string::npos) {
return new ElectronScattering_DurhamData(samplekey);
//<<<<<<< HEAD
// } else if (name.find("MCStudy_KaonPreSelection") != std::string::npos) {
// return (new MCStudy_KaonPreSelection(name, file, rw, type, fkdt));
//=======
//} else if (name.find("MCStudy_KaonPreSelection") != std::string::npos) {
//fChain->push_back(new MCStudy_KaonPreSelection(name, file, rw, type, fkdt));
//>>>>>>> 96ed014ac03821c4f771d6c484740e8b25350aa1
} else if (name.find("MuonValidation_") != std::string::npos) {
return (new MCStudy_MuonValidation(name, file, rw, type, fkdt));
} else {
ERR(FTL) << "Error: No such sample: " << name << std::endl;
exit(-1);
return NULL;
}
// Return NULL if no sample loaded.
return NULL;
}
}
diff --git a/src/FCN/SampleList.h b/src/FCN/SampleList.h
index 931ff5b..c8ec4c7 100644
--- a/src/FCN/SampleList.h
+++ b/src/FCN/SampleList.h
@@ -1,249 +1,250 @@
#ifndef _SAMPLE_LIST_H_
#define _SAMPLE_LIST_H_
/*!
* \addtogroup FCN
* @{
*/
#include "ANL_CCQE_Evt_1DQ2_nu.h"
#include "ANL_CCQE_XSec_1DEnu_nu.h"
// ANL CC1ppip
#include "ANL_CC1ppip_Evt_1DQ2_nu.h"
#include "ANL_CC1ppip_Evt_1DcosmuStar_nu.h"
#include "ANL_CC1ppip_Evt_1DcosmuStar_nu.h"
#include "ANL_CC1ppip_Evt_1DcosthAdler_nu.h"
#include "ANL_CC1ppip_Evt_1Dphi_nu.h"
#include "ANL_CC1ppip_Evt_1Dppi_nu.h"
#include "ANL_CC1ppip_Evt_1Dthpr_nu.h"
#include "ANL_CC1ppip_XSec_1DEnu_nu.h"
#include "ANL_CC1ppip_XSec_1DQ2_nu.h"
// ANL CC1npip
#include "ANL_CC1npip_Evt_1DQ2_nu.h"
#include "ANL_CC1npip_Evt_1DcosmuStar_nu.h"
#include "ANL_CC1npip_Evt_1Dppi_nu.h"
#include "ANL_CC1npip_XSec_1DEnu_nu.h"
// ANL CC1pi0
#include "ANL_CC1pi0_Evt_1DQ2_nu.h"
#include "ANL_CC1pi0_Evt_1DcosmuStar_nu.h"
#include "ANL_CC1pi0_XSec_1DEnu_nu.h"
// ANL NC1npip (mm, exotic!)
#include "ANL_NC1npip_Evt_1Dppi_nu.h"
// ANL NC1ppim (mm, exotic!)
#include "ANL_NC1ppim_XSec_1DEnu_nu.h"
#include "ANL_NC1ppim_Evt_1DcosmuStar_nu.h"
// ANL CC2pi 1pim1pip (mm, even more exotic!)
#include "ANL_CC2pi_1pim1pip_XSec_1DEnu_nu.h"
#include "ANL_CC2pi_1pim1pip_Evt_1Dpmu_nu.h"
#include "ANL_CC2pi_1pim1pip_Evt_1Dppip_nu.h"
#include "ANL_CC2pi_1pim1pip_Evt_1Dppim_nu.h"
#include "ANL_CC2pi_1pim1pip_Evt_1Dpprot_nu.h"
// ANL CC2pi 1pip1pip (mm, even more exotic!)
#include "ANL_CC2pi_1pip1pip_XSec_1DEnu_nu.h"
#include "ANL_CC2pi_1pip1pip_Evt_1Dpmu_nu.h"
#include "ANL_CC2pi_1pip1pip_Evt_1Dpneut_nu.h"
#include "ANL_CC2pi_1pip1pip_Evt_1DppipHigh_nu.h"
#include "ANL_CC2pi_1pip1pip_Evt_1DppipLow_nu.h"
// ANL CC2pi 1pip1pi0 (mm, even more exotic!)
#include "ANL_CC2pi_1pip1pi0_XSec_1DEnu_nu.h"
#include "ANL_CC2pi_1pip1pi0_Evt_1Dpmu_nu.h"
#include "ANL_CC2pi_1pip1pi0_Evt_1Dppip_nu.h"
#include "ANL_CC2pi_1pip1pi0_Evt_1Dppi0_nu.h"
#include "ANL_CC2pi_1pip1pi0_Evt_1Dpprot_nu.h"
// ArgoNeuT CC-inclusive
#include "ArgoNeuT_CCInc_XSec_1Dpmu_antinu.h"
#include "ArgoNeuT_CCInc_XSec_1Dpmu_nu.h"
#include "ArgoNeuT_CCInc_XSec_1Dthetamu_antinu.h"
#include "ArgoNeuT_CCInc_XSec_1Dthetamu_nu.h"
// BNL CCQE
#include "BNL_CCQE_Evt_1DQ2_nu.h"
#include "BNL_CCQE_XSec_1DEnu_nu.h"
// BNL CC1ppip
#include "BNL_CC1ppip_Evt_1DQ2_nu.h"
#include "BNL_CC1ppip_Evt_1DQ2_nu.h"
#include "BNL_CC1ppip_Evt_1DcosthAdler_nu.h"
#include "BNL_CC1ppip_Evt_1Dphi_nu.h"
#include "BNL_CC1ppip_XSec_1DEnu_nu.h"
// BNL CC1npip
#include "BNL_CC1npip_Evt_1DQ2_nu.h"
#include "BNL_CC1npip_XSec_1DEnu_nu.h"
// BNL CC1pi0
#include "BNL_CC1pi0_Evt_1DQ2_nu.h"
#include "BNL_CC1pi0_XSec_1DEnu_nu.h"
// FNAL CCQE
#include "FNAL_CCQE_Evt_1DQ2_nu.h"
// FNAL CC1ppip
#include "FNAL_CC1ppip_Evt_1DQ2_nu.h"
#include "FNAL_CC1ppip_XSec_1DEnu_nu.h"
#include "FNAL_CC1ppip_XSec_1DQ2_nu.h"
// FNAL CC1ppim
#include "FNAL_CC1ppim_XSec_1DEnu_antinu.h"
// BEBC CCQE
#include "BEBC_CCQE_XSec_1DQ2_nu.h"
// BEBC CC1ppip
#include "BEBC_CC1ppip_XSec_1DEnu_nu.h"
#include "BEBC_CC1ppip_XSec_1DQ2_nu.h"
// BEBC CC1npip
#include "BEBC_CC1npip_XSec_1DEnu_nu.h"
#include "BEBC_CC1npip_XSec_1DQ2_nu.h"
// BEBC CC1pi0
#include "BEBC_CC1pi0_XSec_1DEnu_nu.h"
#include "BEBC_CC1pi0_XSec_1DQ2_nu.h"
// BEBC CC1npim
#include "BEBC_CC1npim_XSec_1DEnu_antinu.h"
#include "BEBC_CC1npim_XSec_1DQ2_antinu.h"
// BEBC CC1ppim
#include "BEBC_CC1ppim_XSec_1DEnu_antinu.h"
#include "BEBC_CC1ppim_XSec_1DQ2_antinu.h"
// GGM CC1ppip
#include "GGM_CC1ppip_Evt_1DQ2_nu.h"
#include "GGM_CC1ppip_XSec_1DEnu_nu.h"
// MiniBooNE CCQE
#include "MiniBooNE_CCQE_XSec_1DQ2_nu.h"
#include "MiniBooNE_CCQE_XSec_1DQ2_antinu.h"
#include "MiniBooNE_CCQE_XSec_2DTcos_antinu.h"
#include "MiniBooNE_CCQE_XSec_2DTcos_antinu.h"
#include "MiniBooNE_CCQE_XSec_2DTcos_nu.h"
// MiniBooNE CC1pi+ 1D
#include "MiniBooNE_CC1pip_XSec_1DEnu_nu.h"
#include "MiniBooNE_CC1pip_XSec_1DQ2_nu.h"
#include "MiniBooNE_CC1pip_XSec_1DTpi_nu.h"
#include "MiniBooNE_CC1pip_XSec_1DTu_nu.h"
// MiniBooNE CC1pi+ 2D
#include "MiniBooNE_CC1pip_XSec_2DQ2Enu_nu.h"
#include "MiniBooNE_CC1pip_XSec_2DTpiCospi_nu.h"
#include "MiniBooNE_CC1pip_XSec_2DTpiEnu_nu.h"
#include "MiniBooNE_CC1pip_XSec_2DTuCosmu_nu.h"
#include "MiniBooNE_CC1pip_XSec_2DTuEnu_nu.h"
// MiniBooNE CC1pi0
#include "MiniBooNE_CC1pi0_XSec_1DEnu_nu.h"
#include "MiniBooNE_CC1pi0_XSec_1DQ2_nu.h"
#include "MiniBooNE_CC1pi0_XSec_1DTu_nu.h"
#include "MiniBooNE_CC1pi0_XSec_1Dcosmu_nu.h"
#include "MiniBooNE_CC1pi0_XSec_1Dcospi0_nu.h"
#include "MiniBooNE_CC1pi0_XSec_1Dppi0_nu.h"
#include "MiniBooNE_NC1pi0_XSec_1Dcospi0_antinu.h"
#include "MiniBooNE_NC1pi0_XSec_1Dcospi0_nu.h"
#include "MiniBooNE_NC1pi0_XSec_1Dppi0_antinu.h"
#include "MiniBooNE_NC1pi0_XSec_1Dppi0_nu.h"
// MiniBooNE NC1pi0
//#include "MiniBooNE_NCpi0_XSec_1Dppi0_nu.h"
// MiniBooNE NCEL
-// #include "MiniBooNE_NCEL_XSec_Treco_nu.h"
+#include "MiniBooNE_NCEL_XSec_Treco_nu.h"
// MINERvA CCQE
#include "MINERvA_CCQE_XSec_1DQ2_antinu.h"
#include "MINERvA_CCQE_XSec_1DQ2_joint.h"
#include "MINERvA_CCQE_XSec_1DQ2_nu.h"
// MINERvA CC0pi
#include "MINERvA_CC0pi_XSec_1DEe_nue.h"
#include "MINERvA_CC0pi_XSec_1DQ2_nu_proton.h"
#include "MINERvA_CC0pi_XSec_1DQ2_nue.h"
#include "MINERvA_CC0pi_XSec_1DThetae_nue.h"
// MINERvA CC1pi+
#include "MINERvA_CC1pip_XSec_1DTpi_20deg_nu.h"
#include "MINERvA_CC1pip_XSec_1DTpi_nu.h"
#include "MINERvA_CC1pip_XSec_1Dth_20deg_nu.h"
#include "MINERvA_CC1pip_XSec_1Dth_nu.h"
// MINERvA CCNpi+
#include "MINERvA_CCNpip_XSec_1Dth_nu.h"
#include "MINERvA_CCNpip_XSec_1DTpi_nu.h"
#include "MINERvA_CCNpip_XSec_1Dpmu_nu.h"
#include "MINERvA_CCNpip_XSec_1Dthmu_nu.h"
#include "MINERvA_CCNpip_XSec_1DQ2_nu.h"
#include "MINERvA_CCNpip_XSec_1DEnu_nu.h"
// MINERvA CC1pi0
#include "MINERvA_CC1pi0_XSec_1Dth_antinu.h"
#include "MINERvA_CC1pi0_XSec_1Dppi0_antinu.h"
#include "MINERvA_CC1pi0_XSec_1DTpi0_antinu.h"
#include "MINERvA_CC1pi0_XSec_1Dthmu_antinu.h"
#include "MINERvA_CC1pi0_XSec_1Dpmu_antinu.h"
#include "MINERvA_CC1pi0_XSec_1DQ2_antinu.h"
#include "MINERvA_CC1pi0_XSec_1DEnu_antinu.h"
// MINERvA CCINC
#include "MINERvA_CCinc_XSec_2DEavq3_nu.h"
#include "MINERvA_CCinc_XSec_1Dx_ratio.h"
#include "MINERvA_CCinc_XSec_1DEnu_ratio.h"
// T2K CC0pi
#include "T2K_CC0pi_XSec_2DPcos_nu.h"
// T2K CC1pi+ on CH
#include "T2K_CC1pip_CH_XSec_1Dpmu_nu.h"
#include "T2K_CC1pip_CH_XSec_1Dppi_nu.h"
#include "T2K_CC1pip_CH_XSec_1Dthpi_nu.h"
#include "T2K_CC1pip_CH_XSec_1Dthmupi_nu.h"
#include "T2K_CC1pip_CH_XSec_1DQ2_nu.h"
#include "T2K_CC1pip_CH_XSec_1Dq3_nu.h"
#include "T2K_CC1pip_CH_XSec_1Dthq3pi_nu.h"
#include "T2K_CC1pip_CH_XSec_1DWrec_nu.h"
// T2K CC1pi+ on H2O
#include "T2K_CC1pip_H2O_XSec_1DEnuDelta_nu.h"
#include "T2K_CC1pip_H2O_XSec_1DEnuMB_nu.h"
#include "T2K_CC1pip_H2O_XSec_1Dcosmu_nu.h"
#include "T2K_CC1pip_H2O_XSec_1Dcosmupi_nu.h"
#include "T2K_CC1pip_H2O_XSec_1Dcospi_nu.h"
#include "T2K_CC1pip_H2O_XSec_1Dpmu_nu.h"
#include "T2K_CC1pip_H2O_XSec_1Dppi_nu.h"
// T2K STV CC0pi
#include "T2K_CC0pinp_STV_XSec_1Ddpt_nu.h"
// K2K NC1pi0
#include "K2K_NC1pi0_Evt_1Dppi0_nu.h"
// MC Studies
#include "ExpMultDist_CCQE_XSec_1DVar_FakeStudy.h"
#include "ExpMultDist_CCQE_XSec_2DVar_FakeStudy.h"
#include "MCStudy_CCQEHistograms.h"
#include "GenericFlux_Tester.h"
#include "MCStudy_KaonPreSelection.h"
#include "MCStudy_MuonValidation.h"
#include "ElectronFlux_FlatTree.h"
#include "ElectronScattering_DurhamData.h"
#include "MINERvA_CC0pi_XSec_1DQ2_Tgt_nu.h"
+#include "T2K_CC0pi_XSec_2DPcos_nu_nonuniform.h"
#include "MINERvA_CC0pi_XSec_1DQ2_TgtRatio_nu.h"
#include "T2K2017_FakeData.h"
#include "FitWeight.h"
#include "NuisConfig.h"
#include "NuisKey.h"
//! Functions to make it easier for samples to be created and handled.
namespace SampleUtils {
//! Create a given sample given its name, file, type, fakdata(fkdt) file and the
//! current rw engine and push it back into the list fChain.
/*bool LoadSample(std::list<MeasurementBase*>* fChain, std::string name,
std::string file, std::string type, std::string fkdt,
FitWeight* rw);*/
MeasurementBase* CreateSample(std::string name, std::string file, std::string type, std::string fkdt, FitWeight* rw);
MeasurementBase* CreateSample(nuiskey samplekey);
}
/*! @} */
#endif
diff --git a/src/FitBase/CMakeLists.txt b/src/FitBase/CMakeLists.txt
index cd7b95d..4631d6d 100644
--- a/src/FitBase/CMakeLists.txt
+++ b/src/FitBase/CMakeLists.txt
@@ -1,109 +1,111 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
set(IMPLFILES
ParamPull.cxx
BaseFitEvt.cxx
FitParticle.cxx
Measurement1D.cxx
EventManager.cxx
Measurement2D.cxx
FitEvent.cxx
JointMeas1D.cxx
MeasurementBase.cxx
GeneratorUtils.cxx
StdHepEvt.cxx
TemplateMeas1D.cxx
InputUtils.cxx
NEUTInputHandler.cxx
GENIEInputHandler.cxx
NuWroInputHandler.cxx
GIBUUInputHandler.cxx
NUANCEInputHandler.cxx
NuanceEvent.cxx
SampleSettings.cxx
FitEventInputHandler.cxx
SplineInputHandler.cxx
MeasurementVariableBox.cxx
MeasurementVariableBox2D.cxx
MeasurementVariableBox1D.cxx
CustomVariableBoxes.h
GeneratorInfoBase.h
InputTypes.h
GNUISANCEFlux.cxx
GNUISANCEMCJDriver.cxx
+HepMCTextInputHandler.cxx
)
set(HEADERFILES
ParamPull.h
NuanceEvent.h
BaseFitEvt.h FitEvent.h JointMeas1D.h Measurement2D.h
EventManager.h FitParticle.h MeasurementBase.h Measurement1D.h GeneratorUtils.h StdHepEvt.h TemplateMeas1D.h
InputUtils.h
NEUTInputHandler.h
+HepMCTextInputHandler.h
GENIEInputHandler.h
NuWroInputHandler.h
InputHandler2.h
GIBUUInputHandler.h
NUANCEInputHandler.h
SampleSettings.h
FitEventInputHandler.h
SplineInputHandler.h
MeasurementVariableBox.h
MeasurementVariableBox2D.h
MeasurementVariableBox1D.h
CustomVariableBoxes.h
GeneratorInfoBase.h
GNUISANCEFlux.h
GNUISANCEMCJDriver.h
)
set(LIBNAME FitBase)
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
add_library(${LIBNAME} STATIC ${IMPLFILES})
else(CMAKE_BUILD_TYPE MATCHES RELEASE)
add_library(${LIBNAME} SHARED ${IMPLFILES})
endif()
include_directories(${RWENGINE_INCLUDE_DIRECTORIES})
if (USE_GENIE)
include_directories(${GENIE_INCLUDES}/Apps)
include_directories(${GENIE_INCLUDES}/FluxDrivers)
include_directories(${GENIE_INCLUDES}/EVGDrivers)
endif()
include_directories(${CMAKE_SOURCE_DIR}/src/Reweight)
include_directories(${CMAKE_SOURCE_DIR}/src/Splines)
include_directories(${CMAKE_SOURCE_DIR}/src/Utils)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(${LIBNAME} PROPERTIES VERSION
"${ExtFit_VERSION_MAJOR}.${ExtFit_VERSION_MINOR}.${ExtFit_VERSION_REVISION}")
set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS ${ROOT_LD_FLAGS})
if(DEFINED PROJECTWIDE_EXTRA_DEPENDENCIES)
add_dependencies(${LIBNAME} ${PROJECTWIDE_EXTRA_DEPENDENCIES})
endif()
install(TARGETS ${LIBNAME} DESTINATION lib)
#Can uncomment this to install the headers... but is it really neccessary?
install(FILES ${HEADERFILES} DESTINATION include)
set(MODULETargets ${MODULETargets} ${LIBNAME} PARENT_SCOPE)
diff --git a/src/FitBase/GIBUUInputHandler.cxx b/src/FitBase/GIBUUInputHandler.cxx
index 7d66eef..400aae5 100644
--- a/src/FitBase/GIBUUInputHandler.cxx
+++ b/src/FitBase/GIBUUInputHandler.cxx
@@ -1,455 +1,457 @@
#include "GIBUUInputHandler.h"
GIBUUInputHandler::GIBUUInputHandler(std::string const& handle, std::string const& rawinputs) {
// Run a joint input handling
fName = handle;
fEventType = kGiBUU;
// Open Root File
LOG(SAM) << "Opening event file " << rawinputs << std::endl;
TFile* rootFile = new TFile(rawinputs.c_str(), "READ");
// Get flux histograms NEUT supplies
TH1D* numuFlux = dynamic_cast<TH1D*>(rootFile->Get("numu_flux"));
TH1D* numubFlux = dynamic_cast<TH1D*>(rootFile->Get("numub_flux"));
TH1D* nueFlux = dynamic_cast<TH1D*>(rootFile->Get("nue_flux"));
TH1D* nuebFlux = dynamic_cast<TH1D*>(rootFile->Get("nueb_flux"));
// Replace local pointers with NULL dir'd clones.
if (numuFlux) {
numuFlux = static_cast<TH1D*>(numuFlux->Clone());
numuFlux->Scale(1.0 / numuFlux->Integral("width"));
std::cout << "GiBUU Flux: numuFlux, Width integral = "
<< numuFlux->Integral("width") << std::endl;
numuFlux->SetDirectory(NULL);
numuFlux->SetNameTitle(
(fName + "_numu_FLUX").c_str(),
(fName + "; E_{#nu} (GeV); #Phi_{#nu} (A.U.)").c_str());
fFluxList.push_back(numuFlux);
}
if (numubFlux) {
numubFlux = static_cast<TH1D*>(numubFlux->Clone());
numubFlux->Scale(1.0 / numubFlux->Integral("width"));
std::cout << "GiBUU Flux: numubFlux, Width integral = "
<< numubFlux->Integral("width") << std::endl;
numubFlux->SetDirectory(NULL);
numubFlux->SetNameTitle(
(fName + "_numub_FLUX").c_str(),
(fName + "; E_{#nu} (GeV); #Phi_{#bar{#nu}} (A.U.)").c_str());
fFluxList.push_back(numubFlux);
}
if (nueFlux) {
nueFlux = static_cast<TH1D*>(nueFlux->Clone());
nueFlux->Scale(1.0 / nueFlux->Integral("width"));
std::cout << "GiBUU Flux: nueFlux, Width integral = "
<< nueFlux->Integral("width") << std::endl;
nueFlux->SetDirectory(NULL);
nueFlux->SetNameTitle(
(fName + "_nue_FLUX").c_str(),
(fName + "; E_{#nu} (GeV); #Phi_{#nu} (A.U.)").c_str());
fFluxList.push_back(nueFlux);
}
if (nuebFlux) {
nuebFlux = static_cast<TH1D*>(nuebFlux->Clone());
nuebFlux->Scale(1.0 / nuebFlux->Integral("width"));
std::cout << "GiBUU Flux: nuebFlux, Width integral = "
<< nuebFlux->Integral("width") << std::endl;
nuebFlux->SetDirectory(NULL);
nuebFlux->SetNameTitle(
(fName + "_nueb_FLUX").c_str(),
(fName + "; E_{#nu} (GeV); #Phi_{#bar{#nu}} (A.U.)").c_str());
fFluxList.push_back(nuebFlux);
}
rootFile->Close();
fGIBUUTree = new TChain("giRooTracker");
fGIBUUTree->AddFile(rawinputs.c_str());
fGiReader = new GiBUUStdHepReader();
fGiReader->SetBranchAddresses(fGIBUUTree);
bool IsNuBarDominant = false;
size_t Found_nu = 0;
size_t Found_nuMask = ((numuFlux ? 1 : 0) + (numubFlux ? 2 : 0) +
(nueFlux ? 4 : 0) + (nuebFlux ? 8 : 0));
static const char* specNames[] = {"numu", "numubar", "nue", "nuebar"};
size_t nExpected = (Found_nuMask & (1 << 0)) + (Found_nuMask & (1 << 1)) +
(Found_nuMask & (1 << 2)) + (Found_nuMask & (1 << 3));
size_t nFound = 0;
std::string expectStr = "";
for (size_t sn_it = 0; sn_it < 4; ++sn_it) {
if (Found_nuMask & (1 << sn_it)) {
if (!nFound) {
expectStr = "(";
}
expectStr += specNames[sn_it];
nFound++;
if (nFound == nExpected) {
expectStr += ")";
} else {
expectStr += ", ";
}
}
}
LOG(SAM) << "Looking for dominant vector species in GiBUU file ("
<< rawinputs << ") expecting to find: " << expectStr << std::endl;
size_t maskHW = GeneralUtils::GetHammingWeight(Found_nuMask);
if (maskHW > 2) {
LOG(SAM) << "We are looking for more than two species... this will have to "
"loop through a large portion of the vector. Please be patient."
<< std::endl;
}
double SpeciesWeights[] = {0, 0, 0, 0};
Long64_t nevt = 0;
fNEvents = fGIBUUTree->GetEntries();
fFluxHist = NULL;
+ fNUISANCEEvent = new FitEvent();
+
while ((Found_nu != Found_nuMask) && (nevt < fNEvents)) {
if ((maskHW == 2) && fFluxHist) { // If we have found the dominant one can
// now guess the other
size_t OtherBit = GeneralUtils::GetFirstOnBit(Found_nuMask - Found_nu);
SpeciesWeights[OtherBit] = 1 - fGiReader->SpeciesWght;
Found_nu += (1 << OtherBit);
LOG(SAM) << "\tGuessing other species weight as we are only expecting "
"two species. Other species weight: "
<< SpeciesWeights[OtherBit] << std::endl;
continue;
}
this->GetNuisanceEvent(nevt++);
FitParticle* isnu = fNUISANCEEvent->GetHMISParticle(PhysConst::pdg_neutrinos);
if (!isnu) {
continue;
}
switch (isnu->fPID) {
case 12: {
if ((Found_nu & 4)) {
continue;
}
Found_nu += 4;
SpeciesWeights[2] = fGiReader->SpeciesWght;
LOG(SAM) << "\tGiBUU File: " << rawinputs << " -- ev: " << nevt
<< " has IS nu (" << isnu->fPID
<< "), species weight: " << fGiReader->SpeciesWght << std::endl;
if ((fGiReader->SpeciesWght < 0.5) &&
(maskHW > 1)) { // If we only care about a single species, then
// species-weight might not be filled.
continue;
}
fFluxHist = nueFlux;
LOG(SAM) << "\tInput file: " << rawinputs
<< " determined to be nue dominated vector." << std::endl;
break;
}
case -12: {
if ((Found_nu & 8)) {
continue;
}
Found_nu += 8;
SpeciesWeights[3] = fGiReader->SpeciesWght;
LOG(SAM) << "\tGiBUU File: " << rawinputs << " -- ev: " << nevt
<< " has IS nu (" << isnu->fPID
<< "), species weight: " << fGiReader->SpeciesWght << std::endl;
if ((fGiReader->SpeciesWght < 0.5) &&
(maskHW > 1)) { // If we only care about a single species, then
// species-weight might not be filled.
continue;
}
IsNuBarDominant = true;
fFluxHist = nuebFlux;
LOG(SAM) << "\tInput file: " << rawinputs
<< " determined to be nuebar dominated vector." << std::endl;
break;
}
case 14: {
if ((Found_nu & 1)) {
continue;
}
Found_nu += 1;
SpeciesWeights[0] = fGiReader->SpeciesWght;
LOG(SAM) << "\tGiBUU File: " << rawinputs << " -- ev: " << nevt
<< " has IS nu (" << isnu->fPID
<< "), species weight: " << fGiReader->SpeciesWght << std::endl;
if ((fGiReader->SpeciesWght < 0.5) &&
(maskHW > 1)) { // If we only care about a single species, then
// species-weight might not be filled.
continue;
}
fFluxHist = numuFlux;
LOG(SAM) << "\tInput file: " << rawinputs
<< " determined to be numu dominated vector." << std::endl;
break;
}
case -14: {
if ((Found_nu & 2)) {
continue;
}
Found_nu += 2;
SpeciesWeights[1] = fGiReader->SpeciesWght;
LOG(SAM) << "\tGiBUU File: " << rawinputs << " -- ev: " << nevt
<< " has IS nu (" << isnu->fPID
<< "), species weight: " << fGiReader->SpeciesWght << std::endl;
if ((fGiReader->SpeciesWght < 0.5) &&
(maskHW > 1)) { // If we only care about a single species, then
// species-weight might not be filled.
continue;
}
IsNuBarDominant = true;
fFluxHist = numubFlux;
LOG(SAM) << "\tInput file: " << rawinputs
<< " determined to be numubar dominated vector." << std::endl;
break;
}
default: {}
}
}
if (Found_nu != Found_nuMask) {
ERR(FTL) << "Input GiBUU file (" << rawinputs
<< ") appeared to not contain all the relevant incoming neutrino "
"species: Found (numu:"
<< ((Found_nu & (1 << 0)) ? 1 : 0)
<< ",numub:" << ((Found_nu & (1 << 1)) ? 1 : 0)
<< ",nue:" << ((Found_nu & (1 << 2)) ? 1 : 0)
<< ",nueb:" << ((Found_nu & (1 << 3)) ? 1 : 0)
<< "), expected: (numu:" << ((Found_nuMask & (1 << 0)) ? 1 : 0)
<< ",numub:" << ((Found_nuMask & (1 << 1)) ? 1 : 0)
<< ",nue:" << ((Found_nuMask & (1 << 2)) ? 1 : 0)
<< ",nueb:" << ((Found_nuMask & (1 << 3)) ? 1 : 0) << ")"
<< std::endl;
throw;
}
if (!fFluxHist) {
ERR(FTL) << "Couldn't find: "
<< (IsNuBarDominant ? "nuXb_flux" : "nuX_flux")
<< " in input file: " << rootFile->GetName() << std::endl;
throw;
}
if (numuFlux) {
if ((maskHW > 1) && !GeneralUtils::IsSmallNum(SpeciesWeights[0])) {
numuFlux->Scale(SpeciesWeights[0]);
}
TH1D* numuEvt =
static_cast<TH1D*>(numuFlux->Clone((fName + "_numu_EVT").c_str()));
numuEvt->Reset();
numuEvt->SetBinContent(1, SpeciesWeights[0] * double(fNEvents) /
numuEvt->GetXaxis()->GetBinWidth(1));
TH1D* numuXSec =
static_cast<TH1D*>(numuEvt->Clone((fName + "_numu_XSEC").c_str()));
numuXSec->Divide(fFluxHist);
numuXSec->SetTitle((fName + "; E_{#nu} (GeV);XSec").c_str());
}
if (numubFlux) {
if ((maskHW > 1) && !GeneralUtils::IsSmallNum(SpeciesWeights[1])) {
numubFlux->Scale(SpeciesWeights[1]);
}
TH1D* numubEvt =
static_cast<TH1D*>(numubFlux->Clone((fName + "_numub_EVT").c_str()));
numubEvt->Reset();
numubEvt->SetBinContent(1, SpeciesWeights[1] * double(fNEvents) /
numubEvt->GetXaxis()->GetBinWidth(1));
TH1D* numubXSec =
static_cast<TH1D*>(numubEvt->Clone((fName + "_numub_XSEC").c_str()));
numubXSec->Divide(fFluxHist);
numubXSec->SetTitle((fName + "; E_{#nu} (GeV);XSec").c_str());
}
if (nueFlux) {
if ((maskHW > 1) && !GeneralUtils::IsSmallNum(SpeciesWeights[2])) {
nueFlux->Scale(SpeciesWeights[2]);
}
TH1D* nueEvt =
static_cast<TH1D*>(nueFlux->Clone((fName + "_nue_EVT").c_str()));
nueEvt->Reset();
nueEvt->SetBinContent(1, SpeciesWeights[2] * double(fNEvents) /
nueEvt->GetXaxis()->GetBinWidth(1));
TH1D* nueXSec =
static_cast<TH1D*>(nueEvt->Clone((fName + "_nue_XSEC").c_str()));
nueXSec->Divide(fFluxHist);
nueXSec->SetTitle((fName + "; E_{#nu} (GeV);XSec").c_str());
}
if (nuebFlux) {
if ((maskHW > 1) && !GeneralUtils::IsSmallNum(SpeciesWeights[3])) {
nuebFlux->Scale(SpeciesWeights[3]);
}
TH1D* nuebEvt =
static_cast<TH1D*>(nuebFlux->Clone((fName + "_nueb_EVT").c_str()));
nuebEvt->Reset();
nuebEvt->SetBinContent(1, SpeciesWeights[3] * double(fNEvents) /
nuebEvt->GetXaxis()->GetBinWidth(1));
TH1D* nuebXSec =
static_cast<TH1D*>(nuebEvt->Clone((fName + "_nueb_XSEC").c_str()));
nuebXSec->Divide(fFluxHist);
nuebXSec->SetTitle((fName + "; E_{#nu} (GeV);XSec").c_str());
}
fGIBUUTree->GetEntry(0);
LOG(SAM) << "\tInput GiBUU file species weights: (numu:" << SpeciesWeights[0]
<< ",numub:" << SpeciesWeights[1] << ",nue:" << SpeciesWeights[2]
<< ",nueb:" << SpeciesWeights[3] << ")" << std::endl;
fFluxHist->SetNameTitle(
(fName + "_FLUX").c_str(),
(fName + "; E_{#nu} (GeV);" +
(IsNuBarDominant ? "#Phi_{#bar{#nu}} (A.U.)" : "#Phi_{#nu} (A.U.)"))
.c_str());
fEventHist = static_cast<TH1D*>(fFluxHist->Clone((fName + "_EVT").c_str()));
fEventHist->Reset();
fEventHist->SetBinContent(1, double(fNEvents) *
TotalIntegratedFlux(0, 1.E5, "width") /
fEventHist->GetXaxis()->GetBinWidth(1));
fXSecHist = static_cast<TH1D*>(fEventHist->Clone((fName + "_XSEC").c_str()));
fXSecHist->Divide(fFluxHist);
fXSecHist->SetTitle((fName + "; E_{#nu} (GeV);XSec").c_str());
};
FitEvent* GIBUUInputHandler::GetNuisanceEvent(const UInt_t entry) {
// Make sure events setup
// if (!fNUISANCEEvent) fNUISANCEEvent = new FitEvent(fGiReader);
// Read Entry from TTree to fill NEUT Vect in BaseFitEvt;
fGIBUUTree->GetEntry(entry);
// GiBUU reads input weight from tree
// fNUISANCEEvent->InputWeight = GetInputWeight(entry);
// Run NUISANCE Vector Filler
CalcNUISANCEKinematics();
return fNUISANCEEvent;
}
int GIBUUInputHandler::GetGIBUUParticleStatus(int status, int pdg) {
int state = kUndefinedState;
switch (status) {
case 0: // Incoming
case 11: // Struck nucleon
state = kInitialState;
break;
case 1: // Good Final State
state = kFinalState;
break;
default: // Other
break;
}
// Set Nuclear States Flag
if (pdg > 1000000) {
if (state == kInitialState)
state = kNuclearInitial;
else if (state == kFinalState)
state = kNuclearRemnant;
else
state = kUndefinedState;
}
return state;
}
void GIBUUInputHandler::CalcNUISANCEKinematics() {
// Reset all variables
fNUISANCEEvent->ResetEvent();
FitEvent* evt = fNUISANCEEvent;
// Split Kinematics
// LOG(DEB) << "Reading GiBUU Event: " << std::endl;
// LOG(DEB) << WriteGiBUUEvent(*GiRead) << std::endl;
evt->fMode = fGiReader->GiBUU2NeutCode;
evt->Mode = evt->fMode;
evt->fEventNo = 0.0;
evt->fTotCrs = 0;
evt->fTargetA = 0.0; // Change to get these from nuclear remnant.
evt->fTargetZ = 0.0;
evt->fTargetH = 0;
evt->fBound = 0.0;
// Extra GiBUU Input Weight
evt->InputWeight = fGiReader->EvtWght;
// Check Stack N
int npart = fGiReader->StdHepN;
int kmax = evt->kMaxParticles;
if ((UInt_t)npart > (UInt_t)kmax) {
ERR(FTL) << "GiBUU has too many particles" << std::endl;
ERR(FTL) << "npart=" << npart << " kMax=" << kmax << std::endl;
throw;
}
// Create Stack
evt->fNParticles = 0;
for (int i = 0; i < npart; i++) {
// State
int state = GetGIBUUParticleStatus(fGiReader->StdHepStatus[i],
fGiReader->StdHepPdg[i]);
int curpart = evt->fNParticles;
// Set State
evt->fParticleState[evt->fNParticles] = state;
// Mom
evt->fParticleMom[curpart][0] = fGiReader->StdHepP4[i][0] * 1.E3;
evt->fParticleMom[curpart][1] = fGiReader->StdHepP4[i][1] * 1.E3;
evt->fParticleMom[curpart][2] = fGiReader->StdHepP4[i][2] * 1.E3;
evt->fParticleMom[curpart][3] = fGiReader->StdHepP4[i][3] * 1.E3;
// PDG
evt->fParticlePDG[curpart] = fGiReader->StdHepPdg[i];
// Add to total particles
evt->fNParticles++;
}
// Run Initial, FSI, Final, Other ordering.
fNUISANCEEvent->OrderStack();
return;
}
double GIBUUInputHandler::GetInputWeight(int entry) {
return fNUISANCEEvent->InputWeight;
};
BaseFitEvt* GIBUUInputHandler::GetBaseEvent(const UInt_t entry) {
// Make sure events setup
// if (!fBaseEvent) fBaseEvent = new BaseFitEvt(fGiReader);
// Read entry from TTree to fill NEUT Vect in BaseFitEvt;
fGIBUUTree->GetEntry(entry);
// GiBUU don't need no input weight...
// fBaseEvent->InputWeight = GetInputWeight(entry);
return fBaseEvent;
}
void GIBUUInputHandler::Print() {}
diff --git a/src/FitBase/GNUISANCEFlux.cxx b/src/FitBase/GNUISANCEFlux.cxx
index ac65722..816e686 100644
--- a/src/FitBase/GNUISANCEFlux.cxx
+++ b/src/FitBase/GNUISANCEFlux.cxx
@@ -1,304 +1,304 @@
-#ifdef __GENIE_ENABLED__
+#ifdef __GEVGEN_ENABLED__
//____________________________________________________________________________
/*
Copyright (c) 2003-2016, GENIE Neutrino MC Generator Collaboration
For the full text of the license visit http://copyright.genie-mc.org
or see $GENIE/LICENSE
Author: Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
University of Liverpool & STFC Rutherford Appleton Lab - July 04, 2005
For the class documentation see the corresponding header file.
Important revisions after version 2.0.0 :
@ Feb 22, 2011 - JD
Implemented dummy versions of the new GFluxI::Clear, GFluxI::Index and
GFluxI::GenerateWeighted methods needed for pre-generation of flux
interaction probabilities in GMCJDriver.
*/
//____________________________________________________________________________
#include <cassert>
#include <algorithm>
#include <TH1D.h>
#include <TF1.h>
#include <TVector3.h>
#include "Conventions/Constants.h"
#include "GNUISANCEFlux.h"
#include "Messenger/Messenger.h"
#include "Numerical/RandomGen.h"
#include "PDG/PDGCodeList.h"
#include "Utils/PrintUtils.h"
#include "FluxDrivers/GFluxDriverFactory.h"
FLUXDRIVERREG4(genie,flux,GNUISANCEFlux,genie::flux::GNUISANCEFlux)
using namespace genie;
using namespace genie::constants;
using namespace genie::flux;
//____________________________________________________________________________
GNUISANCEFlux::GNUISANCEFlux()
{
this->Initialize();
}
//___________________________________________________________________________
GNUISANCEFlux::~GNUISANCEFlux()
{
this->CleanUp();
}
//___________________________________________________________________________
bool GNUISANCEFlux::GenerateNext(void)
{
//-- Reset previously generated neutrino code / 4-p / 4-x
this->ResetSelection();
//-- Generate an energy from the 'combined' spectrum histogram
// and compute the momentum vector
if (!fTotSpectrum) AddAllFluxes();
std::cout << "fTotSpectrum = " << fTotSpectrum << std::endl;
std::cout << "TotalSpectrum Integral = " << fTotSpectrum->Integral() << std::endl;
double Ev = (double) fTotSpectrum->GetRandom();
TVector3 p3(*fDirVec); // momentum along the neutrino direction
p3.SetMag(Ev); // with |p|=Ev
fgP4.SetPxPyPzE(p3.Px(), p3.Py(), p3.Pz(), Ev);
//-- Select a neutrino species from the flux fractions at the
// selected energy
fgPdgC = (*fPdgCList)[this->SelectNeutrino(Ev)];
//-- Compute neutrino 4-x
if(fRt <= 0) {
fgX4.SetXYZT(0.,0.,0.,0.);
}
else {
// Create a vector (vec) that points to a random position at a disk
// of radius Rt passing through the origin, perpendicular to the
// input direction.
TVector3 vec0(*fDirVec); // vector along the input direction
TVector3 vec = vec0.Orthogonal(); // orthogonal vector
double psi = this->GeneratePhi(); // rndm angle [0,2pi]
double Rt = this->GenerateRt(); // rndm R [0,Rtransverse]
vec.Rotate(psi,vec0); // rotate around original vector
vec.SetMag(Rt); // set new norm
// Set the neutrino position as beam_spot + vec
double x = fBeamSpot->X() + vec.X();
double y = fBeamSpot->Y() + vec.Y();
double z = fBeamSpot->Z() + vec.Z();
fgX4.SetXYZT(x,y,z,0.);
}
LOG("Flux", pINFO) << "Generated neutrino pdg-code: " << fgPdgC;
LOG("Flux", pINFO)
<< "Generated neutrino p4: " << utils::print::P4AsShortString(&fgP4);
LOG("Flux", pINFO)
<< "Generated neutrino x4: " << utils::print::X4AsString(&fgX4);
return true;
}
//___________________________________________________________________________
void GNUISANCEFlux::Clear(Option_t * opt)
{
// Dummy clear method needed to conform to GFluxI interface
//
LOG("Flux", pERROR) <<
"No Clear(Option_t * opt) method implemented for opt: "<< opt;
}
//___________________________________________________________________________
void GNUISANCEFlux::GenerateWeighted(bool gen_weighted)
{
// Dummy implementation needed to conform to GFluxI interface
//
LOG("Flux", pERROR) <<
"No GenerateWeighted(bool gen_weighted) method implemented for " <<
"gen_weighted: " << gen_weighted;
}
//___________________________________________________________________________
void GNUISANCEFlux::Initialize(void)
{
LOG("Flux", pNOTICE) << "Initializing GNUISANCEFlux driver";
fMaxEv = 0;
fPdgCList = new PDGCodeList;
fTotSpectrum = 0;
fDirVec = 0;
fBeamSpot = 0;
fRt =-1;
fRtDep = 0;
this->ResetSelection();
this->SetRtDependence("x");
//eg, other example: this->SetRtDependence("pow(x,2)");
}
//___________________________________________________________________________
void GNUISANCEFlux::ResetSelection(void)
{
// initializing running neutrino pdg-code, 4-position, 4-momentum
fgPdgC = 0;
fgP4.SetPxPyPzE (0.,0.,0.,0.);
fgX4.SetXYZT (0.,0.,0.,0.);
}
//___________________________________________________________________________
void GNUISANCEFlux::CleanUp(void)
{
LOG("Flux", pNOTICE) << "Cleaning up...";
if (fDirVec ) delete fDirVec;
if (fBeamSpot ) delete fBeamSpot;
if (fPdgCList ) delete fPdgCList;
// if (fTotSpectrum) delete fTotSpectrum;
if (fRtDep ) delete fRtDep;
unsigned int nspectra = fSpectrum.size();
for(unsigned int i = 0; i < nspectra; i++) {
TH1D * spectrum = fSpectrum[i];
delete spectrum;
spectrum = 0;
}
}
//___________________________________________________________________________
void GNUISANCEFlux::SetNuDirection(const TVector3 & direction)
{
if(fDirVec) delete fDirVec;
fDirVec = new TVector3(direction);
}
//___________________________________________________________________________
void GNUISANCEFlux::SetBeamSpot(const TVector3 & spot)
{
if(fBeamSpot) delete fBeamSpot;
fBeamSpot = new TVector3(spot);
}
//___________________________________________________________________________
void GNUISANCEFlux::SetTransverseRadius(double Rt)
{
LOG ("Flux", pNOTICE) << "Setting R[transverse] = " << Rt;
fRt = Rt;
if(fRtDep) fRtDep->SetRange(0,Rt);
}
//___________________________________________________________________________
void GNUISANCEFlux::AddEnergySpectrum(int nu_pdgc, TH1D * spectrum)
{
LOG("Flux", pNOTICE) << "Adding flux spectrum for pdg = " << nu_pdgc;
fPdgCList->push_back(nu_pdgc);
bool accepted = (count(fPdgCList->begin(),fPdgCList->end(),nu_pdgc) == 1);
if(!accepted) {
LOG ("Flux", pWARN)
<< "The pdg-code isn't recognized and the spectrum was ignored";
} else {
fSpectrum.push_back(spectrum);
int nb = spectrum->GetNbinsX();
Axis_t max = spectrum->GetBinLowEdge(nb)+spectrum->GetBinWidth(nb);
fMaxEv = TMath::Max(fMaxEv, (double)max);
LOG("Flux", pNOTICE)
<< "Updating maximum energy of flux particles to: " << fMaxEv;
// this->AddAllFluxes(); // update combined flux
}
}
//___________________________________________________________________________
void GNUISANCEFlux::SetRtDependence(string rdep)
{
// Set the (functional form of) Rt dependence as string, eg "x*x+sin(x)"
// You do not need to set this method. The default behaviour is to generate
// flux neutrinos uniformly over the area of the cylinder's cross section.
if(fRtDep) delete fRtDep;
fRtDep = new TF1("rdep", rdep.c_str(), 0,fRt);
}
//___________________________________________________________________________
void GNUISANCEFlux::AddAllFluxes(void)
{
LOG("Flux", pNOTICE) << "Computing combined flux";
//if(fTotSpectrum) delete fTotSpectrum;
vector<TH1D *>::const_iterator spectrum_iter;
unsigned int inu=0;
for(spectrum_iter = fSpectrum.begin();
spectrum_iter != fSpectrum.end(); ++spectrum_iter) {
TH1D * spectrum = *spectrum_iter;
if(inu==0) { fTotSpectrum = new TH1D(*spectrum); }
else { fTotSpectrum->Add(spectrum); }
LOG("Flux",pNOTICE) << "Added spectrum ";
inu++;
}
LOG("Flux", pNOTICE) << "Flux Pointer = " << fTotSpectrum;
LOG("Flux", pNOTICE) << "Total flux integral = " << fTotSpectrum->Integral();
}
//___________________________________________________________________________
int GNUISANCEFlux::SelectNeutrino(double Ev)
{
const unsigned int n = fPdgCList->size();
double fraction[n];
vector<TH1D *>::const_iterator spectrum_iter;
unsigned int inu=0;
for(spectrum_iter = fSpectrum.begin();
spectrum_iter != fSpectrum.end(); ++spectrum_iter) {
TH1D * spectrum = *spectrum_iter;
fraction[inu++] = spectrum->GetBinContent(spectrum->FindBin(Ev));
}
double sum = 0;
for(inu = 0; inu < n; inu++) {
sum += fraction[inu];
fraction[inu] = sum;
LOG("Flux", pDEBUG) << "SUM-FRACTION(0->" << inu <<") = " << sum;
}
RandomGen * rnd = RandomGen::Instance();
double R = sum * rnd->RndFlux().Rndm();
LOG("Flux", pDEBUG) << "R e [0,SUM] = " << R;
for(inu = 0; inu < n; inu++) {if ( R < fraction[inu] ) return inu;}
LOG("Flux", pERROR) << "Could not select a neutrino species";
assert(false);
return -1;
}
//___________________________________________________________________________
double GNUISANCEFlux::GeneratePhi(void) const
{
RandomGen * rnd = RandomGen::Instance();
double phi = 2.*kPi * rnd->RndFlux().Rndm(); // [0,2pi]
return phi;
}
//___________________________________________________________________________
double GNUISANCEFlux::GenerateRt(void) const
{
double Rt = fRtDep->GetRandom(); // rndm R [0,Rtransverse]
return Rt;
}
//___________________________________________________________________________
TH1D* GNUISANCEFlux::GetTotalSpectrum(void){
// if (fTotSpectrum) delete fTotSpectrum;
this->AddAllFluxes();
return fTotSpectrum;
}
#endif
diff --git a/src/FitBase/GNUISANCEFlux.h b/src/FitBase/GNUISANCEFlux.h
index ac34b2b..841f72f 100644
--- a/src/FitBase/GNUISANCEFlux.h
+++ b/src/FitBase/GNUISANCEFlux.h
@@ -1,103 +1,103 @@
-#ifdef __GENIE_ENABLED__
+#ifdef __GEVGEN_ENABLED__
//____________________________________________________________________________
/*!
\class genie::flux::GNUISANCEFlux
\brief A generic GENIE flux driver.
Generates a 'cylindrical' neutrino beam along the input direction,
with the input transverse radius and centered at the input position.
The energies are generated from the input energy spectrum (TH1D).
Multiple neutrino species can be generated (you will need to supply
an energy spectrum for each).
\author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
University of Liverpool & STFC Rutherford Appleton Lab
\created July 4, 2005
\cpright Copyright (c) 2003-2016, GENIE Neutrino MC Generator Collaboration
For the full text of the license visit http://copyright.genie-mc.org
or see $GENIE/LICENSE
*/
//____________________________________________________________________________
#ifndef _G_NUISANCE_FLUX_H_
#define _G_NUISANCE_FLUX_H_
#include <string>
#include <vector>
#include <TLorentzVector.h>
#include "EVGDrivers/GFluxI.h"
class TH1D;
class TF1;
class TVector3;
using std::string;
using std::vector;
namespace genie {
namespace flux {
class GNUISANCEFlux: public GFluxI {
public :
GNUISANCEFlux();
~GNUISANCEFlux();
// methods specific to this flux object
void SetNuDirection (const TVector3 & direction);
void SetBeamSpot (const TVector3 & spot);
void SetTransverseRadius (double Rt);
void AddEnergySpectrum (int nu_pdgc, TH1D * spectrum);
void SetRtDependence (string rdep);
// methods implementing the GENIE GFluxI interface
const PDGCodeList & FluxParticles (void) { return *fPdgCList; }
double MaxEnergy (void) { return fMaxEv; }
bool GenerateNext (void);
int PdgCode (void) { return fgPdgC; }
double Weight (void) { return 1.0; }
const TLorentzVector & Momentum (void) { return fgP4; }
const TLorentzVector & Position (void) { return fgX4; }
bool End (void) { return false; }
long int Index (void) { return -1; }
void Clear (Option_t * opt);
void GenerateWeighted (bool gen_weighted);
TH1D* GetTotalSpectrum();
inline vector<TH1D*> GetSpectrum(){ return fSpectrum; };
void AddAllFluxes (void);
private:
// private methods
void Initialize (void);
void CleanUp (void);
void ResetSelection (void);
int SelectNeutrino (double Ev);
double GeneratePhi (void) const;
double GenerateRt (void) const;
// private data members
double fMaxEv; ///< maximum energy
PDGCodeList * fPdgCList; ///< list of neutrino pdg-codes
int fgPdgC; ///< running generated nu pdg-code
TLorentzVector fgP4; ///< running generated nu 4-momentum
TLorentzVector fgX4; ///< running generated nu 4-position
vector<TH1D *> fSpectrum; ///< flux = f(Ev), 1/neutrino species
TH1D * fTotSpectrum; ///< combined flux = f(Ev)
TVector3 * fDirVec; ///< neutrino direction
TVector3 * fBeamSpot; ///< beam spot position
double fRt; ///< transverse size of neutrino beam
TF1 * fRtDep; ///< transverse radius dependence
};
} // flux namespace
} // genie namespace
#endif // _G_TH1_CYLICDRICAL_FLUX_H_
#endif
diff --git a/src/FitBase/GNUISANCEMCJDriver.cxx b/src/FitBase/GNUISANCEMCJDriver.cxx
index fe3a1fe..faf3f88 100644
--- a/src/FitBase/GNUISANCEMCJDriver.cxx
+++ b/src/FitBase/GNUISANCEMCJDriver.cxx
@@ -1,1372 +1,1372 @@
-#ifdef __GENIE_ENABLED__
+#ifdef __GEVGEN_ENABLED__
//____________________________________________________________________________
/*
Copyright (c) 2003-2016, GENIE Neutrino MC Generator Collaboration
For the full text of the license visit http://copyright.genie-mc.org
or see $GENIE/LICENSE
Author: Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
University of Liverpool & STFC Rutherford Appleton Lab
For the class documentation see the corresponding header file.
Important revisions after version 2.0.0 :
@ Feb 08, 2008 - CA
Modified the global probability scale to be the maximum amongst the maximum
interaction probabilities for each neutrino (rather than the sum of maximum
probabilities). The modified probability scale still gives unbiased event
generation & reduces the 'no-interaction' probability.
@ Feb 14, 2008 - CA
Significant speed improvements - Most of the rejected flux neutrinos, are
rejected before having them propagated through the detector geometry
(flux neutrinos are pre-selected using the maximum path-lengths / for most
realistic fluxes -high energy tail, low energy peak- most of the selection
inefficiency is caused not because the path-lengths are not close the max
possible ones, but because the energy is not close to the max possible one).
Also some speed improvement was gained by properly using the total cross
section splines (before, han repeatedly summing-up the
The driver does not assert that _each_ flux neutrino generation & geometry
navigation will be succesfull - In the rare event that this may happen, it
prints an err mesg and tries again. In next revision I will limit the
number of successive trials something may go wrong to prevent the driver
from hanging in truly problematic cases.
The driver was adapted to handle flux drivers that -at some point- may stop
generating more flux neutrinos (eg because they read flux neutrinos by
looping over a beam simulation ntuple and they reached its last entry).
Code was appropriately restructured and some methods have been renamed.
@ Feb 29, 2008 - CA
Modified the InteractionProbability() to calculate absolute interaction
probabilities. Added NFluxNeutrinos() and GlobProbScale() to get the
number of neutrinos thrown by the flux driver towards the geometry and
the global interaction probability scale so as to be able to calculate
event sample normalization factors.
@ Jan 15, 2009 - CA
Stopped GMCJDriver from initializing the unphysical event mask so as not
to overwrite the values that each GEVGDriver obtains from the environment.
@ Jan 16, 2009 - CA
Added methods to return pointers to the flux and geometry drivers.
@ Mar 11, 2009 - CA
In GenerateEvent1Try() handle failure to generate kinematics. Added sanity
check on the no interaction probability.
@ Mar 04, 2010 - CA
Remove unused FilterUnphysical(TBits) method. Now set exclusively via the
GUNPHYSMASK env.var.
@ Apr 15, 2010 - CA
Fix unit error in ComputeEventProbability() - Reported by Corey Reed.
The probability stored at the output event was wrong but this doesn't
affect any of the existing applications as this number wasn't actually
used anywhere.
@ Dec 07, 2010 - CA
Don't use a fixed bin size in ComputeProbScales() as this was causing
errors for low energy applications. Addresses a problem reported by
Joachim Kopp.
@ Feb 22, 2011 - JD
Added a number of new methods to allow pre-calculation of exact flux
interaction probabilities for a given set of flux neutrinos from the
flux driver. See the comments for the new LoadFluxProbabilities,
SaveFluxProbabilities, PreCalcFluxProbabilities and PreSelectEvents
methods for details. Using these methods mean that there is no need
to generate maximum path lengths as instead use the exact interaction
probabilities to pre-select. This can result in very significant speed
increases (between factor of 5 and ~300) for event generation over complex
detector geometries and with realistic flux drivers. See
src/support/t2k/EvGen/gT2KEvGen.cxx for an example of how to use.
@ Mar, 7, 2011 - JD
Store sum totals of the flux interaction probabilities for various neutrino
type in a map relating pdg code to total interaction probability. Also add
public getter method so that this can be used in applications to work out
expected event rates. See gT2KEvGen.cxx for an example of how to do this.
Also save the PDG code for each entry in the flux interaction probabilities
tree.
@ Mar, 11, 2011 - JD
Set the directory of fFluxIntTree to the output file fFluxIntProbFile if
saving it later. This is so that it is incrementally saved and fixes bug
where getting std::bad_alloc when trying to Write large trees
fFluxIntProbFile.
@ Jan 31, 2013 - CA
Added SetEventGeneratorList(string listname). $GEVGL var no longer in use.
@ Feb 01, 2013 - CA
The GUNPHYSMASK env. var is no longer used. Added SetUnphysEventMask(const
TBits &). Input is propagated accordingly.
@ Feb 06, 2013 - CA
Fix small problem introduced with recent changes.
In PopulateEventGenDriverPool() calls to GEVGDriver::SetEventGeneratorList()
and GEVGDriver::Configure() were reversed. Problem reported by W.Huelsnitz.
@ July 15, 2014 - HG
Incorporated code provided by Jason Koskinen - IceCube
Modified ComputeProbScales to evalulate the cross sections at both the high
and low edges of the energy bin when calculating the max interaction
probability.
*/
//____________________________________________________________________________
#include <cassert>
#include <TVector3.h>
#include <TSystem.h>
#include <TStopwatch.h>
#include "Algorithm/AlgConfigPool.h"
#include "Conventions/GBuild.h"
#include "Conventions/Constants.h"
#include "Conventions/Units.h"
#include "Conventions/Controls.h"
#include "EVGCore/EventRecord.h"
#include "EVGDrivers/GMCJDriver.h"
#include "GNUISANCEMCJDriver.h"
#include "EVGDrivers/GEVGDriver.h"
#include "EVGDrivers/GEVGPool.h"
#include "EVGDrivers/GFluxI.h"
#include "EVGDrivers/GeomAnalyzerI.h"
#include "GHEP/GHepFlags.h"
#include "GHEP/GHepParticle.h"
#include "Interaction/InitialState.h"
#include "Messenger/Messenger.h"
#include "Numerical/RandomGen.h"
#include "Numerical/Spline.h"
#include "PDG/PDGUtils.h"
#include "Utils/PrintUtils.h"
#include "Utils/XSecSplineList.h"
#include "Conventions/Constants.h"
using namespace genie;
using namespace genie::constants;
//____________________________________________________________________________
GNUISANCEMCJDriver::GNUISANCEMCJDriver()
{
this->InitJob();
}
//___________________________________________________________________________
GNUISANCEMCJDriver::~GNUISANCEMCJDriver()
{
if(fUnphysEventMask) delete fUnphysEventMask;
if (fGPool) delete fGPool;
map<int,TH1D*>::iterator pmax_iter = fPmax.begin();
for( ; pmax_iter != fPmax.end(); ++pmax_iter) {
TH1D * pmax = pmax_iter->second;
if(pmax) {
delete pmax; pmax = 0;
}
}
fPmax.clear();
if(fFluxIntTree) delete fFluxIntTree;
if(fFluxIntProbFile) delete fFluxIntProbFile;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::SetEventGeneratorList(string listname)
{
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Setting event generator list: " << listname;
fEventGenList = listname;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::SetUnphysEventMask(const TBits & mask)
{
*fUnphysEventMask = mask;
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Setting unphysical event mask (bits: " << GHepFlags::NFlags() - 1
<< " -> 0) : " << *fUnphysEventMask;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::UseFluxDriver(GFluxI * flux_driver)
{
fFluxDriver = flux_driver;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::UseGeomAnalyzer(GeomAnalyzerI * geom_analyzer)
{
fGeomAnalyzer = geom_analyzer;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::UseSplines(bool useLogE)
{
fUseSplines = true;
fUseLogE = useLogE;
}
//___________________________________________________________________________
bool GNUISANCEMCJDriver::UseMaxPathLengths(string xml_filename)
{
// If you supply the maximum path lengths for all materials in your geometry
// (eg for ROOT/GEANT geometries they can be computed running GENIE's gmxpl
// application, see $GENIE/src/stdapp/gMaxPathLengths.cxx ) you can speed up
// the driver init phase by quite a bit (especially for complex geometries).
fMaxPlXmlFilename = xml_filename;
bool is_accessible = !(gSystem->AccessPathName(fMaxPlXmlFilename.c_str()));
if ( is_accessible ) fUseExtMaxPl = true;
else {
fUseExtMaxPl = false;
LOG("GNUISANCEMCJDriver", pWARN)
<< "UseMaxPathLengths could not find file: \"" << xml_filename << "\"";
}
return fUseExtMaxPl;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::KeepOnThrowingFluxNeutrinos(bool keep_on)
{
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Keep on throwing flux neutrinos till one interacts? : "
<< utils::print::BoolAsYNString(keep_on);
fKeepThrowingFluxNu = keep_on;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::ForceSingleProbScale()
{
// Use a single probability scale. That generates unweighted events.
// (Note that generating unweighted event kinematics is a different thing)
//
fGenerateUnweighted = true;
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "GNUISANCEMCJDriver will generate un-weighted events. "
<< "Note: That does not force unweighted event kinematics!";
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::PreSelectEvents(bool preselect)
{
// Set whether to pre-select events based on a max-path lengths file. This
// should be turned off if using pre-generated interaction probabilities
// calculated from a given flux file.
fPreSelect = preselect;
}
//___________________________________________________________________________
bool GNUISANCEMCJDriver::PreCalcFluxProbabilities(void)
{
// Loop over complete set of flux entries satisfying input config options
// (such as neutrino type) and save the interaction probability in a tree
// relating flux index (entry number in input flux tree) to interaction
// probability. If a pre-generated flux interaction probability tree has
// already been loaded then just returns true. Also save tree to a TFile
// for use in later jobs if flag is set
//
bool success = true;
bool save_to_file = fFluxIntProbFile == 0 && fFluxIntFileName.size()>0;
// Clear map storing sum(fBrFluxWeight*fBrFluxIntProb) for each neutrino pdg
fSumFluxIntProbs.clear();
// check if already loaded flux interaction probs using LoadFluxProbTree
if(fFluxIntTree){
LOG("GNUISANCEMCJDriver", pNOTICE) <<
"Skipping pre-generation of flux interaction probabilities - "<<
"using pre-generated file";
success = true;
}
// otherwise create them on the fly now
else {
if(save_to_file){
fFluxIntProbFile = new TFile(fFluxIntFileName.c_str(), "CREATE");
if(fFluxIntProbFile->IsZombie()){
LOG("GNUISANCEMCJDriver", pFATAL) << "Cannot overwrite an existing file. Exiting!";
exit(1);
}
}
// Create the tree to store flux probs
fFluxIntTree = new TTree(fFluxIntTreeName.c_str(),
"Tree storing pre-calculated flux interaction probs");
fFluxIntTree->Branch("FluxIndex", &fBrFluxIndex, "FluxIndex/I");
fFluxIntTree->Branch("FluxIntProb", &fBrFluxIntProb, "FluxIntProb/D");
fFluxIntTree->Branch("FluxEnu", &fBrFluxEnu, "FluxEnu/D");
fFluxIntTree->Branch("FluxWeight", &fBrFluxWeight, "FluxWeight/D");
fFluxIntTree->Branch("FluxPDG", &fBrFluxPDG, "FluxPDG/I");
// Associate to file otherwise get std::bad_alloc when writing large trees
if(save_to_file) fFluxIntTree->SetDirectory(fFluxIntProbFile);
fFluxDriver->GenerateWeighted(true);
fGlobPmax = 1.0; // Force ComputeInteractionProbabilities to return absolute value
// Loop over flux entries and calculate interaction probabilities
TStopwatch stopwatch;
stopwatch.Start();
long int first_index = -1;
bool first_loop = true;
// loop until at end of flux ntuple
while(fFluxDriver->End() == false){
// get the next flux neutrino
bool gotnext = fFluxDriver->GenerateNext();
if(!gotnext){
LOG("GNUISANCEMCJDriver", pWARN) << "*** Couldn't generate next flux ray! ";
continue;
}
// stop if completed a full cycle (this check is necessary as fluxdriver
// may be set to loop over more than one cycle before reaching end)
bool already_been_here = first_loop ? false : first_index == fFluxDriver->Index();
if(already_been_here) break;
// compute the path lengths for current flux neutrino
if(this->ComputePathLengths() == false){ success = false; break;}
// compute and store the interaction probability
double psum = this->ComputeInteractionProbabilities(false /*Based on actual PLs*/);
assert(psum+controls::kASmallNum > 0.);
fBrFluxIntProb = psum;
fBrFluxIndex = fFluxDriver->Index();
fBrFluxEnu = fFluxDriver->Momentum().E();
fBrFluxWeight = fFluxDriver->Weight();
fBrFluxPDG = fFluxDriver->PdgCode();
fFluxIntTree->Fill();
// store the first index so know when have cycled exactly once
if(first_loop){
first_index = fFluxDriver->Index();
first_loop = false;
}
} // flux loop
stopwatch.Stop();
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Finished pre-calculating flux interaction probabilities. "
<< "Total CPU time to process "<< fFluxIntTree->GetEntries()
<< " entries: "<< stopwatch.CpuTime();
// reset the flux driver so can be used at next stage. N.B. This
// should also reset flux driver to throw de-weighted flux neutrinos
fFluxDriver->Clear("CycleHistory");
}
// If successfully calculated/loaded interaction probabilities then set global
// probability scale and, if requested, save tree to output file
if(success){
fGlobPmax = 0.0;
double safety_factor = 1.01;
for(int i = 0; i< fFluxIntTree->GetEntries(); i++){
fFluxIntTree->GetEntry(i);
// Check have non-negative probabilities
assert(fBrFluxIntProb+controls::kASmallNum > 0.0);
assert(fBrFluxWeight+controls::kASmallNum > 0.0);
// Update the global maximum
fGlobPmax = TMath::Max(fGlobPmax, fBrFluxIntProb*safety_factor);
// Update the sum of fBrFluxIntProb*fBrFluxWeight for different species
if(fSumFluxIntProbs.find(fBrFluxPDG) == fSumFluxIntProbs.end()){
fSumFluxIntProbs[fBrFluxPDG] = 0.0;
}
fSumFluxIntProbs[fBrFluxPDG] += fBrFluxIntProb * fBrFluxWeight;
}
LOG("GNUISANCEMCJDriver", pNOTICE) <<
"Updated global probability scale to fGlobPmax = "<< fGlobPmax;
if(save_to_file){
LOG("GNUISANCEMCJDriver", pNOTICE) <<
"Saving pre-generated interaction probabilities to file: "<<
fFluxIntProbFile->GetName();
fFluxIntProbFile->cd();
fFluxIntTree->Write();
}
// Also build index for use later
if(fFluxIntTree->BuildIndex("FluxIndex") != fFluxIntTree->GetEntries()){
LOG("GNUISANCEMCJDriver", pFATAL) <<
"Cannot build index using branch \"FluxIndex\" for flux prob tree!";
exit(1);
}
// Now that have pre-generated flux probabilities need to trun off event
// preselection as this is only advantages when using max path lengths
this->PreSelectEvents(false);
LOG("GNUISANCEMCJDriver", pNOTICE) << "Successfully generated/loaded pre-calculate flux interaction probabilities";
}
// Otherwise clean up
else if(fFluxIntTree){
delete fFluxIntTree;
fFluxIntTree = 0;
}
// Return whether have successfully pre-calculated flux interaction probabilities
return success;
}
//___________________________________________________________________________
bool GNUISANCEMCJDriver::LoadFluxProbabilities(string filename)
{
// Load a pre-generated set of flux interaction probabilities from an external
// file. This is recommended when using large flux files (>100k entries) as
// for these the time to calculate the interaction probabilities can exceed
// ~20 minutes. After loading the input tree we call PreCalcFluxProbabilities
// to check that has successfully loaded
//
if(fFluxIntProbFile){
LOG("GNUISANCEMCJDriver", pWARN)
<< "Can't load flux interaction prob file as one is already loaded";
return false;
}
fFluxIntProbFile = new TFile(filename.c_str(), "OPEN");
if(fFluxIntProbFile){
fFluxIntTree = dynamic_cast<TTree*>(fFluxIntProbFile->Get(fFluxIntTreeName.c_str()));
if(fFluxIntTree){
bool set_addresses =
fFluxIntTree->SetBranchAddress("FluxIntProb", &fBrFluxIntProb) >= 0 &&
fFluxIntTree->SetBranchAddress("FluxIndex", &fBrFluxIndex) >= 0 &&
fFluxIntTree->SetBranchAddress("FluxPDG", &fBrFluxPDG) >= 0 &&
fFluxIntTree->SetBranchAddress("FluxWeight", &fBrFluxWeight) >= 0 &&
fFluxIntTree->SetBranchAddress("FluxEnu", &fBrFluxEnu) >= 0;
if(set_addresses){
// Finally check that can use them
if(this->PreCalcFluxProbabilities()) {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Successfully loaded pre-generated flux interaction probabilities";
return true;
}
}
// If cannot load then delete tree
LOG("GNUISANCEMCJDriver", pERROR) <<
"Cannot find expected branches in input flux probability tree!";
delete fFluxIntTree; fFluxIntTree = 0;
}
else LOG("GNUISANCEMCJDriver", pERROR)
<< "Cannot find tree: "<< fFluxIntTreeName.c_str();
}
LOG("GNUISANCEMCJDriver", pWARN)
<< "Unable to load flux interaction probabilities file";
return false;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::SaveFluxProbabilities(string outfilename)
{
// Configue the flux driver to save the calculated flux interaction
// probabilities to the specified output file name for use in later jobs. See
// the LoadFluxProbTree method for how they are fed into a later job.
//
fFluxIntFileName = outfilename;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::Configure(bool calc_prob_scales)
{
LOG("GNUISANCEMCJDriver", pNOTICE)
<< utils::print::PrintFramedMesg("Configuring GNUISANCEMCJDriver");
// Get the list of neutrino types from the input flux driver and the list
// of target materials from the input geometry driver
this->GetParticleLists();
// Ask the input GFluxI for the max. neutrino energy (to compute Pmax)
this->GetMaxFluxEnergy();
// Create all possible initial states and for each one initialize,
// configure & store an GEVGDriver event generation driver object.
// Once an 'initial state' has been selected from the input flux / geom,
// the responsibility for generating the neutrino interaction will be
// delegated to one of these drivers.
this->PopulateEventGenDriverPool();
// If the user wants to use cross section splines in order to speed things
// up, then coordinate spline creation from all GEVGDriver objects pushed
// into GEVGPool. This will create all xsec splines needed for all (enabled)
// processes that can be simulated involving the particles in the input flux
// and geometry.
// Spline creation will be skipped for every spline that has been pre-loaded
// into the the XSecSplineList.
// Once more it is noted that computing cross section splines is a huge
// overhead. The user is encouraged to generate them in advance and load
// them into the XSecSplineList
this->BootstrapXSecSplines();
// Create cross section splines describing the total interaction xsec
// for a given initial state (Create them by summing all xsec splines
// for each possible initial state)
this->BootstrapXSecSplineSummation();
if(calc_prob_scales){
// Ask the input geometry driver to compute the max. path length for each
// material in the list of target materials (or load a precomputed list)
this->GetMaxPathLengthList();
// Compute the max. interaction probability to scale all interaction
// probabilities to be computed by this driver
this->ComputeProbScales();
}
LOG("GNUISANCEMCJDriver", pNOTICE) << "Finished configuring GNUISANCEMCJDriver\n\n";
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::InitJob(void)
{
fEventGenList = "Default"; // <-- set of event generators to be loaded by this driver
fUnphysEventMask = new TBits(GHepFlags::NFlags()); //<-- unphysical event mask
//fUnphysEventMask->ResetAllBits(true);
for(unsigned int i = 0; i < GHepFlags::NFlags(); i++) {
fUnphysEventMask->SetBitNumber(i, true);
}
fFluxDriver = 0; // <-- flux driver
fGeomAnalyzer = 0; // <-- geometry driver
fGPool = 0; // <-- pool of GEVGDriver event generation drivers
fEmax = 0; // <-- maximum neutrino energy
fMaxPlXmlFilename = ""; // <-- XML file with external path lengths
fUseExtMaxPl = false;
fUseSplines = false;
fNFluxNeutrinos = 0; // <-- number of flux neutrinos thrown so far
fGlobPmax = 0; // <-- maximum interaction probability (global prob scale)
fPmax.clear(); // <-- maximum interaction probability per neutrino & per energy bin
fGenerateUnweighted = false; // <-- default opt to generate weighted events
fPreSelect = true; // <-- default to use pre-selection based on maximum path lengths
fSelTgtPdg = 0;
fCurEvt = 0;
fCurVtx.SetXYZT(0.,0.,0.,0.);
fFluxIntProbFile = 0;
fFluxIntTreeName = "gFlxIntProb";
fFluxIntFileName = "";
fFluxIntTree = 0;
fBrFluxIntProb = -1.;
fBrFluxIndex = -1;
fBrFluxEnu = -1.;
fBrFluxWeight = -1.;
fBrFluxPDG = 0;
fSumFluxIntProbs.clear();
// Throw as many flux neutrinos as necessary till one has interacted
// so that GenerateEvent() never returns NULL (except when in error)
this->KeepOnThrowingFluxNeutrinos(true);
// Allow the selected GEVGDriver to go into recursive mode and regenerate
// an interaction that turns out to be unphysical.
//TBits unphysmask(GHepFlags::NFlags());
//unphysmask.ResetAllBits(false);
//this->FilterUnphysical(unphysmask);
// Force early initialization of singleton objects that are typically
// would be initialized at their first use later on.
// This is purely cosmetic and I do it to send the banner and some prolific
// initialization printout at the top.
assert( Messenger::Instance() );
assert( AlgConfigPool::Instance() );
// Autoload splines (from the XML file pointed at the $GSPLOAD env. var.,
// if the env. var. has been set);
XSecSplineList * xspl = XSecSplineList::Instance();
xspl->AutoLoad();
// Clear the target and neutrino lists
fNuList.clear();
fTgtList.clear();
// Clear the maximum path length list
fMaxPathLengths.clear();
fCurPathLengths.clear();
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::GetParticleLists(void)
{
// Get the list of flux neutrinos from the flux driver
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Asking the flux driver for its list of neutrinos";
fNuList = fFluxDriver->FluxParticles();
LOG("GNUISANCEMCJDriver", pNOTICE) << "Flux particles: " << fNuList;
// Get the list of target materials from the geometry driver
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Asking the geometry driver for its list of targets";
fTgtList = fGeomAnalyzer->ListOfTargetNuclei();
LOG("GNUISANCEMCJDriver", pNOTICE) << "Target materials: " << fTgtList;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::GetMaxPathLengthList(void)
{
if(fUseExtMaxPl) {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Loading external max path-length list for input geometry from "
<< fMaxPlXmlFilename;
fMaxPathLengths.LoadFromXml(fMaxPlXmlFilename);
} else {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Querying the geometry driver to compute the max path-length list";
fMaxPathLengths = fGeomAnalyzer->ComputeMaxPathLengths();
}
// Print maximum path lengths & neutrino energy
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Maximum path length list: " << fMaxPathLengths;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::GetMaxFluxEnergy(void)
{
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Querying the flux driver for the maximum energy of flux neutrinos";
fEmax = fFluxDriver->MaxEnergy();
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Maximum flux neutrino energy = " << fEmax << " GeV";
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::PopulateEventGenDriverPool(void)
{
LOG("GNUISANCEMCJDriver", pDEBUG)
<< "Creating GEVGPool & adding a GEVGDriver object per init-state";
if (fGPool) delete fGPool;
fGPool = new GEVGPool;
PDGCodeList::const_iterator nuiter;
PDGCodeList::const_iterator tgtiter;
for(nuiter = fNuList.begin(); nuiter != fNuList.end(); ++nuiter) {
for(tgtiter = fTgtList.begin(); tgtiter != fTgtList.end(); ++tgtiter) {
int target_pdgc = *tgtiter;
int neutrino_pdgc = *nuiter;
InitialState init_state(target_pdgc, neutrino_pdgc);
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "\n\n ---- Creating a GEVGDriver object configured for init-state: "
<< init_state.AsString() << " ----\n\n";
GEVGDriver * evgdriver = new GEVGDriver;
evgdriver->SetEventGeneratorList(fEventGenList); // specify list of generators
evgdriver->Configure(init_state);
evgdriver->UseSplines(); // check if all splines needed are loaded
LOG("GNUISANCEMCJDriver", pDEBUG) << "Adding new GEVGDriver object to GEVGPool";
fGPool->insert( GEVGPool::value_type(init_state.AsString(), evgdriver) );
} // targets
} // neutrinos
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "All necessary GEVGDriver object were pushed into GEVGPool\n";
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::BootstrapXSecSplines(void)
{
// Bootstrap cross section spline generation by the event generation drivers
// that handle each initial state.
if(!fUseSplines) return;
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Asking event generation drivers to compute all needed xsec splines";
PDGCodeList::const_iterator nuiter;
PDGCodeList::const_iterator tgtiter;
for(nuiter = fNuList.begin(); nuiter != fNuList.end(); ++nuiter){
for(tgtiter = fTgtList.begin(); tgtiter != fTgtList.end(); ++tgtiter) {
int target_pdgc = *tgtiter;
int neutrino_pdgc = *nuiter;
InitialState init_state(target_pdgc, neutrino_pdgc);
LOG("GNUISANCEMCJDriver", pINFO)
<< "Computing all splines needed for init-state: "
<< init_state.AsString();
GEVGDriver * evgdriver = fGPool->FindDriver(init_state);
evgdriver->CreateSplines(-1,-1,fUseLogE);
} // targets
} // neutrinos
LOG("GNUISANCEMCJDriver", pINFO) << "Finished creating cross section splines\n";
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::BootstrapXSecSplineSummation(void)
{
// Sum-up the cross section splines for all the interaction that can be
// simulated for each initial state
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Summing-up splines to get total cross section for each init state";
GEVGPool::iterator diter;
for(diter = fGPool->begin(); diter != fGPool->end(); ++diter) {
string init_state = diter->first;
GEVGDriver * evgdriver = diter->second;
assert(evgdriver);
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "**** Summing xsec splines for init-state = " << init_state;
Range1D_t rE = evgdriver->ValidEnergyRange();
if (fEmax>rE.max || fEmax<rE.min)
LOG("GNUISANCEMCJDriver",pFATAL)
<< " rE (validEnergyRange) [" << rE.min << "," << rE.max << "] "
<< " fEmax " << fEmax;
assert(fEmax<rE.max && fEmax>rE.min);
// decide the energy range for the sum spline - extend the spline a little
// bit above the maximum beam energy (but below the maximum valid energy)
// to avoid the evaluation of the cubic spline around the viscinity of
// knots with zero y values (although the GENIE Spline object handles it)
double dE = fEmax/10.;
double min = rE.min;
double max = (fEmax+dE < rE.max) ? fEmax+dE : rE.max;
evgdriver->CreateXSecSumSpline(100,min,max,true);
}
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Finished summing all interaction xsec splines per initial state";
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::ComputeProbScales(void)
{
// Computing interaction probability scales.
// To minimize the numbers or trials before choosing a neutrino+target init
// state for generating an event (note: each trial means selecting a flux
// neutrino, navigating it through the detector to compute path lengths,
// computing interaction probabilities for each material and so on...)
// a set of probability scales can be used for different neutrino species
// and at different energy bins.
// A global probability scale is also being constructed for keeping the correct
// proportions between differect flux neutrino species or flux neutrinos of
// different energies.
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Computing the max. interaction probability (probability scale)";
// clean up global probability scale and maximum probabilties per neutrino
// type & energy bin
{
fGlobPmax = 0;
map<int,TH1D*>::iterator pmax_iter = fPmax.begin();
for( ; pmax_iter != fPmax.end(); ++pmax_iter) {
TH1D * pmax = pmax_iter->second;
if(pmax) {
delete pmax; pmax = 0;
}
}
fPmax.clear();
}
// for maximum interaction probability vs E /for given geometry/ I will
// be using 300 bins up to the maximum energy for the input flux
// double de = fEmax/300.;//djk june 5, 2013
double de = fEmax/300.;//djk june 5, 2013
double emin = 0.0;
double emax = fEmax + de;
int n = 1 + (int) ((emax-emin)/de);
PDGCodeList::const_iterator nuiter;
PDGCodeList::const_iterator tgtiter;
// loop over all neutrino types generated by the flux driver
for(nuiter = fNuList.begin(); nuiter != fNuList.end(); ++nuiter) {
int neutrino_pdgc = *nuiter;
TH1D * pmax_hst = new TH1D("pmax_hst",
"max interaction probability vs E | geom",n,emin,emax);
pmax_hst->SetDirectory(0);
// loop over energy bins
for(int ie = 1; ie <= pmax_hst->GetNbinsX(); ie++) {
double EvLow = pmax_hst->GetBinCenter(ie) - 0.5*pmax_hst->GetBinWidth(ie);
double EvHigh = pmax_hst->GetBinCenter(ie) + 0.5*pmax_hst->GetBinWidth(ie);
//double Ev = pmax_hst->GetBinCenter(ie);
// loop over targets in input geometry, form initial state and compute
// the sum of maximum interaction probabilities at the current energy bin
//
for(tgtiter = fTgtList.begin(); tgtiter != fTgtList.end(); ++tgtiter) {
int target_pdgc = *tgtiter;
InitialState init_state(target_pdgc, neutrino_pdgc);
LOG("GNUISANCEMCJDriver", pDEBUG)
<< "Computing Pmax for init-state: " << init_state.AsString() << " E from " << EvLow << "-" << EvHigh;
// get the appropriate driver
GEVGDriver * evgdriver = fGPool->FindDriver(init_state);
// get xsec sum over all modelled processes for given neutrino+target)
double sxsecLow = evgdriver->XSecSumSpline()->Evaluate(EvLow);
double sxsecHigh = evgdriver->XSecSumSpline()->Evaluate(EvHigh);
// get max{path-length x density}
double plmax = fMaxPathLengths.PathLength(target_pdgc);
// compute/store the max interaction probabiity (for given energy)
int A = pdg::IonPdgCodeToA(target_pdgc);
double pmaxLow = this->InteractionProbability(sxsecLow, plmax, A);
double pmaxHigh = this->InteractionProbability(sxsecHigh, plmax, A);
double pmax = pmaxHigh;
if ( pmaxLow > pmaxHigh){
pmax = pmaxLow;
LOG("GNUISANCEMCJDriver", pWARN)
<< "Lower energy neutrinos have a higher probability of interacting than those at higher energy."
<< " pmaxLow(E=" << EvLow << ")=" << pmaxLow << " and " << " pmaxHigh(E=" << EvHigh << ")=" << pmaxHigh;
}
pmax_hst->SetBinContent(ie, pmax_hst->GetBinContent(ie) + pmax);
LOG("GNUISANCEMCJDriver", pDEBUG)
<< "Pmax[" << init_state.AsString() << ", Ev from " << EvLow << "-" << EvHigh << "] = " << pmax;
} // targets
pmax_hst->SetBinContent(ie, 1.2 * pmax_hst->GetBinContent(ie));
LOG("GNUISANCEMCJDriver", pINFO)
<< "Pmax[nu=" << neutrino_pdgc << ", Ev from " << EvLow << "-" << EvHigh << "] = "
<< pmax_hst->GetBinContent(ie);
} // E
fPmax.insert(map<int,TH1D*>::value_type(neutrino_pdgc,pmax_hst));
} // nu
// Compute global probability scale
// Sum Probabilities {
// all neutrinos, all targets, @ max path length, @ max energy}
//
{
for(nuiter = fNuList.begin(); nuiter != fNuList.end(); ++nuiter) {
int neutrino_pdgc = *nuiter;
map<int,TH1D*>::const_iterator pmax_iter = fPmax.find(neutrino_pdgc);
assert(pmax_iter != fPmax.end());
TH1D * pmax_hst = pmax_iter->second;
assert(pmax_hst);
// double pmax = pmax_hst->GetBinContent(pmax_hst->FindBin(fEmax));
double pmax = pmax_hst->GetMaximum();
assert(pmax>0);
// fGlobPmax += pmax;
fGlobPmax = TMath::Max(pmax, fGlobPmax); // ?;
}
LOG("GNUISANCEMCJDriver", pNOTICE) << "*** Probability scale = " << fGlobPmax;
}
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::InitEventGeneration(void)
{
fCurPathLengths.clear();
fCurEvt = 0;
fSelTgtPdg = 0;
fCurVtx.SetXYZT(0.,0.,0.,0.);
}
//___________________________________________________________________________
EventRecord * GNUISANCEMCJDriver::GenerateEvent(void)
{
LOG("GNUISANCEMCJDriver", pNOTICE) << "Generating next event...";
this->InitEventGeneration();
while(1) {
bool flux_end = fFluxDriver->End();
if(flux_end) {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "No more neutrinos can be thrown by the flux driver";
return 0;
}
EventRecord * event = this->GenerateEvent1Try();
if(event) return event;
if(fKeepThrowingFluxNu) {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Flux neutrino didn't interact - Trying the next one...";
continue;
}
break;
} // (w(1)
LOG("GNUISANCEMCJDriver", pINFO) << "Returning NULL event!";
return 0;
}
//___________________________________________________________________________
EventRecord * GNUISANCEMCJDriver::GenerateEvent1Try(void)
{
// attempt generating a neutrino interaction by firing a single flux neutrino
//
RandomGen * rnd = RandomGen::Instance();
double Pno=0, Psum=0;
double R = rnd->RndEvg().Rndm();
LOG("GNUISANCEMCJDriver", pDEBUG) << "Rndm [0,1] = " << R;
// Generate a neutrino using the input GFluxI & get current pdgc/p4/x4
bool flux_ok = this->GenerateFluxNeutrino();
if(!flux_ok) {
LOG("GNUISANCEMCJDriver", pERROR)
<< "** Rejecting current flux neutrino (flux driver err)";
return 0;
}
// Compute the interaction probabilities assuming max. path lengths
// and decide whether the neutrino would interact --
// Many flux neutrinos should be rejected here, drastically reducing
// the number of neutrinos that I need to propagate through the
// actual detector geometry (this is skipped when using
// pre-calculated flux interaction probabilities)
if(fPreSelect) {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Computing interaction probabilities for max. path lengths";
Psum = this->ComputeInteractionProbabilities(true /* <- max PL*/);
Pno = 1-Psum;
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "The no-interaction probability (max. path lengths) is: "
<< 100*Pno << " %";
if(Pno<0.) {
LOG("GNUISANCEMCJDriver", pFATAL)
<< "Negative no-interaction probability! (P = " << 100*Pno << " %)"
<< " Particle E=" << fFluxDriver->Momentum().E() << " type=" << fFluxDriver->PdgCode() << "Psum=" << Psum;
gAbortingInErr=true;
exit(1);
}
if(R>=1-Pno) {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "** Rejecting current flux neutrino";
return 0;
}
} // preselect
bool pl_ok = false;
// If possible use pre-generated flux neutrino interaction probabilities
if(fFluxIntTree){
Psum = this->PreGenFluxInteractionProbability();
}
// Else compute them in the usual manner
else {
// Compute (pathLength x density x weight fraction) for all materials
// in the input geometry, for the neutrino generated by the flux driver
pl_ok = this->ComputePathLengths();
if(!pl_ok) {
LOG("GNUISANCEMCJDriver", pERROR)
<< "** Rejecting current flux neutrino (err computing path-lengths)";
return 0;
}
if(fCurPathLengths.AreAllZero()) {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "** Rejecting current flux neutrino (misses generation volume)";
return 0;
}
Psum = this->ComputeInteractionProbabilities(false /* <- actual PL */);
}
if(TMath::Abs(Psum) < controls::kASmallNum){
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "** Rejecting current flux neutrino (has null interaction probability)";
return 0;
}
// Now decide whether the current neutrino interacts
Pno = 1-Psum;
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "The actual 'no interaction' probability is: " << 100*Pno << " %";
if(Pno<0.) {
LOG("GNUISANCEMCJDriver", pFATAL)
<< "Negative no interactin probability! (P = " << 100*Pno << " %)";
// print info about what caused the problem
int nupdg = fFluxDriver -> PdgCode ();
const TLorentzVector & nup4 = fFluxDriver -> Momentum ();
const TLorentzVector & nux4 = fFluxDriver -> Position ();
LOG("GNUISANCEMCJDriver", pWARN)
<< "\n [-] Problematic neutrino: "
<< "\n |----o PDG-code : " << nupdg
<< "\n |----o 4-momentum : " << utils::print::P4AsString(&nup4)
<< "\n |----o 4-position : " << utils::print::X4AsString(&nux4)
<< "\n Emax : " << fEmax;
LOG("GNUISANCEMCJDriver", pWARN)
<< "\n Problematic path lengths:" << fCurPathLengths;
LOG("GNUISANCEMCJDriver", pWARN)
<< "\n Maximum path lengths:" << fMaxPathLengths;
exit(1);
}
if(R>=1-Pno) {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "** Rejecting current flux neutrino";
return 0;
}
//
// The flux neutrino interacts!
//
// Calculate path lengths for first time and check potential mismatch if
// used pre-generated flux interaction probabilities
if(fFluxIntTree){
pl_ok = this->ComputePathLengths();
if(!pl_ok) {
LOG("GNUISANCEMCJDriver", pFATAL) << "** Cannot calculate path lenths!";
exit(1);
}
double Psum_curr = this->ComputeInteractionProbabilities(false /* <- actual PL */);
bool mismatch = TMath::Abs(Psum-Psum_curr) > controls::kASmallNum;
if(mismatch){
LOG("GNUISANCEMCJDriver", pFATAL) <<
"** Mismatch between pre-calculated and current interaction "<<
"probabilities!";
exit(1);
}
}
// Select a target material
fSelTgtPdg = this->SelectTargetMaterial(R);
if(fSelTgtPdg==0) {
LOG("GNUISANCEMCJDriver", pERROR)
<< "** Rejecting current flux neutrino (failed to select tgt!)";
return 0;
}
// Ask the GEVGDriver object to select and generate an interaction and
// its kinematics for the selected initial state & neutrino 4-momentum
this->GenerateEventKinematics();
if(!fCurEvt) {
LOG("GNUISANCEMCJDriver", pWARN)
<< "** Couldn't generate kinematics for selected interaction";
return 0;
}
// Generate an 'interaction position' in the selected material (in the
// detector coord system), along the direction of nup4 & set it
this->GenerateVertexPosition();
// Set the event probability (probability for this event to happen given
// the detector setup & the selected flux neutrino)
// Note for users:
// The above probability is stored at GHepRecord::Probability()
// For normalization purposes make sure that you take into account the
// GHepRecord::Weight() -if event generation is weighted-, and
// GFluxI::Weight() -if beam simulation is weighted-.
this->ComputeEventProbability();
return fCurEvt;
}
//___________________________________________________________________________
bool GNUISANCEMCJDriver::GenerateFluxNeutrino(void)
{
// Ask the neutrino flux driver to generate a flux neutrino and make sure
// that things look ok...
//
LOG("GNUISANCEMCJDriver", pNOTICE) << "Generating a flux neutrino";
bool ok = fFluxDriver->GenerateNext();
if(!ok) {
LOG("GNUISANCEMCJDriver", pERROR)
<< "*** The flux driver couldn't generate a flux neutrino!!";
return false;
}
fNFluxNeutrinos++;
int nupdg = fFluxDriver -> PdgCode ();
const TLorentzVector & nup4 = fFluxDriver -> Momentum ();
const TLorentzVector & nux4 = fFluxDriver -> Position ();
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "\n [-] Generated flux neutrino: "
<< "\n |----o PDG-code : " << nupdg
<< "\n |----o 4-momentum : " << utils::print::P4AsString(&nup4)
<< "\n |----o 4-position : " << utils::print::X4AsString(&nux4);
if(nup4.Energy() > fEmax) {
LOG("GNUISANCEMCJDriver", pFATAL)
<< "\n *** Flux driver error ***"
<< "\n Generated flux v with E = " << nup4.Energy() << " GeV"
<< "\n Max v energy (declared by flux driver) = " << fEmax << " GeV"
<< "\n My interaction probability scaling is invalidated!!";
return false;
}
if(!fNuList.ExistsInPDGCodeList(nupdg)) {
LOG("GNUISANCEMCJDriver", pFATAL)
<< "\n *** Flux driver error ***"
<< "\n Generated flux v with pdg = " << nupdg
<< "\n It does not belong to the declared list of flux neutrinos"
<< "\n I was not configured to handle this!!";
return false;
}
return true;
}
//___________________________________________________________________________
bool GNUISANCEMCJDriver::ComputePathLengths(void)
{
// Ask the geometry driver to compute (pathLength x density x weight frac.)
// for all detector materials for the neutrino generated by the flux driver
// and make sure that things look ok...
fCurPathLengths.clear();
const TLorentzVector & nup4 = fFluxDriver -> Momentum ();
const TLorentzVector & nux4 = fFluxDriver -> Position ();
fCurPathLengths = fGeomAnalyzer->ComputePathLengths(nux4, nup4);
LOG("GNUISANCEMCJDriver", pNOTICE) << fCurPathLengths;
if(fCurPathLengths.size() == 0) {
LOG("GNUISANCEMCJDriver", pFATAL)
<< "\n *** Geometry driver error ***"
<< "\n Got an empty PathLengthList - No material found in geometry?";
return false;
}
if(fCurPathLengths.AreAllZero()) {
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "current flux v doesn't cross any geometry material...";
}
return true;
}
//___________________________________________________________________________
double GNUISANCEMCJDriver::ComputeInteractionProbabilities(bool use_max_path_length)
{
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Computing relative interaction probabilities for each material";
// current flux neutrino code & 4-p
int nupdg = fFluxDriver->PdgCode();
const TLorentzVector & nup4 = fFluxDriver->Momentum();
fCurCumulProbMap.clear();
const PathLengthList & path_length_list =
(use_max_path_length) ? fMaxPathLengths : fCurPathLengths;
double probsum=0;
PathLengthList::const_iterator pliter;
for(pliter = path_length_list.begin();
pliter != path_length_list.end(); ++pliter) {
int mpdg = pliter->first; // material PDG code
double pl = pliter->second; // density x path-length
int A = pdg::IonPdgCodeToA(mpdg);
double xsec = 0.; // sum of xsecs for all modelled processes for given init state
double prob = 0.; // interaction probability
double probn = 0.; // normalized interaction probability
// find the GEVGDriver object that is handling the current init state
InitialState init_state(mpdg, nupdg);
GEVGDriver * evgdriver = fGPool->FindDriver(init_state);
if(!evgdriver) {
LOG("GNUISANCEMCJDriver", pFATAL)
<< "\n * The MC Job driver isn't properly configured!"
<< "\n * No event generation driver could be found for init state: "
<< init_state.AsString();
exit(1);
}
// compute the interaction xsec and probability (if path-length>0)
if(pl>0.) {
const Spline * totxsecspl = evgdriver->XSecSumSpline();
if(!totxsecspl) {
LOG("GNUISANCEMCJDriver", pFATAL)
<< "\n * The MC Job driver isn't properly configured!"
<< "\n * Couldn't retrieve total cross section spline for init state: "
<< init_state.AsString();
exit(1);
} else {
xsec = totxsecspl->Evaluate( nup4.Energy() );
}
prob = this->InteractionProbability(xsec,pl,A);
LOG("GNUISANCEMCJDriver", pDEBUG)
<< " (xsec, pl, A)=(" << xsec << "," << pl << "," << A << ")";
// scale the interaction probability to the maximum one so as not
// to have to throw few billions of flux neutrinos before getting
// an interaction...
double pmax = 0;
if(fGenerateUnweighted) pmax = fGlobPmax;
else {
map<int,TH1D*>::const_iterator pmax_iter = fPmax.find(nupdg);
assert(pmax_iter != fPmax.end());
TH1D * pmax_hst = pmax_iter->second;
assert(pmax_hst);
int ie = pmax_hst->FindBin(nup4.Energy());
pmax = pmax_hst->GetBinContent(ie);
}
assert(pmax>0);
LOG("GNUISANCEMCJDriver", pDEBUG)
<< "Pmax=" << pmax;
probn = prob/pmax;
}
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "tgt: " << mpdg << " -> TotXSec = "
<< xsec/units::cm2 << " cm^2, Norm.Prob = " << 100*probn << "%";
#endif
probsum += probn;
fCurCumulProbMap.insert(map<int,double>::value_type(mpdg,probsum));
}
return probsum;
}
//___________________________________________________________________________
int GNUISANCEMCJDriver::SelectTargetMaterial(double R)
{
// Pick a target material using the pre-computed interaction probabilities
// for a flux neutrino that has already been determined that interacts
LOG("GNUISANCEMCJDriver", pNOTICE) << "Selecting target material";
int tgtpdg = 0;
map<int,double>::const_iterator probiter = fCurCumulProbMap.begin();
for( ; probiter != fCurCumulProbMap.end(); ++probiter) {
double prob = probiter->second;
if(R<prob) {
tgtpdg = probiter->first;
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Selected target material = " << tgtpdg;
return tgtpdg;
}
}
LOG("GNUISANCEMCJDriver", pERROR)
<< "Could not select target material for an interacting neutrino";
return 0;
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::GenerateEventKinematics(void)
{
int nupdg = fFluxDriver->PdgCode();
const TLorentzVector & nup4 = fFluxDriver->Momentum();
// Find the GEVGDriver object that generates interactions for the
// given initial state (neutrino + target)
InitialState init_state(fSelTgtPdg, nupdg);
GEVGDriver * evgdriver = fGPool->FindDriver(init_state);
if(!evgdriver) {
LOG("GNUISANCEMCJDriver", pFATAL)
<< "No GEVGDriver object for init state: " << init_state.AsString();
exit(1);
}
// propagate current unphysical event mask
evgdriver->SetUnphysEventMask(*fUnphysEventMask);
// Ask the GEVGDriver object to select and generate an interaction for
// the selected initial state & neutrino 4-momentum
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Asking the selected GEVGDriver object to generate an event";
fCurEvt = evgdriver->GenerateEvent(nup4);
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::GenerateVertexPosition(void)
{
// Generate an 'interaction position' in the selected material, along
// the direction of nup4
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "Asking the geometry analyzer to generate a vertex";
const TLorentzVector & p4 = fFluxDriver->Momentum ();
const TLorentzVector & x4 = fFluxDriver->Position ();
const TVector3 & vtx = fGeomAnalyzer->GenerateVertex(x4, p4, fSelTgtPdg);
TVector3 origin(x4.X(), x4.Y(), x4.Z());
origin-=vtx; // computes vector dr = origin - vtx
double dL = origin.Mag();
double c = kLightSpeed /(units::meter/units::second);
double dt = dL/c;
LOG("GNUISANCEMCJDriver", pNOTICE)
<< "|vtx - origin|: dL = " << dL << " m, dt = " << dt << " sec";
fCurVtx.SetXYZT(vtx.x(), vtx.y(), vtx.z(), x4.T() + dt);
fCurEvt->SetVertex(fCurVtx);
}
//___________________________________________________________________________
void GNUISANCEMCJDriver::ComputeEventProbability(void)
{
// Compute event probability for the given flux neutrino & detector geometry
// get interaction cross section
double xsec = fCurEvt->XSec();
// get path length in detector along v direction for specified target material
PathLengthList::const_iterator pliter = fCurPathLengths.find(fSelTgtPdg);
double path_length = pliter->second;
// get target material mass number
int A = pdg::IonPdgCodeToA(fSelTgtPdg);
// calculate interaction probability
double P = this->InteractionProbability(xsec, path_length, A);
//
// get weight for selected event
//
GHepParticle * nu = fCurEvt->Probe();
int nu_pdg = nu->Pdg();
double Ev = nu->P4()->Energy();
double weight = 1.0;
if(!fGenerateUnweighted) {
map<int,TH1D*>::const_iterator pmax_iter = fPmax.find(nu_pdg);
assert(pmax_iter != fPmax.end());
TH1D * pmax_hst = pmax_iter->second;
assert(pmax_hst);
double pmax = pmax_hst->GetBinContent(pmax_hst->FindBin(Ev));
assert(pmax>0);
weight = pmax/fGlobPmax;
}
// set probability & update weight
fCurEvt->SetProbability(P);
fCurEvt->SetWeight(weight * fCurEvt->Weight());
}
//___________________________________________________________________________
double GNUISANCEMCJDriver::InteractionProbability(double xsec, double pL, int A)
{
// P = Na (Avogadro number, atoms/mole) *
// 1/A (1/mass number, mole/gr) *
// xsec (total interaction cross section, cm^2) *
// pL (density-weighted path-length, gr/cm^2)
//
xsec = xsec / units::cm2;
pL = pL * ((units::kilogram/units::m2)/(units::gram/units::cm2));
return kNA*(xsec*pL)/A;
}
//___________________________________________________________________________
double GNUISANCEMCJDriver::PreGenFluxInteractionProbability()
{
// Return the pre-computed interaction probability for the current flux
// neutrino index (entry number in flux file). Exit if not possible as
// using meaningless interaction probability leads to incorrect physics
//
if(!fFluxIntTree){
LOG("GNUISANCEMCJDriver", pERROR) <<
"Cannot get pre-computed flux interaction probability as no tree!";
exit(1);
}
assert(fFluxDriver->Index() >= 0); // Check trying to find meaningfull index
// Check if can find relevant entry and no mismatch in energies -->
// using correct pre-gen interaction prob file
bool found_entry = fFluxIntTree->GetEntryWithIndex(fFluxDriver->Index()) > 0;
bool enu_match = false;
if(found_entry){
double rel_err = fBrFluxEnu-fFluxDriver->Momentum().E();
if(fBrFluxEnu > controls::kASmallNum) rel_err /= fBrFluxEnu;
enu_match = TMath::Abs(rel_err)<controls::kASmallNum;
if(enu_match == false){
LOG("GNUISANCEMCJDriver", pERROR) <<
"Mismatch between: Enu_curr = "<< fFluxDriver->Momentum().E() <<
", Enu_pre_gen = "<< fBrFluxEnu;
}
}
else {
LOG("GNUISANCEMCJDriver", pERROR) << "Cannot find flux entry in interaction prob tree!";
}
// Exit if not successful
bool success = found_entry && enu_match;
if(!success){
LOG("GNUISANCEMCJDriver", pFATAL) <<
"Cannot find pre-generated interaction probability! Check you "<<
"are using the correct pre-generated interaction prob file " <<
"generated using current flux input file with same input " <<
"config (same geom TopVol, neutrino species list)";
exit(1);
}
assert(fGlobPmax+controls::kASmallNum>0.0);
return fBrFluxIntProb/fGlobPmax;
}
//___________________________________________________________________________
#endif
diff --git a/src/FitBase/GNUISANCEMCJDriver.h b/src/FitBase/GNUISANCEMCJDriver.h
index 600bbc5..3d7e4f9 100644
--- a/src/FitBase/GNUISANCEMCJDriver.h
+++ b/src/FitBase/GNUISANCEMCJDriver.h
@@ -1,145 +1,145 @@
//____________________________________________________________________________
/*!
\class genie::GMCJDriver
\brief A GENIE `MC Job Driver'. Can be used for setting up complicated event
generation cases involving detailed flux descriptions and detector
geometry descriptions.
\author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
University of Liverpool & STFC Rutherford Appleton Lab
\created May 25, 2005
\cpright Copyright (c) 2003-2016, GENIE Neutrino MC Generator Collaboration
For the full text of the license visit http://copyright.genie-mc.org
or see $GENIE/LICENSE
*/
//____________________________________________________________________________
#ifndef _GENIE_NUISANCE_MC_JOB_DRIVER_H_
#define _GENIE_NUISANCE_MC_JOB_DRIVER_H_
-#ifdef __GENIE_ENABLED__
+#ifdef __GEVGEN_ENABLED__
#include <string>
#include <map>
#include <TH1D.h>
#include <TLorentzVector.h>
#include <TFile.h>
#include <TTree.h>
#include <TBits.h>
#include "EVGDrivers/PathLengthList.h"
#include "PDG/PDGCodeList.h"
#include "EVGDrivers/GEVGPool.h"
using std::string;
using std::map;
namespace genie {
class EventRecord;
class GFluxI;
class GeomAnalyzerI;
class GENIE;
//class GEVGPool;
class GNUISANCEMCJDriver {
public :
GNUISANCEMCJDriver();
~GNUISANCEMCJDriver();
// configure MC job
void SetEventGeneratorList (string listname);
void SetUnphysEventMask (const TBits & mask);
void UseFluxDriver (GFluxI * flux);
void UseGeomAnalyzer (GeomAnalyzerI * geom);
void UseSplines (bool useLogE = true);
bool UseMaxPathLengths (string xml_filename);
void KeepOnThrowingFluxNeutrinos (bool keep_on);
void ForceSingleProbScale (void);
void PreSelectEvents (bool preselect = true);
bool PreCalcFluxProbabilities (void);
bool LoadFluxProbabilities (string filename);
void SaveFluxProbabilities (string outfilename);
void Configure (bool calc_prob_scales = true);
GEVGPool* GetConfigPool(void){return this->fGPool;};
// generate single neutrino event for input flux & geometry
EventRecord * GenerateEvent (void);
// info needed for computing the generated sample normalization
double GlobProbScale (void) const { return fGlobPmax; }
long int NFluxNeutrinos (void) const { return (long int) fNFluxNeutrinos; }
map<int, double> SumFluxIntProbs(void) const { return fSumFluxIntProbs; }
// input flux and geometry drivers
const GFluxI & FluxDriver (void) const { return *fFluxDriver; }
const GeomAnalyzerI & GeomAnalyzer (void) const { return *fGeomAnalyzer; }
GFluxI * FluxDriverPtr (void) const { return fFluxDriver; }
GeomAnalyzerI * GeomAnalyzerPtr (void) const { return fGeomAnalyzer; }
// private methods:
void InitJob (void);
void InitEventGeneration (void);
void GetParticleLists (void);
void GetMaxPathLengthList (void);
void GetMaxFluxEnergy (void);
void PopulateEventGenDriverPool (void);
void BootstrapXSecSplines (void);
void BootstrapXSecSplineSummation (void);
void ComputeProbScales (void);
EventRecord * GenerateEvent1Try (void);
bool GenerateFluxNeutrino (void);
bool ComputePathLengths (void);
double ComputeInteractionProbabilities (bool use_max_path_length);
int SelectTargetMaterial (double R);
void GenerateEventKinematics (void);
void GenerateVertexPosition (void);
void ComputeEventProbability (void);
double InteractionProbability (double xsec, double pl, int A);
double PreGenFluxInteractionProbability(void);
// private data members:
GEVGPool * fGPool; ///< A pool of GEVGDrivers properly configured event generation drivers / one per init state
GFluxI * fFluxDriver; ///< [input] neutrino flux driver
GeomAnalyzerI * fGeomAnalyzer; ///< [input] detector geometry analyzer
double fEmax; ///< [declared by the flux driver] maximum neutrino energy
PDGCodeList fNuList; ///< [declared by the flux driver] list of neutrino codes
PDGCodeList fTgtList; ///< [declared by the geom driver] list of target codes
PathLengthList fMaxPathLengths; ///< [declared by the geom driver] maximum path length list
PathLengthList fCurPathLengths; ///< [current] path length list for current flux neutrino
TLorentzVector fCurVtx; ///< [current] interaction vertex
EventRecord * fCurEvt; ///< [current] generated event
int fSelTgtPdg; ///< [current] selected target material PDG code
map<int,double> fCurCumulProbMap; ///< [current] cummulative interaction probabilities
double fNFluxNeutrinos; ///< [current] number of flux nuetrinos fired by the flux driver so far
map<int,TH1D*> fPmax; ///< [computed at init] interaction probability scale /neutrino /energy for given geometry
double fGlobPmax; ///< [computed at init] global interaction probability scale for given flux & geometry
string fEventGenList; ///< [config] list of event generators loaded by this driver (what used to be the $GEVGL setting)
TBits * fUnphysEventMask; ///< [config] controls whether unphysical events are returned (what used to be the $GUNPHYSMASK setting)
string fMaxPlXmlFilename; ///< [config] input file with max density-weighted path lengths for all materials
bool fUseExtMaxPl; ///< [config] using external max path length estimate?
bool fUseSplines; ///< [config] compute all needed & not-loaded splines at init
bool fUseLogE; ///< [config] build splines = f(logE) (rather than f(E)) ?
bool fKeepThrowingFluxNu; ///< [config] keep firing flux neutrinos till one of them interacts
bool fGenerateUnweighted; ///< [config] force single probability scale?
bool fPreSelect; ///< [config] set whether to pre-select events using max interaction paths
TFile* fFluxIntProbFile; ///< [input] pre-generated flux interaction probability file
TTree* fFluxIntTree; ///< [computed-or-loaded] pre-computed flux interaction probabilities (expected tree name is "gFlxIntProbs")
double fBrFluxIntProb; ///< flux interaction probability (set to branch:"FluxIntProb")
int fBrFluxIndex; ///< corresponding entry in flux input tree (set to address of branch:"FluxEntry")
double fBrFluxEnu; ///< corresponding flux P4 (set to address of branch:"FluxP4")
double fBrFluxWeight; ///< corresponding flux weight (set to address of branch: "FluxWeight")
int fBrFluxPDG; ///< corresponding flux pdg code (set to address of branch: "FluxPDG")
string fFluxIntFileName; ///< whether to save pre-generated flux tree for use in later jobs
string fFluxIntTreeName; ///< name for tree holding flux probabilities
map<int, double> fSumFluxIntProbs; ///< map where the key is flux pdg code and the value is sum of fBrFluxWeight * fBrFluxIntProb for all these flux neutrinos
};
} // genie namespace
#endif // _GENIE_MC_JOB_DRIVER_H_
#endif
diff --git a/src/FitBase/HepMCTextInputHandler.cxx b/src/FitBase/HepMCTextInputHandler.cxx
new file mode 100644
index 0000000..d7c82b1
--- /dev/null
+++ b/src/FitBase/HepMCTextInputHandler.cxx
@@ -0,0 +1,171 @@
+#ifdef __HEPMC_ENABLED__
+#include "HepMCTextInputHandler.h"
+
+HepMCTextInputHandler::~HepMCTextInputHandler(){
+
+};
+
+
+HepMCTextInputHandler::HepMCTextInputHandler(std::string const& handle, std::string const& rawinputs) {
+
+ LOG(SAM) << "Creating HepMCTextInputHandler : " << handle << std::endl;
+
+ // Run a joint input handling
+ fName = handle;
+ jointinput = false;
+ jointindexswitch = 0;
+
+ // Get initial flags
+ fMaxEvents = FitPar::Config().GetParI("MAXEVENTS");
+
+ // Form list of all inputs, remove brackets if required.
+ std::vector<std::string> inputs = GeneralUtils::ParseToStr(rawinputs, ",");
+ if (inputs.front()[0] == '(') {
+ inputs.front() = inputs.front().substr(1);
+ }
+ if (inputs.back()[inputs.back().size() - 1] == ')') {
+ inputs.back() = inputs.back().substr(0, inputs.back().size() - 1);
+ }
+ for (size_t inp_it = 0; inp_it < inputs.size(); ++inp_it) {
+ if (LOG_LEVEL(SAM)) {
+ std::cout << "\t\t|-> Input File " << inp_it
+ << " : " << inputs[inp_it] << std::endl;
+ }
+ }
+
+ fEventType = kHEPMC;
+
+ fASCIIStream = std::ifstream(inputs[0].c_str());
+ fHepMCEvent = HepMC::GenEvent();
+
+ // Loop through events and get N
+ fNEvents = 0;
+ while (fASCIIStream){
+ fHepMCEvent.read(fASCIIStream);
+ fNEvents++;
+ }
+ fASCIIStream.seekg(0);
+
+ fEventHist = new TH1D("eventhist","eventhist",10,0.0,1.0);
+ fFluxHist = new TH1D("eventhist","eventhist",10,0.0,1.0);
+
+ fNUISANCEEvent = new FitEvent(kHEPMC);
+ fNUISANCEEvent->HardReset();
+ fBaseEvent = static_cast<BaseFitEvt*>(fNUISANCEEvent);
+
+};
+
+
+FitEvent* HepMCTextInputHandler::GetNuisanceEvent(const UInt_t entry) {
+
+ // Catch too large entries
+ if (entry >= (UInt_t)fNEvents){
+ fASCIIStream.seekg(0);
+ return NULL;
+ }
+
+ // If no event get the first one
+ if (!fHepMCEvent.is_valid()){
+ fHepMCEvent.read(fASCIIStream);
+ }
+
+ // Read Entry from TTree to fill NEUT Vect in BaseFitEvt;
+ if (fHepMCEvent.event_number() != entry){
+
+ // If have to read backwords skip to start of ifstream
+ if (fHepMCEvent.event_number() > entry){
+ fASCIIStream.seekg(0);
+ fHepMCEvent.read(fASCIIStream);
+ }
+
+ // Loop to event before if reading forwards
+ while (fHepMCEvent.event_number() < entry - 1 and fASCIIStream){
+ fHepMCEvent.read(fASCIIStream);
+ }
+
+ fHepMCEvent.read(fASCIIStream);
+ }
+
+ // Setup Input scaling for joint inputs
+ if (jointinput) {
+ fNUISANCEEvent->InputWeight = GetInputWeight(entry);
+ } else {
+ fNUISANCEEvent->InputWeight = 1.0;
+ }
+
+ // Run NUISANCE Vector Filler
+ CalcNUISANCEKinematics();
+
+ // Return event pointer
+ return fNUISANCEEvent;
+}
+
+int HepMCTextInputHandler::ConvertHepMCStatus() {
+
+ // Status for HepMC convertor
+ return 0;
+}
+
+void HepMCTextInputHandler::CalcNUISANCEKinematics() {
+
+ // Reset all variables
+ fNUISANCEEvent->ResetEvent();
+
+ // Read all particles from fHepMCEvent
+ std::vector<HepMC::GenParticle*> allstateparticles;
+ for ( HepMC::GenEvent::particle_iterator p = fHepMCEvent.particles_begin();
+ p != fHepMCEvent.particles_end(); ++p ){
+ allstateparticles.push_back(*p);
+
+ int pdg = (*p)->pdg_id();
+ int status = (*p)->status();
+ // FourVector vect = (*p)->momentum();
+
+ int state = ConvertHepMCStatus(status);
+
+ int curpart = fNUISANCEEvent->fNParticles;
+ fNUISANCEEvent->fParticleState[curpart] = state;
+
+ // Mom
+ // fNUISANCEEvent->fParticleMom[curpart][0] = vect.px();
+ // fNUISANCEEvent->fParticleMom[curpart][1] = vect.py();
+ // fNUISANCEEvent->fParticleMom[curpart][2] = vect.pz();
+ // fNUISANCEEvent->fParticleMom[curpart][3] = vect.e();
+
+ // PDG
+ fNUISANCEEvent->fParticlePDG[curpart] = pdg;
+
+ // Add up particle count
+ fNUISANCEEvent->fNParticles++;
+
+ }
+
+ // Run Initial, FSI, Final, Other ordering.
+ fNUISANCEEvent-> OrderStack();
+ return;
+}
+
+
+double HepMCTextInputHandler::GetInputWeight(const UInt_t entry) {
+
+ // Find Switch Scale
+ while ( entry < (UInt_t)jointindexlow[jointindexswitch] ||
+ entry >= (UInt_t)jointindexhigh[jointindexswitch] ) {
+ jointindexswitch++;
+
+ // Loop Around
+ if (jointindexswitch == jointindexlow.size()) {
+ jointindexswitch = 0;
+ }
+ }
+ return jointindexscale[jointindexswitch];
+};
+
+
+BaseFitEvt* HepMCTextInputHandler::GetBaseEvent(const UInt_t entry) {
+
+ // Read entry from TTree to fill NEUT Vect in BaseFitEvt;
+ if (entry >= (UInt_t)fNEvents) return NULL;
+ return (BaseFitEvent*)GetNuisanceEvent(entry);
+}
+#endif
diff --git a/src/FitBase/HepMCTextInputHandler.h b/src/FitBase/HepMCTextInputHandler.h
new file mode 100644
index 0000000..995a297
--- /dev/null
+++ b/src/FitBase/HepMCTextInputHandler.h
@@ -0,0 +1,40 @@
+#ifndef HEPMCINPUTHANDLER_H
+#define HEPMCINPUTHANDLER_H
+
+#ifdef __HEPMC_ENABLED__
+#include "SimpleVector.h"
+#include "Flow.h"
+#include "GenParticle.h"
+#include "GenEvent.h"
+#include "InputHandler2.h"
+#include "TargetUtils.h"
+#include "PlotUtils.h"
+
+/// NEUT Input Convertor to read in NeutVects and convert to FitEvents
+class HepMCTextInputHandler : public InputHandlerBase {
+public:
+
+ /// Main constructor. Can read in single or joint inputs.
+ HepMCTextInputHandler(std::string const& handle, std::string const& rawinputs);
+ ~HepMCTextInputHandler();
+
+ /// Returns NUISANCE Format event from entry in fNEUTTree
+ FitEvent* GetNuisanceEvent(const UInt_t entry);
+
+ /// Returns BaseEvent (just NeutVect pointer) from entry in fNEUTTree
+ BaseFitEvt* GetBaseEvent(const UInt_t entry);
+
+ /// eads fNeutVect and fills into fNUISANCEEvent.
+ void CalcNUISANCEKinematics();
+
+ /// Convert status codes to our format
+ int ConvertHepMCStatus();
+
+ /// Calculates weight if using joint inputs
+ double GetInputWeight(const UInt_t entry);
+
+ HepMC::GenEvent fHepMCEvent;
+ std::ifstream fASCIIStream;
+};
+#endif
+#endif
diff --git a/src/FitBase/InputTypes.h b/src/FitBase/InputTypes.h
index bee9bab..130cf86 100644
--- a/src/FitBase/InputTypes.h
+++ b/src/FitBase/InputTypes.h
@@ -1,64 +1,68 @@
//! Global Enum to define generator type being read with FitEvent
// Have to define kNORM as if its a generator for the time being.
enum generator_event_type {
kUNKNOWN = 999,
kNEUT = 0,
kNIWG = 1,
kNUWRO = 2,
kT2K = 3,
kCUSTOM = 4,
kGENIE = 5,
kEVTSPLINE = 6,
kNUANCE = 7,
kGiBUU = 8,
kNORM = 9,
kMODENORM = 10,
kEMPTY = 11,
kINPUTFITEVENT = 12,
kNEWSPLINE = 13,
kLIKEWEIGHT = 14,
kSPLINEPARAMETER = 15,
+ kHEPMC = 16,
};
inline std::ostream& operator<<(std::ostream& os,
generator_event_type const& gs) {
switch (gs) {
case kUNKNOWN: {
return os << "kUNKNOWN";
}
case kNEUT: {
return os << "kNEUT";
}
case kNIWG: {
return os << "kNIWG";
}
case kNUWRO: {
return os << "kNUWRO";
}
case kT2K: {
return os << "kT2K";
}
case kCUSTOM: {
return os << "kCUSTOM";
}
case kGENIE: {
return os << "kGENIE";
}
case kEVTSPLINE: {
return os << "kEVTSPLINE";
}
case kNUANCE: {
return os << "kNUANCE";
}
case kGiBUU: {
return os << "kGiBUU";
}
case kNORM: {
return os << "kNORM";
}
case kMODENORM: {
return os << "kMODENORM";
}
+ case kHEPMC: {
+ return os << "kHEPMC";
+ }
default: { return os << "kUNKNOWN"; }
}
-}
\ No newline at end of file
+}
diff --git a/src/FitBase/InputUtils.cxx b/src/FitBase/InputUtils.cxx
index f09c64f..ccbe8fc 100644
--- a/src/FitBase/InputUtils.cxx
+++ b/src/FitBase/InputUtils.cxx
@@ -1,211 +1,214 @@
// 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 <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "FitParameters.h"
#include "GeneralUtils.h"
#include "GeneratorUtils.h"
#include "InputUtils.h"
#include "InputHandler2.h"
namespace InputUtils {
//********************************************************************
InputType ParseInputType(std::string const &inp) {
//********************************************************************
// The hard-coded list of supported input generators
const static std::string filetypes[] = {"NEUT", "NUWRO", "GENIE",
"GiBUU", "NUANCE", "EVSPLN",
"EMPTY", "FEVENT", "JOINT"
};
size_t nInputTypes = GeneralUtils::GetArraySize(filetypes);
for (size_t i = 0; i < nInputTypes; i++) {
if (inp == filetypes[i]) {
+ std::cout << "INPUT TYPE = " << inp << " " << i << std::endl;
return InputType(i);
}
}
return kInvalid_Input;
}
//********************************************************************
bool IsJointInput(std::string const &inputs) {
//********************************************************************
bool isJoint = (inputs[0] == '(');
if (isJoint && (inputs[inputs.length() - 1] != ')')) {
ERR(FTL) << "Inputs specifier: \"" << inputs
<< "\" looks like a composite input specifier -- "
"(filea.root,fileb.root), however, it did not end in a \')\', "
"it ended in a \'"
<< inputs[inputs.length() - 1] << "\'" << std::endl;
throw;
}
return isJoint;
}
//********************************************************************
std::string ExpandInputDirectories(std::string const &inputs) {
//********************************************************************
// Parse the "environement" flags in the fitter config
// Can specify NEUT_DIR = "" and others in parameters/fitter.config.dat
const static std::string filedir[] = {"NEUT_DIR", "NUWRO_DIR",
"GENIE_DIR", "NUANCE_DIR",
"EVSPLN_DIR", "GIBUU_DIR"
};
size_t nfiledir = GeneralUtils::GetArraySize(filedir);
std::string expandedInputs = inputs;
for (size_t i = 0; i < nfiledir; i++) {
std::string tempdir = "@" + filedir[i];
size_t torpl = expandedInputs.find(tempdir);
if (torpl != std::string::npos) {
std::string event_folder = FitPar::Config().GetParS(filedir[i]);
expandedInputs.replace(torpl, tempdir.size(), event_folder);
break;
}
}
return expandedInputs;
}
InputType GuessInputTypeFromFile(TFile *inpF) {
if (!inpF) {
return kInvalid_Input;
}
TTree *NEUT_Input =
dynamic_cast<TTree *>(inpF->Get(GeneratorUtils::NEUT_TreeName.c_str()));
if (NEUT_Input) {
return kNEUT_Input;
}
TTree *NUWRO_Input =
dynamic_cast<TTree *>(inpF->Get(GeneratorUtils::NuWro_TreeName.c_str()));
if (NUWRO_Input) {
return kNUWRO_Input;
}
TTree *GENIE_Input =
dynamic_cast<TTree *>(inpF->Get(GeneratorUtils::GENIE_TreeName.c_str()));
if (GENIE_Input) {
return kGENIE_Input;
}
TTree *GiBUU_Input =
dynamic_cast<TTree *>(inpF->Get(GeneratorUtils::GiBUU_TreeName.c_str()));
if (GiBUU_Input) {
return kGiBUU_Input;
}
return kInvalid_Input;
}
std::string PrependGuessedInputTypeToName(std::string const &inpFName) {
TFile *inpF = TFile::Open(inpFName.c_str(), "READ");
if (!inpF || !inpF->IsOpen()) {
ERR(FTL) << "Couldn't open \"" << inpFName << "\" for reading."
<< std::endl;
throw;
}
InputType iType = GuessInputTypeFromFile(inpF);
if (iType == kInvalid_Input) {
ERR(FTL) << "Couldn't determine input type from file: " << inpFName
<< "." << std::endl;
throw;
}
inpF->Close();
delete inpF;
switch (iType) {
case kNEUT_Input: {
return "NEUT:" + inpFName;
}
case kNUWRO_Input: {
return "NUWRO:" + inpFName;
}
case kGENIE_Input: {
return "GENIE:" + inpFName;
}
case kGiBUU_Input: {
return "GiBUU:" + inpFName;
}
default: {
ERR(FTL) << "Input type from file: " << inpFName << " was invalid."
<< std::endl;
throw;
}
}
}
InputHandlerBase* CreateInputHandler(std::string const& handle,
InputUtils::InputType inpType,
std::string const& inputs) {
InputHandlerBase* input = NULL;
+ std::string newinputs = ExpandInputDirectories(inputs);
+
switch (inpType) {
case (kNEUT_Input):
#ifdef __NEUT_ENABLED__
- input = new NEUTInputHandler(handle, inputs);
+ input = new NEUTInputHandler(handle, newinputs);
break;
#endif
case (kGENIE_Input):
#ifdef __GENIE_ENABLED__
- input = new GENIEInputHandler(handle, inputs);
- break;
+ input = new GENIEInputHandler(handle, newinputs);
#endif
+ break;
case (kNUWRO_Input):
#ifdef __NUWRO_ENABLED__
- input = new NuWroInputHandler(handle, inputs);
- break;
+ input = new NuWroInputHandler(handle, newinputs);
#endif
+ break;
case (kGiBUU_Input):
-#ifdef __GIBUU_ENABLED__
- input = new GIBUUInputHandler(handle, inputs);
- break;
+#ifdef __GiBUU_ENABLED__
+ input = new GIBUUInputHandler(handle, newinputs);
#endif
+ break;
case (kFEVENT_Input):
- input = new FitEventInputHandler(handle, inputs);
+ input = new FitEventInputHandler(handle, newinputs);
break;
case (kEVSPLN_Input):
- input = new SplineInputHandler(handle, inputs);
+ input = new SplineInputHandler(handle, newinputs);
break;
default:
break;
}
/// Input failed
if (!input) {
ERR(FTL) << "Input handler creation failed!" << std::endl;
}
return input;
};
}
diff --git a/src/FitBase/InputUtils.h b/src/FitBase/InputUtils.h
index 25eb6d5..fa3edb6 100644
--- a/src/FitBase/InputUtils.h
+++ b/src/FitBase/InputUtils.h
@@ -1,102 +1,102 @@
// 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 <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef INPUT_UTILS_H
#define INPUT_UTILS_H
#include <string>
#include "TFile.h"
#include "InputHandler2.h"
#include "NEUTInputHandler.h"
#include "GENIEInputHandler.h"
#include "NuWroInputHandler.h"
#include "GIBUUInputHandler.h"
#include "NUANCEInputHandler.h"
#include "FitEventInputHandler.h"
#include "SplineInputHandler.h"
namespace InputUtils {
enum InputType {
kNEUT_Input = 0,
- kNUWRO_Input,
- kGENIE_Input,
+ kNUWRO_Input = 1,
+ kGENIE_Input = 2,
kGiBUU_Input,
kNUANCE_Input,
kEVSPLN_Input,
kEMPTY_Input,
kFEVENT_Input,
kJOINT_Input, // Kept for backwards compatibility
kInvalid_Input,
kHIST_Input, // Not sure if this are currently used.
kBNSPLN_Input // Not sure if this are currently used.
};
InputType ParseInputType(std::string const &inp);
bool IsJointInput(std::string const &inputs);
std::string ExpandInputDirectories(std::string const &inputs);
InputType GuessInputTypeFromFile(TFile *inpF);
std::string PrependGuessedInputTypeToName(std::string const &inpFName);
InputHandlerBase* CreateInputHandler(std::string const& handle,
InputUtils::InputType inpType,
std::string const& inputs);
}
inline std::ostream &operator<<(std::ostream &os, InputUtils::InputType it) {
switch (it) {
case InputUtils::kNEUT_Input: {
return os << "kNEUT_Input";
}
case InputUtils::kNUWRO_Input: {
return os << "kNUWRO_Input";
}
case InputUtils::kGENIE_Input: {
return os << "kGENIE_Input";
}
case InputUtils::kGiBUU_Input: {
return os << "kGiBUU_Input";
}
case InputUtils::kNUANCE_Input: {
return os << "kNUANCE_Input";
}
case InputUtils::kEVSPLN_Input: {
return os << "kEVSPLN_Input";
}
case InputUtils::kEMPTY_Input: {
return os << "kEMPTY_Input";
}
case InputUtils::kFEVENT_Input: {
return os << "kFEVENT_Input";
}
case InputUtils::kJOINT_Input: {
return os << "kJOINT_Input";
}
case InputUtils::kInvalid_Input:
case InputUtils::kHIST_Input:
case InputUtils::kBNSPLN_Input:
default: { return os << "kInvalid_Input"; }
}
}
#endif
diff --git a/src/FitBase/Measurement1D.cxx b/src/FitBase/Measurement1D.cxx
index f245a73..baff4b7 100644
--- a/src/FitBase/Measurement1D.cxx
+++ b/src/FitBase/Measurement1D.cxx
@@ -1,1785 +1,1786 @@
// Copyright 2016 L. Pickering, P caltowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This ile 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 <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "Measurement1D.h"
//********************************************************************
Measurement1D::Measurement1D(void) {
//********************************************************************
// XSec Scalings
fScaleFactor = -1.0;
fCurrentNorm = 1.0;
// Histograms
fDataHist = NULL;
fDataTrue = NULL;
fMCHist = NULL;
fMCFine = NULL;
fMCWeighted = NULL;
fMaskHist = NULL;
// Covar
covar = NULL;
fFullCovar = NULL;
fCovar = NULL;
fInvert = NULL;
fDecomp = NULL;
// Fake Data
fFakeDataInput = "";
fFakeDataFile = NULL;
// Options
fDefaultTypes = "FIX/FULL/CHI2";
fAllowedTypes =
"FIX,FREE,SHAPE/FULL,DIAG/CHI2/NORM/ENUCORR/Q2CORR/ENU1D/MASK";
fIsFix = false;
fIsShape = false;
fIsFree = false;
fIsDiag = false;
fIsFull = false;
fAddNormPen = false;
fIsMask = false;
fIsChi2SVD = false;
fIsRawEvents = false;
fIsDifXSec = false;
fIsEnu1D = false;
// Inputs
fInput = NULL;
fRW = NULL;
// Extra Histograms
fMCHist_Modes = NULL;
}
//********************************************************************
Measurement1D::~Measurement1D(void) {
//********************************************************************
if (fDataHist) delete fDataHist;
if (fDataTrue) delete fDataTrue;
if (fMCHist) delete fMCHist;
if (fMCFine) delete fMCFine;
if (fMCWeighted) delete fMCWeighted;
if (fMaskHist) delete fMaskHist;
if (covar) delete covar;
if (fFullCovar) delete fFullCovar;
if (fCovar) delete fCovar;
if (fInvert) delete fInvert;
if (fDecomp) delete fDecomp;
}
//********************************************************************
void Measurement1D::FinaliseSampleSettings() {
//********************************************************************
MeasurementBase::FinaliseSampleSettings();
// Setup naming + renaming
fName = fSettings.GetName();
fSettings.SetS("originalname", fName);
if (fSettings.Has("rename")) {
fName = fSettings.GetS("rename");
fSettings.SetS("name", fName);
}
// Setup all other options
LOG(SAM) << "Finalising Sample Settings: " << fName << std::endl;
if ((fSettings.GetS("originalname").find("Evt") != std::string::npos)) {
fIsRawEvents = true;
LOG(SAM) << "Found event rate measurement but using poisson likelihoods."
<< std::endl;
}
if (fSettings.GetS("originalname").find("XSec_1DEnu") != std::string::npos) {
fIsEnu1D = true;
LOG(SAM) << "::" << fName << "::" << std::endl;
LOG(SAM) << "Found XSec Enu measurement, applying flux integrated scaling, "
<< "not flux averaged!" << std::endl;
}
if (fIsEnu1D && fIsRawEvents) {
LOG(SAM) << "Found 1D Enu XSec distribution AND fIsRawEvents, is this "
"really correct?!"
<< std::endl;
LOG(SAM) << "Check experiment constructor for " << fName
<< " and correct this!" << std::endl;
LOG(SAM) << "I live in " << __FILE__ << ":" << __LINE__ << std::endl;
exit(-1);
}
LOG(FIT) << "Sample isjoint = " << fIsJoint << std::endl;
if (!fRW) fRW = FitBase::GetRW();
if (!fInput and !fIsJoint) SetupInputs(fSettings.GetS("input"));
// Setup options
SetFitOptions(fDefaultTypes); // defaults
SetFitOptions(fSettings.GetS("type")); // user specified
EnuMin = GeneralUtils::StrToDbl(fSettings.GetS("enu_min"));
EnuMax = GeneralUtils::StrToDbl(fSettings.GetS("enu_max"));
if (fAddNormPen) {
if (fNormError <= 0.0) {
ERR(WRN) << "Norm error for class " << fName << " is 0.0!" << endl;
ERR(WRN) << "If you want to use it please add fNormError=VAL" << endl;
throw;
}
}
}
//********************************************************************
void Measurement1D::CreateDataHistogram(int dimx, double* binx) {
//********************************************************************
if (fDataHist) delete fDataHist;
fDataHist = new TH1D( (fSettings.GetName() + "_data").c_str(), (fSettings.GetFullTitles()).c_str(),
dimx, binx) ;
}
//********************************************************************
void Measurement1D::SetDataFromTextFile(std::string datafile) {
//********************************************************************
LOG(SAM) << "Reading data from text file: " << datafile << std::endl;
fDataHist = PlotUtils::GetTH1DFromFile(datafile,
fSettings.GetName() + "_data",
fSettings.GetFullTitles());
}
//********************************************************************
void Measurement1D::SetDataFromRootFile(std::string datafile,
std::string histname) {
//********************************************************************
LOG(SAM) << "Reading data from root file: " << datafile << ";" << histname << std::endl;
fDataHist = PlotUtils::GetTH1DFromRootFile(datafile, histname);
fDataHist->SetNameTitle((fSettings.GetName() + "_data").c_str(),
(fSettings.GetFullTitles()).c_str());
return;
};
//********************************************************************
void Measurement1D::SetEmptyData(){
//********************************************************************
fDataHist = new TH1D("EMPTY_DATA","EMPTY_DATA",1,0.0,1.0);
}
//********************************************************************
void Measurement1D::SetPoissonErrors() {
//********************************************************************
if (!fDataHist) {
ERR(FTL) << "Need a data hist to setup possion errors! " << std::endl;
ERR(FTL) << "Setup Data First!" << std::endl;
throw;
}
for (int i = 0; i < fDataHist->GetNbinsX() + 1; i++) {
fDataHist->SetBinError(i + 1, sqrt(fDataHist->GetBinContent(i + 1)));
}
}
//********************************************************************
void Measurement1D::SetCovarFromDiagonal(TH1D* data) {
//********************************************************************
if (!data and fDataHist) {
data = fDataHist;
}
if (data) {
LOG(SAM) << "Setting diagonal covariance for: " << data->GetName() << std::endl;
fFullCovar = StatUtils::MakeDiagonalCovarMatrix(data);
covar = StatUtils::GetInvert(fFullCovar);
fDecomp = StatUtils::GetDecomp(fFullCovar);
} else {
ERR(FTL) << "No data input provided to set diagonal covar from!" << std::endl;
}
// if (!fIsDiag) {
// ERR(FTL) << "SetCovarMatrixFromDiag called for measurement "
// << "that is not set as diagonal." << std::endl;
// throw;
// }
}
//********************************************************************
void Measurement1D::SetCovarFromTextFile(std::string covfile, int dim) {
//********************************************************************
if (dim == -1) {
dim = fDataHist->GetNbinsX();
}
LOG(SAM) << "Reading covariance from text file: " << covfile << std::endl;
fFullCovar = StatUtils::GetCovarFromTextFile(covfile, dim);
covar = StatUtils::GetInvert(fFullCovar);
fDecomp = StatUtils::GetDecomp(fFullCovar);
}
//********************************************************************
void Measurement1D::SetCovarFromRootFile(std::string covfile, std::string histname) {
//********************************************************************
LOG(SAM) << "Reading covariance from text file: " << covfile << ";" << histname << std::endl;
fFullCovar = StatUtils::GetCovarFromRootFile(covfile, histname);
covar = StatUtils::GetInvert(fFullCovar);
fDecomp = StatUtils::GetDecomp(fFullCovar);
}
//********************************************************************
void Measurement1D::SetCovarInvertFromTextFile(std::string covfile, int dim) {
//********************************************************************
if (dim == -1) {
dim = fDataHist->GetNbinsX();
}
LOG(SAM) << "Reading inverted covariance from text file: " << covfile << std::endl;
covar = StatUtils::GetCovarFromTextFile(covfile, dim);
fFullCovar = StatUtils::GetInvert(covar);
fDecomp = StatUtils::GetDecomp(fFullCovar);
}
//********************************************************************
void Measurement1D::SetCovarInvertFromRootFile(std::string covfile, std::string histname) {
//********************************************************************
LOG(SAM) << "Reading inverted covariance from text file: " << covfile << ";" << histname << std::endl;
covar = StatUtils::GetCovarFromRootFile(covfile, histname);
fFullCovar = StatUtils::GetInvert(covar);
fDecomp = StatUtils::GetDecomp(fFullCovar);
}
//********************************************************************
void Measurement1D::SetCorrelationFromTextFile(std::string covfile, int dim) {
//********************************************************************
if (dim == -1) dim = fDataHist->GetNbinsX();
LOG(SAM) << "Reading data correlations from text file: " << covfile << ";" << dim << std::endl;
TMatrixDSym* correlation = StatUtils::GetCovarFromTextFile(covfile, dim);
if (!fDataHist) {
ERR(FTL) << "Trying to set correlations from text file but there is no data to build it from. \n"
<< "In constructor make sure data is set before SetCorrelationFromTextFile is called. \n" << std::endl;
throw;
}
// Fill covar from data errors and correlations
fFullCovar = new TMatrixDSym(dim);
for (int i = 0; i < fDataHist->GetNbinsX(); i++) {
for (int j = 0; j < fDataHist->GetNbinsX(); j++) {
(*fFullCovar)(i, j) = (*correlation)(i, j) * fDataHist->GetBinError(i + 1) * fDataHist->GetBinError(j + 1) * 1.E76;
}
}
// Fill other covars.
covar = StatUtils::GetInvert(fFullCovar);
fDecomp = StatUtils::GetDecomp(fFullCovar);
delete correlation;
}
//********************************************************************
void Measurement1D::SetCorrelationFromRootFile(std::string covfile, std::string histname) {
//********************************************************************
LOG(SAM) << "Reading data correlations from text file: " << covfile << ";" << histname << std::endl;
TMatrixDSym* correlation = StatUtils::GetCovarFromRootFile(covfile, histname);
if (!fDataHist) {
ERR(FTL) << "Trying to set correlations from text file but there is no data to build it from. \n"
<< "In constructor make sure data is set before SetCorrelationFromTextFile is called. \n" << std::endl;
throw;
}
// Fill covar from data errors and correlations
fFullCovar = new TMatrixDSym(fDataHist->GetNbinsX());
for (int i = 0; i < fDataHist->GetNbinsX(); i++) {
for (int j = 0; j < fDataHist->GetNbinsX(); j++) {
(*fFullCovar)(i, j) = (*correlation)(i, j) * fDataHist->GetBinError(i + 1) * fDataHist->GetBinError(j + 1) * 1.E76;
}
}
// Fill other covars.
covar = StatUtils::GetInvert(fFullCovar);
fDecomp = StatUtils::GetDecomp(fFullCovar);
delete correlation;
}
//********************************************************************
void Measurement1D::SetCholDecompFromTextFile(std::string covfile, int dim) {
//********************************************************************
if (dim == -1) {
dim = fDataHist->GetNbinsX();
}
LOG(SAM) << "Reading cholesky from text file: " << covfile << std::endl;
TMatrixD* temp = StatUtils::GetMatrixFromTextFile(covfile, dim, dim);
TMatrixD* trans = (TMatrixD*)temp->Clone();
trans->T();
(*trans) *= (*temp);
fFullCovar = new TMatrixDSym(dim, trans->GetMatrixArray(), "");
covar = StatUtils::GetInvert(fFullCovar);
fDecomp = StatUtils::GetDecomp(fFullCovar);
delete temp;
delete trans;
}
//********************************************************************
void Measurement1D::SetCholDecompFromRootFile(std::string covfile, std::string histname) {
//********************************************************************
LOG(SAM) << "Reading cholesky decomp from root file: " << covfile << ";" << histname << std::endl;
TMatrixD* temp = StatUtils::GetMatrixFromRootFile(covfile, histname);
TMatrixD* trans = (TMatrixD*)temp->Clone();
trans->T();
(*trans) *= (*temp);
fFullCovar = new TMatrixDSym(temp->GetNrows(), trans->GetMatrixArray(), "");
covar = StatUtils::GetInvert(fFullCovar);
fDecomp = StatUtils::GetDecomp(fFullCovar);
delete temp;
delete trans;
}
//********************************************************************
void Measurement1D::ScaleData(double scale) {
//********************************************************************
fDataHist->Scale(scale);
}
//********************************************************************
void Measurement1D::ScaleDataErrors(double scale) {
//********************************************************************
for (int i = 0; i < fDataHist->GetNbinsX(); i++) {
fDataHist->SetBinError(i + 1, fDataHist->GetBinError(i + 1) * scale);
}
}
//********************************************************************
void Measurement1D::ScaleCovar(double scale) {
//********************************************************************
(*fFullCovar) *= scale;
(*covar) *= 1.0 / scale;
(*fDecomp) *= sqrt(scale);
}
//********************************************************************
void Measurement1D::SetBinMask(std::string maskfile) {
//********************************************************************
if (!fIsMask) return;
LOG(SAM) << "Reading bin mask from file: " << maskfile << std::endl;
// Create a mask histogram with dim of data
int nbins = fDataHist->GetNbinsX();
fMaskHist =
new TH1I((fSettings.GetName() + "_BINMASK").c_str(),
(fSettings.GetName() + "_BINMASK; Bin; Mask?").c_str(), nbins, 0, nbins);
std::string line;
std::ifstream mask(maskfile.c_str(), ifstream::in);
if (!mask.is_open()) {
LOG(FTL) << " Cannot find mask file." << std::endl;
throw;
}
while (std::getline(mask >> std::ws, line, '\n')) {
std::vector<int> entries = GeneralUtils::ParseToInt(line, " ");
// Skip lines with poorly formatted lines
if (entries.size() < 2) {
LOG(WRN) << "Measurement1D::SetBinMask(), couldn't parse line: " << line
<< std::endl;
continue;
}
// The first index should be the bin number, the second should be the mask
// value.
int val = 0;
if (entries[1] > 0) val = 1;
fMaskHist->SetBinContent(entries[0], val);
}
// Apply masking by setting masked data bins to zero
PlotUtils::MaskBins(fDataHist, fMaskHist);
return;
}
//********************************************************************
void Measurement1D::FinaliseMeasurement() {
//********************************************************************
LOG(SAM) << "Finalising Measurement: " << fName << std::endl;
// Make sure data is setup
if (!fDataHist) {
ERR(FTL) << "No data has been setup inside " << fName << " constructor!" << std::endl;
throw;
}
// Make sure covariances are setup
if (!fFullCovar) {
SetCovarFromDiagonal(fDataHist);
}
if (!covar) {
covar = StatUtils::GetInvert(fFullCovar);
}
if (!fDecomp) {
fDecomp = StatUtils::GetDecomp(fFullCovar);
}
// Setup fMCHist from data
fMCHist = (TH1D*)fDataHist->Clone();
fMCHist->SetNameTitle((fSettings.GetName() + "_MC").c_str(),
(fSettings.GetFullTitles()).c_str());
fMCHist->Reset();
// Setup fMCFine
fMCFine = new TH1D("mcfine", "mcfine", fDataHist->GetNbinsX(),
fMCHist->GetBinLowEdge(1),
fMCHist->GetBinLowEdge(fDataHist->GetNbinsX() + 1));
fMCFine->SetNameTitle((fSettings.GetName() + "_MC_FINE").c_str(),
(fSettings.GetFullTitles()).c_str());
fMCFine->Reset();
// Setup MC Stat
fMCStat = (TH1D*)fMCHist->Clone();
fMCStat->Reset();
// Search drawopts for possible types to include by default
std::string drawopts = FitPar::Config().GetParS("drawopts");
if (drawopts.find("MODES") != std::string::npos) {
fMCHist_Modes = new TrueModeStack( (fSettings.GetName() + "_MODES").c_str(),
("True Channels"), fMCHist);
SetAutoProcessTH1(fMCHist_Modes, kCMD_Reset, kCMD_Norm, kCMD_Write);
}
// Setup bin masks using sample name
if (fIsMask) {
std::string curname = fName;
std::string origname = fSettings.GetS("originalname");
// Check rename.mask
std::string maskloc = FitPar::Config().GetParDIR(curname + ".mask");
// Check origname.mask
if (maskloc.empty()) maskloc = FitPar::Config().GetParDIR(origname + ".mask");
// Check database
if (maskloc.empty()) {
maskloc = FitPar::GetDataBase() + "/masks/" + origname + ".mask";
}
// Setup Bin Mask
SetBinMask(maskloc);
}
if (fScaleFactor < 0) {
ERR(FTL) << "I found a negative fScaleFactor in " << __FILE__ << ":" << __LINE__ << std::endl;
ERR(FTL) << "fScaleFactor = " << fScaleFactor << std::endl;
ERR(FTL) << "EXITING" << std::endl;
throw;
}
// Create and fill Weighted Histogram
if (!fMCWeighted) {
fMCWeighted = (TH1D*)fMCHist->Clone();
fMCWeighted->SetNameTitle((fName + "_MCWGHTS").c_str(),
(fName + "_MCWGHTS" + fPlotTitles).c_str());
fMCWeighted->GetYaxis()->SetTitle("Weighted Events");
}
}
//********************************************************************
void Measurement1D::SetFitOptions(std::string opt) {
//********************************************************************
// Do nothing if default given
if (opt == "DEFAULT") return;
// CHECK Conflicting Fit Options
std::vector<std::string> fit_option_allow =
GeneralUtils::ParseToStr(fAllowedTypes, "/");
for (UInt_t i = 0; i < fit_option_allow.size(); i++) {
std::vector<std::string> fit_option_section =
GeneralUtils::ParseToStr(fit_option_allow.at(i), ",");
bool found_option = false;
for (UInt_t j = 0; j < fit_option_section.size(); j++) {
std::string av_opt = fit_option_section.at(j);
if (!found_option and opt.find(av_opt) != std::string::npos) {
found_option = true;
} else if (found_option and opt.find(av_opt) != std::string::npos) {
ERR(FTL) << "ERROR: Conflicting fit options provided: "
<< opt << std::endl
<< "Conflicting group = " << fit_option_section.at(i) << std::endl
<< "You should only supply one of these options in card file." << std::endl;
throw;
}
}
}
// Check all options are allowed
std::vector<std::string> fit_options_input =
GeneralUtils::ParseToStr(opt, "/");
for (UInt_t i = 0; i < fit_options_input.size(); i++) {
if (fAllowedTypes.find(fit_options_input.at(i)) == std::string::npos) {
ERR(FTL) << "ERROR: Fit Option '" << fit_options_input.at(i)
<< "' Provided is not allowed for this measurement."
<< std::endl;
ERR(FTL) << "Fit Options should be provided as a '/' seperated list "
"(e.g. FREE/DIAG/NORM)"
<< std::endl;
ERR(FTL) << "Available options for " << fName << " are '" << fAllowedTypes
<< "'" << std::endl;
throw;
}
}
// Set TYPE
fFitType = opt;
// FIX,SHAPE,FREE
if (opt.find("FIX") != std::string::npos) {
fIsFree = fIsShape = false;
fIsFix = true;
} else if (opt.find("SHAPE") != std::string::npos) {
fIsFree = fIsFix = false;
fIsShape = true;
} else if (opt.find("FREE") != std::string::npos) {
fIsFix = fIsShape = false;
fIsFree = true;
}
// DIAG,FULL (or default to full)
if (opt.find("DIAG") != std::string::npos) {
fIsDiag = true;
fIsFull = false;
} else if (opt.find("FULL") != std::string::npos) {
fIsDiag = false;
fIsFull = true;
}
// CHI2/LL (OTHERS?)
if (opt.find("LOG") != std::string::npos) {
fIsChi2 = false;
ERR(FTL) << "No other LIKELIHOODS properly supported!" << std::endl;
ERR(FTL) << "Try to use a chi2!" << std::endl;
throw;
} else {
fIsChi2 = true;
}
// EXTRAS
if (opt.find("RAW") != std::string::npos) fIsRawEvents = true;
if (opt.find("DIF") != std::string::npos) fIsDifXSec = true;
if (opt.find("ENU1D") != std::string::npos) fIsEnu1D = true;
if (opt.find("NORM") != std::string::npos) fAddNormPen = true;
if (opt.find("MASK") != std::string::npos) fIsMask = true;
std::cout << fSettings.fKeyValues.fNode << std::endl;
return;
};
//********************************************************************
void Measurement1D::SetSmearingMatrix(std::string smearfile, int truedim,
int recodim) {
//********************************************************************
// The smearing matrix describes the migration from true bins (rows) to reco
// bins (columns)
// Counter over the true bins!
int row = 0;
std::string line;
std::ifstream smear(smearfile.c_str(), ifstream::in);
// Note that the smearing matrix may be rectangular.
fSmearMatrix = new TMatrixD(truedim, recodim);
if (smear.is_open())
LOG(SAM) << "Reading smearing matrix from file: " << smearfile << std::endl;
else
ERR(FTL) << "Smearing matrix provided is incorrect: " << smearfile
<< std::endl;
while (std::getline(smear >> std::ws, line, '\n')) {
int column = 0;
std::vector<double> entries = GeneralUtils::ParseToDbl(line, " ");
for (std::vector<double>::iterator iter = entries.begin();
iter != entries.end(); iter++) {
(*fSmearMatrix)(row, column) =
(*iter) / 100.; // Convert to fraction from
// percentage (this may not be
// general enough)
column++;
}
row++;
}
return;
}
//********************************************************************
void Measurement1D::ApplySmearingMatrix() {
//********************************************************************
if (!fSmearMatrix) {
ERR(WRN) << fName
<< ": attempted to apply smearing matrix, but none was set"
<< std::endl;
return;
}
TH1D* unsmeared = (TH1D*)fMCHist->Clone();
TH1D* smeared = (TH1D*)fMCHist->Clone();
smeared->Reset();
// Loop over reconstructed bins
// true = row; reco = column
for (int rbin = 0; rbin < fSmearMatrix->GetNcols(); ++rbin) {
// Sum up the constributions from all true bins
double rBinVal = 0;
// Loop over true bins
for (int tbin = 0; tbin < fSmearMatrix->GetNrows(); ++tbin) {
rBinVal +=
(*fSmearMatrix)(tbin, rbin) * unsmeared->GetBinContent(tbin + 1);
}
smeared->SetBinContent(rbin + 1, rBinVal);
}
fMCHist = (TH1D*)smeared->Clone();
return;
}
/*
Reconfigure LOOP
*/
//********************************************************************
void Measurement1D::ResetAll() {
//********************************************************************
fMCHist->Reset();
fMCFine->Reset();
fMCStat->Reset();
return;
};
//********************************************************************
void Measurement1D::FillHistograms() {
//********************************************************************
if (Signal) {
fMCHist->Fill(fXVar, Weight);
fMCFine->Fill(fXVar, Weight);
fMCStat->Fill(fXVar, 1.0);
if (fMCHist_Modes) fMCHist_Modes->Fill(Mode, fXVar, Weight);
}
return;
};
//********************************************************************
void Measurement1D::ScaleEvents() {
//********************************************************************
// Fill MCWeighted;
// for (int i = 0; i < fMCHist->GetNbinsX(); i++) {
// fMCWeighted->SetBinContent(i + 1, fMCHist->GetBinContent(i + 1));
// fMCWeighted->SetBinError(i + 1, fMCHist->GetBinError(i + 1));
// }
// Setup Stat ratios for MC and MC Fine
double* statratio = new double[fMCHist->GetNbinsX()];
for (int i = 0; i < fMCHist->GetNbinsX(); i++) {
if (fMCHist->GetBinContent(i + 1) != 0) {
statratio[i] = fMCHist->GetBinError(i + 1) / fMCHist->GetBinContent(i + 1);
} else {
statratio[i] = 0.0;
}
}
double* statratiofine = new double[fMCFine->GetNbinsX()];
for (int i = 0; i < fMCFine->GetNbinsX(); i++) {
if (fMCFine->GetBinContent(i + 1) != 0) {
statratiofine[i] = fMCFine->GetBinError(i + 1) / fMCFine->GetBinContent(i + 1);
} else {
statratiofine[i] = 0.0;
}
}
// Scaling for raw event rates
if (fIsRawEvents) {
double datamcratio = fDataHist->Integral() / fMCHist->Integral();
fMCHist->Scale(datamcratio);
fMCFine->Scale(datamcratio);
if (fMCHist_Modes) fMCHist_Modes->Scale(datamcratio);
// Scaling for XSec as function of Enu
} else if (fIsEnu1D) {
PlotUtils::FluxUnfoldedScaling(fMCHist, GetFluxHistogram(),
GetEventHistogram(), fScaleFactor,
fNEvents);
PlotUtils::FluxUnfoldedScaling(fMCFine, GetFluxHistogram(),
GetEventHistogram(), fScaleFactor,
fNEvents);
// if (fMCHist_Modes) {
// PlotUtils::FluxUnfoldedScaling(fMCHist_Modes, GetFluxHistogram(),
// GetEventHistogram(), fScaleFactor,
// fNEvents);
// }
// Any other differential scaling
} else {
fMCHist->Scale(fScaleFactor, "width");
fMCFine->Scale(fScaleFactor, "width");
if (fMCHist_Modes) fMCHist_Modes->Scale(fScaleFactor, "width");
}
// Proper error scaling - ROOT Freaks out with xsec weights sometimes
for (int i = 0; i < fMCStat->GetNbinsX(); i++) {
fMCHist->SetBinError(i + 1, fMCHist->GetBinContent(i + 1) * statratio[i]);
}
for (int i = 0; i < fMCFine->GetNbinsX(); i++) {
fMCFine->SetBinError(i + 1, fMCFine->GetBinContent(i + 1) * statratiofine[i]);
}
// Clean up
delete statratio;
delete statratiofine;
return;
};
//********************************************************************
void Measurement1D::ApplyNormScale(double norm) {
//********************************************************************
fCurrentNorm = norm;
fMCHist->Scale(1.0 / norm);
fMCFine->Scale(1.0 / norm);
return;
};
/*
Statistic Functions - Outsources to StatUtils
*/
//********************************************************************
int Measurement1D::GetNDOF() {
//********************************************************************
int ndof = fDataHist->GetNbinsX();
if (fMaskHist) ndof -= fMaskHist->Integral();
return ndof;
}
//********************************************************************
double Measurement1D::GetLikelihood() {
//********************************************************************
// If this is for a ratio, there is no data histogram to compare to!
if (fNoData || !fDataHist) return 0.;
// Apply Masking to MC if Required.
if (fIsMask and fMaskHist) {
PlotUtils::MaskBins(fMCHist, fMaskHist);
}
// Sort Shape Scaling
double scaleF = 0.0;
if (fIsShape) {
if (fMCHist->Integral(1, fMCHist->GetNbinsX(), "width")) {
scaleF = fDataHist->Integral(1, fDataHist->GetNbinsX(), "width") /
fMCHist->Integral(1, fMCHist->GetNbinsX(), "width");
fMCHist->Scale(scaleF);
fMCFine->Scale(scaleF);
}
}
// Likelihood Calculation
double stat = 0.;
if (fIsChi2) {
if (fIsRawEvents) {
stat = StatUtils::GetChi2FromEventRate(fDataHist, fMCHist, fMaskHist);
} else if (fIsDiag) {
stat = StatUtils::GetChi2FromDiag(fDataHist, fMCHist, fMaskHist);
} else if (!fIsDiag and !fIsRawEvents) {
+ std::cout << "Getting likelihood from covariance " << std::endl;
stat = StatUtils::GetChi2FromCov(fDataHist, fMCHist, covar, fMaskHist);
}
}
// Sort Penalty Terms
if (fAddNormPen) {
double penalty =
(1. - fCurrentNorm) * (1. - fCurrentNorm) / (fNormError * fNormError);
stat += penalty;
}
// Return to normal scaling
if (fIsShape and !FitPar::Config().GetParB("saveshapescaling")) {
fMCHist->Scale(1. / scaleF);
fMCFine->Scale(1. / scaleF);
}
return stat;
}
/*
Fake Data Functions
*/
//********************************************************************
void Measurement1D::SetFakeDataValues(std::string fakeOption) {
//********************************************************************
// Setup original/datatrue
TH1D* tempdata = (TH1D*) fDataHist->Clone();
if (!fIsFakeData) {
fIsFakeData = true;
// Make a copy of the original data histogram.
if (!fDataOrig) fDataOrig = (TH1D*)fDataHist->Clone((fName + "_data_original").c_str());
} else {
ResetFakeData();
}
// Setup Inputs
fFakeDataInput = fakeOption;
LOG(SAM) << "Setting fake data from : " << fFakeDataInput << std::endl;
// From MC
if (fFakeDataInput.compare("MC") == 0) {
fDataHist = (TH1D*)fMCHist->Clone((fName + "_MC").c_str());
// Fake File
} else {
if (!fFakeDataFile) fFakeDataFile = new TFile(fFakeDataInput.c_str(), "READ");
fDataHist = (TH1D*)fFakeDataFile->Get((fName + "_MC").c_str());
}
// Setup Data Hist
fDataHist->SetNameTitle((fName + "_FAKE").c_str(),
(fName + fPlotTitles).c_str());
// Replace Data True
if (fDataTrue) delete fDataTrue;
fDataTrue = (TH1D*)fDataHist->Clone();
fDataTrue->SetNameTitle((fName + "_FAKE_TRUE").c_str(),
(fName + fPlotTitles).c_str());
// Make a new covariance for fake data hist.
int nbins = fDataHist->GetNbinsX();
double alpha_i = 0.0;
double alpha_j = 0.0;
for (int i = 0; i < nbins; i++) {
for (int j = 0; j < nbins; j++) {
alpha_i = fDataHist->GetBinContent(i + 1) / tempdata->GetBinContent(i + 1);
alpha_j = fDataHist->GetBinContent(j + 1) / tempdata->GetBinContent(j + 1);
(*fFullCovar)(i, j) = alpha_i * alpha_j * (*fFullCovar)(i, j);
}
}
// Setup Covariances
if (covar) delete covar;
covar = StatUtils::GetInvert(fFullCovar);
if (fDecomp) delete fDecomp;
fDecomp = StatUtils::GetInvert(fFullCovar);
delete tempdata;
return;
};
//********************************************************************
void Measurement1D::ResetFakeData() {
//********************************************************************
if (fIsFakeData) {
if (fDataHist) delete fDataHist;
fDataHist = (TH1D*)fDataTrue->Clone((fSettings.GetName() + "_FKDAT").c_str());
}
}
//********************************************************************
void Measurement1D::ResetData() {
//********************************************************************
if (fIsFakeData) {
if (fDataHist) delete fDataHist;
fDataHist = (TH1D*)fDataOrig->Clone((fSettings.GetName() + "_data").c_str());
}
fIsFakeData = false;
}
//********************************************************************
void Measurement1D::ThrowCovariance() {
//********************************************************************
// Take a fDecomposition and use it to throw the current dataset.
// Requires fDataTrue also be set incase used repeatedly.
if (fDataHist) delete fDataHist;
fDataHist = StatUtils::ThrowHistogram(fDataTrue, fFullCovar);
return;
};
/*
Access Functions
*/
//********************************************************************
TH1D* Measurement1D::GetMCHistogram() {
//********************************************************************
if (!fMCHist) return fMCHist;
std::ostringstream chi2;
chi2 << std::setprecision(5) << this->GetLikelihood();
int linecolor = kRed;
int linestyle = 1;
int linewidth = 1;
int fillcolor = 0;
int fillstyle = 1001;
// if (fSettings.Has("linecolor")) linecolor = fSettings.GetI("linecolor");
// if (fSettings.Has("linestyle")) linestyle = fSettings.GetI("linestyle");
// if (fSettings.Has("linewidth")) linewidth = fSettings.GetI("linewidth");
// if (fSettings.Has("fillcolor")) fillcolor = fSettings.GetI("fillcolor");
// if (fSettings.Has("fillstyle")) fillstyle = fSettings.GetI("fillstyle");
fMCHist->SetTitle(chi2.str().c_str());
fMCHist->SetLineColor(linecolor);
fMCHist->SetLineStyle(linestyle);
fMCHist->SetLineWidth(linewidth);
fMCHist->SetFillColor(fillcolor);
fMCHist->SetFillStyle(fillstyle);
return fMCHist;
};
//********************************************************************
TH1D* Measurement1D::GetDataHistogram() {
//********************************************************************
if (!fDataHist) return fDataHist;
int datacolor = kBlack;
int datastyle = 1;
int datawidth = 1;
// if (fSettings.Has("datacolor")) datacolor = fSettings.GetI("datacolor");
// if (fSettings.Has("datastyle")) datastyle = fSettings.GetI("datastyle");
// if (fSettings.Has("datawidth")) datawidth = fSettings.GetI("datawidth");
fDataHist->SetLineColor(datacolor);
fDataHist->SetLineWidth(datawidth);
fDataHist->SetMarkerStyle(datastyle);
return fDataHist;
};
/*
Write Functions
*/
// Save all the histograms at once
//********************************************************************
void Measurement1D::Write(std::string drawOpt) {
//********************************************************************
// Get Draw Options
drawOpt = FitPar::Config().GetParS("drawopts");
// Write Data/MC
GetDataList().at(0)->Write();
GetMCList().at(0)->Write();
// Write Fine Histogram
if (drawOpt.find("FINE") != std::string::npos)
GetFineList().at(0)->Write();
// Write Weighted Histogram
if (drawOpt.find("WEIGHTS") != std::string::npos && fMCWeighted)
fMCWeighted->Write();
// Save Flux/Evt if no event manager
if (!FitPar::Config().GetParB("EventManager")) {
if (drawOpt.find("FLUX") != std::string::npos && GetFluxHistogram())
GetFluxHistogram()->Write();
if (drawOpt.find("EVT") != std::string::npos && GetEventHistogram())
GetEventHistogram()->Write();
if (drawOpt.find("XSEC") != std::string::npos && GetEventHistogram())
GetEventHistogram()->Write();
}
// Write Mask
if (fIsMask && (drawOpt.find("MASK") != std::string::npos)) {
fMaskHist->Write();
}
// Write Covariances
if (drawOpt.find("COV") != std::string::npos && fFullCovar) {
PlotUtils::GetFullCovarPlot(fFullCovar, fSettings.GetName());
}
if (drawOpt.find("INVCOV") != std::string::npos && covar) {
PlotUtils::GetInvCovarPlot(covar, fSettings.GetName());
}
if (drawOpt.find("DECOMP") != std::string::npos && fDecomp) {
PlotUtils::GetDecompCovarPlot(fDecomp, fSettings.GetName());
}
// // Likelihood residual plots
// if (drawOpt.find("RESIDUAL") != std::string::npos) {
// WriteResidualPlots();
// }
// Ratio and Shape Plots
if (drawOpt.find("RATIO") != std::string::npos) {
WriteRatioPlot();
}
if (drawOpt.find("SHAPE") != std::string::npos) {
WriteShapePlot();
if (drawOpt.find("RATIO") != std::string::npos)
WriteShapeRatioPlot();
}
// // RATIO
// if (drawOpt.find("CANVMC") != std::string::npos) {
// TCanvas* c1 = WriteMCCanvas(fDataHist, fMCHist);
// c1->Write();
// delete c1;
// }
// // PDG
// if (drawOpt.find("CANVPDG") != std::string::npos && fMCHist_Modes) {
// TCanvas* c2 = WritePDGCanvas(fDataHist, fMCHist, fMCHist_Modes);
// c2->Write();
// delete c2;
// }
// Write Extra Histograms
AutoWriteExtraTH1();
WriteExtraHistograms();
// Returning
LOG(SAM) << "Written Histograms: " << fName << std::endl;
return;
}
//********************************************************************
void Measurement1D::WriteRatioPlot() {
//********************************************************************
// Setup mc data ratios
TH1D* dataRatio = (TH1D*)fDataHist->Clone((fName + "_data_RATIO").c_str());
TH1D* mcRatio = (TH1D*)fMCHist->Clone((fName + "_MC_RATIO").c_str());
// Extra MC Data Ratios
for (int i = 0; i < mcRatio->GetNbinsX(); i++) {
dataRatio->SetBinContent(i + 1, fDataHist->GetBinContent(i + 1) / fMCHist->GetBinContent(i + 1));
dataRatio->SetBinError(i + 1, fDataHist->GetBinError(i + 1) / fMCHist->GetBinContent(i + 1));
mcRatio->SetBinContent(i + 1, fMCHist->GetBinContent(i + 1) / fMCHist->GetBinContent(i + 1));
mcRatio->SetBinError(i + 1, fMCHist->GetBinError(i + 1) / fMCHist->GetBinContent(i + 1));
}
// Write ratios
mcRatio->Write();
dataRatio->Write();
delete mcRatio;
delete dataRatio;
}
//********************************************************************
void Measurement1D::WriteShapePlot() {
//********************************************************************
TH1D* mcShape = (TH1D*)fMCHist->Clone((fName + "_MC_SHAPE").c_str());
double shapeScale = 1.0;
if (fIsRawEvents) {
shapeScale = fDataHist->Integral() / fMCHist->Integral();
} else {
shapeScale = fDataHist->Integral("width") / fMCHist->Integral("width");
}
mcShape->Scale(shapeScale);
std::stringstream ss;
ss << shapeScale;
mcShape->SetTitle(ss.str().c_str());
mcShape->SetLineWidth(3);
mcShape->SetLineStyle(7);
mcShape->Write();
delete mcShape;
}
//********************************************************************
void Measurement1D::WriteShapeRatioPlot() {
//********************************************************************
// Get a mcshape histogram
TH1D* mcShape = (TH1D*)fMCHist->Clone((fName + "_MC_SHAPE").c_str());
double shapeScale = 1.0;
if (fIsRawEvents) {
shapeScale = fDataHist->Integral() / fMCHist->Integral();
} else {
shapeScale = fDataHist->Integral("width") / fMCHist->Integral("width");
}
mcShape->Scale(shapeScale);
// Create shape ratio histograms
TH1D* mcShapeRatio = (TH1D*)mcShape->Clone((fName + "_MC_SHAPE_RATIO").c_str());
TH1D* dataShapeRatio = (TH1D*)fDataHist->Clone((fName + "_data_SHAPE_RATIO").c_str());
// Divide the histograms
mcShapeRatio->Divide(mcShape);
dataShapeRatio->Divide(mcShape);
// Colour the shape ratio plots
mcShapeRatio->SetLineWidth(3);
mcShapeRatio->SetLineStyle(7);
mcShapeRatio->Write();
dataShapeRatio->Write();
delete mcShapeRatio;
delete dataShapeRatio;
}
//// CRAP TO BE REMOVED
//********************************************************************
void Measurement1D::SetupMeasurement(std::string inputfile, std::string type,
FitWeight * rw, std::string fkdt) {
//********************************************************************
//nuiskey samplekey = Config::CreateKey("sample");
// samplekey.AddS("name", fName);
// samplekey.AddS("type",type);
// samplekey.AddS("input",inputfile);
// fSettings = LoadSampleSettings(samplekey);
// Reset everything to NULL
// Init();
// Check if name contains Evt, indicating that it is a raw number of events
// measurements and should thus be treated as once
fIsRawEvents = false;
if ((fName.find("Evt") != std::string::npos) && fIsRawEvents == false) {
fIsRawEvents = true;
LOG(SAM) << "Found event rate measurement but fIsRawEvents == false!"
<< std::endl;
LOG(SAM) << "Overriding this and setting fIsRawEvents == true!"
<< std::endl;
}
fIsEnu1D = false;
if (fName.find("XSec_1DEnu") != std::string::npos) {
fIsEnu1D = true;
LOG(SAM) << "::" << fName << "::" << std::endl;
LOG(SAM) << "Found XSec Enu measurement, applying flux integrated scaling, "
"not flux averaged!"
<< std::endl;
}
if (fIsEnu1D && fIsRawEvents) {
LOG(SAM) << "Found 1D Enu XSec distribution AND fIsRawEvents, is this "
"really correct?!"
<< std::endl;
LOG(SAM) << "Check experiment constructor for " << fName
<< " and correct this!" << std::endl;
LOG(SAM) << "I live in " << __FILE__ << ":" << __LINE__ << std::endl;
exit(-1);
}
fRW = rw;
if (!fInput and !fIsJoint) SetupInputs(inputfile);
// Set Default Options
SetFitOptions(fDefaultTypes);
// Set Passed Options
SetFitOptions(type);
// Still adding support for flat flux inputs
// // Set Enu Flux Scaling
// if (isFlatFluxFolding) this->Input()->ApplyFluxFolding(
// this->defaultFluxHist );
// FinaliseMeasurement();
}
//********************************************************************
void Measurement1D::SetupDefaultHist() {
//********************************************************************
// Setup fMCHist
fMCHist = (TH1D*)fDataHist->Clone();
fMCHist->SetNameTitle((fName + "_MC").c_str(),
(fName + "_MC" + fPlotTitles).c_str());
// Setup fMCFine
Int_t nBins = fMCHist->GetNbinsX();
fMCFine = new TH1D(
(fName + "_MC_FINE").c_str(), (fName + "_MC_FINE" + fPlotTitles).c_str(),
nBins * 6, fMCHist->GetBinLowEdge(1), fMCHist->GetBinLowEdge(nBins + 1));
fMCStat = (TH1D*)fMCHist->Clone();
fMCStat->Reset();
fMCHist->Reset();
fMCFine->Reset();
// Setup the NEUT Mode Array
PlotUtils::CreateNeutModeArray((TH1D*)fMCHist, (TH1**)fMCHist_PDG);
PlotUtils::ResetNeutModeArray((TH1**)fMCHist_PDG);
// Setup bin masks using sample name
if (fIsMask) {
std::string maskloc = FitPar::Config().GetParDIR(fName + ".mask");
if (maskloc.empty()) {
maskloc = FitPar::GetDataBase() + "/masks/" + fName + ".mask";
}
SetBinMask(maskloc);
}
fMCHist_Modes = new TrueModeStack( (fName + "_MODES").c_str(), ("True Channels"), fMCHist);
SetAutoProcessTH1(fMCHist_Modes, kCMD_Reset, kCMD_Norm, kCMD_Write);
return;
}
//********************************************************************
void Measurement1D::SetDataValues(std::string dataFile) {
//********************************************************************
// Override this function if the input file isn't in a suitable format
LOG(SAM) << "Reading data from: " << dataFile.c_str() << std::endl;
fDataHist =
PlotUtils::GetTH1DFromFile(dataFile, (fName + "_data"), fPlotTitles);
fDataTrue = (TH1D*)fDataHist->Clone();
// Number of data points is number of bins
fNDataPointsX = fDataHist->GetXaxis()->GetNbins();
return;
};
//********************************************************************
void Measurement1D::SetDataFromDatabase(std::string inhistfile,
std::string histname) {
//********************************************************************
LOG(SAM) << "Filling histogram from " << inhistfile << "->" << histname
<< std::endl;
fDataHist = PlotUtils::GetTH1DFromRootFile(
(GeneralUtils::GetTopLevelDir() + "/data/" + inhistfile), histname);
fDataHist->SetNameTitle((fName + "_data").c_str(), (fName + "_data").c_str());
return;
};
//********************************************************************
void Measurement1D::SetDataFromFile(std::string inhistfile,
std::string histname) {
//********************************************************************
LOG(SAM) << "Filling histogram from " << inhistfile << "->" << histname
<< std::endl;
fDataHist = PlotUtils::GetTH1DFromRootFile((inhistfile), histname);
fDataHist->SetNameTitle((fName + "_data").c_str(), (fName + "_data").c_str());
return;
};
//********************************************************************
void Measurement1D::SetCovarMatrix(std::string covarFile) {
//********************************************************************
// Covariance function, only really used when reading in the MB Covariances.
TFile* tempFile = new TFile(covarFile.c_str(), "READ");
TH2D* covarPlot = new TH2D();
// TH2D* decmpPlot = new TH2D();
TH2D* covarInvPlot = new TH2D();
TH2D* fFullCovarPlot = new TH2D();
std::string covName = "";
std::string covOption = FitPar::Config().GetParS("thrown_covariance");
if (fIsShape || fIsFree) covName = "shp_";
if (fIsDiag)
covName += "diag";
else
covName += "full";
covarPlot = (TH2D*)tempFile->Get((covName + "cov").c_str());
covarInvPlot = (TH2D*)tempFile->Get((covName + "covinv").c_str());
if (!covOption.compare("SUB"))
fFullCovarPlot = (TH2D*)tempFile->Get((covName + "cov").c_str());
else if (!covOption.compare("FULL"))
fFullCovarPlot = (TH2D*)tempFile->Get("fullcov");
else
ERR(WRN) << "Incorrect thrown_covariance option in parameters."
<< std::endl;
int dim = int(fDataHist->GetNbinsX()); //-this->masked->Integral());
int covdim = int(fDataHist->GetNbinsX());
this->covar = new TMatrixDSym(dim);
fFullCovar = new TMatrixDSym(dim);
fDecomp = new TMatrixDSym(dim);
int row, column = 0;
row = 0;
column = 0;
for (Int_t i = 0; i < covdim; i++) {
// if (this->masked->GetBinContent(i+1) > 0) continue;
for (Int_t j = 0; j < covdim; j++) {
// if (this->masked->GetBinContent(j+1) > 0) continue;
(*this->covar)(row, column) = covarPlot->GetBinContent(i + 1, j + 1);
(*fFullCovar)(row, column) = fFullCovarPlot->GetBinContent(i + 1, j + 1);
column++;
}
column = 0;
row++;
}
// Set bin errors on data
if (!fIsDiag) {
StatUtils::SetDataErrorFromCov(fDataHist, fFullCovar);
}
// Get Deteriminant and inverse matrix
// fCovDet = this->covar->Determinant();
TDecompSVD LU = TDecompSVD(*this->covar);
this->covar = new TMatrixDSym(dim, LU.Invert().GetMatrixArray(), "");
return;
};
//********************************************************************
// Sets the covariance matrix from a provided file in a text format
// scale is a multiplicative pre-factor to apply in the case where the
// covariance is given in some unit (e.g. 1E-38)
void Measurement1D::SetCovarMatrixFromText(std::string covarFile, int dim,
double scale) {
//********************************************************************
// Make a counter to track the line number
int row = 0;
std::string line;
std::ifstream covarread(covarFile.c_str(), ifstream::in);
this->covar = new TMatrixDSym(dim);
fFullCovar = new TMatrixDSym(dim);
if (covarread.is_open())
LOG(SAM) << "Reading covariance matrix from file: " << covarFile
<< std::endl;
else
ERR(FTL) << "Covariance matrix provided is incorrect: " << covarFile
<< std::endl;
// Loop over the lines in the file
while (std::getline(covarread >> std::ws, line, '\n')) {
int column = 0;
// Loop over entries and insert them into matrix
std::vector<double> entries = GeneralUtils::ParseToDbl(line, " ");
if (entries.size() <= 1) {
ERR(WRN) << "SetCovarMatrixFromText -> Covariance matrix only has <= 1 "
"entries on this line: "
<< row << std::endl;
}
for (std::vector<double>::iterator iter = entries.begin();
iter != entries.end(); iter++) {
(*covar)(row, column) = *iter;
(*fFullCovar)(row, column) = *iter;
column++;
}
row++;
}
covarread.close();
// Scale the actualy covariance matrix by some multiplicative factor
(*fFullCovar) *= scale;
// Robust matrix inversion method
TDecompSVD LU = TDecompSVD(*this->covar);
// THIS IS ACTUALLY THE INVERSE COVARIANCE MATRIXA AAAAARGH
delete this->covar;
this->covar = new TMatrixDSym(dim, LU.Invert().GetMatrixArray(), "");
// Now need to multiply by the scaling factor
// If the covariance
(*this->covar) *= 1. / (scale);
return;
};
//********************************************************************
void Measurement1D::SetCovarMatrixFromCorrText(std::string corrFile, int dim) {
//********************************************************************
// Make a counter to track the line number
int row = 0;
std::string line;
std::ifstream corr(corrFile.c_str(), ifstream::in);
this->covar = new TMatrixDSym(dim);
this->fFullCovar = new TMatrixDSym(dim);
if (corr.is_open())
LOG(SAM) << "Reading and converting correlation matrix from file: "
<< corrFile << std::endl;
else {
ERR(FTL) << "Correlation matrix provided is incorrect: " << corrFile
<< std::endl;
exit(-1);
}
while (std::getline(corr >> std::ws, line, '\n')) {
int column = 0;
// Loop over entries and insert them into matrix
// Multiply by the errors to get the covariance, rather than the correlation
// matrix
std::vector<double> entries = GeneralUtils::ParseToDbl(line, " ");
for (std::vector<double>::iterator iter = entries.begin();
iter != entries.end(); iter++) {
double val = (*iter) * this->fDataHist->GetBinError(row + 1) * 1E38 *
this->fDataHist->GetBinError(column + 1) * 1E38;
if (val == 0) {
ERR(FTL) << "Found a zero value in the covariance matrix, assuming "
"this is an error!"
<< std::endl;
exit(-1);
}
(*this->covar)(row, column) = val;
(*this->fFullCovar)(row, column) = val;
column++;
}
row++;
}
// Robust matrix inversion method
TDecompSVD LU = TDecompSVD(*this->covar);
delete this->covar;
this->covar = new TMatrixDSym(dim, LU.Invert().GetMatrixArray(), "");
return;
};
//********************************************************************
// FullUnits refers to if we have "real" unscaled units in the covariance matrix, e.g. 1E-76.
// If this is the case we need to scale it so that the chi2 contribution is correct
// NUISANCE internally assumes the covariance matrix has units of 1E76
void Measurement1D::SetCovarFromDataFile(std::string covarFile,
std::string covName, bool FullUnits) {
//********************************************************************
LOG(SAM) << "Getting covariance from " << covarFile << "->" << covName
<< std::endl;
TFile* tempFile = new TFile(covarFile.c_str(), "READ");
TH2D* covPlot = (TH2D*)tempFile->Get(covName.c_str());
covPlot->SetDirectory(0);
// Scale the covariance matrix if it comes in normal units
if (FullUnits) {
covPlot->Scale(1.E76);
}
int dim = covPlot->GetNbinsX();
fFullCovar = new TMatrixDSym(dim);
for (int i = 0; i < dim; i++) {
for (int j = 0; j < dim; j++) {
(*fFullCovar)(i, j) = covPlot->GetBinContent(i + 1, j + 1);
}
}
this->covar = (TMatrixDSym*)fFullCovar->Clone();
fDecomp = (TMatrixDSym*)fFullCovar->Clone();
TDecompSVD LU = TDecompSVD(*this->covar);
this->covar = new TMatrixDSym(dim, LU.Invert().GetMatrixArray(), "");
TDecompChol LUChol = TDecompChol(*fDecomp);
LUChol.Decompose();
fDecomp = new TMatrixDSym(dim, LU.GetU().GetMatrixArray(), "");
return;
};
// //********************************************************************
// void Measurement1D::SetBinMask(std::string maskFile) {
// //********************************************************************
// // Create a mask histogram.
// int nbins = fDataHist->GetNbinsX();
// fMaskHist =
// new TH1I((fName + "_fMaskHist").c_str(),
// (fName + "_fMaskHist; Bin; Mask?").c_str(), nbins, 0, nbins);
// std::string line;
// std::ifstream mask(maskFile.c_str(), ifstream::in);
// if (mask.is_open())
// LOG(SAM) << "Reading bin mask from file: " << maskFile << std::endl;
// else
// LOG(FTL) << " Cannot find mask file." << std::endl;
// while (std::getline(mask >> std::ws, line, '\n')) {
// std::vector<int> entries = GeneralUtils::ParseToInt(line, " ");
// // Skip lines with poorly formatted lines
// if (entries.size() < 2) {
// LOG(WRN) << "Measurement1D::SetBinMask(), couldn't parse line: " << line
// << std::endl;
// continue;
// }
// // The first index should be the bin number, the second should be the mask
// // value.
// fMaskHist->SetBinContent(entries[0], entries[1]);
// }
// // Set masked data bins to zero
// PlotUtils::MaskBins(fDataHist, fMaskHist);
// return;
// }
// //********************************************************************
// void Measurement1D::GetBinContents(std::vector<double>& cont,
// std::vector<double>& err) {
// //********************************************************************
// // Return a vector of the main bin contents
// for (int i = 0; i < fMCHist->GetNbinsX(); i++) {
// cont.push_back(fMCHist->GetBinContent(i + 1));
// err.push_back(fMCHist->GetBinError(i + 1));
// }
// return;
// };
/*
XSec Functions
*/
// //********************************************************************
// void Measurement1D::SetFluxHistogram(std::string fluxFile, int minE, int
// maxE,
// double fluxNorm) {
// //********************************************************************
// // Note this expects the flux bins to be given in terms of MeV
// LOG(SAM) << "Reading flux from file: " << fluxFile << std::endl;
// TGraph f(fluxFile.c_str(), "%lg %lg");
// fFluxHist =
// new TH1D((fName + "_flux").c_str(), (fName + "; E_{#nu} (GeV)").c_str(),
// f.GetN() - 1, minE, maxE);
// Double_t* yVal = f.GetY();
// for (int i = 0; i < fFluxHist->GetNbinsX(); ++i)
// fFluxHist->SetBinContent(i + 1, yVal[i] * fluxNorm);
// };
// //********************************************************************
// double Measurement1D::TotalIntegratedFlux(std::string intOpt, double low,
// double high) {
// //********************************************************************
// if (fInput->GetType() == kGiBUU) {
// return 1.0;
// }
// // The default case of low = -9999.9 and high = -9999.9
// if (low == -9999.9) low = this->EnuMin;
// if (high == -9999.9) high = this->EnuMax;
// int minBin = fFluxHist->GetXaxis()->FindBin(low);
// int maxBin = fFluxHist->GetXaxis()->FindBin(high);
// // Get integral over custom range
// double integral = fFluxHist->Integral(minBin, maxBin + 1, intOpt.c_str());
// return integral;
// };
diff --git a/src/K2K/K2K_NC1pi0_Evt_1Dppi0_nu.cxx b/src/K2K/K2K_NC1pi0_Evt_1Dppi0_nu.cxx
index ffcd51c..e93aee9 100644
--- a/src/K2K/K2K_NC1pi0_Evt_1Dppi0_nu.cxx
+++ b/src/K2K/K2K_NC1pi0_Evt_1Dppi0_nu.cxx
@@ -1,73 +1,73 @@
// 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 <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "K2K_NC1pi0_Evt_1Dppi0_nu.h"
// The constructor
K2K_NC1pi0_Evt_1Dppi0_nu::K2K_NC1pi0_Evt_1Dppi0_nu(nuiskey samplekey){
// Sample overview ---------------------------------------------------
std::string descrip = "K2K_NC1pi0_Evt_1Dppi0_nu sample. \n" \
"Target: D2 \n" \
"Flux: \n" \
"Signal: \n";
// Setup common settings
fSettings = LoadSampleSettings(samplekey);
fSettings.SetDescription(descrip);
fSettings.SetXTitle("p_{#pi^{0}} (MeV/c)");
fSettings.SetYTitle("Number of events");
fSettings.SetAllowedTypes("EVT/SHAPE/DIAG", "EVT/SHAPE/DIAG/Q2CORR/MASK");
fSettings.SetEnuRange(0.0, 5.0);
fSettings.DefineAllowedTargets("H,O");
// plot information
fSettings.SetTitle("K2K_NC1pi0_Evt_1Dppi0_nu");
fSettings.DefineAllowedSpecies("numu");
fSettings.SetDataInput( FitPar::GetDataBase() + "K2K/nc1pi0/ppi0.csv");
FinaliseSampleSettings();
// Scaling Setup ---------------------------------------------------
// ScaleFactor for shape
fScaleFactor = (fDataHist->Integral() / (fNEvents + 0.));
// Plot Setup -------------------------------------------------------
- SetDataFromRootFile( fSettings.GetDataInput() );
+ SetDataFromTextFile( fSettings.GetDataInput() );
SetCovarFromDiagonal();
// Final setup ---------------------------------------------------
FinaliseMeasurement();
};
void K2K_NC1pi0_Evt_1Dppi0_nu::FillEventVariables(FitEvent *event) {
if (event->NumFSParticle(111) == 0)
return;
TLorentzVector Ppi0 = event->GetHMFSParticle(111)->fP;
double ppi0 = FitUtils::p(Ppi0)*1000.;
fXVar = ppi0;
return;
};
bool K2K_NC1pi0_Evt_1Dppi0_nu::isSignal(FitEvent *event) {
return SignalDef::isNC1pi(event, 14, 111, EnuMin, EnuMax); // Check this signal definition
}
diff --git a/src/MiniBooNE/CMakeLists.txt b/src/MiniBooNE/CMakeLists.txt
index 6e32aef..3e95124 100644
--- a/src/MiniBooNE/CMakeLists.txt
+++ b/src/MiniBooNE/CMakeLists.txt
@@ -1,100 +1,100 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
set(IMPLFILES
MiniBooNE_CC1pi0_XSec_1Dcosmu_nu.cxx
MiniBooNE_CC1pip_XSec_2DTpiCospi_nu.cxx
MiniBooNE_CC1pi0_XSec_1Dcospi0_nu.cxx
MiniBooNE_CC1pip_XSec_2DTpiEnu_nu.cxx
MiniBooNE_CC1pi0_XSec_1DEnu_nu.cxx
MiniBooNE_CC1pip_XSec_2DTuCosmu_nu.cxx
MiniBooNE_CC1pi0_XSec_1Dppi0_nu.cxx
MiniBooNE_CC1pip_XSec_2DTuEnu_nu.cxx
MiniBooNE_CC1pi0_XSec_1DQ2_nu.cxx
MiniBooNE_CCQE_XSec_1DQ2_antinu.cxx
MiniBooNE_CC1pi0_XSec_1DTu_nu.cxx
MiniBooNE_CC1pip_XSec_1DEnu_nu.cxx
MiniBooNE_CCQE_XSec_1DQ2_nu.cxx
MiniBooNE_CC1pip_XSec_1DQ2_nu.cxx
MiniBooNE_CCQE_XSec_2DTcos_antinu.cxx
MiniBooNE_CC1pip_XSec_1DTpi_nu.cxx
MiniBooNE_CCQE_XSec_2DTcos_nu.cxx
MiniBooNE_CC1pip_XSec_1DTu_nu.cxx
-# MiniBooNE_NCEL_XSec_Treco_nu.cxx
+MiniBooNE_NCEL_XSec_Treco_nu.cxx
MiniBooNE_CC1pip_XSec_2DQ2Enu_nu.cxx
MiniBooNE_NC1pi0_XSec_1Dppi0_nu.cxx
MiniBooNE_NC1pi0_XSec_1Dcospi0_nu.cxx
MiniBooNE_NC1pi0_XSec_1Dppi0_antinu.cxx
MiniBooNE_NC1pi0_XSec_1Dcospi0_antinu.cxx
)
set(HEADERFILES
MiniBooNE_CC1pi0_XSec_1Dcosmu_nu.h
MiniBooNE_CC1pip_XSec_2DTpiCospi_nu.h
MiniBooNE_CC1pi0_XSec_1Dcospi0_nu.h
MiniBooNE_CC1pip_XSec_2DTpiEnu_nu.h
MiniBooNE_CC1pi0_XSec_1DEnu_nu.h
MiniBooNE_CC1pip_XSec_2DTuCosmu_nu.h
MiniBooNE_CC1pi0_XSec_1Dppi0_nu.h
MiniBooNE_CC1pip_XSec_2DTuEnu_nu.h
MiniBooNE_CC1pi0_XSec_1DQ2_nu.h
MiniBooNE_CCQE_XSec_1DQ2_antinu.h
MiniBooNE_CC1pi0_XSec_1DTu_nu.h
MiniBooNE_CC1pip_XSec_1DEnu_nu.h
MiniBooNE_CCQE_XSec_1DQ2_nu.h
MiniBooNE_CC1pip_XSec_1DQ2_nu.h
MiniBooNE_CCQE_XSec_2DTcos_antinu.h
MiniBooNE_CC1pip_XSec_1DTpi_nu.h
MiniBooNE_CCQE_XSec_2DTcos_nu.h
MiniBooNE_CC1pip_XSec_1DTu_nu.h
-# MiniBooNE_NCEL_XSec_Treco_nu.h
+MiniBooNE_NCEL_XSec_Treco_nu.h
MiniBooNE_CC1pip_XSec_2DQ2Enu_nu.h
MiniBooNE_NC1pi0_XSec_1Dppi0_nu.h
MiniBooNE_NC1pi0_XSec_1Dcospi0_nu.h
MiniBooNE_NC1pi0_XSec_1Dppi0_antinu.h
MiniBooNE_NC1pi0_XSec_1Dcospi0_antinu.h
MiniBooNE_Boxes.h
)
set(LIBNAME expMiniBooNE)
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
add_library(${LIBNAME} STATIC ${IMPLFILES})
else(CMAKE_BUILD_TYPE MATCHES RELEASE)
add_library(${LIBNAME} SHARED ${IMPLFILES})
endif()
include_directories(${RWENGINE_INCLUDE_DIRECTORIES})
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
include_directories(${CMAKE_SOURCE_DIR}/src/Utils)
include_directories(${CMAKE_SOURCE_DIR}/src/Reweight)
include_directories(${CMAKE_SOURCE_DIR}/src/Splines)
set_target_properties(${LIBNAME} PROPERTIES VERSION
"${ExtFit_VERSION_MAJOR}.${ExtFit_VERSION_MINOR}.${ExtFit_VERSION_REVISION}")
set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS ${ROOT_LD_FLAGS})
if(DEFINED PROJECTWIDE_EXTRA_DEPENDENCIES)
add_dependencies(${LIBNAME} ${PROJECTWIDE_EXTRA_DEPENDENCIES})
endif()
install(TARGETS ${LIBNAME} DESTINATION lib)
#Can uncomment this to install the headers... but is it really neccessary?
#install(FILES ${HEADERFILES} DESTINATION include)
set(MODULETargets ${MODULETargets} ${LIBNAME} PARENT_SCOPE)
diff --git a/src/MiniBooNE/MiniBooNE_NCEL_XSec_Treco_nu.cxx b/src/MiniBooNE/MiniBooNE_NCEL_XSec_Treco_nu.cxx
index 5a1eb89..dacb4e8 100644
--- a/src/MiniBooNE/MiniBooNE_NCEL_XSec_Treco_nu.cxx
+++ b/src/MiniBooNE/MiniBooNE_NCEL_XSec_Treco_nu.cxx
@@ -1,224 +1,264 @@
// 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 <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "MiniBooNE_NCEL_XSec_Treco_nu.h"
#include "TLorentzVector.h"
-// The constructor
-MiniBooNE_NCEL_XSec_Treco_nu::MiniBooNE_NCEL_XSec_Treco_nu(std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile){
-
- fName = "MiniBooNE_NCEL_XSec_Treco_nu";
- fPlotTitles = "; T_{reco} (MeV); Events/(12 MeV)";
- EnuMin = 0.;
- EnuMax = 10.0;
- fTRecoEdges = {40.0, 52.0, 63.9, 75.9, 87.8, 99.8, 111.8, 123.7, 135.7, 147.6, 159.6, 171.6, 183.5, 195.5,
- 207.5, 219.4, 231.4, 243.3, 255.3, 267.3, 279.2, 291.2, 303.1, 315.1, 327.1, 339.0, 351.0, 362.9, 374.9, 386.9,
- 398.8, 410.8, 422.7, 434.7, 446.7, 458.6, 470.6, 482.5, 494.5, 506.5, 518.4, 530.4, 542.4, 554.3, 566.3, 578.2,
- 590.2, 602.2, 614.1, 626.1, 638.0, 650.0};
+//********************************************************************
+MiniBooNE_NCEL_XSec_Treco_nu::MiniBooNE_NCEL_XSec_Treco_nu(nuiskey samplekey) {
+//********************************************************************
+
+ // Sample overview ---------------------------------------------------
+ std::string descrip = "MiniBooNE_NCEL_XSec_Treco_nu sample. \n" \
+ "Target: CH \n" \
+ "Flux: MiniBooNE Numu Flux \n" \
+ "Signal: Any event with True NCEL modes \n";
+
+ // Setup common settings
+ fSettings = LoadSampleSettings(samplekey);
+ fSettings.SetDescription(descrip);
+ fSettings.SetXTitle("T_{reco} (MeV)");
+ fSettings.SetYTitle("Events/(12 MeV)");
+ fSettings.SetAllowedTypes("FIX,FREE,SHAPE/FULL,DIAG/NORM/MASK", "FIX/FULL,DIAG");
+ fSettings.DefineAllowedTargets("C,H");
+ fSettings.DefineAllowedSpecies("numu");
+ fSettings.SetEnuRange(0.0, 10.0);
+
+arr_treco = {40.0, 52.0, 63.9, 75.9, 87.8, 99.8, 111.8, 123.7, 135.7, 147.6, 159.6, 171.6, 183.5, 195.5,
+ 207.5, 219.4, 231.4, 243.3, 255.3, 267.3, 279.2, 291.2, 303.1, 315.1, 327.1, 339.0, 351.0, 362.9, 374.9, 386.9,
+ 398.8, 410.8, 422.7, 434.7, 446.7, 458.6, 470.6, 482.5, 494.5, 506.5, 518.4, 530.4, 542.4, 554.3, 566.3, 578.2,
+ 590.2, 602.2, 614.1, 626.1, 638.0, 650.0};
+
+ SetDataValues(FitPar::GetDataBase()+"/MiniBooNE/ncqe/input_data.txt");
+ SetCovarMatrix(FitPar::GetDataBase()+"/MiniBooNE/ncqe/ErrorMatrix.tab", 51);
+ SetResponseMatrix(FitPar::GetDataBase()+"/MiniBooNE/ncqe/response_mat.txt", 51);
+ SetFluxHistogram(FitPar::GetDataBase()+"/MiniBooNE/ncqe/flux.txt");
+
+ FinaliseSampleSettings();
+
+ // Scaling Setup ---------------------------------------------------
+ // The scale factor is quite complicated because MB didn't divide by number of targets.
+ // nMolMB is the number of CH_2 molecules in the MB FV (610.6 cm radius sphere) and 0.845 is the published density of the mineral oil.
+ // UPDATE: nMolMB is the number of CH_2 molecules in the MB FV (500 cm radius sphere) and 0.845 is the published density of the mineral oil.
+ // UPDATE UPDATE: They didn't account for fiducial cut, so neither do we.
+ double nMolMB = 6.023E+23*0.845*4.0*M_PI*610.6*610.6*610.6/3.0;
+ double POT = 6.46e20;
- SetDataValues(FitPar::GetDataBase()+"/MiniBooNE/ncqe/input_data.txt");
- SetCovarMatrix(FitPar::GetDataBase()+"/MiniBooNE/ncqe/ErrorMatrix.tab", 51);
- SetResponseMatrix(FitPar::GetDataBase()+"/MiniBooNE/ncqe/response_mat.txt", 51);
+ // Need to update scalefactor to reflect actual flux used
+ fScaleFactor = (this->newFluxHist->Integral("")*POT*(GetEventHistogram()->Integral("width"))*1E-38*14.08/(fNEvents+0.))*nMolMB;
+ fScaleFactor /= GetFluxHistogram()->Integral("width");
- // Setup MC Hists
- Measurement1D::SetupDefaultHist();
+ // Final setup ---------------------------------------------------
+ FinaliseMeasurement();
// Usually the MCFine histogram is a finer binned version of MC Hist.
// In this case we need to use it to save the true distribution before smearing.
- if (fMCFine) delete fMCFine;
- fMCFine = new TH1D((this->fName+"_Ttrue").c_str(), (this->fName+this->fPlotTitles).c_str(), 50, 0, 900);
+ if (fMCFine) delete fMCFine;
+ fMCFine = new TH1D((this->fName+"_Ttrue").c_str(), (this->fName+this->fPlotTitles).c_str(), 50, 0, 900);
- // The scale factor is quite complicated because MB didn't divide by number of targets.
- // nMolMB is the number of CH_2 molecules in the MB FV (610.6 cm radius sphere) and 0.845 is the published density of the mineral oil.
- double nMolMB = 6.023E+23*0.845*4.0*M_PI*610.6*610.6*610.6/3.0;
- fScaleFactor = (GetEventHistogram()->Integral("width")*1E-38*14.08/(fNEvents+0.))*nMolMB*0.646165;
- };
+};
+
- void MiniBooNE_NCEL_XSec_Treco_nu::FillEventVariables(FitEvent *event){
+void MiniBooNE_NCEL_XSec_Treco_nu::Write(std::string arg){
+ newFluxHist->Write("MB_NCEL_newFlux");
+ response_mat->Write("MB_NCEL_response matrix");
+
+ Measurement1D::Write(arg);
+ return;
+}
+
+void MiniBooNE_NCEL_XSec_Treco_nu::FillEventVariables(FitEvent *event){
double t_raw = 0.0;
// Loop and add all Tnucleon
for (UInt_t i = 0; i < event->Npart(); i++){
if (event->PartInfo(i)->Status() != kFinalState) continue;
int pdg = event->PartInfo(i)->fPID;
if (pdg == 2212 || pdg == 2112){
t_raw += FitUtils::T(event->PartInfo(i)->fP)*1.E3;
}
}
fXVar = t_raw;
}
-bool MiniBooNE_NCEL_XSec_Treco_nu::ScaleEvents(){
+void MiniBooNE_NCEL_XSec_Treco_nu::ScaleEvents(){
// Now convert Ttrue to Treco...
for (int treco = 0; treco < 51; ++treco){
double total = 0.;
- for (int ttrue = 0; ttrue < 50; ++ttrue) total += fMCFine->GetBinContent(ttrue+1)*response_mat->GetBinContent(ttrue+1, treco+1);
- fMCHist->SetBinContent(treco+1, total);
+ for (int ttrue = 0; ttrue < 50; ++ttrue)
+ total += fMCFine->GetBinContent(ttrue+1)*response_mat->GetBinContent(ttrue+1, treco+1);
+ fMCHist->SetBinContent(treco+1, total);
}
// Scale
this->fMCHist->Scale(this->fScaleFactor, "width");
this->fMCFine->Scale(this->fScaleFactor, "width");
PlotUtils::ScaleNeutModeArray((TH1**)fMCHist_PDG, fScaleFactor, "width");
// Add in the backgrounds...
for (int treco = 0; treco < 51; ++treco){
- double total = this->fMCHist->GetBinContent(treco+1) + this->BKGD_other->GetBinContent(treco+1) + this->BKGD_irrid->GetBinContent(treco+1);
- this->fMCHist->SetBinContent(treco+1, total);
+ double total = this->fMCHist->GetBinContent(treco+1) + this->BKGD_other->GetBinContent(treco+1) + this->BKGD_irrid->GetBinContent(treco+1);
+ this->fMCHist->SetBinContent(treco+1, total);
}
}
bool MiniBooNE_NCEL_XSec_Treco_nu::isSignal(FitEvent *event){
// Should put in MB SignalDef eventually
if (event->Mode != 51 && event->Mode != 52) return false;
// Numu or nue
- if (event->PDGnu != 14 && event->PDGnu != 12) return false;
+ if (event->PDGnu() != 14 && event->PDGnu() != 12) return false;
// Enu
if (event->Enu() < EnuMin*1000.0 || event->Enu() > EnuMax*1000.0)
return false;
return true;
};
+void MiniBooNE_NCEL_XSec_Treco_nu::SetFluxHistogram(std::string dataFile){
+ this->newFluxHist = PlotUtils::GetTH1DFromFile(dataFile.c_str(),
+ (this->fName+"Real Flux Hist"), "idgaf");
+ this->newFluxHist->Print();
+ return;
+}
// Read in the covariance matrix from the file specified in the constructor
void MiniBooNE_NCEL_XSec_Treco_nu::SetCovarMatrix(std::string covarFile, int dim){
// Use Utils
// // Make a counter to track the line number
- // int row = 0;
+ int row = 0;
- // std::string line;
- // std::ifstream covar(covarFile.c_str(),ifstream::in);
+ std::string line;
+ std::ifstream covar(covarFile.c_str(),ifstream::in);
- // this->covar = new TMatrixDSym(dim);
+ this->covar = new TMatrixDSym(dim);
- // if(covar.is_open()) LOG(DEB) << "Reading covariance matrix from file: " << covarFile << std::endl;
+ if(covar.is_open()) LOG(DEB) << "Reading covariance matrix from file: " << covarFile << std::endl;
- // while(std::getline(covar >> std::ws, line, '\n')){
- // std::istringstream stream(line);
- // double entry;
- // int column = 0;
+ while(std::getline(covar >> std::ws, line, '\n')){
+ std::istringstream stream(line);
+ double entry;
+ int column = 0;
- // // Loop over entries and insert them into matrix
- // // Multiply by the errors to get the covariance, rather than the correlation matrix
- // while(stream >> entry){
- // (*this->covar)(row, column) = entry;
- // if (row == column) this->fDataHist->SetBinError(row+1, sqrt(entry));
- // column++;
- // }
- // row++;
- // }
+ // Loop over entries and insert them into matrix
+ // Multiply by the errors to get the covariance, rather than the correlation matrix
+ while(stream >> entry){
+ (*this->covar)(row, column) = entry;
+ if (row == column) this->fDataHist->SetBinError(row+1, sqrt(entry));
+ column++;
+ }
+ row++;
+ }
// // Robust matrix inversion method
- // TDecompSVD LU = TDecompSVD(*this->covar);
- // this->covar = new TMatrixDSym(dim, LU .Invert().GetMatrixArray(), "");
+ TDecompSVD LU = TDecompSVD(*this->covar);
+ this->covar = new TMatrixDSym(dim, LU .Invert().GetMatrixArray(), "");
return;
};
// Override the usual function in the base class because this is more complicated for the NCEL sample...
void MiniBooNE_NCEL_XSec_Treco_nu::SetDataValues(std::string inputFile){
- std::string line;
- std::ifstream input(inputFile.c_str(),ifstream::in);
+ std::string line;
+ std::ifstream input(inputFile.c_str(),ifstream::in);
- if(input.is_open()) LOG(DEB) << "Reading data from file: " << inputFile << std::endl;
+ if(input.is_open()) LOG(DEB) << "Reading data from file: " << inputFile << std::endl;
- this->fDataHist = new TH1D((this->fName+"_data").c_str(), (this->fName+this->fPlotTitles).c_str(),
- 51, this->arr_treco);
- this->BKGD_other = new TH1D((this->fName+"_BKGD_other").c_str(), (this->fName+this->fPlotTitles).c_str(),
- 51, arr_treco);
- this->BKGD_irrid = new TH1D((this->fName+"_BKGD_irrid").c_str(), (this->fName+this->fPlotTitles).c_str(),
- 51, arr_treco);
- To get the nDOF correct...
- this->fNDataPointsX= 52;
+ this->fDataHist = new TH1D((this->fName+"_data").c_str(), (this->fName+this->fPlotTitles).c_str(),
+ 51, this->arr_treco);
+ this->BKGD_other = new TH1D((this->fName+"_BKGD_other").c_str(), (this->fName+this->fPlotTitles).c_str(),
+ 51, arr_treco);
+ this->BKGD_irrid = new TH1D((this->fName+"_BKGD_irrid").c_str(), (this->fName+this->fPlotTitles).c_str(),
+ 51, arr_treco);
+ // To get the nDOF correct...
+ this->fNDataPointsX= 52;
- double entry = 0;
- int xBin = 0;
+ double entry = 0;
+ int xBin = 0;
// First line is the MB data
- std::getline(input >> std::ws, line, '\n');
- std::istringstream stream1(line);
-
- while(stream1 >> entry){
- this->fDataHist->SetBinContent(xBin+1, entry);
- xBin++;
- }
-
- // Second line is "other" backgrounds
- std::getline(input >> std::ws, line, '\n');
- std::istringstream stream2(line);
- entry = 0;
- xBin = 0;
- while(stream2 >> entry){
- this->BKGD_other->SetBinContent(xBin+1, entry);
- xBin++;
- }
+ std::getline(input >> std::ws, line, '\n');
+ std::istringstream stream1(line);
+
+ while(stream1 >> entry){
+ this->fDataHist->SetBinContent(xBin+1, entry);
+ xBin++;
+ }
+
+ // Second line is "other" backgrounds
+ std::getline(input >> std::ws, line, '\n');
+ std::istringstream stream2(line);
+ entry = 0;
+ xBin = 0;
+ while(stream2 >> entry){
+ this->BKGD_other->SetBinContent(xBin+1, entry);
+ xBin++;
+ }
// Third line is the irreducible background
- std::getline(input >> std::ws, line, '\n');
- std::istringstream stream3(line);
- entry = 0;
- xBin = 0;
- while(stream3 >> entry){
- this->BKGD_irrid->SetBinContent(xBin+1, entry);
- xBin++;
- }
+ std::getline(input >> std::ws, line, '\n');
+ std::istringstream stream3(line);
+ entry = 0;
+ xBin = 0;
+ while(stream3 >> entry){
+ this->BKGD_irrid->SetBinContent(xBin+1, entry);
+ xBin++;
+ }
};
// Read in the response matrix -- thus far, a response matrix is unique to the NCEL sample
void MiniBooNE_NCEL_XSec_Treco_nu::SetResponseMatrix(std::string responseFile, int dim){
// Make a counter to track the line number
- // int xBin = 0;
-
- // std::string line;
- // std::ifstream response(responseFile.c_str(),ifstream::in);
-
- // // Response matrix: x axis is Ttrue, y axis is Treco
- // this->response_mat = new TH2D((this->fName+"_RESPONSE_MATRIX").c_str(), (this->fName+this->fPlotTitles).c_str(),
- // 50, 0, 900, 51, this->arr_treco);
-
- // if(response.is_open()) LOG(DEB) << "Reading in the response matrix from file: " << responseFile << std::endl;
-
- // while(std::getline(response, line, '\n')){
- // std::istringstream stream(line);
- // double entry;
- // int yBin = 0;
-
- // // Loop over entries and insert them into matrix
- // // Multiply by the errors to get the covariance, rather than the correlation matrix
- // while(stream >> entry){
- // this->response_mat->SetBinContent(xBin+1, yBin+1, entry);
- // yBin++;
- // }
- // xBin++;
- // }
+ int xBin = 0;
+
+ std::string line;
+ std::ifstream response(responseFile.c_str(),ifstream::in);
+
+ // Response matrix: x axis is Ttrue, y axis is Treco
+ this->response_mat = new TH2D((this->fName+"_RESPONSE_MATRIX").c_str(), (this->fName+this->fPlotTitles).c_str(),
+ 50, 0, 900, 51, this->arr_treco);
+
+ if(response.is_open()) LOG(DEB) << "Reading in the response matrix from file: " << responseFile << std::endl;
+
+ while(std::getline(response, line, '\n')){
+ std::istringstream stream(line);
+ double entry;
+ int yBin = 0;
+
+ // Loop over entries and insert them into matrix
+ // Multiply by the errors to get the covariance, rather than the correlation matrix
+ while(stream >> entry){
+ this->response_mat->SetBinContent(xBin+1, yBin+1, entry);
+ yBin++;
+ }
+ xBin++;
+ }
};
diff --git a/src/MiniBooNE/MiniBooNE_NCEL_XSec_Treco_nu.h b/src/MiniBooNE/MiniBooNE_NCEL_XSec_Treco_nu.h
index 5885153..d5a2fca 100644
--- a/src/MiniBooNE/MiniBooNE_NCEL_XSec_Treco_nu.h
+++ b/src/MiniBooNE/MiniBooNE_NCEL_XSec_Treco_nu.h
@@ -1,56 +1,61 @@
// 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 <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef MINIBOONE_NCEL_XSEC_TRECO_NU_H_SEEN
#define MINIBOONE_NCEL_XSEC_RECO_NU_H_SEEN
#include "Measurement1D.h"
//********************************************************************
class MiniBooNE_NCEL_XSec_Treco_nu : public Measurement1D {
//********************************************************************
public:
+ void Write(std::string arg);
+
+ MiniBooNE_NCEL_XSec_Treco_nu(nuiskey samplekey);
- MiniBooNE_NCEL_XSec_Treco_nu(std::string inputfile, FitWeight *rw, std::string type, std::string fakeDataFile);
virtual ~MiniBooNE_NCEL_XSec_Treco_nu() {};
void FillEventVariables(FitEvent *event);
bool isSignal(FitEvent *event);
void ScaleEvents();
void SetDataValues(std::string inputFile);
private:
void SetCovarMatrix(std::string covarFile, int dim);
void SetResponseMatrix(std::string responseFile, int dim);
+ void SetFluxHistogram(std::string dataFile);
+
// Because the Treco binning is irregular, store an array of bin edges...
double arr_treco[52];
+ TH1D *newFluxHist;
TH1D *BKGD_other;
TH1D *BKGD_irrid;
TH2D *response_mat;
};
#endif
diff --git a/src/T2K/CMakeLists.txt b/src/T2K/CMakeLists.txt
index 4c9e64e..5656f6e 100644
--- a/src/T2K/CMakeLists.txt
+++ b/src/T2K/CMakeLists.txt
@@ -1,87 +1,89 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
set(IMPLFILES
T2K_CC0pi_XSec_2DPcos_nu.cxx
T2K_CC1pip_CH_XSec_1DQ2_nu.cxx
T2K_CC1pip_CH_XSec_1DWrec_nu.cxx
T2K_CC1pip_CH_XSec_1Dpmu_nu.cxx
T2K_CC1pip_CH_XSec_1Dppi_nu.cxx
T2K_CC1pip_CH_XSec_1Dq3_nu.cxx
T2K_CC1pip_CH_XSec_1Dthmupi_nu.cxx
T2K_CC1pip_CH_XSec_1Dthpi_nu.cxx
T2K_CC1pip_CH_XSec_1Dthq3pi_nu.cxx
T2K_CC1pip_H2O_XSec_1DEnuDelta_nu.cxx
T2K_CC1pip_H2O_XSec_1DEnuMB_nu.cxx
T2K_CC1pip_H2O_XSec_1Dcosmu_nu.cxx
T2K_CC1pip_H2O_XSec_1Dcosmupi_nu.cxx
T2K_CC1pip_H2O_XSec_1Dcospi_nu.cxx
T2K_CC1pip_H2O_XSec_1Dpmu_nu.cxx
T2K_CC1pip_H2O_XSec_1Dppi_nu.cxx
T2K_CC0pinp_STV_XSec_1Ddpt_nu.cxx
+T2K_CC0pi_XSec_2DPcos_nu_nonuniform.cxx
T2K_SignalDef.cxx
)
set(HEADERFILES
T2K_CC0pi_XSec_2DPcos_nu.h
T2K_CC1pip_CH_XSec_1DQ2_nu.h
T2K_CC1pip_CH_XSec_1DWrec_nu.h
T2K_CC1pip_CH_XSec_1Dpmu_nu.h
T2K_CC1pip_CH_XSec_1Dppi_nu.h
T2K_CC1pip_CH_XSec_1Dq3_nu.h
T2K_CC1pip_CH_XSec_1Dthmupi_nu.h
T2K_CC1pip_CH_XSec_1Dthpi_nu.h
T2K_CC1pip_CH_XSec_1Dthq3pi_nu.h
T2K_CC1pip_H2O_XSec_1DEnuDelta_nu.h
T2K_CC1pip_H2O_XSec_1DEnuMB_nu.h
T2K_CC1pip_H2O_XSec_1Dcosmu_nu.h
T2K_CC1pip_H2O_XSec_1Dcosmupi_nu.h
T2K_CC1pip_H2O_XSec_1Dcospi_nu.h
T2K_CC1pip_H2O_XSec_1Dpmu_nu.h
T2K_CC1pip_H2O_XSec_1Dppi_nu.h
T2K_CC0pinp_STV_XSec_1Ddpt_nu.h
+T2K_CC0pi_XSec_2DPcos_nu_nonuniform.h
T2K_SignalDef.h
)
set(LIBNAME expT2K)
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
add_library(${LIBNAME} STATIC ${IMPLFILES})
else(CMAKE_BUILD_TYPE MATCHES RELEASE)
add_library(${LIBNAME} SHARED ${IMPLFILES})
endif()
include_directories(${RWENGINE_INCLUDE_DIRECTORIES})
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
include_directories(${CMAKE_SOURCE_DIR}/src/Utils)
include_directories(${CMAKE_SOURCE_DIR}/src/Reweight)
include_directories(${CMAKE_SOURCE_DIR}/src/Splines)
set_target_properties(${LIBNAME} PROPERTIES VERSION
"${ExtFit_VERSION_MAJOR}.${ExtFit_VERSION_MINOR}.${ExtFit_VERSION_REVISION}")
set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS ${ROOT_LD_FLAGS})
if(DEFINED PROJECTWIDE_EXTRA_DEPENDENCIES)
add_dependencies(${LIBNAME} ${PROJECTWIDE_EXTRA_DEPENDENCIES})
endif()
install(TARGETS ${LIBNAME} DESTINATION lib)
#Can uncomment this to install the headers... but is it really neccessary?
#install(FILES ${HEADERFILES} DESTINATION include)
set(MODULETargets ${MODULETargets} ${LIBNAME} PARENT_SCOPE)
diff --git a/src/T2K/T2K_CC0pi_XSec_2DPcos_nu.cxx b/src/T2K/T2K_CC0pi_XSec_2DPcos_nu.cxx
index dfd8a07..36220b3 100644
--- a/src/T2K/T2K_CC0pi_XSec_2DPcos_nu.cxx
+++ b/src/T2K/T2K_CC0pi_XSec_2DPcos_nu.cxx
@@ -1,286 +1,271 @@
// 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 <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "T2K_SignalDef.h"
#include "T2K_CC0pi_XSec_2DPcos_nu.h"
//********************************************************************
T2K_CC0pi_XSec_2DPcos_nu::T2K_CC0pi_XSec_2DPcos_nu(nuiskey samplekey) {
//********************************************************************
// Sample overview ---------------------------------------------------
std::string descrip = "T2K_CC0pi_XSec_2DPcos_nu sample. \n" \
"Target: CH \n" \
"Flux: MINERvA Medium Energy FHC numu \n" \
"Signal: CC-inclusive with theta < 20deg \n";
// Setup common settings
fSettings = LoadSampleSettings(samplekey);
fSettings.SetDescription(descrip);
fSettings.SetXTitle("P_{#mu} (GeV)");
fSettings.SetYTitle("cos#theta_{#mu}");
fSettings.SetZTitle("d^{2}#sigma/dP_{#mu}dcos#theta_{#mu} (cm^{2}/GeV)");
fSettings.SetAllowedTypes("DIAG,FULL/FREE,SHAPE,FIX/SYSTCOV/STATCOV","FIX");
fSettings.SetEnuRange(0.0, 10.0);
fSettings.DefineAllowedTargets("C,H");
if (fName == "T2K_CC0pi_XSec_2DPcos_nu_I") fAnalysis = 1;
else fAnalysis = 2;
// CCQELike plot information
fSettings.SetTitle("T2K_CC0pi_XSec_2DPcos_nu");
-
- fSettings.SetDataInput( FitPar::GetDataBase() + "/MINERvA/CCEavq3/data_2D.txt" );
- fSettings.SetCovarInput( FitPar::GetDataBase() + "/MINERvA/CCEavq3/covar_2D.txt" );
- fSettings.SetMapInput( FitPar::GetDataBase() + "/MINERvA/CCEavq3/map_2D.txt" );
fSettings.DefineAllowedSpecies("numu");
forwardgoing = (fSettings.GetS("type").find("REST") != std::string::npos);
FinaliseSampleSettings();
// Scaling Setup ---------------------------------------------------
// ScaleFactor automatically setup for DiffXSec/cm2/Nucleon
fScaleFactor = ((GetEventHistogram()->Integral("width")/(fNEvents+0.)) * 1E-38 / (TotalIntegratedFlux()));
- // Plot Setup -------------------------------------------------------
- Double_t binx[7] = {0.0, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8};
- Double_t biny[17] = {0.0, 0.02, 0.04, 0.06, 0.08, 0.10, 0.12, 0.14, 0.16, 0.20, 0.25, 0.30, 0.35, 0.40, 0.50, 0.60, 0.80};
- CreateDataHistogram(7, binx, 17, biny);
-
- SetDataValuesFromTextFile( fSettings.GetDataInput() );
- ScaleData(1E-42);
-
- SetMapValuesFromText( fSettings.GetMapInput() );
-
- SetCholDecompFromTextFile( fSettings.GetCovarInput() );
- ScaleCovar(1E-16);
-
+ // Setup Histograms
+ SetHistograms();
StatUtils::SetDataErrorFromCov(fDataHist, fFullCovar, fMapHist, 1E-38);
// Final setup ---------------------------------------------------
FinaliseMeasurement();
};
bool T2K_CC0pi_XSec_2DPcos_nu::isSignal(FitEvent *event){
return SignalDef::isT2K_CC0pi(event, EnuMin, EnuMax, forwardgoing);
};
void T2K_CC0pi_XSec_2DPcos_nu::FillEventVariables(FitEvent* event){
if (event->NumFSParticle(13) == 0)
return;
TLorentzVector Pnu = event->GetNeutrinoIn()->fP;
TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
double pmu = Pmu.Vect().Mag()/1000.;
double CosThetaMu = cos(Pnu.Vect().Angle(Pmu.Vect()));
fXVar = pmu;
fYVar = CosThetaMu;
return;
};
// Modification is needed after the full reconfigure to move bins around
// Otherwise this would need to be replaced by a TH2Poly which is too awkward.
void T2K_CC0pi_XSec_2DPcos_nu::ConvertEventRates(){
// Do standard conversion.
Measurement2D::ConvertEventRates();
if (fAnalysis == 1){
// Following code handles weird ND280 Binning
int nbins = this->fMCHist->GetNbinsX() + 1;
double total = 0.0;
// Y = 1
total = 0.0;
for (int i = 3; i < nbins; i++){
double width = this->fMCHist->GetXaxis()->GetBinWidth(i) * this->fMCHist->GetYaxis()->GetBinWidth(1);
total += this->fMCHist->GetBinContent(i, 1) * width;
this->fMCHist->SetBinContent(i,1,0);
}
this->fMCHist->SetBinContent(3, 1, total / (1.0 * 29.6));
// Y = 2
total = 0.0;
for (int i = 5; i < nbins; i++){
double width = this->fMCHist->GetXaxis()->GetBinWidth(i) * this->fMCHist->GetYaxis()->GetBinWidth(2);
total += this->fMCHist->GetBinContent(i, 2)* width;
this->fMCHist->SetBinContent(i,2,0);
}
this->fMCHist->SetBinContent(5, 2, total / (0.6 *29.4));
// Y = 3
total = 0.0;
for (int i = 7; i < nbins; i++){
double width = this->fMCHist->GetXaxis()->GetBinWidth(i) * this->fMCHist->GetYaxis()->GetBinWidth(3);
total += this->fMCHist->GetBinContent(i, 3)* width;
this->fMCHist->SetBinContent(i, 3,0);
}
this->fMCHist->SetBinContent(7, 3, total/ (0.1 * 29.2));
// Y = 4
total = 0.0;
for (int i = 7; i < nbins; i++){
double width = this->fMCHist->GetXaxis()->GetBinWidth(i) * this->fMCHist->GetYaxis()->GetBinWidth(4);
total += this->fMCHist->GetBinContent(i, 4)* width;
this->fMCHist->SetBinContent(i, 4,0);
}
this->fMCHist->SetBinContent(7, 4, total / (0.1 * 29.2));
// Y = 5
total = 0.0;
for (int i = 8; i < nbins; i++){
double width = this->fMCHist->GetXaxis()->GetBinWidth(i) * this->fMCHist->GetYaxis()->GetBinWidth(5);
total += this->fMCHist->GetBinContent(i, 5)* width;
this->fMCHist->SetBinContent(i,5,0);
}
this->fMCHist->SetBinContent(8, 5, total / (0.05 * 29.0));
// Y = 6
total = 0.0;
for (int i = 9; i < nbins; i++){
double width = this->fMCHist->GetXaxis()->GetBinWidth(i) * this->fMCHist->GetYaxis()->GetBinWidth(6);
total += this->fMCHist->GetBinContent(i, 6)* width;
this->fMCHist->SetBinContent(i, 6,0);
}
this->fMCHist->SetBinContent(9, 6, total / (0.05 * 28.5));
// Y = 7
total = 0.0;
for (int i = 8; i < nbins; i++){
double width = this->fMCHist->GetXaxis()->GetBinWidth(i) * this->fMCHist->GetYaxis()->GetBinWidth(7);
total += this->fMCHist->GetBinContent(i, 7)* width;
this->fMCHist->SetBinContent(i, 7,0);
}
this->fMCHist->SetBinContent(8, 7, total/ (0.04 * 28.0));
// Y = 8
total = 0.0;
for (int i = 11; i < nbins; i++){
double width = this->fMCHist->GetXaxis()->GetBinWidth(i) * this->fMCHist->GetYaxis()->GetBinWidth(8);
total += this->fMCHist->GetBinContent(i, 8)* width;
this->fMCHist->SetBinContent(i, 8,0);
}
this->fMCHist->SetBinContent(11, 8, total / (0.4 * 27.0));
// Y = 9
total = 0.0;
for (int i = 9; i < nbins; i++){
double width = this->fMCHist->GetXaxis()->GetBinWidth(i) * this->fMCHist->GetYaxis()->GetBinWidth(9);
total += this->fMCHist->GetBinContent(i, 9)* width;
this->fMCHist->SetBinContent(i,9,0);
}
this->fMCHist->SetBinContent(9, 9, total / (0.02 * 25.0));
}
return;
}
void T2K_CC0pi_XSec_2DPcos_nu::SetHistograms(){
fIsSystCov = fSettings.GetS("type").find("SYSTCOV") != std::string::npos;
fIsStatCov = fSettings.GetS("type").find("STATCOV") != std::string::npos;
fIsNormCov = fSettings.GetS("type").find("NORMCOV") != std::string::npos;
fNDataPointsX = 12;
fNDataPointsY = 10;
// Open file
std::string infile = FitPar::GetDataBase()+"/T2K/CC0pi/T2K_CC0PI_2DPmuCosmu_Data.root";
TFile* rootfile = new TFile(infile.c_str(), "READ");
TH2D* tempcov;
// ANALYSIS 2
if (fAnalysis == 2){
// Get Data
fDataHist = (TH2D*) rootfile->Get("analysis2_data");
fDataHist->SetDirectory(0);
fDataHist->SetNameTitle((fName + "_data").c_str(),
(fName + "_data" + fPlotTitles).c_str());
// Get Map
fMapHist = (TH2I*) rootfile->Get("analysis2_map");
fMapHist->SetDirectory(0);
fMapHist->SetNameTitle((fName + "_map").c_str(),
(fName + "_map" + fPlotTitles).c_str());
// Get Syst/Stat Covar
TH2D* tempsyst = (TH2D*) rootfile->Get("analysis2_systcov");
TH2D* tempstat = (TH2D*) rootfile->Get("analysis2_statcov");
TH2D* tempnorm = (TH2D*) rootfile->Get("analysis2_normcov");
// Create covar [Default is both]
tempcov = (TH2D*) tempsyst->Clone();
tempcov->Reset();
if (fIsSystCov) tempcov->Add(tempsyst);
if (fIsStatCov) tempcov->Add(tempstat);
if (fIsNormCov) tempcov->Add(tempnorm);
if (!fIsSystCov && !fIsStatCov && !fIsNormCov){
tempcov->Add(tempsyst);
tempcov->Add(tempstat);
tempcov->Add(tempnorm);
}
// SARAS ANALYSIS
} else if (fAnalysis == 1){
//TODO (P.Stowell) Add a TH2Poly Measurement class
ERR(FTL) << "T2K CC0Pi Analysis 1 is not yet available due to its awkward binning!" << endl;
ERR(FTL) << "If you want to use it, add a TH2Poly Class!" << endl;
throw;
}
// Setup Covar
int nbins = tempcov->GetNbinsX();
fFullCovar = new TMatrixDSym(nbins);
for (int i = 0; i < nbins; i++){
for (int j = 0; j < nbins; j++){
(*fFullCovar)(i,j) = tempcov->GetBinContent(i+1,j+1);
}
}
covar = StatUtils::GetInvert(fFullCovar);
fDecomp = StatUtils::GetDecomp(covar);
// Set Data Errors
StatUtils::SetDataErrorFromCov(fDataHist, fFullCovar, fMapHist, 1E-38);
// Remove root file
rootfile->Close();
return;
};
diff --git a/src/T2K/T2K_CC0pi_XSec_2DPcos_nu_nonuniform.cxx b/src/T2K/T2K_CC0pi_XSec_2DPcos_nu_nonuniform.cxx
new file mode 100644
index 0000000..9f83362
--- /dev/null
+++ b/src/T2K/T2K_CC0pi_XSec_2DPcos_nu_nonuniform.cxx
@@ -0,0 +1,210 @@
+// 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 <http://www.gnu.org/licenses/>.
+*******************************************************************************/
+
+#include "T2K_SignalDef.h"
+
+#include "T2K_CC0pi_XSec_2DPcos_nu_nonuniform.h"
+
+
+
+//********************************************************************
+T2K_CC0pi_XSec_2DPcos_nu_nonuniform::T2K_CC0pi_XSec_2DPcos_nu_nonuniform(nuiskey samplekey) {
+//********************************************************************
+
+ // Sample overview ---------------------------------------------------
+ std::string descrip = "T2K_CC0pi_XSec_2DPcos_nu_nonuniform sample. \n" \
+ "Target: CH \n" \
+ "Flux: MINERvA Medium Energy FHC numu \n" \
+ "Signal: CC-inclusive with theta < 20deg \n";
+
+ // Setup common settings
+ fSettings = LoadSampleSettings(samplekey);
+ fSettings.SetDescription(descrip);
+ fSettings.SetXTitle("P_{#mu} (GeV)");
+ fSettings.SetYTitle("cos#theta_{#mu}");
+ fSettings.SetZTitle("d^{2}#sigma/dP_{#mu}dcos#theta_{#mu} (cm^{2}/GeV)");
+ fSettings.SetAllowedTypes("FULL,DIAG/FREE,SHAPE,FIX/SYSTCOV/STATCOV","FIX/FULL");
+ fSettings.SetEnuRange(0.0, 10.0);
+ fSettings.DefineAllowedTargets("C,H");
+
+ fAnalysis = 1;
+
+
+ // CCQELike plot information
+ fSettings.SetTitle("T2K_CC0pi_XSec_2DPcos_nu_nonuniform");
+ fSettings.DefineAllowedSpecies("numu");
+
+ forwardgoing = (fSettings.GetS("type").find("REST") != std::string::npos);
+
+ FinaliseSampleSettings();
+
+ // Scaling Setup ---------------------------------------------------
+ // ScaleFactor automatically setup for DiffXSec/cm2/Nucleon
+ fScaleFactor = ((GetEventHistogram()->Integral("width")/(fNEvents+0.)) * 1E-38 / (TotalIntegratedFlux()));
+
+ // Setup Histograms
+ SetHistograms();
+
+ // Final setup ---------------------------------------------------
+ FinaliseMeasurement();
+
+};
+
+
+bool T2K_CC0pi_XSec_2DPcos_nu_nonuniform::isSignal(FitEvent *event){
+ return SignalDef::isT2K_CC0pi(event, EnuMin, EnuMax, forwardgoing);
+};
+
+void T2K_CC0pi_XSec_2DPcos_nu_nonuniform::FillEventVariables(FitEvent* event){
+
+ if (event->NumFSParticle(13) == 0)
+ return;
+
+ TLorentzVector Pnu = event->GetNeutrinoIn()->fP;
+ TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
+
+ double pmu = Pmu.Vect().Mag()/1000.;
+ double CosThetaMu = cos(Pnu.Vect().Angle(Pmu.Vect()));
+
+ fXVar = pmu;
+ fYVar = CosThetaMu;
+
+ return;
+};
+
+void T2K_CC0pi_XSec_2DPcos_nu_nonuniform::FillHistograms(){
+
+ Measurement1D::FillHistograms();
+ if (Signal){
+ fMCHist_Fine2D->Fill( fXVar, fYVar, Weight );
+ FillMCSlice( fXVar, fYVar, Weight );
+
+ }
+
+}
+
+
+// Modification is needed after the full reconfigure to move bins around
+// Otherwise this would need to be replaced by a TH2Poly which is too awkward.
+void T2K_CC0pi_XSec_2DPcos_nu_nonuniform::ConvertEventRates(){
+
+ // Do standard conversion.
+ Measurement1D::ConvertEventRates();
+
+ // First scale MC slices also by their width in Y
+ fMCHist_Slices[0]->Scale(1.0 / 1.00);
+ fMCHist_Slices[1]->Scale(1.0 / 0.60);
+ fMCHist_Slices[2]->Scale(1.0 / 0.10);
+ fMCHist_Slices[3]->Scale(1.0 / 0.10);
+ fMCHist_Slices[4]->Scale(1.0 / 0.05);
+ fMCHist_Slices[5]->Scale(1.0 / 0.05);
+ fMCHist_Slices[6]->Scale(1.0 / 0.04);
+ fMCHist_Slices[7]->Scale(1.0 / 0.04);
+ fMCHist_Slices[8]->Scale(1.0 / 0.02);
+
+
+ // Now Convert into 1D list
+ fMCHist->Reset();
+ int bincount = 0;
+ for (int i = 0; i < 9; i++){
+ for (int j = 0; j < fDataHist_Slices[i]->GetNbinsX(); j++){
+ fMCHist->SetBinContent(bincount+1, fMCHist_Slices[i]->GetBinContent(j+1));
+ bincount++;
+ }
+ }
+
+ return;
+}
+
+void T2K_CC0pi_XSec_2DPcos_nu_nonuniform::FillMCSlice(double x, double y, double w){
+
+ if (y >= -1.0 and y < 0.0) fMCHist_Slices[0]->Fill(x,w);
+ else if (y >= 0.0 and y < 0.6) fMCHist_Slices[1]->Fill(x,w);
+ else if (y >= 0.6 and y < 0.7) fMCHist_Slices[2]->Fill(x,w);
+ else if (y >= 0.7 and y < 0.8) fMCHist_Slices[3]->Fill(x,w);
+ else if (y >= 0.8 and y < 0.85) fMCHist_Slices[4]->Fill(x,w);
+ else if (y >= 0.85 and y < 0.90) fMCHist_Slices[5]->Fill(x,w);
+ else if (y >= 0.90 and y < 0.94) fMCHist_Slices[6]->Fill(x,w);
+ else if (y >= 0.94 and y < 0.98) fMCHist_Slices[7]->Fill(x,w);
+ else if (y >= 0.98 and y <= 1.00) fMCHist_Slices[8]->Fill(x,w);
+}
+
+
+void T2K_CC0pi_XSec_2DPcos_nu_nonuniform::SetHistograms(){
+
+ // Read in 1D Data Histograms
+ fInputFile = new TFile( (FitPar::GetDataBase() + "/T2K/CC0pi/T2K_CC0PI_2DPmuCosmu_Data.root").c_str(),"READ");
+ fInputFile->ls();
+
+ // Read in 1D Data
+ fDataHist = (TH1D*) fInputFile->Get("datahist");
+
+ fMCHist_Fine2D = new TH2D("T2K_CC0pi_XSec_2DPcos_nu_nonuniform_Fine2D","T2K_CC0pi_XSec_2DPcos_nu_nonuniform_Fine2D", 400, 0.0,30.0,100,-1.0,1.0);
+ SetAutoProcessTH1(fMCHist_Fine2D);
+
+ TH2D* tempcov = (TH2D*) fInputFile->Get("analysis1_totcov");
+
+ fFullCovar = new TMatrixDSym(fDataHist->GetNbinsX());
+ for (int i = 0; i < fDataHist->GetNbinsX(); i++){
+ for (int j = 0; j < fDataHist->GetNbinsX(); j++){
+ (*fFullCovar)(i,j) = tempcov->GetBinContent(i+1, j+1);
+ }
+ }
+ covar = StatUtils::GetInvert(fFullCovar);
+ fDecomp = StatUtils::GetDecomp(fFullCovar);
+
+ // Read in 2D Data
+ fDataPoly = (TH2Poly*) fInputFile->Get("datapoly");
+ fDataPoly->SetNameTitle("T2K_CC0pi_XSec_2DPcos_nu_nonuniform_datapoly","T2K_CC0pi_XSec_2DPcos_nu_nonuniform_datapoly");
+ SetAutoProcessTH1(fDataPoly, kCMD_Write);
+ fDataHist->Reset();
+
+ // Read in 2D Data Slices and Make MC Slices
+ int bincount = 0;
+ for (int i = 0; i < 9; i++){
+
+ // Get Data Histogram
+ fInputFile->ls();
+ fDataHist_Slices.push_back((TH1D*)fInputFile->Get(Form("dataslice_%i",i))->Clone());
+ fDataHist_Slices[i]->SetNameTitle(Form("T2K_CC0pi_XSec_2DPcos_nu_nonuniform_data_Slice%i",i),
+ (Form("T2K_CC0pi_XSec_2DPcos_nu_nonuniform_data_Slice%i",i)));
+
+ // Loop over nbins and set errors from covar
+ for (int j = 0; j < fDataHist_Slices[i]->GetNbinsX(); j++){
+ fDataHist_Slices[i]->SetBinError(j+1, sqrt((*fFullCovar)(bincount,bincount)) * 1E-38);
+
+ std::cout << "Setting data hist " << fDataHist_Slices[i]->GetBinContent(j+1) << " " << fDataHist_Slices[i]->GetBinError(j+1) << std::endl;
+ fDataHist->SetBinContent(bincount+1, fDataHist_Slices[i]->GetBinContent(j+1) );
+ fDataHist->SetBinError(bincount+1, fDataHist_Slices[i]->GetBinError(j+1) );
+
+ bincount++;
+ }
+
+ // Make MC Clones
+ fMCHist_Slices.push_back((TH1D*) fDataHist_Slices[i]->Clone());
+ fMCHist_Slices[i]->SetNameTitle(Form("T2K_CC0pi_XSec_2DPcos_nu_nonuniform_MC_Slice%i",i),
+ (Form("T2K_CC0pi_XSec_2DPcos_nu_nonuniform_MC_Slice%i",i)));
+
+ SetAutoProcessTH1(fDataHist_Slices[i],kCMD_Write);
+ SetAutoProcessTH1(fMCHist_Slices[i]);
+ // fMCHist_Slices[i]->Reset();
+ }
+
+ return;
+};
diff --git a/src/T2K/T2K_CC0pi_XSec_2DPcos_nu_nonuniform.h b/src/T2K/T2K_CC0pi_XSec_2DPcos_nu_nonuniform.h
new file mode 100644
index 0000000..e3b2d00
--- /dev/null
+++ b/src/T2K/T2K_CC0pi_XSec_2DPcos_nu_nonuniform.h
@@ -0,0 +1,82 @@
+// 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 <http://www.gnu.org/licenses/>.
+*******************************************************************************/
+#ifndef T2K_CC0PI_2DPCOS_NU_NONUNIFORM_H_SEEN
+#define T2K_CC0PI_2DPCOS_NU_NONUNIFORM_H_SEEN
+
+#include "Measurement1D.h"
+#include "TH2Poly.h"
+
+class T2K_CC0pi_XSec_2DPcos_nu_nonuniform : public Measurement1D {
+public:
+
+ /// Basic Constructor.
+ /// /brief Parses two different measurements.
+ ///
+ /// T2K_CC0pi_XSec_2DPcos_nu_nonuniform -> T2K CC0PI Analysis 2
+ /// T2K_CC0pi_XSec_2DPcos_nu_nonuniform_I -> T2K CC0PI Analysis 1
+ /// T2K_CC0pi_XSec_2DPcos_nu_nonuniform_II -> T2K CC0PI Analysis 2
+ T2K_CC0pi_XSec_2DPcos_nu_nonuniform(nuiskey samplekey);
+
+ /// Virtual Destructor
+ ~T2K_CC0pi_XSec_2DPcos_nu_nonuniform() {};
+
+ /// Numu CC0PI Signal Definition
+ ///
+ /// /item
+ bool isSignal(FitEvent *nvect);
+
+ /// Read histograms in a special way because format is different.
+ /// Read from FitPar::GetDataBase()+"/T2K/CC0pi/T2K_CC0PI_2DPmuCosmu_Data.root"
+ void SetHistograms();
+
+ /// Bin Tmu CosThetaMu
+ void FillEventVariables(FitEvent* customEvent);
+
+ // Fill Histograms
+ void FillHistograms();
+
+ /// Have to do a weird event scaling for analysis 1
+ void ConvertEventRates();
+
+ private:
+
+ bool forwardgoing;
+ bool only_allowed_particles;
+ bool numu_event;
+ double numu_energy;
+ int particle_pdg;
+ double pmu, CosThetaMu;
+ int fAnalysis;
+
+ bool fIsSystCov, fIsStatCov, fIsNormCov;
+
+ TH2Poly* fDataPoly;
+ TH2Poly* fMCPoly;
+
+ TFile* fInputFile;
+ TH2D* fMCHist_Fine2D;
+
+ std::vector<TH1D*> fMCHist_Slices;
+ std::vector<TH1D*> fDataHist_Slices;
+
+ void FillMCSlice(double x, double y, double w);
+
+};
+
+#endif
diff --git a/src/Utils/BeamUtils.cxx b/src/Utils/BeamUtils.cxx
index 6b9a313..65e23dc 100644
--- a/src/Utils/BeamUtils.cxx
+++ b/src/Utils/BeamUtils.cxx
@@ -1,27 +1,29 @@
#include "BeamUtils.h"
std::vector<int> BeamUtils::ParseSpeciesToIntVect(std::string spc){
- std::vector<std::string> splitspc = GeneralUtils::ParseToStr(spc,",");
- std::vector<int> convspc;
-
- for (size_t i = 0; i < splitspc.size(); i++){
-
- std::string type = splitspc[i];
-
- if (!type.compare("electron")) convspc.push_back(11);
- else if (!type.compare("positron")) convspc.push_back(-11);
- else if (!type.compare("muon")) convspc.push_back(13);
- else if (!type.compare("antimuon")) convspc.push_back(-13);
-
- else if (!type.compare("nue")) convspc.push_back(12);
- else if (!type.compare("numu")) convspc.push_back(14);
- else if (!type.compare("antinue")) convspc.push_back(12);
- else if (!type.compare("antinumu")) convspc.push_back(14);
- else{
- convspc.push_back( GeneralUtils::StrToInt(type) );
- }
- }
-
- return convspc;
-}
\ No newline at end of file
+ // Split by comma
+ std::vector<std::string> splitspc = GeneralUtils::ParseToStr(spc,",");
+ std::vector<int> convspc;
+
+ // Run through hard coded list
+ for (size_t i = 0; i < splitspc.size(); i++){
+
+ std::string type = splitspc[i];
+
+ if (!type.compare("electron")) convspc.push_back(11);
+ else if (!type.compare("positron")) convspc.push_back(-11);
+ else if (!type.compare("muon")) convspc.push_back(13);
+ else if (!type.compare("antimuon")) convspc.push_back(-13);
+
+ else if (!type.compare("nue")) convspc.push_back(12);
+ else if (!type.compare("numu")) convspc.push_back(14);
+ else if (!type.compare("antinue")) convspc.push_back(12);
+ else if (!type.compare("antinumu")) convspc.push_back(14);
+ else{
+ convspc.push_back( GeneralUtils::StrToInt(type) );
+ }
+ }
+
+ return convspc;
+}
diff --git a/src/Utils/BeamUtils.h b/src/Utils/BeamUtils.h
index 80739ed..74dbc7d 100644
--- a/src/Utils/BeamUtils.h
+++ b/src/Utils/BeamUtils.h
@@ -1,11 +1,16 @@
#ifndef BEAM_UTILS_H
#define BEAM_UTILS_H
#include <vector>
#include "FitLogger.h"
#include "NuisConfig.h"
+/// Namespace for any global util functions related to beam simulation
namespace BeamUtils{
- std::vector<int> ParseSpeciesToIntVect(std::string spc);
+
+ /// @brief Converts comma seperated string of beam ids into PDG vector
+ ///
+ /// e.g. 'numu,nue,numub,e,16' = <14,12,-14,11,16>
+ std::vector<int> ParseSpeciesToIntVect(std::string spc);
}
-#endif
\ No newline at end of file
+#endif
diff --git a/src/Utils/GeneralUtils.h b/src/Utils/GeneralUtils.h
index e34dadf..ffb594d 100644
--- a/src/Utils/GeneralUtils.h
+++ b/src/Utils/GeneralUtils.h
@@ -1,159 +1,163 @@
// 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 <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef GENERALUTILS_H_SEEN
#define GENERALUTILS_H_SEEN
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iostream>
#include <numeric>
#include <limits>
#include <sstream>
#include <string>
#include <vector>
#include "FitLogger.h"
/*!
* \addtogroup Utils
* @{
*/
-//! Functions which deal with basic string and file handling. They should have
-//! no dependence on the other NUISANCE files!
+/// Functions which deal with basic string and file handling. They should have
+/// no dependence on the other NUISANCE files!
namespace GeneralUtils {
/*!
String handling and file parsing functions
*/
-//! Parse a string into a vector of doubles given a delimiter "del"
+/// Parse a string into a vector of doubles given a delimiter "del"
std::vector<double> ParseToDbl(std::string str, const char* del);
-//! Parse a string into a vector of ints given a delimiter "del"
+/// Parse a string into a vector of ints given a delimiter "del"
std::vector<int> ParseToInt(std::string str, const char* del);
-//! Parse a string into a vector of strings given a delimiter "del"
+/// Parse a string into a vector of strings given a delimiter "del"
std::vector<std::string> ParseToStr(std::string str, const char* del);
-//! Parse text file into a vector of strings
+/// Parse text file into a vector of strings
std::vector<std::string> ParseFileToStr(std::string str, const char* del);
-//! Convert a string to a double
+/// Convert a string to a double
double StrToDbl(std::string str);
-//! Convert a string to an int
+/// Convert a string to an int
int StrToInt(std::string str);
-//! Convert a string to an bool
+/// Convert a string to an bool
bool StrToBool(std::string str);
+/// Convert a bool to string
std::string BoolToStr(bool val);
+/// Convert Int to string
std::string IntToStr(int val);
+/// Convert Double to String
std::string DblToStr(double val);
-
-//! Return the top level environmental variable for the fitter
+/// Return the top level environmental variable for the fitter
std::string GetTopLevelDir();
-// //! A utility function to return a std::vector from an array
+// /// A utility function to return a std::vector from an array
// template <typename T, size_t N>
// std::vector<T> makeVector(const T (&data)[N]) {
// return std::vector<T>(data, data + N);
// }
std::vector<std::string> LoadCharToVectStr(int argc, char* argv[]);
template <typename T, size_t N>
size_t GetArraySize(const T (&data)[N]) {
return N;
}
template <typename T>
size_t GetHammingWeight(T const& d) {
T c = d;
size_t w = 0;
while (bool(c)) {
w += c & 1;
c = (c >> 1);
}
return w;
}
template <typename T>
size_t GetFirstOnBit(T const& d) {
T c = d;
size_t fob = 0;
while (bool(c)) {
if (c & 1) {
return fob;
} else {
c = (c >> 1);
}
fob++;
}
return fob;
}
template <typename T>
size_t IsSmallNum(T const& d) {
if (std::numeric_limits<T>::is_integer) {
return (d == 0);
}
return (((d > 0) && (d < std::numeric_limits<T>::epsilon())) ||
((d < 0) && (d > -std::numeric_limits<T>::epsilon())));
}
}
+
+/// namespace to contain all physical constants used by NUISANCE
namespace PhysConst {
const double mass_proton = 0.93827203; // Proton mass in GeV
const double mass_neutron = 0.93956536; // Neutron mass in GeV
const double mass_delta = 1.232; // Delta mass in GeV
const double mass_muon = 0.10565837; // Muon mass in GeV
const int pdg_neutrinos[] = {12, -12, 14, -14 /*, 16, -16*/};
const int pdg_muons[] = {13, -13};
const int pdg_pions[] = {211, -211, 111};
const int pdg_charged_pions[] = {211, -211};
const int pdg_strangemesons[] = {
130, 310, 311, 321, 9000311, 9000321, 10311,
10321, 100311, 100321, 9010311, 9010321, 9020311, 9020321,
313, 323, 10313, 10323, 20313, 20323, 100313,
100323, 9000313, 9000323, 30313, 30323, 315, 325,
9000315, 9000325, 10315, 10325, 20315, 20325, 9010315,
9010325, 9020315, 9020325, 317, 327, 9010317, 9010327};
// Just *-1 to cover possibility
const int pdg_kplus = 321;
const int pdg_antistrangemesons[] = {
-130, -310, -311, -321, -9000311, -9000321, -10311,
-10321, -100311, -100321, -9010311, -9010321, -9020311, -9020321,
-313, -323, -10313, -10323, -20313, -20323, -100313,
-100323, -9000313, -9000323, -30313, -30323, -315, -325,
-9000315, -9000325, -10315, -10325, -20315, -20325, -9010315,
-9010325, -9020315, -9020325, -317, -327, -9010317, -9010327};
}
/*! @} */
#endif
diff --git a/src/Utils/StandardStacks.h b/src/Utils/StandardStacks.h
index 1dc5970..1264bf8 100644
--- a/src/Utils/StandardStacks.h
+++ b/src/Utils/StandardStacks.h
@@ -1,122 +1,123 @@
#ifndef STANDARD_STACKS_H
#define STANDARD_STACKS_H
#include "StackBase.h"
#include "FitEvent.h"
#include "BaseFitEvt.h"
/// Single stack class, for consistent handling of TH1* and StackBase* histograms.
class FakeStack : public StackBase {
public:
/// Sets Template to exact pointer to hist without cloning.
FakeStack(TH1* hist) ;
/// Unlinks pointer to original histogram
~FakeStack();
/// Fills the normal fTemplate histogram
void Fill(double x, double y = 1.0, double z = 1.0, double weight = 1.0);
/// Scales the normal fTemplate histogram
void Scale(double norm, std::string opt);
/// Resets the normal fTemplate histogram
void Reset();
/// Writes the normal fTemplate histogram
void Write();
};
+
/// True Mode stack, an array of neut true interaction channels
class TrueModeStack : public StackBase {
public:
/// Main constructor listing true mode categories.
TrueModeStack(std::string name, std::string title, TH1* hist);
/// List to convert Modes to Index.
/// Should be kept in sync with constructor.
int ConvertModeToIndex(int mode);
/// Fill fromgiven mode integer
void Fill(int mode, double x, double y = 1.0, double z = 1.0, double weight = 1.0);
/// Extracts Mode from FitEvent and fills
void Fill(FitEvent* evt, double x, double y = 1.0, double z = 1.0, double weight = 1.0);
/// Extracts Mode from BaseFitEvt
void Fill(BaseFitEvt* evt, double x, double y = 1.0, double z = 1.0, double weight = 1.0);
};
/// True Mode NuNuBar stack, array of true channels split by nu/nubar
class NuNuBarTrueModeStack : public StackBase {
public:
/// Main constructor listing true mode categories.
NuNuBarTrueModeStack(std::string name, std::string title, TH1* hist);
/// List to convert Modes to Index.
/// Should be kept in sync with constructor.
int ConvertModeToIndex(int mode);
/// Fill fromgiven mode integer
void Fill(int species, int mode, double x, double y = 1.0, double z = 1.0, double weight = 1.0);
};
/// Species stack to look at contributions from multiple beam leptons
class BeamSpeciesStack : public StackBase {
public:
/// main constructor listing beam categories
BeamSpeciesStack(std::string name, std::string title, TH1* hist);
/// Fills stack using neutrino species
void Fill(int species, double x, double y = 1.0, double z = 1.0, double weight = 1.0);
/// List converts PDG Beam to index.
/// Should be kept in sync with constructor.
int ConvertSpeciesToIndex(int species);
};
/// Species stack to look at contributions from multiple beam leptons
class TargetTypeStack : public StackBase {
public:
/// main constructor listing beam categories
TargetTypeStack(std::string name, std::string title, TH1* hist);
/// Fills stack using target pdg
void Fill(int pdg, double x, double y = 1.0, double z = 1.0, double weight = 1.0);
/// List converts PDG Beam to index.
/// Should be kept in sync with constructor.
int ConvertPDGToIndex(int pdg);
/// Specie empty histograms to not be included in final stack
bool IncludeInStack(TH1* hist);
};
/// CC Topology Stack, categories defined by final state particle counts.
class CCTopologyStack : public StackBase {
public:
/// main constructor listing beam categories
CCTopologyStack(std::string name, std::string title, TH1* hist);
/// Fills stack using FitEvent
void Fill(FitEvent* evt, double x, double y = 1.0, double z = 1.0, double weight = 1.0);
/// Extracts index from evt particle counts
int GetIndexFromEventParticles(FitEvent* evt);
};
-#endif
\ No newline at end of file
+#endif

File Metadata

Mime Type
text/x-diff
Expires
Sat, Dec 21, 1:17 PM (1 d, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4022923
Default Alt Text
(450 KB)

Event Timeline