diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96fd9e0..2391ab4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,239 +1,244 @@
# 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 .
################################################################################
cmake_minimum_required (VERSION 2.8 FATAL_ERROR)
#Use the compilers found in the path
find_program(CMAKE_C_COMPILER NAMES $ENV{CC} gcc PATHS ENV PATH NO_DEFAULT_PATH)
find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} g++ PATHS ENV PATH NO_DEFAULT_PATH)
project(NUISANCE)
include(ExternalProject)
enable_language(Fortran)
set (NUISANCE_VERSION_MAJOR 2)
set (NUISANCE_VERSION_MINOR 7)
set (NUISANCE_VERSION_REVISION 0)
set (NUISANCE_VERSION_STRING "v${NUISANCE_VERSION_MAJOR}r${NUISANCE_VERSION_MINOR}")
if(${NUISANCE_VERSION_REVISION} STRGREATER "0")
set (NUISANCE_VERSION_STRING "${NUISANCE_VERSION_STRING}p${NUISANCE_VERSION_REVISION}")
endif()
#Set this to TRUE to enable build debugging messages
set(BUILD_DEBUG_MSGS TRUE)
include(${CMAKE_SOURCE_DIR}/cmake/cmessage.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/cacheVariables.cmake)
cmessage(STATUS "CMAKE_INSTALL_PREFIX: \"${CMAKE_INSTALL_PREFIX}\"")
cmessage(STATUS "CMAKE_BUILD_TYPE: \"${CMAKE_BUILD_TYPE}\"")
################################################################################
# Check Dependencies
################################################################################
################################## ROOT ######################################
include(${CMAKE_SOURCE_DIR}/cmake/ROOTSetup.cmake)
################################# HEPMC ######################################
include(${CMAKE_SOURCE_DIR}/cmake/HepMC.cmake)
############################ Reweight Engines ################################
include(${CMAKE_SOURCE_DIR}/cmake/ReweightEnginesSetup.cmake)
############################ Other Generators ################################
include(${CMAKE_SOURCE_DIR}/cmake/GiBUUSetup.cmake)
if(USE_NUANCE)
LIST(APPEND EXTRA_CXX_FLAGS -D__NUANCE_ENABLED__)
endif()
################################# Pythia6/8 ####################################
include(${CMAKE_SOURCE_DIR}/cmake/pythia6Setup.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/pythia8Setup.cmake)
################################# gperftools ###################################
include(${CMAKE_SOURCE_DIR}/cmake/gperfSetup.cmake)
if(NOT NOTEST)
enable_testing()
endif()
SET(GENERATOR_SUPPORT)
foreach(gen NEUT;NuWro;GENIE;GiBUU;NUANCE)
if(USE_${gen})
SET(GENERATOR_SUPPORT "${GENERATOR_SUPPORT}${gen} ")
endif()
endforeach(gen)
cmessage(STATUS "Generator Input Support: ${GENERATOR_SUPPORT}")
set(MINCODE
Routines
FCN)
set(CORE
MCStudies
Genie
FitBase
Config
Logger
InputHandler
Splines
Utils
Statistical
#Devel
Smearceptance
)
LIST(APPEND ALLEXPERIMENTS
ANL
ArgoNeuT
BEBC
BNL
Electron
FNAL
GGM
K2K
MINERvA
MicroBooNE
MiniBooNE
SciBooNE
T2K)
foreach(exp ${ALLEXPERIMENTS})
if(NOT NO_${exp})
LIST(APPEND EXPERIMENTS_TO_BUILD ${exp})
else()
LIST(REVERSE EXTRA_CXX_FLAGS)
LIST(APPEND EXTRA_CXX_FLAGS -D__NO_${exp}__)
LIST(REVERSE EXTRA_CXX_FLAGS)
endif()
endforeach()
################################## COMPILER ####################################
include(${CMAKE_SOURCE_DIR}/cmake/c++CompilerSetup.cmake)
################################### doxygen ###################################
include(${CMAKE_SOURCE_DIR}/cmake/docsSetup.cmake)
################################################################################
set(MINIMUM_INCLUDE_DIRECTORIES)
LIST(APPEND MINIMUM_INCLUDE_DIRECTORIES
${RWENGINE_INCLUDE_DIRECTORIES}
${CMAKE_SOURCE_DIR}/src/FitBase
${CMAKE_SOURCE_DIR}/src/Reweight
${CMAKE_SOURCE_DIR}/src/InputHandler
${CMAKE_SOURCE_DIR}/src/Config
${CMAKE_SOURCE_DIR}/src/Logger
${CMAKE_SOURCE_DIR}/src/Statistical
${CMAKE_SOURCE_DIR}/src/Splines
${CMAKE_SOURCE_DIR}/src/Utils
${CMAKE_SOURCE_DIR}/src/Genie)
#Not yet capable of just building without the rwdirs.
#if(USE_REWEIGHT)
LIST(APPEND MINIMUM_INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/src/Reweight)
LIST(APPEND CORE Reweight)
#endif()
cmessage(DEBUG "Base include directories: ${MINIMUM_INCLUDE_DIRECTORIES}")
set(EXP_INCLUDE_DIRECTORIES)
foreach(edir ${EXPERIMENTS_TO_BUILD})
LIST(APPEND EXP_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/src/${edir})
endforeach()
cmessage(DEBUG "Included experiments: ${EXP_INCLUDE_DIRECTORIES}")
foreach(mdir ${MINCODE})
cmessage (DEBUG "Configuring directory: src/${mdir}")
add_subdirectory(src/${mdir})
endforeach()
foreach(edir ${EXPERIMENTS_TO_BUILD})
cmessage (DEBUG "Configuring directory: src/${edir}")
add_subdirectory(src/${edir})
endforeach()
foreach(cdir ${CORE})
cmessage (DEBUG "Configuring directory: src/${cdir}")
add_subdirectory(src/${cdir})
endforeach()
cmessage(DEBUG "Module targets: ${MODULETargets}")
+LIST(APPEND MODULETargets -Wl,--end-group)
+LIST(REVERSE MODULETargets)
+LIST(APPEND MODULETargets -Wl,--start-group)
+LIST(REVERSE 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})
configure_file(cmake/MakeBinaryBlob.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/MakeBinaryBlob" @ONLY)
install(PROGRAMS
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/MakeBinaryBlob" DESTINATION
bin)
if(USE_DYNSAMPLES)
SET(ALL_INCLUDES ${MINIMUM_INCLUDE_DIRECTORIES})
LIST(APPEND ALL_INCLUDES ${CMAKE_SOURCE_DIR}/src/Smearceptance)
LIST(APPEND ALL_INCLUDES ${EXP_INCLUDE_DIRECTORIES})
string(REPLACE ";" " -I" ALL_INCLUDES_STR "${ALL_INCLUDES}")
cmessage(DEBUG ${CMAKE_DEPENDLIB_FLAGS})
string(REPLACE "-levent " "" CMAKE_DEPENDLIB_FLAGS_NEW ${CMAKE_DEPENDLIB_FLAGS})
set(CMAKE_DEPENDLIB_FLAGS ${CMAKE_DEPENDLIB_FLAGS_NEW})
cmessage(DEBUG ${CMAKE_DEPENDLIB_FLAGS})
string(REPLACE ";" " -l" ALL_MODULETARGETS_STR "${MODULETargets}")
configure_file(cmake/BuildDynamicSample.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/BuildDynamicSample" @ONLY)
install(PROGRAMS
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/BuildDynamicSample" DESTINATION
bin)
configure_file(cmake/BuildDynamicSmearcepter.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/BuildDynamicSmearcepter" @ONLY)
install(PROGRAMS
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/BuildDynamicSmearcepter" DESTINATION
bin)
endif()
install(PROGRAMS
"${PROJECT_SOURCE_DIR}/scripts/nuiscardgen" DESTINATION
bin)
install(PROGRAMS
"${PROJECT_SOURCE_DIR}/scripts/nuissamples" DESTINATION
bin)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 1afec7d..a83b26e 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -1,225 +1,225 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NUISANCE.
#
# NUISANCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NUISANCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NUISANCE. If not, see .
################################################################################
set(TARGETS_TO_BUILD)
if(USE_MINIMIZER)
add_executable(nuismin nuismin.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuismin)
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/InputHandler)
include_directories(${CMAKE_SOURCE_DIR}/src/Genie)
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
include_directories(${CMAKE_SOURCE_DIR}/src/Statistical)
include_directories(${CMAKE_SOURCE_DIR}/src/Utils)
include_directories(${CMAKE_SOURCE_DIR}/src/Config)
include_directories(${CMAKE_SOURCE_DIR}/src/Logger)
include_directories(${CMAKE_SOURCE_DIR}/src/Splines)
include_directories(${CMAKE_SOURCE_DIR}/src/Reweight)
include_directories(${CMAKE_SOURCE_DIR}/src/FCN)
include_directories(${CMAKE_SOURCE_DIR}/src/MCStudies)
include_directories(${CMAKE_SOURCE_DIR}/src/Smearceptance)
include_directories(${EXP_INCLUDE_DIRECTORIES})
if (USE_NuWro AND NOT NUWRO_BUILT_FROM_FILE)
add_executable(nuwro_nuisance nuwro_NUISANCE.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuwro_nuisance)
target_link_libraries(nuwro_nuisance ${MODULETargets})
target_link_libraries(nuwro_nuisance ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(nuwro_nuisance ${ROOT_LIBS})
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuwro_nuisance PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
endif()
-if (USE_NEUT)
- add_executable(neut_nuisance neut_NUISANCE.cxx)
- set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};neut_nuisance)
- target_link_libraries(neut_nuisance ${MODULETargets})
- target_link_libraries(neut_nuisance ${CMAKE_DEPENDLIB_FLAGS})
- target_link_libraries(neut_nuisance ${ROOT_LIBS})
- include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
- if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
- set_target_properties(neut_nuisance PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
- endif()
-endif()
+# if (USE_NEUT)
+# add_executable(neut_nuisance neut_NUISANCE.cxx)
+# set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};neut_nuisance)
+# target_link_libraries(neut_nuisance ${MODULETargets})
+# target_link_libraries(neut_nuisance ${CMAKE_DEPENDLIB_FLAGS})
+# target_link_libraries(neut_nuisance ${ROOT_LIBS})
+# include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
+# if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
+# set_target_properties(neut_nuisance PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
+# endif()
+# endif()
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()
add_executable(gevgen_nuisance_mixed gEvGen_NUISANCE_MIXED.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};gevgen_nuisance_mixed)
target_link_libraries(gevgen_nuisance_mixed ${MODULETargets})
target_link_libraries(gevgen_nuisance_mixed ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(gevgen_nuisance_mixed ${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_mixed 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(nuissmear nuissmear.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuissmear)
target_link_libraries(nuissmear ${MODULETargets})
target_link_libraries(nuissmear ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(nuissmear ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuissmear 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()
add_executable(nuisbayes nuisbayes.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuisbayes)
target_link_libraries(nuisbayes ${MODULETargets})
target_link_libraries(nuisbayes ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(nuisbayes ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuisbayes 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()
if(USE_NEUT)
add_executable(PrepareNEUT PrepareNEUT.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};PrepareNEUT)
target_link_libraries(PrepareNEUT ${MODULETargets})
target_link_libraries(PrepareNEUT ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(PrepareNEUT ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(PrepareNEUT 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 PrepareNuwroEvents.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()
add_executable(nuisbac nuisbac.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuisbac)
target_link_libraries(nuisbac ${MODULETargets})
target_link_libraries(nuisbac ${CMAKE_DEPENDLIB_FLAGS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuisbac PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
install(TARGETS ${TARGETS_TO_BUILD} DESTINATION bin)
#add_executable(DumpROOTClassesFromVector DumpROOTClassesFromVector.cxx)
# #Strip out -lNuWro_event1
# string(REPLACE "-lNuWro_event1" "" NWEVSTRIPPED_CDF ${CMAKE_DEPENDLIB_FLAGS})
# cmessage(DEBUG "Attempted to strip out nuwro library: \"${CMAKE_DEPENDLIB_FLAGS}\" -> \"${NWEVSTRIPPED_CDF}\"")
# add_executable(PrepareNEUT PrepareNEUT.cxx)
# target_link_libraries(DumpROOTClassesFromVector ${MODULETargets})
# target_link_libraries(DumpROOTClassesFromVector ${NWEVSTRIPPED_CDF})
# if(NOT CMAKE_LINK_FLAGS STREQUAL "")
# set_target_properties(DumpROOTClassesFromVector PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
# endif()
#install(TARGETS DumpROOTClassesFromVector DESTINATION bin)
diff --git a/app/DumpGiBUUEvents.cxx b/app/DumpGiBUUEvents.cxx
index 6320332..e3e571f 100644
--- a/app/DumpGiBUUEvents.cxx
+++ b/app/DumpGiBUUEvents.cxx
@@ -1,56 +1,49 @@
// 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 .
-*******************************************************************************/
+ * 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 .
+ *******************************************************************************/
#include
-#include "StdHepEvt.h"
#include "FitLogger.h"
+#include "StdHepEvt.h"
int main(int argv, char const *argc[]) {
if (argv != 2) {
- ERR(FTL) << "[ERROR]: expected a single input GiBUU rootracker file."
- << std::endl;
- return 1;
+ NUIS_ABORT("[ERROR]: expected a single input GiBUU rootracker file.");
}
std::string inpf(argc[1]);
if (!inpf.length()) {
- ERR(FTL) << "[ERROR]: expected an input GiBUU rootracker file."
- << std::endl;
- return 2;
+ NUIS_ABORT("[ERROR]: expected an input GiBUU rootracker file.");
}
TChain tn("giRooTracker");
tn.AddFile(inpf.c_str());
GiBUUStdHepReader giRead;
bool ok = giRead.SetBranchAddresses(&tn);
if (!ok) {
- ERR(FTL)
- << "[ERROR]: Could not correctly set branch address for input file."
- << std::endl;
- return 4;
+ NUIS_ABORT("[ERROR]: Could not correctly set branch address for input file.");
}
for (Long64_t ievt = 0; ievt < tn.GetEntries(); ++ievt) {
tn.GetEntry(ievt);
- LOG(EVT) << WriteGiBUUEvent(giRead) << std::endl;
+ NUIS_LOG(EVT, WriteGiBUUEvent(giRead));
}
}
diff --git a/app/PrepareGENIE.cxx b/app/PrepareGENIE.cxx
index 8af366c..8196e5e 100644
--- a/app/PrepareGENIE.cxx
+++ b/app/PrepareGENIE.cxx
@@ -1,942 +1,938 @@
#include "FitLogger.h"
#include "PlotUtils.h"
#include "TFile.h"
#include "TH1D.h"
#include "TTree.h"
#include
#include
#ifdef __GENIE_ENABLED__
#ifdef GENIE_PRE_R3
#include "Conventions/Units.h"
#include "GHEP/GHepParticle.h"
#include "PDG/PDGUtils.h"
#else
#include "Framework/Conventions/Units.h"
#include "Framework/GHEP/GHepParticle.h"
#include "Framework/ParticleData/PDGUtils.h"
#endif
#endif
std::string gInputFiles = "";
std::string gOutputFile = "";
std::string gFluxFile = "";
std::string gTarget = "";
double MonoEnergy;
int gNEvents = -999;
bool IsMonoE = false;
void PrintOptions();
void ParseOptions(int argc, char *argv[]);
void RunGENIEPrepareMono(std::string input, std::string target,
std::string output);
void RunGENIEPrepare(std::string input, std::string flux, std::string target,
std::string output);
int main(int argc, char *argv[]) {
ParseOptions(argc, argv);
if (IsMonoE) {
RunGENIEPrepareMono(gInputFiles, gTarget, gOutputFile);
} else {
RunGENIEPrepare(gInputFiles, gFluxFile, gTarget, gOutputFile);
}
}
void RunGENIEPrepareMono(std::string input, std::string target,
std::string output) {
- LOG(FIT) << "Running GENIE Prepare in mono energetic with E = " << MonoEnergy
- << " GeV" << std::endl;
+ NUIS_LOG(FIT, "Running GENIE Prepare in mono energetic with E = " << MonoEnergy
+ << " GeV");
// Setup TTree
TChain *tn = new TChain("gtree");
tn->AddFile(input.c_str());
if (tn->GetFile() == NULL) {
tn->Print();
- ERROR(FTL, "gtree not located in GENIE file: " << input);
- THROW("Check your inputs, they may need to be completely regenerated!");
+ NUIS_ERR(FTL, "gtree not located in GENIE file: " << input);
+ NUIS_ABORT("Check your inputs, they may need to be completely regenerated!");
throw;
}
int nevt = tn->GetEntries();
if (gNEvents != -999) {
- LOG(FIT) << "Overriding number of events by user from " << nevt << " to "
- << gNEvents << std::endl;
+ NUIS_LOG(FIT, "Overriding number of events by user from " << nevt << " to "
+ << gNEvents);
nevt = gNEvents;
}
NtpMCEventRecord *genientpl = NULL;
tn->SetBranchAddress("gmcrec", &genientpl);
// Have the TH1D go from MonoEnergy/2 to MonoEnergy/2
TH1D *fluxhist =
new TH1D("flux", "flux", 1000, MonoEnergy / 2., MonoEnergy * 2.);
fluxhist->Fill(MonoEnergy);
fluxhist->Scale(1, "width");
// Make Event Hist
TH1D *eventhist = (TH1D *)fluxhist->Clone();
eventhist->Reset();
TH1D *xsechist = (TH1D *)eventhist->Clone();
// Create maps
std::map modexsec;
std::map modecount;
std::vector genieids;
std::vector targetids;
std::vector interids;
// Loop over all events
for (int i = 0; i < nevt; i++) {
tn->GetEntry(i);
StopTalking();
EventRecord &event = *(genientpl->event);
GHepParticle *neu = event.Probe();
StartTalking();
// Get XSec From Spline
GHepRecord genie_record = static_cast(event);
double xsec = (genie_record.XSec() / (1E-38 * genie::units::cm2));
// Parse Interaction String
std::string mode = genie_record.Summary()->AsString();
std::vector modevec = GeneralUtils::ParseToStr(mode, ";");
std::string targ = (modevec[0] + ";" + modevec[1]);
std::string inter = mode;
// Fill lists of Unique IDS
if (std::find(targetids.begin(), targetids.end(), targ) ==
targetids.end()) {
targetids.push_back(targ);
}
if (std::find(interids.begin(), interids.end(), inter) == interids.end()) {
interids.push_back(inter);
}
// Create entries Mode Maps
if (modexsec.find(mode) == modexsec.end()) {
genieids.push_back(mode);
modexsec[mode] = (TH1D *)xsechist->Clone();
modecount[mode] = (TH1D *)xsechist->Clone();
modexsec[mode]->GetYaxis()->SetTitle(
"d#sigma/dE_{#nu} #times 10^{-38} (events weighted by #sigma)");
modecount[mode]->GetYaxis()->SetTitle("Number of events in file");
}
// Fill XSec Histograms
modexsec[mode]->Fill(neu->E(), xsec);
modecount[mode]->Fill(neu->E());
// Fill total event hist
eventhist->Fill(neu->E());
// Clear Event
genientpl->Clear();
size_t freq = nevt / 20;
if (freq && !(i % freq)) {
- LOG(FIT) << "Processed " << i << "/" << nevt
- << " GENIE events (E: " << neu->E() << " GeV, xsec: " << xsec
- << " E-38 cm^2/nucleon)" << std::endl;
+ NUIS_LOG(FIT, "Processed "
+ << i << "/" << nevt << " GENIE events (E: " << neu->E()
+ << " GeV, xsec: " << xsec << " E-38 cm^2/nucleon)");
}
}
- LOG(FIT) << "Processed all events" << std::endl;
+ NUIS_LOG(FIT, "Processed all events");
TFile *outputfile;
// If no output is specified just append to the file
if (!gOutputFile.length()) {
tn->GetEntry(0);
outputfile = tn->GetFile();
outputfile->cd();
} else {
outputfile = new TFile(gOutputFile.c_str(), "RECREATE");
outputfile->cd();
- QLOG(FIT, "Cloning input vector to output file: " << gOutputFile);
+ NUIS_LOG(FIT, "Cloning input vector to output file: " << gOutputFile);
TTree *cloneTree = tn->CloneTree(-1, "fast");
cloneTree->SetDirectory(outputfile);
cloneTree->Write();
- QLOG(FIT, "Cloning input nova_wgts to output file: " << gOutputFile);
+ NUIS_LOG(FIT, "Cloning input nova_wgts to output file: " << gOutputFile);
// ***********************************
// ***********************************
// FUDGE FOR NOVA MINERVA WORKSHOP
// Also check for the nova_wgts tree from Jeremy
TChain *nova_chain = new TChain("nova_wgts");
nova_chain->AddFile(input.c_str());
TTree *nova_tree = nova_chain->GetTree();
if (!nova_tree) {
- QLOG(FIT, "Could not find nova_wgts tree in " << gOutputFile);
+ NUIS_LOG(FIT, "Could not find nova_wgts tree in " << gOutputFile);
} else {
- QLOG(FIT, "Found nova_wgts tree in " << gOutputFile);
+ NUIS_LOG(FIT, "Found nova_wgts tree in " << gOutputFile);
}
if (nova_tree) {
nova_tree->SetDirectory(outputfile);
nova_tree->Write();
}
- QLOG(FIT, "Done cloning tree.");
+ NUIS_LOG(FIT, "Done cloning tree.");
}
- LOG(FIT) << "Getting splines in mono-energetic..." << std::endl;
+ NUIS_LOG(FIT, "Getting splines in mono-energetic...");
// Save each of the reconstructed splines to file
std::map modeavg;
TDirectory *inddir = (TDirectory *)outputfile->Get("IndividualGENIESplines");
if (!inddir)
inddir = (TDirectory *)outputfile->mkdir("IndividualGENIESplines");
inddir->cd();
// Loop over GENIE ID's and get MEC count
int MECcount = 0;
bool MECcorrect = FitPar::Config().GetParB("CorrectGENIEMECNorm");
for (UInt_t i = 0; i < genieids.size(); i++) {
if (genieids[i].find("MEC") != std::string::npos) {
MECcount++;
}
}
- LOG(FIT) << "Found " << MECcount << " repeated MEC instances." << std::endl;
+ NUIS_LOG(FIT, "Found " << MECcount << " repeated MEC instances.");
for (UInt_t i = 0; i < genieids.size(); i++) {
std::string mode = genieids[i];
modexsec[mode]->Write((mode + "_summed_xsec").c_str(), TObject::kOverwrite);
modecount[mode]->Write((mode + "_summed_evt").c_str(), TObject::kOverwrite);
// Form extra avg xsec map -> Reconstructed spline
modeavg[mode] = (TH1D *)modexsec[mode]->Clone();
modeavg[mode]->GetYaxis()->SetTitle(
"#sigma (E_{#nu}) #times 10^{-38} (cm^{2}/target)");
modeavg[mode]->Divide(modecount[mode]);
if (MECcorrect && (mode.find("MEC") != std::string::npos)) {
modeavg[mode]->Scale(1.0 / double(MECcount));
}
modeavg[mode]->Write((mode + "_rec_spline").c_str(), TObject::kOverwrite);
}
TDirectory *targdir = (TDirectory *)outputfile->Get("TargetGENIESplines");
if (!targdir)
targdir = (TDirectory *)outputfile->mkdir("TargetGENIESplines");
targdir->cd();
- LOG(FIT) << "Getting Target Splines" << std::endl;
+ NUIS_LOG(FIT, "Getting Target Splines");
// For each target save a total spline
std::map targetsplines;
for (uint i = 0; i < targetids.size(); i++) {
std::string targ = targetids[i];
- LOG(FIT) << "Getting target " << i << ": " << targ << std::endl;
+ NUIS_LOG(FIT, "Getting target " << i << ": " << targ);
targetsplines[targ] = (TH1D *)xsechist->Clone();
targetsplines[targ]->GetYaxis()->SetTitle(
"#sigma (E_{#nu}) #times 10^{-38} (cm^{2}/target)");
- LOG(FIT) << "Created target spline for " << targ << std::endl;
+ NUIS_LOG(FIT, "Created target spline for " << targ);
for (uint j = 0; j < genieids.size(); j++) {
std::string mode = genieids[j];
if (mode.find(targ) != std::string::npos) {
- LOG(FIT) << " Mode " << mode << " contains " << targ << " target"
- << std::endl;
+ NUIS_LOG(FIT, " Mode " << mode << " contains " << targ << " target");
targetsplines[targ]->Add(modeavg[mode]);
- LOG(FIT) << "Finished with Mode " << mode << " "
- << modeavg[mode]->Integral() << std::endl;
+ NUIS_LOG(FIT,
+ "Finished with Mode " << mode << " " << modeavg[mode]->Integral());
}
}
- LOG(FIT) << "Saving target spline:" << targ << std::endl;
+ NUIS_LOG(FIT, "Saving target spline:" << targ);
targetsplines[targ]->Write(("Total_" + targ).c_str(), TObject::kOverwrite);
}
- LOG(FIT) << "Getting total splines" << std::endl;
+ NUIS_LOG(FIT, "Getting total splines");
// Now we have each of the targets we need to create a total cross-section.
int totalnucl = 0;
// Get the targets specified by the user, separated by commas
// This has structure target1[fraction1], target2[fraction2]
std::vector targprs = GeneralUtils::ParseToStr(target, ",");
std::vector targ_list;
std::vector frac_list;
// Chop up the target string which has format
// TARGET1[fraction1],TARGET2[fraction2]
// std::cout << "Targets: " << std::endl;
// Loop over the vector of strings "TARGET1[fraction1]" "TARGET2[fraction2]"
for (std::vector::iterator it = targprs.begin();
it != targprs.end(); ++it) {
// Cut into "TARGET1" and "fraction1]"
std::vector targind = GeneralUtils::ParseToStr(*it, "[");
// std::cout << " " << *it << std::endl;
// Cut into "TARGET1" and "fraction1"
for (std::vector::iterator jt = targind.begin();
jt != targind.end(); ++jt) {
if ((*jt).find("]") != std::string::npos) {
(*jt) = (*jt).substr(0, (*jt).find("]"));
//*jt = "hello";
frac_list.push_back(*jt);
// Won't find bracket for target
} else {
targ_list.push_back(*jt);
}
}
}
targprs = targ_list;
std::vector targ_fractions;
double minimum = 1.0;
for (std::vector::iterator it = frac_list.begin();
it != frac_list.end(); it++) {
// std::cout << " " << *it << std::endl;
double frac = std::atof((*it).c_str());
targ_fractions.push_back(frac);
if (frac < minimum)
minimum = frac;
}
std::vector::iterator it = targ_fractions.begin();
std::vector::iterator jt = targ_list.begin();
double scaling = 0;
for (; it != targ_fractions.end(); it++, jt++) {
// First get the mass number from the targ_list
int nucl = atoi((*jt).c_str());
nucl = (nucl % 10000) / 10;
// Gets the relative portions right
*it = (*it) / minimum;
// Scale relative the atomic mass
//(*it) *= (double(nucl)/(*it));
double tempscaling = double(nucl) / (*it);
if (tempscaling > scaling)
scaling = tempscaling;
}
it = targ_fractions.begin();
for (; it != targ_fractions.end(); it++) {
// Round the scaling to nearest integer and multiply
*it *= int(scaling + 0.5);
// Round to nearest integer
*it = int(*it + 0.5);
totalnucl += *it;
}
if (totalnucl == 0) {
- THROW("Didn't find any nucleons in input file. Did you really specify the "
- "target ratios?\ne.g. TARGET1[fraction1],TARGET2[fraction2]"
- << std::endl);
+ NUIS_ABORT("Didn't find any nucleons in input file. Did you really specify the "
+ "target ratios?\ne.g. TARGET1[fraction1],TARGET2[fraction2]");
}
TH1D *totalxsec = (TH1D *)xsechist->Clone();
for (uint i = 0; i < targprs.size(); i++) {
std::string targpdg = targprs[i];
// Check that we found the user requested target in GENIE
bool FoundTarget = false;
for (std::map::iterator iter = targetsplines.begin();
iter != targetsplines.end(); iter++) {
std::string targstr = iter->first;
TH1D *xsec = iter->second;
// Match the user targets to the targets found in GENIE
if (targstr.find(targpdg) != std::string::npos) {
FoundTarget = true;
- LOG(FIT) << "Adding target spline " << targstr
- << " Integral = " << xsec->Integral("width") << std::endl;
+ NUIS_LOG(FIT, "Adding target spline "
+ << targstr << " Integral = " << xsec->Integral("width"));
totalxsec->Add(xsec);
// int nucl = atoi(targpdg.c_str());
// totalnucl += int((nucl % 10000) / 10);
}
}
// Check that targets were all found
if (!FoundTarget) {
- ERR(WRN) << "Didn't find target " << targpdg
- << " in the list of targets recorded by GENIE" << std::endl;
- ERR(WRN) << " The list of targets you requested is: " << std::endl;
+ NUIS_ERR(WRN, "Didn't find target "
+ << targpdg
+ << " in the list of targets recorded by GENIE");
+ NUIS_ERR(WRN, " The list of targets you requested is: ");
for (uint i = 0; i < targprs.size(); ++i)
- ERR(WRN) << " " << targprs[i] << std::endl;
- ERR(WRN) << " The list of targets found in GENIE is: " << std::endl;
+ NUIS_ERR(WRN, " " << targprs[i]);
+ NUIS_ERR(WRN, " The list of targets found in GENIE is: ");
for (std::map::iterator iter = targetsplines.begin();
iter != targetsplines.end(); iter++)
- ERR(WRN) << " " << iter->first << std::endl;
+ NUIS_ERR(WRN, " " << iter->first);
}
}
outputfile->cd();
totalxsec->GetYaxis()->SetTitle(
"#sigma (E_{#nu}) #times 10^{-38} (cm^{2}/nucleon)");
totalxsec->Write("nuisance_xsec", TObject::kOverwrite);
eventhist = (TH1D *)fluxhist->Clone();
eventhist->Multiply(totalxsec);
eventhist->GetYaxis()->SetTitle(
(std::string("Event rate (N = #sigma #times #Phi) #times 10^{-38} "
"(cm^{2}/nucleon) #times ") +
eventhist->GetYaxis()->GetTitle())
.c_str());
- LOG(FIT) << "Dividing by Total Nucl = " << totalnucl << std::endl;
+ NUIS_LOG(FIT, "Dividing by Total Nucl = " << totalnucl);
eventhist->Scale(1.0 / double(totalnucl));
eventhist->Write("nuisance_events", TObject::kOverwrite);
fluxhist->Write("nuisance_flux", TObject::kOverwrite);
- LOG(FIT) << "Inclusive XSec Per Nucleon = "
- << eventhist->Integral("width") * 1E-38 / fluxhist->Integral("width")
- << std::endl;
- LOG(FIT) << "XSec Hist Integral = " << totalxsec->Integral("width")
- << std::endl;
+ NUIS_LOG(FIT, "Inclusive XSec Per Nucleon = " << eventhist->Integral("width") *
+ 1E-38 /
+ fluxhist->Integral("width"));
+ NUIS_LOG(FIT, "XSec Hist Integral = " << totalxsec->Integral("width"));
outputfile->Close();
return;
}
void RunGENIEPrepare(std::string input, std::string flux, std::string target,
std::string output) {
- LOG(FIT) << "Running GENIE Prepare with flux..." << std::endl;
+ NUIS_LOG(FIT, "Running GENIE Prepare with flux...");
// Get Flux Hist
std::vector fluxvect = GeneralUtils::ParseToStr(flux, ",");
TH1 *fluxhist = NULL;
if (fluxvect.size() == 3) {
double from = GeneralUtils::StrToDbl(fluxvect[0]);
double to = GeneralUtils::StrToDbl(fluxvect[1]);
double step = GeneralUtils::StrToDbl(fluxvect[2]);
int nstep = ceil((to - from) / step);
to = from + step * nstep;
- QLOG(FIT, "Generating flat flux histogram from "
+ NUIS_LOG(FIT, "Generating flat flux histogram from "
<< from << " to " << to << " with bins " << step
<< " wide (NBins = " << nstep << ").");
fluxhist =
new TH1D("spectrum", ";E_{#nu} (GeV);Count (A.U.)", nstep, from, to);
for (Int_t bi_it = 1; bi_it < fluxhist->GetXaxis()->GetNbins(); ++bi_it) {
fluxhist->SetBinContent(bi_it, 1.0 / double(step * nstep));
}
fluxhist->SetDirectory(0);
} else if (fluxvect.size() == 2) {
TFile *fluxfile = new TFile(fluxvect[0].c_str(), "READ");
if (!fluxfile->IsZombie()) {
fluxhist = dynamic_cast(fluxfile->Get(fluxvect[1].c_str()));
if (!fluxhist) {
- ERR(FTL) << "Couldn't find histogram named: \"" << fluxvect[1]
- << "\" in file: \"" << fluxvect[0] << std::endl;
+ NUIS_ERR(FTL, "Couldn't find histogram named: \""
+ << fluxvect[1] << "\" in file: \"" << fluxvect[0]);
throw;
}
fluxhist->SetDirectory(0);
}
} else if (fluxvect.size() == 1) {
MonoEnergy = GeneralUtils::StrToDbl(fluxvect[0]);
RunGENIEPrepareMono(input, target, output);
return;
} else {
- LOG(FTL) << "Bad flux specification: \"" << flux << "\"." << std::endl;
+ NUIS_LOG(FTL, "Bad flux specification: \"" << flux << "\".");
throw;
}
// Setup TTree
TChain *tn = new TChain("gtree");
std::string first_file = "";
if (input.find_first_of(',') != std::string::npos) {
std::vector inputvect = GeneralUtils::ParseToStr(input, ",");
for (size_t iv_it = 0; iv_it < inputvect.size(); ++iv_it) {
tn->AddFile(inputvect[iv_it].c_str());
- QLOG(FIT, "Added input file: " << inputvect[iv_it]);
+ NUIS_LOG(FIT, "Added input file: " << inputvect[iv_it]);
if (!first_file.length()) {
first_file = inputvect[iv_it];
}
}
} else { // The Add form can accept wildcards.
tn->Add(input.c_str());
first_file = input;
}
if (tn->GetFile() == NULL) {
tn->Print();
- ERROR(FTL, "gtree not located in GENIE file: " << input);
- THROW("Check your inputs, they may need to be completely regenerated!");
+ NUIS_ERR(FTL, "gtree not located in GENIE file: " << input);
+ NUIS_ABORT("Check your inputs, they may need to be completely regenerated!");
throw;
}
int nevt = tn->GetEntries();
if (gNEvents != -999) {
- LOG(FIT) << "Overriding number of events by user from " << nevt << " to "
- << gNEvents << std::endl;
+ NUIS_LOG(FIT, "Overriding number of events by user from " << nevt << " to "
+ << gNEvents);
nevt = gNEvents;
}
if (!nevt) {
- THROW("Couldn't load any events from input specification: \""
- << input.c_str() << "\"");
+ NUIS_ABORT("Couldn't load any events from input specification: \""
+ << input.c_str() << "\"");
} else {
- QLOG(FIT, "Found " << nevt << " input entries in " << input);
+ NUIS_LOG(FIT, "Found " << nevt << " input entries in " << input);
}
NtpMCEventRecord *genientpl = NULL;
tn->SetBranchAddress("gmcrec", &genientpl);
// Make Event and xsec Hist
TH1D *eventhist = (TH1D *)fluxhist->Clone();
eventhist->SetDirectory(NULL);
eventhist->Reset();
TH1D *xsechist = (TH1D *)eventhist->Clone();
xsechist->SetDirectory(NULL);
// Create maps
std::map modexsec;
std::map modecount;
std::vector genieids;
std::vector targetids;
std::vector interids;
// Loop over all events
for (int i = 0; i < nevt; i++) {
tn->GetEntry(i);
// Hussssch GENIE
StopTalking();
// Get the event
EventRecord &event = *(genientpl->event);
// Get the neutrino
GHepParticle *neu = event.Probe();
StartTalking();
// Get XSec From Spline
// Get the GHepRecord
GHepRecord genie_record = static_cast(event);
double xsec = (genie_record.XSec() / (1E-38 * genie::units::cm2));
// Parse Interaction String
std::string mode = genie_record.Summary()->AsString();
std::vector modevec = GeneralUtils::ParseToStr(mode, ";");
std::string targ = (modevec[0] + ";" + modevec[1]);
std::string inter = mode;
// Get target nucleus
// Alternative ways of getting the summaries
// GHepParticle *target = genie_record.TargetNucleus();
// int pdg = target->Pdg();
// Fill lists of Unique IDS (neutrino and target)
if (std::find(targetids.begin(), targetids.end(), targ) ==
targetids.end()) {
targetids.push_back(targ);
}
// The full interaction list
if (std::find(interids.begin(), interids.end(), inter) == interids.end()) {
interids.push_back(inter);
}
// Create entries Mode Maps
if (modexsec.find(mode) == modexsec.end()) {
genieids.push_back(mode);
modexsec[mode] = (TH1D *)xsechist->Clone();
modecount[mode] = (TH1D *)xsechist->Clone();
modexsec[mode]->SetDirectory(NULL);
modecount[mode]->SetDirectory(NULL);
modexsec[mode]->GetYaxis()->SetTitle(
"d#sigma/dE_{#nu} #times 10^{-38} (events weighted by #sigma)");
modecount[mode]->GetYaxis()->SetTitle("Number of events in file");
}
// Fill XSec Histograms
modexsec[mode]->Fill(neu->E(), xsec);
modecount[mode]->Fill(neu->E());
// Fill total event hist
eventhist->Fill(neu->E());
if (i % (nevt / 20) == 0) {
- LOG(FIT) << "Processed " << i << "/" << nevt
- << " GENIE events (E: " << neu->E() << " GeV, xsec: " << xsec
- << " E-38 cm^2/nucleon)" << std::endl;
+ NUIS_LOG(FIT, "Processed "
+ << i << "/" << nevt << " GENIE events (E: " << neu->E()
+ << " GeV, xsec: " << xsec << " E-38 cm^2/nucleon)");
}
// Clear Event
genientpl->Clear();
}
- LOG(FIT) << "Processed all events" << std::endl;
+ NUIS_LOG(FIT, "Processed all events");
// Once event loop is done we can start saving stuff into the file
TFile *outputfile;
if (!gOutputFile.length()) {
// Shut the chain;
delete tn;
outputfile = new TFile(first_file.c_str(), "UPDATE");
} else {
outputfile = new TFile(gOutputFile.c_str(), "RECREATE");
outputfile->cd();
- QLOG(FIT, "Cloning input vector to output file: " << gOutputFile);
+ NUIS_LOG(FIT, "Cloning input vector to output file: " << gOutputFile);
TTree *cloneTree = tn->CloneTree(-1, "fast");
cloneTree->SetDirectory(outputfile);
cloneTree->Write();
// ********************************
// CLUDGE KLUDGE KLUDGE FOR NOVA
- QLOG(FIT, "Cloning input nova_wgts to output file: " << gOutputFile);
+ NUIS_LOG(FIT, "Cloning input nova_wgts to output file: " << gOutputFile);
// Also check for the nova_wgts tree from Jeremy
TChain *nova_chain = new TChain("nova_wgts");
nova_chain->AddFile(input.c_str());
TTree *nova_tree = nova_chain->CloneTree(-1, "fast");
if (!nova_tree) {
- QLOG(FIT, "Could not find nova_wgts tree in " << input);
+ NUIS_LOG(FIT, "Could not find nova_wgts tree in " << input);
} else {
- QLOG(FIT, "Found nova_wgts tree in " << input);
+ NUIS_LOG(FIT, "Found nova_wgts tree in " << input);
nova_tree->SetDirectory(outputfile);
nova_tree->Write();
}
- QLOG(FIT, "Done cloning tree.");
+ NUIS_LOG(FIT, "Done cloning tree.");
}
- LOG(FIT) << "Getting splines..." << std::endl;
+ NUIS_LOG(FIT, "Getting splines...");
// Save each of the reconstructed splines to file
std::map modeavg;
TDirectory *inddir = (TDirectory *)outputfile->Get("IndividualGENIESplines");
if (!inddir)
inddir = (TDirectory *)outputfile->mkdir("IndividualGENIESplines");
inddir->cd();
// Loop over GENIE ID's and get MEC count
int MECcount = 0;
bool MECcorrect = FitPar::Config().GetParB("CorrectGENIEMECNorm");
for (UInt_t i = 0; i < genieids.size(); i++) {
if (genieids[i].find("MEC") != std::string::npos) {
MECcount++;
}
}
- LOG(FIT) << "Found " << MECcount << " repeated MEC instances." << std::endl;
+ NUIS_LOG(FIT, "Found " << MECcount << " repeated MEC instances.");
for (UInt_t i = 0; i < genieids.size(); i++) {
std::string mode = genieids[i];
modexsec[mode]->Write((mode + "_summed_xsec").c_str(), TObject::kOverwrite);
modecount[mode]->Write((mode + "_summed_evt").c_str(), TObject::kOverwrite);
// Form extra avg xsec map -> Reconstructed spline
modeavg[mode] = (TH1D *)modexsec[mode]->Clone();
modeavg[mode]->GetYaxis()->SetTitle(
"#sigma (E_{#nu}) #times 10^{-38} (cm^{2}/target)");
modeavg[mode]->Divide(modecount[mode]);
if (MECcorrect && (mode.find("MEC") != std::string::npos)) {
modeavg[mode]->Scale(1.0 / double(MECcount));
}
modeavg[mode]->Write((mode + "_rec_spline").c_str(), TObject::kOverwrite);
}
TDirectory *targdir = (TDirectory *)outputfile->Get("TargetGENIESplines");
if (!targdir)
targdir = (TDirectory *)outputfile->mkdir("TargetGENIESplines");
targdir->cd();
- LOG(FIT) << "Getting Target Splines" << std::endl;
+ NUIS_LOG(FIT, "Getting Target Splines");
// For each target save a total spline
std::map targetsplines;
for (uint i = 0; i < targetids.size(); i++) {
std::string targ = targetids[i];
- LOG(FIT) << "Getting target " << i << ": " << targ << std::endl;
+ NUIS_LOG(FIT, "Getting target " << i << ": " << targ);
targetsplines[targ] = (TH1D *)xsechist->Clone();
targetsplines[targ]->GetYaxis()->SetTitle(
"#sigma (E_{#nu}) #times 10^{-38} (cm^{2}/target)");
- LOG(FIT) << "Created target spline for " << targ << std::endl;
+ NUIS_LOG(FIT, "Created target spline for " << targ);
for (uint j = 0; j < genieids.size(); j++) {
std::string mode = genieids[j];
// Look at all matching modes/targets
if (mode.find(targ) != std::string::npos) {
- LOG(FIT) << " Mode " << mode << " contains " << targ << " target"
- << std::endl;
+ NUIS_LOG(FIT, " Mode " << mode << " contains " << targ << " target");
targetsplines[targ]->Add(modeavg[mode]);
- LOG(FIT) << "Finished with Mode " << mode << " "
- << modeavg[mode]->Integral() << std::endl;
+ NUIS_LOG(FIT,
+ "Finished with Mode " << mode << " " << modeavg[mode]->Integral());
}
}
- LOG(FIT) << "Saving target spline: " << targ << std::endl;
+ NUIS_LOG(FIT, "Saving target spline: " << targ);
targetsplines[targ]->Write(("Total_" + targ).c_str(), TObject::kOverwrite);
}
- LOG(FIT) << "Getting total splines" << std::endl;
+ NUIS_LOG(FIT, "Getting total splines");
// Now we have each of the targets we need to create a total cross-section.
int totalnucl = 0;
// This has structure target1[fraction1], target2[fraction2]
std::vector targprs = GeneralUtils::ParseToStr(target, ",");
std::vector targ_list;
std::vector frac_list;
// Chop up the target string which has format
// TARGET1[fraction1],TARGET2[fraction2]
// std::cout << "Targets: " << std::endl;
// Loop over the vector of strings "TARGET1[fraction1]" "TARGET2[fraction2]"
for (std::vector::iterator it = targprs.begin();
it != targprs.end(); ++it) {
// Cut into "TARGET1" and "fraction1]"
std::vector targind = GeneralUtils::ParseToStr(*it, "[");
// std::cout << " " << *it << std::endl;
// Cut into "TARGET1" and "fraction1"
for (std::vector::iterator jt = targind.begin();
jt != targind.end(); ++jt) {
if ((*jt).find("]") != std::string::npos) {
(*jt) = (*jt).substr(0, (*jt).find("]"));
//*jt = "hello";
frac_list.push_back(*jt);
// Won't find bracket for target
} else {
targ_list.push_back(*jt);
}
}
}
targprs = targ_list;
std::vector targ_fractions;
double minimum = 1.0;
for (std::vector::iterator it = frac_list.begin();
it != frac_list.end(); it++) {
// std::cout << " " << *it << std::endl;
double frac = std::atof((*it).c_str());
targ_fractions.push_back(frac);
if (frac < minimum)
minimum = frac;
}
std::vector::iterator it = targ_fractions.begin();
std::vector::iterator jt = targ_list.begin();
double scaling = 0;
for (; it != targ_fractions.end(); it++, jt++) {
// First get the mass number from the targ_list
int nucl = atoi((*jt).c_str());
nucl = (nucl % 10000) / 10;
// Gets the relative portions right
*it = (*it) / minimum;
// Scale relative the atomic mass
//(*it) *= (double(nucl)/(*it));
double tempscaling = double(nucl) / (*it);
if (tempscaling > scaling)
scaling = tempscaling;
}
it = targ_fractions.begin();
for (; it != targ_fractions.end(); it++) {
// Round the scaling to nearest integer and multiply
*it *= int(scaling + 0.5);
// Round to nearest integer
*it = int(*it + 0.5);
totalnucl += *it;
}
if (totalnucl == 0) {
- THROW("Didn't find any nucleons in input file. Did you really specify the "
- "target ratios?\ne.g. TARGET1[fraction1],TARGET2[fraction2]"
- << std::endl);
+ NUIS_ABORT("Didn't find any nucleons in input file. Did you really specify the "
+ "target ratios?\ne.g. TARGET1[fraction1],TARGET2[fraction2]");
}
TH1D *totalxsec = (TH1D *)xsechist->Clone();
// Loop over the specified targets by the user
for (uint i = 0; i < targprs.size(); i++) {
std::string targpdg = targprs[i];
// Check that we found the user requested target in GENIE
bool FoundTarget = false;
for (std::map::iterator iter = targetsplines.begin();
iter != targetsplines.end(); iter++) {
std::string targstr = iter->first;
TH1D *xsec = iter->second;
// Match the user targets to the targets found in GENIE
if (targstr.find(targpdg) != std::string::npos) {
FoundTarget = true;
- LOG(FIT) << "Adding target spline " << targstr
- << " Integral = " << xsec->Integral("width") << std::endl;
+ NUIS_LOG(FIT, "Adding target spline "
+ << targstr << " Integral = " << xsec->Integral("width"));
totalxsec->Add(xsec);
// int nucl = atoi(targpdg.c_str());
// totalnucl += int((nucl % 10000) / 10);
}
} // Looped over target splines
// Check that targets were all found
if (!FoundTarget) {
- ERR(WRN) << "Didn't find target " << targpdg
- << " in the list of targets recorded by GENIE" << std::endl;
- ERR(WRN) << " The list of targets you requested is: " << std::endl;
+ NUIS_ERR(WRN, "Didn't find target "
+ << targpdg
+ << " in the list of targets recorded by GENIE");
+ NUIS_ERR(WRN, " The list of targets you requested is: ");
for (uint i = 0; i < targprs.size(); ++i)
- ERR(WRN) << " " << targprs[i] << std::endl;
- ERR(WRN) << " The list of targets found in GENIE is: " << std::endl;
+ NUIS_ERR(WRN, " " << targprs[i]);
+ NUIS_ERR(WRN, " The list of targets found in GENIE is: ");
for (std::map::iterator iter = targetsplines.begin();
iter != targetsplines.end(); iter++)
- ERR(WRN) << " " << iter->first << std::endl;
+ NUIS_ERR(WRN, " " << iter->first);
}
}
outputfile->cd();
totalxsec->GetYaxis()->SetTitle(
"#sigma (E_{#nu}) #times 10^{-38} (cm^{2}/nucleon)");
totalxsec->Write("nuisance_xsec", TObject::kOverwrite);
eventhist = (TH1D *)fluxhist->Clone();
eventhist->Multiply(totalxsec);
eventhist->GetYaxis()->SetTitle(
(std::string("Event rate (N = #sigma #times #Phi) #times 10^{-38} "
"(cm^{2}/nucleon) #times ") +
eventhist->GetYaxis()->GetTitle())
.c_str());
- LOG(FIT) << "Dividing by Total Nucl = " << totalnucl << std::endl;
+ NUIS_LOG(FIT, "Dividing by Total Nucl = " << totalnucl);
eventhist->Scale(1.0 / double(totalnucl));
eventhist->Write("nuisance_events", TObject::kOverwrite);
fluxhist->Write("nuisance_flux", TObject::kOverwrite);
- LOG(FIT) << "Inclusive XSec Per Nucleon = "
- << eventhist->Integral("width") * 1E-38 / fluxhist->Integral("width")
- << std::endl;
- LOG(FIT) << "XSec Hist Integral = " << totalxsec->Integral() << std::endl;
+ NUIS_LOG(FIT, "Inclusive XSec Per Nucleon = " << eventhist->Integral("width") *
+ 1E-38 /
+ fluxhist->Integral("width"));
+ NUIS_LOG(FIT, "XSec Hist Integral = " << totalxsec->Integral());
outputfile->Close();
return;
};
void PrintOptions() {
std::cout << "PrepareGENIEEvents NUISANCE app. " << std::endl
<< "Takes GHep Outputs and prepares events for NUISANCE."
<< std::endl
<< std::endl
<< "PrepareGENIE [-h,-help,--h,--help] [-i "
"inputfile1.root,inputfile2.root,inputfile3.root,...] "
<< "[-f flux_root_file.root,flux_hist_name] [-t "
"target1[frac1],target2[frac2],...]"
<< "[-n number_of_events (experimental)]" << std::endl
<< std::endl;
std::cout << "Prepare Mode [Default] : Takes a single GHep file, "
"reconstructs the original GENIE splines, "
<< " and creates a duplicate file that also contains the flux, "
"event rate, and xsec predictions that NUISANCE needs. "
<< std::endl;
std::cout << "Following options are required for Prepare Mode:" << std::endl;
std::cout << " [ -i inputfile.root ] : Reads in a single GHep input file "
"that needs the xsec calculation ran on it. "
<< std::endl;
std::cout << " [ -f flux_file.root,hist_name ] : Path to root file "
"containing the flux histogram the GHep records were generated "
"with."
<< " A simple method is to point this to the flux histogram genie "
"generatrs '-f /path/to/events/input-flux.root,spectrum'. "
<< std::endl;
std::cout << " [ -f elow,ehigh,estep ] : Energy range specification when no "
"flux file was used."
<< std::endl;
std::cout << " [ -t target ] : Target that GHepRecords were generated with. "
"Comma seperated list. E.g. for CH2 "
"target=1000060120,1000010010,1000010010"
<< std::endl;
std::cout << " [ -o outputfile.root ] : File to write prepared input file to."
<< std::endl;
std::cout << " [ -m Mono_E_nu_GeV ] : Run in mono-energetic mode with m GeV "
"neutrino energy."
<< std::endl;
std::cout << " [ -n number_of_evt ] : Run with a reduced number of events "
"for debugging purposes"
<< std::endl;
}
void ParseOptions(int argc, char *argv[]) {
bool flagopt = false;
// If No Arguments print commands
for (int i = 1; i < argc; ++i) {
if (!std::strcmp(argv[i], "-h")) {
flagopt = true;
break;
}
if (i + 1 != argc) {
// Cardfile
if (!std::strcmp(argv[i], "-h")) {
flagopt = true;
break;
} else if (!std::strcmp(argv[i], "-i")) {
gInputFiles = argv[i + 1];
++i;
} else if (!std::strcmp(argv[i], "-o")) {
gOutputFile = argv[i + 1];
++i;
} else if (!std::strcmp(argv[i], "-f")) {
gFluxFile = argv[i + 1];
++i;
} else if (!std::strcmp(argv[i], "-t")) {
gTarget = argv[i + 1];
++i;
} else if (!std::strcmp(argv[i], "-n")) {
gNEvents = GeneralUtils::StrToInt(argv[i + 1]);
++i;
} else if (!std::strcmp(argv[i], "-m")) {
MonoEnergy = GeneralUtils::StrToDbl(argv[i + 1]);
IsMonoE = true;
++i;
} else {
- ERR(FTL) << "ERROR: unknown command line option given! - '" << argv[i]
- << " " << argv[i + 1] << "'" << std::endl;
+ NUIS_ERR(FTL, "ERROR: unknown command line option given! - '"
+ << argv[i] << " " << argv[i + 1] << "'");
PrintOptions();
break;
}
}
}
if (gInputFiles == "" && !flagopt) {
- ERR(FTL) << "No input file(s) specified!" << std::endl;
+ NUIS_ERR(FTL, "No input file(s) specified!");
flagopt = true;
}
if (gFluxFile == "" && !flagopt && !IsMonoE) {
- ERR(FTL) << "No flux input specified for Prepare Mode" << std::endl;
+ NUIS_ERR(FTL, "No flux input specified for Prepare Mode");
flagopt = true;
}
if (gTarget == "" && !flagopt) {
- ERR(FTL) << "No target specified for Prepare Mode" << std::endl;
+ NUIS_ERR(FTL, "No target specified for Prepare Mode");
flagopt = true;
}
if (gTarget.find("[") == std::string::npos ||
gTarget.find("]") == std::string::npos) {
- ERR(FTL) << "Didn't specify target ratios in Prepare Mode" << std::endl;
- ERR(FTL) << "Are you sure you gave it as -t "
- "\"TARGET1[fraction1],TARGET2[fraction]\"?"
- << std::endl;
+ NUIS_ERR(FTL, "Didn't specify target ratios in Prepare Mode");
+ NUIS_ERR(FTL, "Are you sure you gave it as -t "
+ "\"TARGET1[fraction1],TARGET2[fraction]\"?");
flagopt = true;
}
if (argc < 1 || flagopt) {
PrintOptions();
exit(-1);
}
return;
}
diff --git a/app/PrepareNEUT.cxx b/app/PrepareNEUT.cxx
index d177a46..10cab79 100644
--- a/app/PrepareNEUT.cxx
+++ b/app/PrepareNEUT.cxx
@@ -1,424 +1,416 @@
#include "FitLogger.h"
#include "PlotUtils.h"
#include "StatUtils.h"
#include "TFile.h"
#include "TH1D.h"
#include "TTree.h"
#include
#include
// If you don't have NEUT enabled, you shouldn't compile this...
#include "neutpart.h"
#include "neutvect.h"
std::string fInputFiles = "";
std::string fOutputFile = "";
std::string fFluxFile = "";
bool fFluxInGeV = false;
bool fIsMonoEFlux = false;
double fMonoEEnergy = 0xdeadbeef;
void PrintOptions();
void ParseOptions(int argc, char *argv[]);
void AddMonoRateHistogram(std::string inputList, double MonoE,
std::string output);
void CreateRateHistogram(std::string inputList, std::string flux,
std::string output);
//*******************************
int main(int argc, char *argv[]) {
//*******************************
- LOG_VERB(FitPar::Config().GetParI("VERBOSITY"));
- ERR_VERB(FitPar::Config().GetParI("ERROR"));
+ SETVERBOSITY(FitPar::Config().GetParI("VERBOSITY"));
+ SETERRVERBOSITY(FitPar::Config().GetParI("ERROR"));
ParseOptions(argc, argv);
- LOG(FIT) << "Running PrepareNEUT" << std::endl;
+ NUIS_LOG(FIT, "Running PrepareNEUT");
if (fIsMonoEFlux) {
AddMonoRateHistogram(fInputFiles, fMonoEEnergy, fOutputFile);
} else {
CreateRateHistogram(fInputFiles, fFluxFile, fOutputFile);
}
};
void AddMonoRateHistogram(std::string inputList, double MonoE,
std::string output) {
// Need to allow for more than one file... will do soon
TChain *tn = new TChain("neuttree");
std::vector inputs = GeneralUtils::ParseToStr(inputList, ",");
for (std::vector::iterator it = inputs.begin();
it != inputs.end(); ++it) {
- LOG(FIT) << "Adding " << *it << " to the output" << std::endl;
+ NUIS_LOG(FIT, "Adding " << *it << " to the output");
tn->AddFile((*it).c_str());
}
if (inputs.size() > 1 && output.empty()) {
- ERR(FTL) << "You must provide a new output file name if you want to have "
- "more than 1 input file!"
- << std::endl;
- throw;
+ NUIS_ABORT("You must provide a new output file name if you want to have "
+ "more than 1 input file!");
}
int nevts = tn->GetEntries();
if (!nevts) {
- ERR(FTL) << "Either the input file is not from NEUT, or it's empty..."
- << std::endl;
- throw;
+ NUIS_ABORT("Either the input file is not from NEUT, or it's empty...");
}
NeutVect *fNeutVect = NULL;
tn->SetBranchAddress("vectorbranch", &fNeutVect);
TH1D *fluxHist = new TH1D("flux", "flux", 1000, 0, fFluxInGeV ? 10 : 10000);
fluxHist->Fill(MonoE);
fluxHist->Scale(1, "width");
// Make Event Hist
TH1D *xsecHist = (TH1D *)fluxHist->Clone();
xsecHist->Reset();
// Make a total cross section hist for shits and giggles
TH1D *entryHist = (TH1D *)xsecHist->Clone();
double MeanE = 0;
for (int i = 0; i < nevts; ++i) {
tn->GetEntry(i);
NeutPart *part = fNeutVect->PartInfo(0);
double E = part->fP.E();
double xsec = fNeutVect->Totcrs;
// Unit conversion
if (fFluxInGeV)
E *= 1E-3;
xsecHist->Fill(E, xsec);
entryHist->Fill(E);
MeanE += E;
if (i % (nevts / 20) == 0) {
- LOG(FIT) << "Processed " << i << "/" << nevts << " NEUT events."
- << std::endl;
+ NUIS_LOG(FIT, "Processed " << i << "/" << nevts << " NEUT events.");
}
}
MeanE /= double(nevts);
- LOG(FIT) << "Processed all events" << std::endl;
+ NUIS_LOG(FIT, "Processed all events");
xsecHist->Divide(entryHist);
// This will be the evtrt histogram
TH1D *evtHist = (TH1D *)xsecHist->Clone();
evtHist->Multiply(fluxHist);
// Check whether the overflow is empty. If not, advise that either the wrong
// flux histogram or units were used...
// If the events were generated with a limited range of the flux histogram,
// this may be benign
if (evtHist->Integral(0, -1) != evtHist->Integral() ||
evtHist->Integral(0, -1) == 0) {
- ERR(WRN) << "The input file(" << evtHist->Integral(0, -1)
- << ") and flux histogram provided do not match... " << std::endl;
- ERR(WRN) << "Are the units correct (MeanE = " << MeanE
- << ", FluxHistoUpperLim: "
- << fluxHist->GetXaxis()->GetBinUpEdge(1000)
- << ")? Did you provide the correct flux file?" << std::endl;
- ERR(WRN) << "Use output with caution..." << std::endl;
+ NUIS_ERR(WRN, "The input file("
+ << evtHist->Integral(0, -1)
+ << ") and flux histogram provided do not match... ");
+ NUIS_ERR(WRN, "Are the units correct (MeanE = "
+ << MeanE << ", FluxHistoUpperLim: "
+ << fluxHist->GetXaxis()->GetBinUpEdge(1000)
+ << ")? Did you provide the correct flux file?");
+ NUIS_ERR(WRN, "Use output with caution...");
}
// Pick where the output should go
TFile *outFile = NULL;
if (!output.empty()) {
- LOG(FIT) << "Saving histograms in " << output << std::endl;
+ NUIS_LOG(FIT, "Saving histograms in " << output);
outFile = new TFile(output.c_str(), "RECREATE");
} else {
- LOG(FIT) << "Saving histograms in " << inputs[0] << std::endl;
+ NUIS_LOG(FIT, "Saving histograms in " << inputs[0]);
outFile = new TFile(inputs[0].c_str(), "UPDATE");
}
outFile->cd();
std::string xsec_name = "xsec_PrepareNeut";
std::string flux_name = "flux_PrepareNeut";
std::string rate_name = "evtrt_PrepareNeut";
if (output.empty()) {
// Check whether we should overwrite existing histograms
std::string input_xsec = PlotUtils::GetObjectWithName(outFile, "xsec");
std::string input_flux = PlotUtils::GetObjectWithName(outFile, "flux");
std::string input_rate = PlotUtils::GetObjectWithName(outFile, "evtrt");
if (!input_xsec.empty()) {
- LOG(FIT) << "Updating histogram: " << input_xsec << std::endl;
+ NUIS_LOG(FIT, "Updating histogram: " << input_xsec);
xsec_name = input_xsec;
}
if (!input_flux.empty()) {
- LOG(FIT) << "Updating histogram: " << input_flux << std::endl;
+ NUIS_LOG(FIT, "Updating histogram: " << input_flux);
flux_name = input_flux;
}
if (!input_rate.empty()) {
- LOG(FIT) << "Updating histogram: " << input_rate << std::endl;
+ NUIS_LOG(FIT, "Updating histogram: " << input_rate);
rate_name = input_rate;
}
} else {
- LOG(FIT) << "Cloning neuttree into output file." << std::endl;
+ NUIS_LOG(FIT, "Cloning neuttree into output file.");
StopTalking();
TTree *newtree = (TTree *)tn->CloneTree(-1, "fast");
StartTalking();
newtree->Write();
}
xsecHist->Write(xsec_name.c_str(), TObject::kOverwrite);
fluxHist->Write(flux_name.c_str(), TObject::kOverwrite);
evtHist->Write(rate_name.c_str(), TObject::kOverwrite);
outFile->Close();
}
//*******************************
void CreateRateHistogram(std::string inputList, std::string flux,
std::string output) {
//*******************************
// Need to allow for more than one file... will do soon
TChain *tn = new TChain("neuttree");
std::vector inputs = GeneralUtils::ParseToStr(inputList, ",");
for (std::vector::iterator it = inputs.begin();
it != inputs.end(); ++it) {
- LOG(FIT) << "Adding " << *it << " to the output" << std::endl;
+ NUIS_LOG(FIT, "Adding " << *it << " to the output");
tn->AddFile((*it).c_str());
}
if (inputs.size() > 1 && output.empty()) {
- ERR(FTL) << "You must provide a new output file name if you want to have "
- "more than 1 input file!"
- << std::endl;
- throw;
+ NUIS_ABORT("You must provide a new output file name if you want to have "
+ "more than 1 input file!");
}
int nevts = tn->GetEntries();
if (!nevts) {
- ERR(FTL) << "Either the input file is not from NEUT, or it's empty..."
- << std::endl;
- throw;
+ NUIS_ABORT("Either the input file is not from NEUT, or it's empty...");
}
NeutVect *fNeutVect = NULL;
tn->SetBranchAddress("vectorbranch", &fNeutVect);
// Get Flux Hist
std::vector fluxvect = GeneralUtils::ParseToStr(flux, ",");
TH1D *fluxHist = NULL;
if (fluxvect.size() > 1) {
TFile *fluxfile = new TFile(fluxvect[0].c_str(), "READ");
fluxHist = (TH1D *)fluxfile->Get(fluxvect[1].c_str());
fluxHist->SetDirectory(0);
} else {
- ERR(FTL) << "NO FLUX SPECIFIED" << std::endl;
- throw;
+ NUIS_ABORT("NO FLUX SPECIFIED");
}
// Decide what type of flux was given
- if (fFluxInGeV)
- LOG(FIT) << "Assuming flux histogram is in GeV" << std::endl;
- else
- LOG(FIT) << "Assuming flux histogram is in MeV" << std::endl;
+ if (fFluxInGeV) {
+ NUIS_LOG(FIT, "Assuming flux histogram is in GeV");
+ } else {
+ NUIS_LOG(FIT, "Assuming flux histogram is in MeV");
+ }
// Make Event Hist
TH1D *xsecHist = (TH1D *)fluxHist->Clone();
xsecHist->Reset();
// Make a total cross section hist for shits and giggles
TH1D *entryHist = (TH1D *)xsecHist->Clone();
for (int i = 0; i < nevts; ++i) {
tn->GetEntry(i);
NeutPart *part = fNeutVect->PartInfo(0);
double E = part->fP.E();
double xsec = fNeutVect->Totcrs;
// Unit conversion
if (fFluxInGeV)
E *= 1E-3;
xsecHist->Fill(E, xsec);
entryHist->Fill(E);
if (i % (nevts / 20) == 0) {
- LOG(FIT) << "Processed " << i << "/" << nevts << " NEUT events."
- << "(Enu = " << E << ", xsec = " << xsec << ") " << std::endl;
+ NUIS_LOG(FIT, "Processed " << i << "/" << nevts << " NEUT events."
+ << "(Enu = " << E << ", xsec = " << xsec << ") ");
}
}
- LOG(FIT) << "Processed all events" << std::endl;
+ NUIS_LOG(FIT, "Processed all events");
xsecHist->Divide(entryHist);
// This will be the evtrt histogram
TH1D *evtHist = NULL;
// If the integral of xsecHist is 0 the input file used a really old version
// of NEUT without Totcrs
if (!xsecHist->Integral(0, -1)) {
- ERR(WRN) << "Old NEUT input file: events will not be correctly normalized"
- << std::endl;
+ NUIS_ERR(WRN, "Old NEUT input file: events will not be correctly normalized");
evtHist = (TH1D *)entryHist->Clone();
if (evtHist->Integral() != 0)
evtHist->Scale(fluxHist->Integral() / float(evtHist->Integral()));
} else {
evtHist = (TH1D *)xsecHist->Clone();
evtHist->Multiply(fluxHist);
}
// Check whether the overflow is empty. If not, advise that either the wrong
// flux histogram or units were used...
// If the events were generated with a limited range of the flux histogram,
// this may be benign
if (evtHist->Integral(0, -1) != evtHist->Integral() ||
evtHist->Integral(0, -1) == 0) {
- ERR(WRN) << "The input file(" << evtHist->Integral(0, -1)
- << ") and flux histogram provided do not match... " << std::endl;
- ERR(WRN) << "Are the units correct? Did you provide the correct flux file?"
- << std::endl;
- ERR(WRN) << "Use output with caution..." << std::endl;
+ NUIS_ERR(WRN, "The input file("
+ << evtHist->Integral(0, -1)
+ << ") and flux histogram provided do not match... ");
+ NUIS_ERR(WRN,
+ "Are the units correct? Did you provide the correct flux file?");
+ NUIS_ERR(WRN, "Use output with caution...");
}
// Pick where the output should go
TFile *outFile = NULL;
if (!output.empty()) {
- LOG(FIT) << "Saving histograms in " << output << std::endl;
+ NUIS_LOG(FIT, "Saving histograms in " << output);
outFile = new TFile(output.c_str(), "RECREATE");
} else {
- LOG(FIT) << "Saving histograms in " << inputs[0] << std::endl;
+ NUIS_LOG(FIT, "Saving histograms in " << inputs[0]);
outFile = new TFile(inputs[0].c_str(), "UPDATE");
}
outFile->cd();
std::string xsec_name = "xsec_PrepareNeut";
std::string flux_name = "flux_PrepareNeut";
std::string rate_name = "evtrt_PrepareNeut";
if (output.empty()) {
// Check whether we should overwrite existing histograms
std::string input_xsec = PlotUtils::GetObjectWithName(outFile, "xsec");
std::string input_flux = PlotUtils::GetObjectWithName(outFile, "flux");
std::string input_rate = PlotUtils::GetObjectWithName(outFile, "evtrt");
if (!input_xsec.empty()) {
- LOG(FIT) << "Updating histogram: " << input_xsec << std::endl;
+ NUIS_LOG(FIT, "Updating histogram: " << input_xsec);
xsec_name = input_xsec;
}
if (!input_flux.empty()) {
- LOG(FIT) << "Updating histogram: " << input_flux << std::endl;
+ NUIS_LOG(FIT, "Updating histogram: " << input_flux);
flux_name = input_flux;
}
if (!input_rate.empty()) {
- LOG(FIT) << "Updating histogram: " << input_rate << std::endl;
+ NUIS_LOG(FIT, "Updating histogram: " << input_rate);
rate_name = input_rate;
}
} else {
- LOG(FIT) << "Cloning neuttree into output file." << std::endl;
+ NUIS_LOG(FIT, "Cloning neuttree into output file.");
StopTalking();
TTree *newtree = (TTree *)tn->CloneTree(-1, "fast");
StartTalking();
newtree->Write();
}
xsecHist->Write(xsec_name.c_str(), TObject::kOverwrite);
fluxHist->Write(flux_name.c_str(), TObject::kOverwrite);
evtHist->Write(rate_name.c_str(), TObject::kOverwrite);
outFile->Close();
return;
}
void PrintOptions() {
std::cout << "PrepareNEUT NUISANCE app. " << std::endl
<< "Produces or recalculates evtrt and flux histograms necessary "
"for NUISANCE normalization."
<< std::endl;
std::cout << "PrepareNEUT: " << std::endl;
std::cout << " [-h,-help,--h,--help]" << std::endl;
std::cout << " -i inputfile1.root,inputfile2.root,inputfile3.root,..."
<< std::endl;
std::cout << " Takes any number of files, but assumes all are "
"produced with a single flux"
<< std::endl;
std::cout << " -f flux_root_file.root,flux_hist_name" << std::endl;
std::cout << " Path to root file containing the flux histogram used "
"when generating the NEUT files"
<< std::endl;
std::cout << " [-o outputfile.root] " << std::endl;
std::cout
<< " If an output file is not given, the input file will be used"
<< std::endl;
std::cout << " If more than one input file is given, an output file "
"must be given"
<< std::endl;
std::cout << " [-G]" << std::endl;
std::cout << " Flux is assumed to be in MeV. This switch indicates "
"the input flux is in GeV"
<< std::endl;
std::cout << " [-m E_nu]" << std::endl;
std::cout << " Used to add dummy flux and evt rate histograms to "
"mono-energetic vectors. Adheres to the -G flag."
<< std::endl;
}
void ParseOptions(int argc, char *argv[]) {
bool flagopt = false;
// If No Arguments print commands
for (int i = 1; i < argc; ++i) {
if (!std::strcmp(argv[i], "-h")) {
flagopt = true;
break;
} else if (!std::strcmp(argv[i], "-G")) {
fFluxInGeV = true;
continue;
}
if (i + 1 != argc) {
// Cardfile
if (!std::strcmp(argv[i], "-h")) {
flagopt = true;
break;
} else if (!std::strcmp(argv[i], "-i")) {
fInputFiles = argv[i + 1];
++i;
} else if (!std::strcmp(argv[i], "-o")) {
fOutputFile = argv[i + 1];
++i;
} else if (!std::strcmp(argv[i], "-f")) {
fFluxFile = argv[i + 1];
++i;
} else if (!std::strcmp(argv[i], "-m")) {
fIsMonoEFlux = true;
fMonoEEnergy = GeneralUtils::StrToDbl(argv[i + 1]);
++i;
} else {
- ERR(FTL) << "ERROR: unknown command line option given! - '" << argv[i]
- << " " << argv[i + 1] << "'" << std::endl;
+ NUIS_ERR(FTL, "ERROR: unknown command line option given! - '"
+ << argv[i] << " " << argv[i + 1] << "'");
PrintOptions();
break;
}
}
}
if (fInputFiles == "" && !flagopt) {
- ERR(FTL) << "No input file(s) specified!" << std::endl;
+ NUIS_ERR(FTL, "No input file(s) specified!");
flagopt = true;
}
if (fFluxFile == "" && (!flagopt) && (!fIsMonoEFlux)) {
- ERR(FTL) << "No flux input specified!" << std::endl;
+ NUIS_ERR(FTL, "No flux input specified!");
flagopt = true;
}
if (argc < 1 || flagopt) {
PrintOptions();
exit(-1);
}
return;
}
diff --git a/app/PrepareNuwroEvents.cxx b/app/PrepareNuwroEvents.cxx
index ad41e3f..2b44f8f 100644
--- a/app/PrepareNuwroEvents.cxx
+++ b/app/PrepareNuwroEvents.cxx
@@ -1,500 +1,492 @@
+#include "event1.h"
#include
#include
-#include "event1.h"
// Hopefully we don't need these as they're included above.
// #include "params_all.h"
// #include "params.h"
#include "FitLogger.h"
#include "PlotUtils.h"
#include "TFile.h"
#include "TH1D.h"
#include "TTree.h"
-void printInputCommands(char* argv[]) {
+void printInputCommands(char *argv[]) {
std::cout << "[USAGE]: " << argv[0]
<< " [-h] [-f] [-F ,] [-o output.root] "
"inputfile.root [file2.root ...]"
<< std::endl
<< "\t-h : Print this message." << std::endl
<< "\t-f : Pass -f argument to '$ hadd' invocation." << std::endl
<< "\t-F : Read input flux from input descriptor." << std::endl
<< "\t-o : Write full output to a new file." << std::endl
<< std::endl;
};
void CreateRateHistograms(std::string inputs, bool force_out);
-void HaddNuwroFiles(std::vector& inputs, bool force_out);
+void HaddNuwroFiles(std::vector &inputs, bool force_out);
bool outputNewFile = false;
std::string ofile = "";
bool haveFluxInputs = false;
struct FluxInputBlob {
FluxInputBlob(std::string _File, std::string _Hist, int _PDG,
double _Fraction)
: File(_File), Hist(_Hist), PDG(_PDG), Fraction(_Fraction) {}
std::string File;
std::string Hist;
int PDG;
double Fraction;
};
std::vector FluxInputs;
bool haddedFiles = false;
-TH1D* F2D(TH1F* f) {
- Double_t* bins = new Double_t[f->GetXaxis()->GetNbins() + 1];
+TH1D *F2D(TH1F *f) {
+ Double_t *bins = new Double_t[f->GetXaxis()->GetNbins() + 1];
for (Int_t bi_it = 0; bi_it < f->GetXaxis()->GetNbins(); ++bi_it) {
bins[bi_it] = f->GetXaxis()->GetBinLowEdge(bi_it + 1);
}
bins[f->GetXaxis()->GetNbins()] =
f->GetXaxis()->GetBinUpEdge(f->GetXaxis()->GetNbins());
- TH1D* d = new TH1D((std::string(f->GetName()) + "_f").c_str(), f->GetTitle(),
+ TH1D *d = new TH1D((std::string(f->GetName()) + "_f").c_str(), f->GetTitle(),
f->GetXaxis()->GetNbins(), bins);
std::cout << "Converted TH1F with " << f->GetXaxis()->GetXbins()
<< " bins : " << std::endl;
for (Int_t bi_it = 0; bi_it < f->GetXaxis()->GetNbins() + 2; ++bi_it) {
d->SetBinContent(bi_it, f->GetBinContent(bi_it));
d->SetBinError(bi_it, f->GetBinError(bi_it));
std::cout << "\tF " << f->GetXaxis()->GetBinLowEdge(bi_it) << "--[" << bi_it
<< "]--" << f->GetXaxis()->GetBinUpEdge(bi_it) << ": "
<< f->GetBinContent(bi_it) << " D "
<< d->GetXaxis()->GetBinLowEdge(bi_it) << "--[" << bi_it << "]--"
<< d->GetXaxis()->GetBinUpEdge(bi_it) << ": "
<< d->GetBinContent(bi_it) << std::endl;
}
delete bins;
return d;
}
-TH1D* GetTH1DFromFile(std::string const& rootFile,
- std::string const& histName) {
- TFile* inpFile = new TFile(rootFile.c_str(), "READ");
+TH1D *GetTH1DFromFile(std::string const &rootFile,
+ std::string const &histName) {
+ TFile *inpFile = new TFile(rootFile.c_str(), "READ");
if (!inpFile || !inpFile->IsOpen()) {
- ERR(FTL) << "Cannot open input root file: " << rootFile
- << " to read input histo." << std::endl;
- throw;
+ NUIS_ABORT("Cannot open input root file: " << rootFile
+ << " to read input histo.");
}
- TH1D* histD = dynamic_cast(inpFile->Get(histName.c_str()));
+ TH1D *histD = dynamic_cast(inpFile->Get(histName.c_str()));
if (!histD) {
- TH1F* histF = dynamic_cast(inpFile->Get(histName.c_str()));
+ TH1F *histF = dynamic_cast(inpFile->Get(histName.c_str()));
if (!histF) {
- ERR(FTL) << "Cannot find TH1D/F: " << histName
- << " in root file: " << rootFile << "." << std::endl;
- throw;
+ NUIS_ABORT("Cannot find TH1D/F: " << histName << " in root file: "
+ << rootFile << ".");
}
histD = F2D(histF);
} else {
- histD = static_cast(histD->Clone());
+ histD = static_cast(histD->Clone());
}
histD->SetDirectory(NULL);
inpFile->Close();
return histD;
}
//*******************************
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
//*******************************
// If No Arguments print commands
if (argc == 1) {
printInputCommands(argv);
return 0;
}
std::vector inputfiles;
bool force_output = false;
// Get Inputs
for (int i = 1; i < argc; ++i) {
if (!std::strcmp(argv[i], "-h")) {
printInputCommands(argv);
return 0;
} else if (!std::strcmp(argv[i], "-f")) {
force_output = true;
} else if (!std::strcmp(argv[i], "-o")) {
outputNewFile = true;
ofile = argv[++i];
} else if (!std::strcmp(argv[i], "-F")) {
std::string inpLine = argv[++i];
std::vector fluxInputDescriptor =
GeneralUtils::ParseToStr(inpLine, ",");
if ((fluxInputDescriptor.size() != 2) &&
(fluxInputDescriptor.size() != 3) &&
(fluxInputDescriptor.size() != 4)) {
- ERR(FTL) << "Received -F argument with option: \"" << inpLine
- << "\", was expecting "
- ",[,PDG[,speciesFraction]]."
- << std::endl;
- return 1;
+ NUIS_ABORT("Received -F argument with option: \""
+ << inpLine
+ << "\", was expecting "
+ ",[,PDG[,speciesFraction]].");
}
haveFluxInputs = true;
FluxInputs.push_back(
FluxInputBlob(fluxInputDescriptor[0], fluxInputDescriptor[1],
(fluxInputDescriptor.size() > 2)
? GeneralUtils::StrToInt(fluxInputDescriptor[2])
: 14,
(fluxInputDescriptor.size() > 3)
? GeneralUtils::StrToDbl(fluxInputDescriptor[3])
: 1));
if (!FluxInputs.back().File.length() ||
!FluxInputs.back().Hist.length()) {
- ERR(FTL) << "Received -F argument with option: \"" << inpLine
- << "\", was expecting "
- ",[,PDG[,speciesFraction]]."
- << std::endl;
- return 1;
+ NUIS_ABORT("Received -F argument with option: \""
+ << inpLine
+ << "\", was expecting "
+ ",[,PDG[,speciesFraction]].");
}
} else {
inputfiles.push_back(std::string(argv[i]));
}
}
// If one input file just create flux histograms
if (inputfiles.size() > (UInt_t)1) {
HaddNuwroFiles(inputfiles, force_output);
} else if (inputfiles.size() < (UInt_t)1) {
printInputCommands(argv);
}
CreateRateHistograms(inputfiles[0], force_output);
- LOG(FIT) << "Finished NUWRO Prep." << std::endl;
+ NUIS_LOG(FIT, "Finished NUWRO Prep.");
};
//*******************************
void CreateRateHistograms(std::string inputs, bool force_out) {
//*******************************
// Open root file
- TFile* outRootFile = 0;
- TTree* nuwrotree = 0;
+ TFile *outRootFile = 0;
+ TTree *nuwrotree = 0;
if (!haddedFiles &&
- outputNewFile) { // we need to make the new file and clone the tree.
- TFile* inpFile = new TFile(inputs.c_str(), "READ");
+ outputNewFile) { // we need to make the new file and clone the tree.
+ TFile *inpFile = new TFile(inputs.c_str(), "READ");
if (!inpFile || !inpFile->IsOpen()) {
- ERR(FTL) << "Cannot open input root file: " << inputs << std::endl;
- throw;
+ NUIS_ABORT("Cannot open input root file: " << inputs);
}
- TTree* inpTree = dynamic_cast(inpFile->Get("treeout"));
+ TTree *inpTree = dynamic_cast(inpFile->Get("treeout"));
if (!inpTree) {
- ERR(FTL) << "Cannot find TTree \"treeout\" in input root file: "
- << inputs.c_str() << std::endl;
- throw;
+ NUIS_ABORT("Cannot find TTree \"treeout\" in input root file: "
+ << inputs.c_str());
}
outRootFile = new TFile(ofile.c_str(), force_out ? "RECREATE" : "CREATE");
if (!outRootFile || !outRootFile->IsOpen()) {
- ERR(FTL) << "Couldn't open root file: " << ofile
- << " for writing, does it already exist?" << std::endl;
- throw;
+ NUIS_ABORT("Couldn't open root file: "
+ << ofile << " for writing, does it already exist?");
}
nuwrotree = inpTree->CloneTree(-1, "fast");
nuwrotree->SetDirectory(outRootFile);
nuwrotree->Write(nuwrotree->GetName());
} else {
outRootFile = new TFile(inputs.c_str(), "UPDATE");
if (!outRootFile || !outRootFile->IsOpen()) {
- ERR(FTL) << "Cannot open input root file: " << inputs << std::endl;
- throw;
+ NUIS_ABORT("Cannot open input root file: " << inputs);
}
- nuwrotree = dynamic_cast(outRootFile->Get("treeout"));
+ nuwrotree = dynamic_cast(outRootFile->Get("treeout"));
if (!nuwrotree) {
- ERR(FTL) << "Cannot find TTree \"treeout\" in input root file: "
- << inputs.c_str() << std::endl;
- throw;
+ NUIS_ABORT("Cannot find TTree \"treeout\" in input root file: "
+ << inputs.c_str());
}
}
// Get Flux Histogram
- event* evt = new event();
+ event *evt = new event();
nuwrotree->SetBranchAddress("e", &evt);
nuwrotree->GetEntry(0);
int fluxtype = evt->par.beam_type;
- std::map fluxlist;
- std::map eventlist;
+ std::map fluxlist;
+ std::map eventlist;
std::vector allpdg;
std::map nevtlist;
std::map intxseclist;
// Did the input file have a mono-energetic flux?
bool isMono = false;
nevtlist[0] = 0.0;
intxseclist[0] = 0.0;
allpdg.push_back(0);
- LOG(FIT) << "Nuwro fluxtype = " << fluxtype << std::endl;
+ NUIS_LOG(FIT, "Nuwro fluxtype = " << fluxtype);
if (haveFluxInputs) {
double totalFraction = 0;
for (size_t flux_it = 0; flux_it < FluxInputs.size(); ++flux_it) {
- FluxInputBlob& fb = FluxInputs[flux_it];
+ FluxInputBlob &fb = FluxInputs[flux_it];
int pdg = fb.PDG;
- TH1D* fluxHist = GetTH1DFromFile(fb.File, fb.Hist);
+ TH1D *fluxHist = GetTH1DFromFile(fb.File, fb.Hist);
double pctg = fb.Fraction;
totalFraction += pctg;
double Elow = fluxHist->GetXaxis()->GetBinLowEdge(1);
double Ehigh = fluxHist->GetXaxis()->GetBinLowEdge(
fluxHist->GetXaxis()->GetNbins() + 1);
- LOG(FIT) << "Adding new nuwro flux "
- << "pdg: " << pdg << " pctg: " << pctg << " Elow: " << Elow
- << " Ehigh: " << Ehigh << std::endl;
+ NUIS_LOG(FIT, "Adding new nuwro flux "
+ << "pdg: " << pdg << " pctg: " << pctg
+ << " Elow: " << Elow << " Ehigh: " << Ehigh);
// Sort total flux plot
if (!fluxlist[0]) {
// Setup total flux
- fluxlist[0] = (TH1D*)fluxHist->Clone();
+ fluxlist[0] = (TH1D *)fluxHist->Clone();
fluxlist[0]->SetNameTitle("FluxHist", "FluxHist");
// Prep empty total events
- eventlist[0] = (TH1D*)fluxHist->Clone();
+ eventlist[0] = (TH1D *)fluxHist->Clone();
eventlist[0]->SetNameTitle("EvtHist", "EvtHist");
eventlist[0]->Reset();
} else {
// Add up each new plot
fluxlist[0]->Add(fluxHist);
}
fluxHist->SetNameTitle(Form("nuwro_pdg%i_pct%f_Flux", pdg, pctg),
Form("nuwro_pdg%i_pct%f_Flux", pdg, pctg));
- TH1D* eventplot = (TH1D*)fluxHist->Clone();
+ TH1D *eventplot = (TH1D *)fluxHist->Clone();
eventplot->SetNameTitle(Form("nuwro_pdg%i_pct%f_Evt", pdg, pctg),
Form("nuwro_pdg%i_pct%f_Evt", pdg, pctg));
eventplot->Reset();
- fluxlist[pdg] = (TH1D*)fluxHist->Clone();
+ fluxlist[pdg] = (TH1D *)fluxHist->Clone();
eventlist[pdg] = eventplot;
nevtlist[pdg] = 0;
intxseclist[pdg] = 0.0;
allpdg.push_back(pdg);
delete fluxHist;
}
if (fabs(totalFraction - 1) > 1E-5) {
- ERR(FTL) << "Total species fraction for input flux histos = "
- << totalFraction << ", expected to sum to 1." << std::endl;
- throw;
+ NUIS_ABORT("Total species fraction for input flux histos = "
+ << totalFraction << ", expected to sum to 1.");
}
} else if (fluxtype == 0) {
std::string fluxstring = evt->par.beam_energy;
std::vector fluxvals = GeneralUtils::ParseToDbl(fluxstring, " ");
int pdg = evt->par.beam_particle;
double Elow = double(fluxvals[0]) / 1000.0;
double Ehigh = double(fluxvals[1]) / 1000.0;
- TH1D* fluxplot = NULL;
+ TH1D *fluxplot = NULL;
- if (Elow > Ehigh) isMono = true;
+ if (Elow > Ehigh)
+ isMono = true;
// For files produced with a flux distribution
if (!isMono) {
- LOG(FIT) << "Adding new nuwro flux "
- << "pdg: " << pdg << " Elow: " << Elow << " Ehigh: " << Ehigh
- << std::endl;
+ NUIS_LOG(FIT, "Adding new nuwro flux "
+ << "pdg: " << pdg << " Elow: " << Elow
+ << " Ehigh: " << Ehigh);
fluxplot =
new TH1D("fluxplot", "fluxplot", fluxvals.size() - 4, Elow, Ehigh);
for (uint j = 2; j < fluxvals.size(); j++) {
- LOG(DEB) << j << " " << fluxvals[j] << endl;
+ NUIS_LOG(DEB, j << " " << fluxvals[j]);
fluxplot->SetBinContent(j - 1, fluxvals[j]);
}
- } else { // For monoenergetic fluxes
- LOG(FIT) << "Adding mono-energetic nuwro flux "
- << "pdg: " << pdg << " E: " << Elow << std::endl;
+ } else { // For monoenergetic fluxes
+ NUIS_LOG(FIT, "Adding mono-energetic nuwro flux "
+ << "pdg: " << pdg << " E: " << Elow);
fluxplot = new TH1D("fluxplot", "fluxplot", 100, 0, Elow * 2);
fluxplot->SetBinContent(fluxplot->FindBin(Elow), 1);
}
// Setup total flux
- fluxlist[0] = (TH1D*)fluxplot->Clone();
+ fluxlist[0] = (TH1D *)fluxplot->Clone();
fluxlist[0]->SetNameTitle("FluxHist", "FluxHist");
// Prep empty total events
- eventlist[0] = (TH1D*)fluxplot->Clone();
+ eventlist[0] = (TH1D *)fluxplot->Clone();
eventlist[0]->SetNameTitle("EvtHist", "EvtHist");
eventlist[0]->Reset();
fluxplot->SetNameTitle(Form("nuwro_pdg%i_Flux", pdg),
Form("nuwro_pdg%i_Flux", pdg));
- TH1D* eventplot = (TH1D*)fluxplot->Clone();
+ TH1D *eventplot = (TH1D *)fluxplot->Clone();
eventplot->SetNameTitle(Form("nuwro_pdg%i_Evt", pdg),
Form("nuwro_pdg%i_Evt", pdg));
eventplot->Reset();
fluxlist[pdg] = fluxplot;
eventlist[pdg] = eventplot;
nevtlist[pdg] = 0;
intxseclist[pdg] = 0.0;
allpdg.push_back(pdg);
} else if (fluxtype == 1) {
std::string fluxstring = evt->par.beam_content;
std::vector fluxlines =
GeneralUtils::ParseToStr(fluxstring, "\n");
for (uint i = 0; i < fluxlines.size(); i++) {
std::vector fluxvals =
GeneralUtils::ParseToDbl(fluxlines[i], " ");
int pdg = int(fluxvals[0]);
double pctg = double(fluxvals[1]) / 100.0;
double Elow = double(fluxvals[2]) / 1000.0;
double Ehigh = double(fluxvals[3]) / 1000.0;
- LOG(FIT) << "Adding new nuwro flux "
- << "pdg: " << pdg << " pctg: " << pctg << " Elow: " << Elow
- << " Ehigh: " << Ehigh << std::endl;
+ NUIS_LOG(FIT, "Adding new nuwro flux "
+ << "pdg: " << pdg << " pctg: " << pctg
+ << " Elow: " << Elow << " Ehigh: " << Ehigh);
- TH1D* fluxplot =
+ TH1D *fluxplot =
new TH1D("fluxplot", "fluxplot", fluxvals.size() - 4, Elow, Ehigh);
for (uint j = 4; j < fluxvals.size(); j++) {
fluxplot->SetBinContent(j + 1, fluxvals[j]);
}
// Sort total flux plot
if (!fluxlist[0]) {
// Setup total flux
- fluxlist[0] = (TH1D*)fluxplot->Clone();
+ fluxlist[0] = (TH1D *)fluxplot->Clone();
fluxlist[0]->SetNameTitle("FluxHist", "FluxHist");
// Prep empty total events
- eventlist[0] = (TH1D*)fluxplot->Clone();
+ eventlist[0] = (TH1D *)fluxplot->Clone();
eventlist[0]->SetNameTitle("EvtHist", "EvtHist");
eventlist[0]->Reset();
} else {
// Add up each new plot
fluxlist[0]->Add(fluxplot);
}
fluxplot->SetNameTitle(Form("nuwro_pdg%i_pct%f_Flux", pdg, pctg),
Form("nuwro_pdg%i_pct%f_Flux", pdg, pctg));
- TH1D* eventplot = (TH1D*)fluxplot->Clone();
+ TH1D *eventplot = (TH1D *)fluxplot->Clone();
eventplot->SetNameTitle(Form("nuwro_pdg%i_pct%f_Evt", pdg, pctg),
Form("nuwro_pdg%i_pct%f_Evt", pdg, pctg));
eventplot->Reset();
fluxlist[pdg] = fluxplot;
eventlist[pdg] = eventplot;
nevtlist[pdg] = 0;
intxseclist[pdg] = 0.0;
allpdg.push_back(pdg);
}
}
// Start main event loop to fill plots
int nevents = nuwrotree->GetEntries();
double Enu = 0.0;
double TotXSec = 0.0;
// double totaleventmode = 0.0;
// double totalevents = 0.0;
int pdg = 0;
int countwidth = nevents / 50.0;
countwidth = countwidth ? countwidth : 1;
for (int i = 0; i < nevents; i++) {
nuwrotree->GetEntry(i);
// Get Variables
Enu = evt->in[0].t / 1000.0;
TotXSec = evt->weight;
pdg = evt->in[0].pdg;
eventlist[0]->Fill(Enu);
eventlist[pdg]->Fill(Enu);
nevtlist[0] += 1;
nevtlist[pdg] += 1;
intxseclist[0] += TotXSec;
intxseclist[pdg] += TotXSec;
- if (i % countwidth == 0)
- LOG(FIT) << "Processed " << i << " events "
- << " (" << int(i * 100.0 / nevents) << "%)"
- << " : E, W, PDG = " << Enu << ", " << TotXSec << ", " << pdg
- << std::endl;
+ if (i % countwidth == 0) {
+ NUIS_LOG(FIT, "Processed " << i << " events "
+ << " (" << int(i * 100.0 / nevents) << "%)"
+ << " : E, W, PDG = " << Enu << ", " << TotXSec
+ << ", " << pdg)
+ }
}
- TH1D* zeroevents = (TH1D*)eventlist[0]->Clone();
+ TH1D *zeroevents = (TH1D *)eventlist[0]->Clone();
outRootFile->cd();
// Loop over eventlist
for (uint i = 0; i < allpdg.size(); i++) {
int pdg = allpdg[i];
double AvgXSec = intxseclist[0] * 1E38 / double(nevtlist[0]);
- LOG(FIT) << pdg << " Avg XSec = " << AvgXSec << endl;
- LOG(FIT) << pdg << " nevents = " << double(nevtlist[pdg]) << endl;
+ NUIS_LOG(FIT, pdg << " Avg XSec = " << AvgXSec);
+ NUIS_LOG(FIT, pdg << " nevents = " << double(nevtlist[pdg]));
if (!isMono) {
// Convert events to PDF
eventlist[pdg]->Scale(1.0 / zeroevents->Integral("width"));
// Multiply by total predicted event rate
eventlist[pdg]->Scale(fluxlist[0]->Integral("width") * AvgXSec);
} else {
// If a mono-energetic flux was used, width should not be used
// The output is (now) forced to be flux = 1, evtrt = xsec (in 1E38 * nb
// cm^2)
eventlist[pdg]->Scale(1.0 / zeroevents->Integral());
eventlist[pdg]->Scale(fluxlist[0]->Integral() * AvgXSec);
}
// Save everything
fluxlist[pdg]->Write("", TObject::kOverwrite);
eventlist[pdg]->Write("", TObject::kOverwrite);
}
// Tidy up
outRootFile->Close();
fluxlist.clear();
eventlist.clear();
// Exit Program
return;
}
//*******************************
-void HaddNuwroFiles(std::vector& inputs, bool force_out) {
+void HaddNuwroFiles(std::vector &inputs, bool force_out) {
//*******************************
// Get output file name
std::string outputname = inputs[0];
// Make command line string
std::string cmd = "hadd ";
if (outputNewFile) {
cmd += ofile + " ";
outputname = ofile;
} else if (force_out) {
cmd += "-f ";
}
for (UInt_t i = 0; i < inputs.size(); i++) {
cmd += inputs[i] + " ";
}
- LOG(FIT) << " Running HADD from PrepareNuwro: " << cmd << std::endl;
+ NUIS_LOG(FIT, " Running HADD from PrepareNuwro: " << cmd);
// Start HADD
system(cmd.c_str());
// Return name of output file
inputs.clear();
inputs.push_back(outputname);
haddedFiles = true;
return;
}
diff --git a/app/neut_NUISANCE.cxx b/app/neut_NUISANCE.cxx
index a2e1dbc..c3d0a39 100644
--- a/app/neut_NUISANCE.cxx
+++ b/app/neut_NUISANCE.cxx
@@ -1,839 +1,911 @@
#ifdef __NEUT_ENABLED__
#include "ComparisonRoutines.h"
#include "ParserUtils.h"
#include "TargetUtils.h"
#ifdef WINDOWS
#include
- #define GetCurrentDir _getcwd
+#define GetCurrentDir _getcwd
#else
#include
- #define GetCurrentDir getcwd
+#define GetCurrentDir getcwd
#endif
// All possible inputs
std::string gOptEnergyDef;
std::vector gOptEnergyRange;
int gOptNumberEvents = -1;
int gOptNumberTestEvents = 5E6;
std::string gOptGeneratorList = "Default";
-std::string gOptCrossSections = "Default"; // If default this will look in $NUISANCE/data/neut/Default_params.txt
+std::string gOptCrossSections =
+ "Default"; // If default this will look in
+ // $NUISANCE/data/neut/Default_params.txt
int gOptSeed = time(NULL);
std::string gOptTargetDef = "";
std::string gOptFluxDef = "";
std::string gOptOutputFile = "";
int gOptRunNumber = -1;
using namespace TargetUtils;
-void GetCommandLineArgs (int argc, char ** argv);
-void PrintSyntax (void);
+void GetCommandLineArgs(int argc, char **argv);
+void PrintSyntax(void);
-std::string GETCWD(){
+std::string GETCWD() {
char cCurrentPath[FILENAME_MAX];
- if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath))){
- THROW("CANT FIND CURRENT DIRECTORY!");
+ if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath))) {
+ NUIS_ABORT("CANT FIND CURRENT DIRECTORY!");
}
std::string curdir = std::string(cCurrentPath);
return curdir;
}
-std::string ExpandPath(std::string name){
+std::string ExpandPath(std::string name) {
// Get Current
char cCurrentPath[FILENAME_MAX];
- if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath))){
- THROW("CANT FIND CURRENT DIRECTORY!");
+ if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath))) {
+ NUIS_ABORT("CANT FIND CURRENT DIRECTORY!");
}
std::string curdir = std::string(cCurrentPath);
-
// If first entry is not / then add the current working directory
- if (!name.empty() and name.at(0) != '/'){
+ if (!name.empty() and name.at(0) != '/') {
name = curdir + "/" + name;
}
return name;
}
-std::string GetBaseName(std::string name){
- std::vector splitfile = GeneralUtils::ParseToStr(name,"/");
+std::string GetBaseName(std::string name) {
+ std::vector splitfile = GeneralUtils::ParseToStr(name, "/");
std::string filename = "";
- if (splitfile.size() == 1){
+ if (splitfile.size() == 1) {
filename = splitfile[0];
- } else if (splitfile.size() > 1){
- filename = splitfile[splitfile.size()-1];
+ } else if (splitfile.size() > 1) {
+ filename = splitfile[splitfile.size() - 1];
} else {
- THROW("Cannot split filename: " << name);
+ NUIS_ABORT("Cannot split filename: " << name);
}
return filename;
}
-std::string GetDynamicModes(std::string list, bool neutrino){
- LOG(FIT) << "Using " << list << " to define interaction modes for Neutrino=" << neutrino << std::endl;
+std::string GetDynamicModes(std::string list, bool neutrino) {
+ NUIS_LOG(FIT, "Using " << list << " to define interaction modes for Neutrino="
+ << neutrino);
std::map modes;
std::vector ids;
-
+
// Create vector of ids for the print out and future reference
/*
C
C nu nub
C 1: CC Q.E. CC Q.E.( Free )
-C 2-4: CC 1pi CC 1pi
-C 5: CC DIS 1320 CC DIS 1.3 < W < 2.0
-C 6-9: NC 1pi NC 1pi
-C 10: NC DIS 1320 NC DIS 1.3 < W < 2.0
+C 2-4: CC 1pi CC 1pi
+C 5: CC DIS 1320 CC DIS 1.3 < W < 2.0
+C 6-9: NC 1pi NC 1pi
+C 10: NC DIS 1320 NC DIS 1.3 < W < 2.0
C 11: NC els CC Q.E.( Bound )
-C 12: NC els NC els
-C 13: NC els NC els
-C 14: coherent NC els
+C 12: NC els NC els
+C 13: NC els NC els
+C 14: coherent NC els
C 15: coherent coherent
C 16: CC eta coherent
-C 17 NC eta CC eta
-C 18: NC eta NC eta
-C 19: CC K NC eta
+C 17 NC eta CC eta
+C 18: NC eta NC eta
+C 19: CC K NC eta
C 20 NC K CC K
C 21: NC K NC K
C 22: N/A NC K
C 23: CC DIS CC DIS (W > 2.0)
C 24: NC DIS NC DIS (W > 2.0)
C 25: CC 1 gamma CC 1 gamma
C 26: NC 1 gamma NC 1 gamma
C 27: NC 1 gamma NC 1 gamma
C 28: 2p2h 2p2h
*/
- ids.push_back("crsmode_CCQE" );
- ids.push_back("crsmode_CC2P2H" );
+ ids.push_back("crsmode_CCQE");
+ ids.push_back("crsmode_CC2P2H");
ids.push_back("crsmode_CC1pi");
- ids.push_back("crsmode_CCDIS_lowW" );
+ ids.push_back("crsmode_CCDIS_lowW");
ids.push_back("crsmode_NC1pi");
- ids.push_back("crsmode_NCDIS_lowW" );
+ ids.push_back("crsmode_NCDIS_lowW");
ids.push_back("crsmode_NCEL");
ids.push_back("crsmode_CCCOH");
ids.push_back("crsmode_NCCOH");
ids.push_back("crsmode_CCETA");
ids.push_back("crsmode_NCETA");
ids.push_back("crsmode_CCKAON");
ids.push_back("crsmode_NCKAON");
ids.push_back("crsmode_CCDIS_highW");
ids.push_back("crsmode_NCDIS_highW");
ids.push_back("crsmode_CCGAMMA");
ids.push_back("crsmode_NCGAMMA");
-
- // Now define possible models
- if (!list.compare("Default")){ // Everything but MEC
+ // Now define possible models
+ if (!list.compare("Default")) { // Everything but MEC
modes["crsmode_CCQE"] = 1;
modes["crsmode_CC2P2H"] = 0;
modes["crsmode_CC1pi"] = 1;
modes["crsmode_CCDIS_lowW"] = 1;
modes["crsmode_CCCOH"] = 1;
modes["crsmode_CCETA"] = 1;
modes["crsmode_CCKAON"] = 1;
modes["crsmode_CCDIS_highW"] = 1;
modes["crsmode_CCGAMMA"] = 1;
modes["crsmode_NC1pi"] = 1;
modes["crsmode_NCDIS_lowW"] = 1;
modes["crsmode_NCEL"] = 1;
modes["crsmode_NCCOH"] = 1;
modes["crsmode_NCETA"] = 1;
modes["crsmode_NCKAON"] = 1;
modes["crsmode_NCDIS_highW"] = 1;
modes["crsmode_NCGAMMA"] = 1;
- } else if (!list.compare("DefaultFree")){
-
+ } else if (!list.compare("DefaultFree")) {
modes["crsmode_CCQE"] = 1;
modes["crsmode_CC2P2H"] = 0;
modes["crsmode_CC1pi"] = 1;
modes["crsmode_CCDIS_lowW"] = 1;
modes["crsmode_CCCOH"] = 0;
modes["crsmode_CCETA"] = 1;
modes["crsmode_CCKAON"] = 1;
modes["crsmode_CCDIS_highW"] = 1;
modes["crsmode_CCGAMMA"] = 1;
modes["crsmode_NC1pi"] = 1;
modes["crsmode_NCDIS_lowW"] = 1;
modes["crsmode_NCEL"] = 1;
modes["crsmode_NCCOH"] = 0;
modes["crsmode_NCETA"] = 1;
modes["crsmode_NCKAON"] = 1;
modes["crsmode_NCDIS_highW"] = 1;
modes["crsmode_NCGAMMA"] = 1;
- } else if (!list.compare("Default+MEC")){
-
+ } else if (!list.compare("Default+MEC")) {
modes["crsmode_CCQE"] = 1;
modes["crsmode_CC2P2H"] = 1;
modes["crsmode_CC1pi"] = 1;
modes["crsmode_CCDIS_lowW"] = 1;
modes["crsmode_CCCOH"] = 1;
modes["crsmode_CCETA"] = 1;
modes["crsmode_CCKAON"] = 1;
modes["crsmode_CCDIS_highW"] = 1;
modes["crsmode_CCGAMMA"] = 1;
modes["crsmode_NC1pi"] = 1;
modes["crsmode_NCDIS_lowW"] = 1;
modes["crsmode_NCEL"] = 1;
modes["crsmode_NCCOH"] = 1;
modes["crsmode_NCETA"] = 1;
modes["crsmode_NCKAON"] = 1;
modes["crsmode_NCDIS_highW"] = 1;
modes["crsmode_NCGAMMA"] = 1;
} else {
- THROW("Event generator list " << list << " not found!");
+ NUIS_ABORT("Event generator list " << list << " not found!");
}
-
- // Now we actually have to make the conversion because NEUTS modes organisation are a mess.
+ // Now we actually have to make the conversion because NEUTS modes
+ // organisation are a mess.
/*
C
C nu nub
C 1: CC Q.E. CC Q.E.( Free )
-C 2-4: CC 1pi CC 1pi
-C 5: CC DIS 1320 CC DIS 1.3 < W < 2.0
-C 6-9: NC 1pi NC 1pi
-C 10: NC DIS 1320 NC DIS 1.3 < W < 2.0
+C 2-4: CC 1pi CC 1pi
+C 5: CC DIS 1320 CC DIS 1.3 < W < 2.0
+C 6-9: NC 1pi NC 1pi
+C 10: NC DIS 1320 NC DIS 1.3 < W < 2.0
C 11: NC els CC Q.E.( Bound )
-C 12: NC els NC els
-C 13: NC els NC els
-C 14: coherent NC els
+C 12: NC els NC els
+C 13: NC els NC els
+C 14: coherent NC els
C 15: coherent coherent
C 16: CC eta coherent
-C 17 NC eta CC eta
-C 18: NC eta NC eta
-C 19: CC K NC eta
+C 17 NC eta CC eta
+C 18: NC eta NC eta
+C 19: CC K NC eta
C 20 NC K CC K
C 21: NC K NC K
C 22: N/A NC K
C 23: CC DIS CC DIS (W > 2.0)
C 24: NC DIS NC DIS (W > 2.0)
C 25: CC 1 gamma CC 1 gamma
C 26,27: NC 1 gamma NC 1 gamma
*/
-
+
std::string modestring_neutrino = "NEUT-CRS ";
std::string modestring_antineutrino = "NEUT-CRSB ";
// Neutrino First
- if (neutrino){
-
+ if (neutrino) {
// Fill empty NEUT-CRSB
- for (size_t i = 0; i < 27; i++){
+ for (size_t i = 0; i < 27; i++) {
modestring_antineutrino += " 0";
}
- modestring_neutrino += (modes["crsmode_CCQE"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_CC1pi"]? " 1 1 1" : " 0 0 0");
- modestring_neutrino += (modes["crsmode_CCDIS_lowW"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_NC1pi"]? " 1 1 1 1" : " 0 0 0 0");
- modestring_neutrino += (modes["crsmode_NCDIS_lowW"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_NCEL"]? " 1 1 1" : " 0 0 0");
- modestring_neutrino += (modes["crsmode_CCCOH"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_NCCOH"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_CCETA"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_NCETA"]? " 1 1" : " 0 0");
- modestring_neutrino += (modes["crsmode_CCKAON"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_NCKAON"]? " 1 1" : " 0 0");
+ modestring_neutrino += (modes["crsmode_CCQE"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_CC1pi"] ? " 1 1 1" : " 0 0 0");
+ modestring_neutrino += (modes["crsmode_CCDIS_lowW"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_NC1pi"] ? " 1 1 1 1" : " 0 0 0 0");
+ modestring_neutrino += (modes["crsmode_NCDIS_lowW"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_NCEL"] ? " 1 1 1" : " 0 0 0");
+ modestring_neutrino += (modes["crsmode_CCCOH"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_NCCOH"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_CCETA"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_NCETA"] ? " 1 1" : " 0 0");
+ modestring_neutrino += (modes["crsmode_CCKAON"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_NCKAON"] ? " 1 1" : " 0 0");
modestring_neutrino += " 1"; // /NA
- modestring_neutrino += (modes["crsmode_CCDIS_highW"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_NCDIS_highW"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_CCGAMMA"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_NCGAMMA"]? " 1" : " 0");
- modestring_neutrino += (modes["crsmode_CC2P2H"]? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_CCDIS_highW"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_NCDIS_highW"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_CCGAMMA"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_NCGAMMA"] ? " 1" : " 0");
+ modestring_neutrino += (modes["crsmode_CC2P2H"] ? " 1" : " 0");
} else {
-
// Fill Empty NEUT CRS
- for (size_t i = 0; i < 27; i++){
+ for (size_t i = 0; i < 27; i++) {
modestring_neutrino += " 0";
}
- modestring_antineutrino += (modes["crsmode_CCQE"]? " 1" : " 0");
- modestring_antineutrino += (modes["crsmode_CC1pi"]? " 1 1 1" : " 0 0 0");
- modestring_antineutrino += (modes["crsmode_CCDIS_lowW"]? " 1" : " 0");
- modestring_antineutrino += (modes["crsmode_NC1pi"]? " 1 1 1 1" : " 0 0 0 0");
- modestring_antineutrino += (modes["crsmode_NCDIS_lowW"]? " 1" : " 0");
- modestring_antineutrino += (modes["crsmode_CCQE"]? " 1" : " 0");
- modestring_antineutrino += (modes["crsmode_NCEL"]? " 1 1 1" : " 0 0 0");
- modestring_antineutrino += (modes["crsmode_CCCOH"]? " 1" : " 0");
- modestring_antineutrino += (modes["crsmode_NCCOH"]? " 1" : " 0");
- modestring_antineutrino += (modes["crsmode_CCETA"]? " 1" : " 0");
- modestring_antineutrino += (modes["crsmode_NCETA"]? " 1 1" : " 0 0");
- modestring_antineutrino += (modes["crsmode_CCKAON"]? " 1" : " 0");
- modestring_antineutrino += (modes["crsmode_NCKAON"]? " 1 1" : " 0 0");
- modestring_antineutrino += (modes["crsmode_CCDIS_highW"]? " 1" : " 0");
- modestring_antineutrino+= (modes["crsmode_NCDIS_highW"]? " 1" : " 0");
- modestring_antineutrino+= (modes["crsmode_CCGAMMA"]? " 1" : " 0");
- modestring_antineutrino+= (modes["crsmode_NCGAMMA"]? " 1" : " 0");
- modestring_antineutrino+= (modes["crsmode_CC2P2H"]? " 1" : " 0");
-
+ modestring_antineutrino += (modes["crsmode_CCQE"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_CC1pi"] ? " 1 1 1" : " 0 0 0");
+ modestring_antineutrino += (modes["crsmode_CCDIS_lowW"] ? " 1" : " 0");
+ modestring_antineutrino +=
+ (modes["crsmode_NC1pi"] ? " 1 1 1 1" : " 0 0 0 0");
+ modestring_antineutrino += (modes["crsmode_NCDIS_lowW"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_CCQE"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_NCEL"] ? " 1 1 1" : " 0 0 0");
+ modestring_antineutrino += (modes["crsmode_CCCOH"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_NCCOH"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_CCETA"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_NCETA"] ? " 1 1" : " 0 0");
+ modestring_antineutrino += (modes["crsmode_CCKAON"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_NCKAON"] ? " 1 1" : " 0 0");
+ modestring_antineutrino += (modes["crsmode_CCDIS_highW"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_NCDIS_highW"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_CCGAMMA"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_NCGAMMA"] ? " 1" : " 0");
+ modestring_antineutrino += (modes["crsmode_CC2P2H"] ? " 1" : " 0");
}
- return "NEUT-MODE -1 \n" + modestring_neutrino + "\n" + modestring_antineutrino;
+ return "NEUT-MODE -1 \n" + modestring_neutrino + "\n" +
+ modestring_antineutrino;
}
-std::map MakeNewFluxFile(std::string flux, std::string out){
- LOG(FIT) << "Using " << flux << " to define NEUT beam." << std::endl;
+std::map MakeNewFluxFile(std::string flux,
+ std::string out) {
+ NUIS_LOG(FIT, "Using " << flux << " to define NEUT beam.");
- std::vector fluxargs = GeneralUtils::ParseToStr(flux,",");
- if (fluxargs.size() < 2){
- THROW("Expected flux in the format: file.root,hist_name1[pdg1],... : reveived : " << flux);
+ std::vector fluxargs = GeneralUtils::ParseToStr(flux, ",");
+ if (fluxargs.size() < 2) {
+ NUIS_ABORT("Expected flux in the format: file.root,hist_name1[pdg1],... : "
+ "reveived : "
+ << flux);
}
- // Build Map
+ // Build Map
std::map fluxmap;
fluxmap["beam_type"] = "6";
fluxmap["beam_inputroot"] = fluxargs[0];
- fluxmap["beam_inputroot_nue"] = "";
- fluxmap["beam_inputroot_nueb"] = "";
- fluxmap["beam_inputroot_numu"] = "";
- fluxmap["beam_inputroot_numub"] = "";
- fluxmap["beam_inputroot_nutau"] = "";
+ fluxmap["beam_inputroot_nue"] = "";
+ fluxmap["beam_inputroot_nueb"] = "";
+ fluxmap["beam_inputroot_numu"] = "";
+ fluxmap["beam_inputroot_numub"] = "";
+ fluxmap["beam_inputroot_nutau"] = "";
fluxmap["beam_inputroot_nutaub"] = "";
- // Split by beam bdgs
- for (uint i = 1; i < fluxargs.size(); i++){
+ // Split by beam bdgs
+ for (uint i = 1; i < fluxargs.size(); i++) {
std::string histdef = fluxargs[i];
- string::size_type open_bracket = histdef.find("[");
+ string::size_type open_bracket = histdef.find("[");
string::size_type close_bracket = histdef.find("]");
string::size_type ibeg = 0;
string::size_type iend = open_bracket;
- string::size_type jbeg = open_bracket+1;
- string::size_type jend = close_bracket-1;
- std::string name = std::string(histdef.substr(ibeg,iend).c_str());
- int pdg = atoi(histdef.substr(jbeg,jend).c_str());
-
- if (pdg == 12) fluxmap["beam_inputroot_nue"] = name;
- else if (pdg ==-12) fluxmap["beam_inputroot_nueb"] = name;
- else if (pdg == 14) fluxmap["beam_inputroot_numu"] = name;
- else if (pdg ==-14) fluxmap["beam_inputroot_numub"] = name;
- else if (pdg == 16) fluxmap["beam_inputroot_tau"] = name;
- else if (pdg ==-16) fluxmap["beam_inputroot_taub"] = name;
+ string::size_type jbeg = open_bracket + 1;
+ string::size_type jend = close_bracket - 1;
+ std::string name = std::string(histdef.substr(ibeg, iend).c_str());
+ int pdg = atoi(histdef.substr(jbeg, jend).c_str());
+
+ if (pdg == 12)
+ fluxmap["beam_inputroot_nue"] = name;
+ else if (pdg == -12)
+ fluxmap["beam_inputroot_nueb"] = name;
+ else if (pdg == 14)
+ fluxmap["beam_inputroot_numu"] = name;
+ else if (pdg == -14)
+ fluxmap["beam_inputroot_numub"] = name;
+ else if (pdg == 16)
+ fluxmap["beam_inputroot_tau"] = name;
+ else if (pdg == -16)
+ fluxmap["beam_inputroot_taub"] = name;
}
- // Now create a new flux file matching the output file
- std::cout << " -> Moving flux from '" + fluxmap["beam_inputroot"] + "' to current directory to keep everything organised." << std::endl;
- TFile* fluxread = new TFile(fluxmap["beam_inputroot"].c_str(),"READ");
- TFile* fluxwrite = new TFile((out + ".flux.root").c_str(),"RECREATE");
-
- for(std::map::iterator iter = fluxmap.begin();
- iter != fluxmap.end(); iter++){
- TH1* temp = (TH1*)fluxread->Get(iter->second.c_str());
- if (!temp) continue;
- TH1D* cuthist = (TH1D*)temp->Clone();
-
- // Restrict energy range if required
- if (gOptEnergyRange.size() == 2){
- for (int i = 0; i < cuthist->GetNbinsX(); i++){
- if (cuthist->GetXaxis()->GetBinCenter(i+1) < gOptEnergyRange[0] or
- cuthist->GetXaxis()->GetBinCenter(i+1) > gOptEnergyRange[1]){
- cuthist->SetBinContent(i+1, 0.0);
+ // Now create a new flux file matching the output file
+ std::cout << " -> Moving flux from '" + fluxmap["beam_inputroot"] +
+ "' to current directory to keep everything organised."
+ << std::endl;
+ TFile *fluxread = new TFile(fluxmap["beam_inputroot"].c_str(), "READ");
+ TFile *fluxwrite = new TFile((out + ".flux.root").c_str(), "RECREATE");
+
+ for (std::map::iterator iter = fluxmap.begin();
+ iter != fluxmap.end(); iter++) {
+ TH1 *temp = (TH1 *)fluxread->Get(iter->second.c_str());
+ if (!temp)
+ continue;
+ TH1D *cuthist = (TH1D *)temp->Clone();
+
+ // Restrict energy range if required
+ if (gOptEnergyRange.size() == 2) {
+ for (int i = 0; i < cuthist->GetNbinsX(); i++) {
+ if (cuthist->GetXaxis()->GetBinCenter(i + 1) < gOptEnergyRange[0] or
+ cuthist->GetXaxis()->GetBinCenter(i + 1) > gOptEnergyRange[1]) {
+ cuthist->SetBinContent(i + 1, 0.0);
}
}
}
- // Check Flux
- if (cuthist->Integral() <= 0.0){
- THROW("Flux histogram " << iter->second << " has integral <= 0.0");
+ // Check Flux
+ if (cuthist->Integral() <= 0.0) {
+ NUIS_ABORT("Flux histogram " << iter->second << " has integral <= 0.0");
}
- // Save
+ // Save
fluxwrite->cd();
cuthist->Write();
}
std::cout << " ->-> Saved to : " << (out + ".flux.root") << std::endl;
fluxmap["beam_inputroot"] = (out + ".flux.root");
fluxwrite->Close();
return fluxmap;
}
-std::string GetFluxDefinition( std::string fluxfile, std::string fluxhist, std::string fluxid ){
+std::string GetFluxDefinition(std::string fluxfile, std::string fluxhist,
+ std::string fluxid) {
// Get base name of flux file as its being copied to NEUT Run Directory
- std::vector splitfluxfile = GeneralUtils::ParseToStr(fluxfile,"/");
+ std::vector splitfluxfile =
+ GeneralUtils::ParseToStr(fluxfile, "/");
std::string filename = "";
- if (splitfluxfile.size() == 1){
+ if (splitfluxfile.size() == 1) {
filename = splitfluxfile[0];
- } else if (splitfluxfile.size() > 1){
- filename = splitfluxfile[splitfluxfile.size()-1];
+ } else if (splitfluxfile.size() > 1) {
+ filename = splitfluxfile[splitfluxfile.size() - 1];
} else {
- THROW("NO FILENAME FOR FLUX DEFINITION FOUND!");
+ NUIS_ABORT("NO FILENAME FOR FLUX DEFINITION FOUND!");
}
-
+
// Build string
std::string fluxparams = "";
fluxparams += "EVCT-FILENM \'" + filename + "\' \n";
fluxparams += "EVCT-HISTNM \'" + fluxhist + "\' \n";
fluxparams += "EVCT-INMEV 0 \n";
fluxparams += "EVCT-MPV 3 \n";
// Set PDG Code
- if (!fluxid.compare("nue")) fluxparams += "EVCT-IDPT 12";
- else if (!fluxid.compare("nueb")) fluxparams += "EVCT-IDPT -12";
- else if (!fluxid.compare("numu")) fluxparams += "EVCT-IDPT 14";
- else if (!fluxid.compare("numub")) fluxparams += "EVCT-IDPT -14";
- else if (!fluxid.compare("nutau")) fluxparams += "EVCT-IDPT 16";
- else if (!fluxid.compare("nutaub")) fluxparams += "EVCT-IDPT -16";
+ if (!fluxid.compare("nue"))
+ fluxparams += "EVCT-IDPT 12";
+ else if (!fluxid.compare("nueb"))
+ fluxparams += "EVCT-IDPT -12";
+ else if (!fluxid.compare("numu"))
+ fluxparams += "EVCT-IDPT 14";
+ else if (!fluxid.compare("numub"))
+ fluxparams += "EVCT-IDPT -14";
+ else if (!fluxid.compare("nutau"))
+ fluxparams += "EVCT-IDPT 16";
+ else if (!fluxid.compare("nutaub"))
+ fluxparams += "EVCT-IDPT -16";
else {
- THROW("UNKNOWN FLUX ID GIVEN!");
+ NUIS_ABORT("UNKNOWN FLUX ID GIVEN!");
}
return fluxparams;
}
-std::string GetTargetDefinition(std::string target){
+std::string GetTargetDefinition(std::string target) {
- LOG(FIT) << "Defining NEUT Target from : " << target << std::endl;
+ NUIS_LOG(FIT, "Defining NEUT Target from : " << target);
- // Target is given as either a single PDG, or a combo with the total number of nucleons
- std::vector trgts = GeneralUtils::ParseToStr(target,",");
+ // Target is given as either a single PDG, or a combo with the total number of
+ // nucleons
+ std::vector trgts = GeneralUtils::ParseToStr(target, ",");
std::string targetstring = "";
// NEUT only lets us pass C and CH type inputs.
// Single Target
- if (trgts.size() == 1){
+ if (trgts.size() == 1) {
int PDG = GeneralUtils::StrToInt(trgts[0]);
int Z = TargetUtils::GetTargetZFromPDG(PDG);
int N = TargetUtils::GetTargetAFromPDG(PDG) - Z;
targetstring += "NEUT-NUMBNDP " + GeneralUtils::IntToStr(Z) + "\n";
targetstring += "NEUT-NUMBNDN " + GeneralUtils::IntToStr(N) + "\n";
targetstring += "NEUT-NUMFREP 0\n";
- targetstring += "NEUT-NUMATOM " + GeneralUtils::IntToStr(Z+N) + "\n";
+ targetstring += "NEUT-NUMATOM " + GeneralUtils::IntToStr(Z + N) + "\n";
+
+ // Combined target
+ } else if (trgts.size() == 3) {
- // Combined target
- } else if (trgts.size() == 3){
-
int NUCLEONS = GeneralUtils::StrToInt(trgts[0]);
std::string target1 = trgts[1];
std::string target2 = trgts[2];
// Parse target strings
- string::size_type open_bracket = target1.find("[");
+ string::size_type open_bracket = target1.find("[");
string::size_type close_bracket = target1.find("]");
string::size_type ibeg = 0;
string::size_type iend = open_bracket;
- string::size_type jbeg = open_bracket+1;
- string::size_type jend = close_bracket-1;
- int PDG1 = atoi(target1.substr(ibeg,iend).c_str());
- double W1 = atof(target1.substr(jbeg,jend).c_str());
+ string::size_type jbeg = open_bracket + 1;
+ string::size_type jend = close_bracket - 1;
+ int PDG1 = atoi(target1.substr(ibeg, iend).c_str());
+ double W1 = atof(target1.substr(jbeg, jend).c_str());
- open_bracket = target2.find("[");
+ open_bracket = target2.find("[");
close_bracket = target2.find("]");
ibeg = 0;
iend = open_bracket;
- jbeg = open_bracket+1;
- jend = close_bracket-1;
- int PDG2 = atoi(target2.substr(ibeg,iend).c_str());
- double W2 = atof(target2.substr(jbeg,jend).c_str());
-
+ jbeg = open_bracket + 1;
+ jend = close_bracket - 1;
+ int PDG2 = atoi(target2.substr(ibeg, iend).c_str());
+ double W2 = atof(target2.substr(jbeg, jend).c_str());
+
// Can only have H as a secondary target!
- if (PDG1 != 1000010010 && PDG2 != 1000010010){
- THROW("NEUT Doesn't support composite targets apart fromn Target+H. E.g. CH");
+ if (PDG1 != 1000010010 && PDG2 != 1000010010) {
+ NUIS_ABORT(
+ "NEUT Doesn't support composite targets apart fromn Target+H. E.g. "
+ "CH");
}
// Switch so H is PDG2 if given
- if (PDG1 == 1000010010 && PDG2 != 1000010010){
+ if (PDG1 == 1000010010 && PDG2 != 1000010010) {
PDG1 = PDG2;
PDG2 = 1000010010;
double temp1 = W1;
W1 = W2;
W2 = temp1;
}
// Now build string
int Z = TargetUtils::GetTargetZFromPDG(PDG1);
int N = TargetUtils::GetTargetAFromPDG(PDG1) - Z;
int NHydrogen = int(W2 * double(NUCLEONS));
- if (double(W2*double(NUCLEONS)) - (double(NHydrogen)) > 0.5){
+ if (double(W2 * double(NUCLEONS)) - (double(NHydrogen)) > 0.5) {
NHydrogen++; // awkward rounding bug fix
}
- targetstring += "NEUT-NUMBNDP " + GeneralUtils::IntToStr(Z) + "\n";
- targetstring += "NEUT-NUMBNDN " + GeneralUtils::IntToStr(N) + "\n";
+ targetstring += "NEUT-NUMBNDP " + GeneralUtils::IntToStr(Z) + "\n";
+ targetstring += "NEUT-NUMBNDN " + GeneralUtils::IntToStr(N) + "\n";
targetstring += "NEUT-NUMFREP " + GeneralUtils::IntToStr(NHydrogen) + "\n";
- targetstring += "NEUT-NUMATOM " + GeneralUtils::IntToStr(Z+N) + "\n";
+ targetstring += "NEUT-NUMATOM " + GeneralUtils::IntToStr(Z + N) + "\n";
} else {
- THROW("NEUT only supports single targets or ones with a secondary H!");
+ NUIS_ABORT("NEUT only supports single targets or ones with a secondary H!");
}
return targetstring;
}
-std::string GetEventAndSeedDefinition(int nevents, int seed){
-
+std::string GetEventAndSeedDefinition(int nevents, int seed) {
+
std::string eventdef = "";
- eventdef += "EVCT-NEVT " + GeneralUtils::IntToStr(nevents) + "\n";
+ eventdef += "EVCT-NEVT " + GeneralUtils::IntToStr(nevents) + "\n";
- LOG(FIT) << "Event Definition: " << std::endl;
+ NUIS_LOG(FIT, "Event Definition: ");
std::cout << " -> EVCT-NEVT : " << nevents << std::endl;
return eventdef;
}
-
-
-
//____________________________________________________________________________
-int main(int argc, char ** argv)
-{
- LOG(FIT) << "==== RUNNING neut_nuisance Event Generator =====" << std::endl;
- GetCommandLineArgs(argc,argv);
+int main(int argc, char **argv) {
+ NUIS_LOG(FIT, "==== RUNNING neut_nuisance Event Generator =====");
+ GetCommandLineArgs(argc, argv);
std::string neutroot = std::string(getenv("NEUT_ROOT")) + "/src/neutsmpl/";
// Calculate the dynamic modes definition
// Read Target string
std::string targetparamsdef = GetTargetDefinition(gOptTargetDef);
-
-
//____________________________
// NEUT doesn't let us do combined flux inputs so have to loop over each flux.
- std::map newfluxdef = MakeNewFluxFile(gOptFluxDef,gOptOutputFile);
+ std::map newfluxdef =
+ MakeNewFluxFile(gOptFluxDef, gOptOutputFile);
// Quick fix to make flux also save to pid_time.root.flux.root
std::stringstream ss;
ss << getpid() << "_" << time(NULL) << ".root";
- newfluxdef = MakeNewFluxFile(gOptFluxDef,ss.str());
+ newfluxdef = MakeNewFluxFile(gOptFluxDef, ss.str());
// Copy this file to the NEUT working directory
- LOG(FIT) << "Copying flux to NEUT working directory" << std::endl;
- system(("cp -v " + newfluxdef["beam_inputroot"] + " " + neutroot + "/").c_str());
- TFile* fluxrootfile = new TFile( newfluxdef["beam_inputroot"].c_str(), "READ");
+ NUIS_LOG(FIT, "Copying flux to NEUT working directory");
+ system(
+ ("cp -v " + newfluxdef["beam_inputroot"] + " " + neutroot + "/").c_str());
+ TFile *fluxrootfile = new TFile(newfluxdef["beam_inputroot"].c_str(), "READ");
// Setup possible beams and get relative fractions
std::vector possiblefluxids;
std::vector fluxfractions;
possiblefluxids.push_back("nue");
possiblefluxids.push_back("nueb");
possiblefluxids.push_back("numu");
possiblefluxids.push_back("numub");
possiblefluxids.push_back("tau");
possiblefluxids.push_back("taub");
// Total up integrals
double totintflux = 0.0;
- for (size_t i = 0; i < possiblefluxids.size(); i++){
- if (newfluxdef["beam_inputroot_" + possiblefluxids[i]].empty()){
+ for (size_t i = 0; i < possiblefluxids.size(); i++) {
+ if (newfluxdef["beam_inputroot_" + possiblefluxids[i]].empty()) {
fluxfractions.push_back(0.0);
} else {
- TH1D* fluxhist = (TH1D*) fluxrootfile->Get( newfluxdef["beam_inputroot_" + possiblefluxids[i]].c_str() );
- if (!fluxhist){
- THROW("FLUX HIST : " << newfluxdef["beam_inputroot_" + possiblefluxids[i]] << " not found!");
+ TH1D *fluxhist = (TH1D *)fluxrootfile->Get(
+ newfluxdef["beam_inputroot_" + possiblefluxids[i]].c_str());
+ if (!fluxhist) {
+ NUIS_ABORT("FLUX HIST : "
+ << newfluxdef["beam_inputroot_" + possiblefluxids[i]]
+ << " not found!");
}
- fluxfractions.push_back( fluxhist->Integral() );
+ fluxfractions.push_back(fluxhist->Integral());
totintflux += fluxhist->Integral();
}
}
fluxrootfile->Close();
-
// Now loop over and actually generate jobs!
- for (size_t i = 0; i < possiblefluxids.size(); i++){
- if (fluxfractions[i] == 0.0) continue;
+ for (size_t i = 0; i < possiblefluxids.size(); i++) {
+ if (fluxfractions[i] == 0.0)
+ continue;
// Get number of events for this subbeam
- int nevents = int( double(gOptNumberEvents) * fluxfractions[i] / totintflux );
- std::cout << "NEVENTS = " << gOptNumberEvents << " " << fluxfractions[i] <<" " << totintflux << " " << nevents << std::endl;
- std::string eventparamsdef = GetEventAndSeedDefinition(nevents,
- gOptSeed);
+ int nevents = int(double(gOptNumberEvents) * fluxfractions[i] / totintflux);
+ std::cout << "NEVENTS = " << gOptNumberEvents << " " << fluxfractions[i]
+ << " " << totintflux << " " << nevents << std::endl;
+ std::string eventparamsdef = GetEventAndSeedDefinition(nevents, gOptSeed);
bool neutrino = true;
- if (possiblefluxids[i].find("b") != std::string::npos) neutrino = false;
+ if (possiblefluxids[i].find("b") != std::string::npos)
+ neutrino = false;
std::string dynparamsdef = GetDynamicModes(gOptGeneratorList, neutrino);
- std::string fluxparamsdef = GetFluxDefinition( newfluxdef["beam_inputroot"],
- newfluxdef["beam_inputroot_" + possiblefluxids[i]],
- possiblefluxids[i] );
-
+ std::string fluxparamsdef = GetFluxDefinition(
+ newfluxdef["beam_inputroot"],
+ newfluxdef["beam_inputroot_" + possiblefluxids[i]], possiblefluxids[i]);
- LOG(FIT) << "==== Generating CardFiles NEUT! ===" << std::endl;
+ NUIS_LOG(FIT,"==== Generating CardFiles NEUT! ===");
std::cout << dynparamsdef << std::endl;
std::cout << targetparamsdef << std::endl;
std::cout << eventparamsdef << std::endl;
std::cout << fluxparamsdef << std::endl;
// Create card file
std::ifstream incardfile;
std::ofstream outcardfile;
std::string line;
- incardfile.open( gOptCrossSections.c_str(), ios::in );
- outcardfile.open( (gOptOutputFile + "." + possiblefluxids[i] + ".par").c_str(), ios::out );
+ incardfile.open(gOptCrossSections.c_str(), ios::in);
+ outcardfile.open(
+ (gOptOutputFile + "." + possiblefluxids[i] + ".par").c_str(), ios::out);
// Copy base card file
- if (incardfile.is_open()){
- while( getline (incardfile, line) ){
- outcardfile << line << '\n';
+ if (incardfile.is_open()) {
+ while (getline(incardfile, line)) {
+ outcardfile << line << '\n';
}
} else {
- THROW( "Cannot find card file : " << gOptCrossSections );
+ NUIS_ABORT("Cannot find card file : " << gOptCrossSections);
}
// Now copy our strings
- outcardfile << eventparamsdef<< '\n';
+ outcardfile << eventparamsdef << '\n';
outcardfile << dynparamsdef << '\n';
- outcardfile << targetparamsdef<< '\n';
- outcardfile << fluxparamsdef<< '\n';
+ outcardfile << targetparamsdef << '\n';
+ outcardfile << fluxparamsdef << '\n';
// Close card and keep name for future use.
outcardfile.close();
-
}
- LOG(FIT) << "GENERATING" << std::endl;
- for (size_t i = 0; i < possiblefluxids.size(); i++){
- if (fluxfractions[i] == 0.0) continue;
- int nevents = int( double(gOptNumberEvents) * fluxfractions[i] / totintflux );
- if (nevents <= 0) continue;
-
- std::string cardfile = ExpandPath(gOptOutputFile + "." + possiblefluxids[i] + ".par");
- std::string outputfile = ExpandPath(gOptOutputFile + "." + possiblefluxids[i] + ".root");
+ NUIS_LOG(FIT, "GENERATING");
+ for (size_t i = 0; i < possiblefluxids.size(); i++) {
+ if (fluxfractions[i] == 0.0)
+ continue;
+ int nevents = int(double(gOptNumberEvents) * fluxfractions[i] / totintflux);
+ if (nevents <= 0)
+ continue;
+
+ std::string cardfile =
+ ExpandPath(gOptOutputFile + "." + possiblefluxids[i] + ".par");
+ std::string outputfile =
+ ExpandPath(gOptOutputFile + "." + possiblefluxids[i] + ".root");
std::string basecardfile = GetBaseName(cardfile);
std::string baseoutputfile = ss.str();
- std::cout << "CARDFILE = " << cardfile << " : " << basecardfile << std::endl;
- std::cout << "OUTPUTFILE = " << outputfile << " : " << baseoutputfile << std::endl;
+ std::cout << "CARDFILE = " << cardfile << " : " << basecardfile
+ << std::endl;
+ std::cout << "OUTPUTFILE = " << outputfile << " : " << baseoutputfile
+ << std::endl;
system(("cp " + cardfile + " " + neutroot).c_str());
std::string cwd = GETCWD();
chdir(neutroot.c_str());
// int attempts = 0;
// while(true){
- // Break if too many attempts
+ // Break if too many attempts
// attempts++;
// if (attempts > 20) continue;
- // Actually run neutroot2
- system(("./neutroot2 " + basecardfile + " " + baseoutputfile).c_str());
+ // Actually run neutroot2
+ system(("./neutroot2 " + basecardfile + " " + baseoutputfile).c_str());
- // Check the output is valid, sometimes NEUT aborts mid run.
- // TFile* f = new TFile(baseoutputfile.c_str(),"READ");
- // if (!f or f->IsZombie()) continue;
-
- // Check neutttree is there and filled correctly.
- // TTree* tn = (TTree*) f->Get("neuttree");
- // if (!tn) continue;
- // if (tn->GetEntries() < nevents * 0.9) continue;
+ // Check the output is valid, sometimes NEUT aborts mid run.
+ // TFile* f = new TFile(baseoutputfile.c_str(),"READ");
+ // if (!f or f->IsZombie()) continue;
- // break;
- // }
+ // Check neutttree is there and filled correctly.
+ // TTree* tn = (TTree*) f->Get("neuttree");
+ // if (!tn) continue;
+ // if (tn->GetEntries() < nevents * 0.9) continue;
+
+ // break;
+ // }
// Move the finished file back and clean this directory of card files
system(("mv -v " + baseoutputfile + " " + outputfile).c_str());
system(("rm -v " + basecardfile).c_str());
chdir(cwd.c_str());
-
}
return 0;
}
//____________________________________________________________________________
-void GetCommandLineArgs(int argc, char ** argv)
-{
+void GetCommandLineArgs(int argc, char **argv) {
// Check for -h flag.
- for (int i = 0; i < argc; i++){
- if (!std::string(argv[i]).compare("-h")) PrintSyntax();
+ for (int i = 0; i < argc; i++) {
+ if (!std::string(argv[i]).compare("-h"))
+ PrintSyntax();
}
- // Format is neut -r run_number -n n events
+ // Format is neut -r run_number -n n events
std::vector args = GeneralUtils::LoadCharToVectStr(argc, argv);
ParserUtils::ParseArgument(args, "-n", gOptNumberEvents, false);
- if (gOptNumberEvents == -1){
- THROW( "No event count passed to neut_NUISANCE!");
+ if (gOptNumberEvents == -1) {
+ NUIS_ABORT("No event count passed to neut_NUISANCE!");
}
// Flux/Energy Specs
ParserUtils::ParseArgument(args, "-e", gOptEnergyDef, false);
- gOptEnergyRange = GeneralUtils::ParseToDbl(gOptEnergyDef,",");
+ gOptEnergyRange = GeneralUtils::ParseToDbl(gOptEnergyDef, ",");
ParserUtils::ParseArgument(args, "-f", gOptFluxDef, false);
- if (gOptFluxDef.empty() and gOptEnergyRange.size() < 1){
- THROW("No flux or energy range given to neut_nuisance!");
+ if (gOptFluxDef.empty() and gOptEnergyRange.size() < 1) {
+ NUIS_ABORT("No flux or energy range given to neut_nuisance!");
- } else if (gOptFluxDef.empty() and gOptEnergyRange.size() == 1){
+ } else if (gOptFluxDef.empty() and gOptEnergyRange.size() == 1) {
// Fixed energy, make sure -p is given
- THROW("neut_NUISANCE cannot yet do fixed energy!");
-
- } else if (gOptFluxDef.empty() and gOptEnergyRange.size() == 2){
+ NUIS_ABORT("neut_NUISANCE cannot yet do fixed energy!");
+
+ } else if (gOptFluxDef.empty() and gOptEnergyRange.size() == 2) {
// Uniform energy range
- THROW("neut_NUISANCE cannot yet do a uniform energy range!");
+ NUIS_ABORT("neut_NUISANCE cannot yet do a uniform energy range!");
- } else if (!gOptFluxDef.empty()){
+ } else if (!gOptFluxDef.empty()) {
// Try to convert the flux definition if possible.
std::string convflux = BeamUtils::ConvertFluxIDs(gOptFluxDef);
- if (!convflux.empty()) gOptFluxDef = convflux;
+ if (!convflux.empty())
+ gOptFluxDef = convflux;
} else {
- THROW("Unknown flux energy range combination!");
+ NUIS_ABORT("Unknown flux energy range combination!");
}
ParserUtils::ParseArgument(args, "-t", gOptTargetDef, false);
- if (gOptTargetDef.empty()){
- THROW("No Target passed to neut_nuisance! use the '-t' argument.");
+ if (gOptTargetDef.empty()) {
+ NUIS_ABORT("No Target passed to neut_nuisance! use the '-t' argument.");
} else {
std::string convtarget = TargetUtils::ConvertTargetIDs(gOptTargetDef);
- if (!convtarget.empty()) gOptTargetDef = convtarget;
+ if (!convtarget.empty())
+ gOptTargetDef = convtarget;
}
ParserUtils::ParseArgument(args, "-r", gOptRunNumber, false);
ParserUtils::ParseArgument(args, "-o", gOptOutputFile, false);
- if (gOptOutputFile.empty()){
- if (gOptRunNumber == -1) gOptRunNumber = 1;
- LOG(FIT) << "No output file given! Saving file to : neutgen." << gOptRunNumber << ".neutvect.root" << std::endl;
- gOptOutputFile = "neutgen." + GeneralUtils::IntToStr(gOptRunNumber) + ".neutvect.root";
+ if (gOptOutputFile.empty()) {
+ if (gOptRunNumber == -1)
+ gOptRunNumber = 1;
+ NUIS_LOG(FIT, "No output file given! Saving file to : neutgen."
+ << gOptRunNumber << ".neutvect.root");
+ gOptOutputFile =
+ "neutgen." + GeneralUtils::IntToStr(gOptRunNumber) + ".neutvect.root";
} else {
// if no run number given leave as is, else add run number.
- if (gOptRunNumber != -1){
+ if (gOptRunNumber != -1) {
gOptOutputFile += "." + GeneralUtils::IntToStr(gOptRunNumber) + ".root";
} else {
gOptRunNumber = 0;
}
}
ParserUtils::ParseArgument(args, "--cross-section", gOptCrossSections, false);
- if (!gOptCrossSections.compare("Default")){
- LOG(FIT) << "No Parameters File passed. Using default neut one." << std::endl;
- char * const var = getenv("NUISANCE");
+ if (!gOptCrossSections.compare("Default")) {
+ NUIS_LOG(FIT, "No Parameters File passed. Using default neut one.");
+ char *const var = getenv("NUISANCE");
if (!var) {
- std::cout << "Cannot find top level directory! Set the NUISANCE environmental variable" << std::endl;
+ std::cout << "Cannot find top level directory! Set the NUISANCE "
+ "environmental variable"
+ << std::endl;
exit(-1);
- }
+ }
std::string topnuisancedir = string(var);
gOptCrossSections = topnuisancedir + "/neut/Default_params.txt";
}
-
- ParserUtils::ParseArgument(args, "--event-generator-list", gOptGeneratorList, false);
+
+ ParserUtils::ParseArgument(args, "--event-generator-list", gOptGeneratorList,
+ false);
// Final Check and output
- if (args.size() > 0){
+ if (args.size() > 0) {
PrintSyntax();
ParserUtils::CheckBadArguments(args);
}
- LOG(FIT) << "Generating Neut Events with the following properties:" << std::endl
- << " -> Energy : " << gOptEnergyDef << " (" << gOptEnergyRange.size() << ")" << std::endl
- << " -> NEvents : " << gOptNumberEvents << std::endl
- << " -> Generators : " << gOptGeneratorList << std::endl
- << " -> XSecPars : " << gOptCrossSections << std::endl
- << " -> Target : " << gOptTargetDef << std::endl
- << " -> Flux : " << gOptFluxDef << std::endl
- << " -> Output : " << gOptOutputFile << std::endl
- << " -> Run : " << gOptRunNumber << std::endl;
+ NUIS_LOG(FIT, "Generating Neut Events with the following properties:"
+ << std::endl
+ << " -> Energy : " << gOptEnergyDef << " ("
+ << gOptEnergyRange.size() << ")" << std::endl
+ << " -> NEvents : " << gOptNumberEvents << std::endl
+ << " -> Generators : " << gOptGeneratorList << std::endl
+ << " -> XSecPars : " << gOptCrossSections << std::endl
+ << " -> Target : " << gOptTargetDef << std::endl
+ << " -> Flux : " << gOptFluxDef << std::endl
+ << " -> Output : " << gOptOutputFile << std::endl
+ << " -> Run : " << gOptRunNumber);
return;
}
//____________________________________________________________________________
-void PrintSyntax(void)
-{
-
- LOG(FIT)
- << "\n\n" << "Syntax:" << "\n"
- << "\n neut_nuisance [-h]"
- << "\n -n nev"
- << "\n -f flux_description"
- << "\n -t target_description"
- << "\n [ -r run_number ]"
- << "\n [ -o output_file ]"
- << "\n [ --cross-section /path/to/params.txt ]"
- << "\n [ --event-generator-list mode_definition ]"
- << "\n \n";
-
- LOG(FIT)
- << "\n\n Arguments:" << "\n"
- << "\n -n nev"
- << "\n -> Total number of events to generate (e.g. 2500000)"
- << "\n"
- << "\n -f flux_description"
- << "\n Definition of the flux to be read in from a ROOT file."
- << "\n"
- << "\n Multiple histograms can be read in from the same file using"
- << "\n the format '-f file.root,hist1[pdg1],hist2[pdg2]"
- << "\n e.g. \'-f ./flux/myfluxfile.root,numu_flux[14],numubar_flux[-14]\'"
- << "\n"
- << "\n A flux can also be given according to any of the flux IDs shown"
- << "\n at the end of this help message."
- << "\n e.g. \' -f MINERvA_fhc_numu\' "
- << "\n"
- << "\n WARNING: NEUT can't actually generate combined fluxes yet"
- << "\n if you want a composite flux, pass them in as normal, but the app"
- << "\n will generate you the files seperately, with reduced nevents in each"
- << "\n so that the statistics are roughly okay."
- << "\n"
- << "\n -t target_description"
- << "\n Definition of the target to be used. Multiple targets can be given."
- << "\n"
- << "\n To pass a single target just provide the target PDG"
- << "\n e.g. \' -t 1000060120 \'"
- << "\n"
- << "\n To pass a combined target provide a list containing the following"
- << "\n \' -t TotalNucleons,Target1[Weight1],Target2[Weight2],.. where the "
- << "\n TotalNucleons is the total nucleons combined, Target1 is the PDG "
- << "\n of the first target, and Weight1 is the fractional weight of the "
- << "\n first target."
- << "\n e.g. \' -t 13,1000060120[0.9231],1000010010[0.0769] \'"
- << "\n"
- << "\n Target can also be specified by the target IDs given at the end of"
- << "\n this help message."
- << "\n e.g. \' -t CH2 \'"
- << "\n"
- << "\n WARNING: NEUT can only generate A+H targets. E.g. CH or CH2 will work, but "
- << "\n Fe+Pb will not. You will have to generate each seperately if you want"
- << "\n something other than A+NH."
- << "\n"
- << "\n -r run_number"
- << "\n run number ID that can be used when generating large samples in small "
- << "\n jobs. Must be an integer. When given neut_nuisance will update the "
- << "\n output file from 'output.root' to 'output.root.run_number.root'"
- << "\n"
- << "\n -o output_file"
- << "\n Path to the output_file you want to save events to."
- << "\n"
- << "\n If this is not given but '-r' is then events will be saved to "
- << "\n the file 'neutgen.run_number.neutvect.root'"
- << "\n"
- << "\n If a run number is given alongside '-o' then events will be saved "
- << "\n to 'output.root.run_number.root'"
- << "\n"
- << "\n --cross-section /path/to/params.txt"
- << "\n Path to the neut model definition. If this is not given, then this "
- << "\n will default to $NUISANCE/data/neut/Default_params.txt"
- << "\n"
- << "\n Look in $NUISANCE/data/neut/Default_params.txt for examples when "
- << "\n writing your own card files."
- << "\n"
- << "\n --event-generator-list mode_definition"
- << "\n Name of modes to run. This sets the CRS and CRSB values in NEUT."
- << "\n e.g. --event-generator-list Default+MEC"
- << "\n"
- << "\n Allowed mode_definitions are given at the end of this help message."
- << "\n"
- << "\n\n";
-
- std::cout << "-----------------"< Total number of events to generate (e.g. 2500000)"
+ << "\n"
+ << "\n -f flux_description"
+ << "\n Definition of the flux to be read in from a ROOT file."
+ << "\n"
+ << "\n Multiple histograms can be read in from the same file using"
+ << "\n the format '-f file.root,hist1[pdg1],hist2[pdg2]"
+ << "\n e.g. \'-f "
+ "./flux/myfluxfile.root,numu_flux[14],numubar_flux[-14]\'"
+ << "\n"
+ << "\n A flux can also be given according to any of the flux IDs "
+ "shown"
+ << "\n at the end of this help message."
+ << "\n e.g. \' -f MINERvA_fhc_numu\' "
+ << "\n"
+ << "\n WARNING: NEUT can't actually generate combined fluxes yet"
+ << "\n if you want a composite flux, pass them in as normal, but "
+ "the "
+ "app"
+ << "\n will generate you the files seperately, with reduced "
+ "nevents "
+ "in each"
+ << "\n so that the statistics are roughly okay."
+ << "\n"
+ << "\n -t target_description"
+ << "\n Definition of the target to be used. Multiple targets can "
+ "be "
+ "given."
+ << "\n"
+ << "\n To pass a single target just provide the target PDG"
+ << "\n e.g. \' -t 1000060120 \'"
+ << "\n"
+ << "\n To pass a combined target provide a list containing the "
+ "following"
+ << "\n \' -t TotalNucleons,Target1[Weight1],Target2[Weight2],.. "
+ "where "
+ "the "
+ << "\n TotalNucleons is the total nucleons combined, Target1 is "
+ "the "
+ "PDG "
+ << "\n of the first target, and Weight1 is the fractional weight "
+ "of "
+ "the "
+ << "\n first target."
+ << "\n e.g. \' -t 13,1000060120[0.9231],1000010010[0.0769] \'"
+ << "\n"
+ << "\n Target can also be specified by the target IDs given at "
+ "the "
+ "end of"
+ << "\n this help message."
+ << "\n e.g. \' -t CH2 \'"
+ << "\n"
+ << "\n WARNING: NEUT can only generate A+H targets. E.g. CH or "
+ "CH2 "
+ "will work, but "
+ << "\n Fe+Pb will not. You will have to generate each seperately "
+ "if "
+ "you want"
+ << "\n something other than A+NH."
+ << "\n"
+ << "\n -r run_number"
+ << "\n run number ID that can be used when generating large "
+ "samples "
+ "in small "
+ << "\n jobs. Must be an integer. When given neut_nuisance will "
+ "update "
+ "the "
+ << "\n output file from 'output.root' to "
+ "'output.root.run_number.root'"
+ << "\n"
+ << "\n -o output_file"
+ << "\n Path to the output_file you want to save events to."
+ << "\n"
+ << "\n If this is not given but '-r' is then events will be saved "
+ "to "
+ << "\n the file 'neutgen.run_number.neutvect.root'"
+ << "\n"
+ << "\n If a run number is given alongside '-o' then events will "
+ "be "
+ "saved "
+ << "\n to 'output.root.run_number.root'"
+ << "\n"
+ << "\n --cross-section /path/to/params.txt"
+ << "\n Path to the neut model definition. If this is not given, "
+ "then "
+ "this "
+ << "\n will default to $NUISANCE/data/neut/Default_params.txt"
+ << "\n"
+ << "\n Look in $NUISANCE/data/neut/Default_params.txt for "
+ "examples "
+ "when "
+ << "\n writing your own card files."
+ << "\n"
+ << "\n --event-generator-list mode_definition"
+ << "\n Name of modes to run. This sets the CRS and CRSB values in "
+ "NEUT."
+ << "\n e.g. --event-generator-list Default+MEC"
+ << "\n"
+ << "\n Allowed mode_definitions are given at the end of this help "
+ "message."
+ << "\n"
+ << "\n\n");
+
+ std::cout << "-----------------" << std::endl;
TargetUtils::ListTargetIDs();
std::cout << "-----------------" << std::endl;
BeamUtils::ListFluxIDs();
std::cout << "-----------------" << std::endl;
- LOG(FIT) << "Allowed Mode Definitions:" << std::endl
- << " - Default : Default CC+NC modes, no MEC" << std::endl
- << " - Default+MEC : Default CC+NC modes + 2p2h MEC " << std::endl
- << " - DefaultFree : Default CC+NC modes, no Coherent or MEC " << std::endl;
+ NUIS_LOG(FIT) << "Allowed Mode Definitions:" << std::endl
+ << " - Default : Default CC+NC modes, no MEC" << std::endl
+ << " - Default+MEC : Default CC+NC modes + 2p2h MEC " << std::endl
+ << " - DefaultFree : Default CC+NC modes, no Coherent or MEC ");
std::cout << "----------------" << std::endl;
exit(0);
}
//____________________________________________________________________________
#endif
diff --git a/app/nuisbayes.cxx b/app/nuisbayes.cxx
index 44a3df0..98c9c3f 100644
--- a/app/nuisbayes.cxx
+++ b/app/nuisbayes.cxx
@@ -1,68 +1,68 @@
// 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 .
*******************************************************************************/
// Author: Patrick Stowell 09/2016
/*
Usage: ./nuissyst -c card file -o output file, where the results of the throws are stored
where:
*/
#include "BayesianRoutines.h"
//*******************************
void printInputCommands(){
//*******************************
exit(-1);
};
//*******************************
int main(int argc, char* argv[]){
//*******************************
// Program status;
int status = 0;
// If No Arguments print commands
if (argc == 1) printInputCommands();
for (int i = 1; i< argc; ++i){
// Cardfile
if (!std::strcmp(argv[i], "-h")) printInputCommands();
else break;
}
// Read input arguments such as card file, parameter arguments, and fit routines
- LOG(FIT)<<"Starting nuissyst"<Run();
// Show Final Status
- LOG(FIT)<<"-------------------------------------"<.
-*******************************************************************************/
+ * 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 .
+ *******************************************************************************/
#include "ComparisonRoutines.h"
//*******************************
void printInputCommands() {
-//*******************************
+ //*******************************
std::cout << "nuiscomp : NUISANCE Data Comparison App \n" << std::endl;
- std::cout << "# Running nuiscomp with a card file #\n"
- << "######################################\n"
- << "nuiscomp -c cardfile.xml [ -o outputfile.root ] [ -f routines ] [ -n maxevents ] \n"
- << " [ -i 'cardstructure' ] [ -d fakedata ] [ -q config=val ] [ +e/-e ] [ +v/-v ] \n"
- << "\n"
- << "# Running nuiscomp with structures at cmd line #\n"
- << "################################################\n"
- << "nuiscomp -i 'cardstructure' -o outputfile.root [ -c cardfile.xml [ -f routines ] [ -n maxevents ] \n"
- << " [ -d fakedata ] [ -q config=val ] [ +e/-e ] [ +v/-v ] \n"
- << std::endl;
+ std::cout
+ << "# Running nuiscomp with a card file #\n"
+ << "######################################\n"
+ << "nuiscomp -c cardfile.xml [ -o outputfile.root ] [ -f routines ] [ "
+ "-n maxevents ] \n"
+ << " [ -i 'cardstructure' ] [ -d fakedata ] [ -q config=val ] [ "
+ "+e/-e ] [ +v/-v ] \n"
+ << "\n"
+ << "# Running nuiscomp with structures at cmd line #\n"
+ << "################################################\n"
+ << "nuiscomp -i 'cardstructure' -o outputfile.root [ -c cardfile.xml [ "
+ "-f routines ] [ -n maxevents ] \n"
+ << " [ -d fakedata ] [ -q config=val ] [ +e/-e ] [ +v/-v ] \n"
+ << std::endl;
sleep(4);
- std::cout << ""
- << "\n"
- << " \n"
- << " -c cardfile.xml : NUISANCE format card file defining comparisons. \n"
- << " \n"
- << " -o outputfile.root : Output file that histograms will be saved in. If a card file is \n"
- << " given but no output file this will default to cardfile.xml.root \n"
- << " \n"
- << " -f routines : Comma separated list of comparison routines to run in order. \n"
- << " Allowed Routines : \n"
- << " Compare : Fixed comparison at nominal dial values. \n"
- << " \n"
- << " -n maxevents : Set limit on the number of event entries to process. \n"
- << " \n"
- << " -i \'cardstructure\' : Define card structure like those available in the standard NUISANCE \n"
- << " card format, but on the command line at runtime. MUST be enclosed \n"
- << " in single quotation marks. See examples below for usage. \n"
- << " \n"
- << " It is possible to entirely define the comparison using \' -i\' commands \n"
- << " without the need to write a card file explicitly. If you do this, \n"
- << " make sure to also use the \' -o\' flag to tell it where to go. \n"
- << " \n"
- << " -d fakedata : Define a fake data set to be used. All data in NUISANCE will be set \n"
- << " to the values defined in this fake data before comparisons are made. \n"
- << " \n"
- << " There are two possible methods. Fake data from MC or a previous file.\n"
- << " fakedata = \'MC\' : Sets the MC to the values defined by \'fake_parameters\' \n"
- << " shown in the examples below, and then sets the data \n"
- << " to be equal to this MC prediction. \n"
- << " fakedata = \'file.root\' : Reads in the ROOT file at the specified path \n"
- << " assuming its a standard NUISANCE file. Takes \n"
- << " MC predictions in this file and uses them as \n"
- << " fake data. \n"
- << " \n"
- << " -q config=val : Overrides default configurations provided in the cardfile and in \n"
- << " '$NUISANCE/parameters/config.xml\'. Any config parameter can be set. \n"
- << " Examples : \n"
- << " \'-q VERBOSITY=4\' \n"
- << " \'-q EventManager=1\' \n"
- << " \'-q drawOpts=DATA/MC\' \n"
- << " \n"
- << " +e/-e : Increase/Decrease the default error verbosity by 1. \n"
- << " \n"
- << " +v/-v : Increase/Decrease the default logging verbosity by 1.\n"
- << " \n\n" << std::endl;
+ std::cout
+ << ""
+ << "\n"
+ << " \n"
+ << " -c cardfile.xml : NUISANCE format card file defining "
+ "comparisons. \n"
+ << " \n"
+ << " -o outputfile.root : Output file that histograms will be "
+ "saved in. If a card file is \n"
+ << " given but no output file this will "
+ "default to cardfile.xml.root \n"
+ << " \n"
+ << " -f routines : Comma separated list of comparison "
+ "routines to run in order. \n"
+ << " Allowed Routines : "
+ " \n"
+ << " Compare : Fixed comparison at "
+ "nominal dial values. \n"
+ << " \n"
+ << " -n maxevents : Set limit on the number of event "
+ "entries to process. \n"
+ << " \n"
+ << " -i \'cardstructure\' : Define card structure like those "
+ "available in the standard NUISANCE \n"
+ << " card format, but on the command line "
+ "at runtime. MUST be enclosed \n"
+ << " in single quotation marks. See "
+ "examples below for usage. \n"
+ << " \n"
+ << " It is possible to entirely define "
+ "the comparison using \' -i\' commands \n"
+ << " without the need to write a card "
+ "file explicitly. If you do this, \n"
+ << " make sure to also use the \' -o\' "
+ "flag to tell it where to go. \n"
+ << " \n"
+ << " -d fakedata : Define a fake data set to be used. "
+ "All data in NUISANCE will be set \n"
+ << " to the values defined in this fake "
+ "data before comparisons are made. \n"
+ << " \n"
+ << " There are two possible methods. Fake "
+ "data from MC or a previous file.\n"
+ << " fakedata = \'MC\' : Sets the MC to "
+ "the values defined by \'fake_parameters\' \n"
+ << " shown in the "
+ "examples below, and then sets the data \n"
+ << " to be equal to "
+ "this MC prediction. \n"
+ << " fakedata = \'file.root\' : Reads in "
+ "the ROOT file at the specified path \n"
+ << " assuming "
+ "its a standard NUISANCE file. Takes \n"
+ << " MC "
+ "predictions in this file and uses them as \n"
+ << " fake data. "
+ "\n"
+ << " \n"
+ << " -q config=val : Overrides default configurations "
+ "provided in the cardfile and in \n"
+ << " '$NUISANCE/parameters/config.xml\'. "
+ "Any config parameter can be set. \n"
+ << " Examples : \n"
+ << " \'-q VERBOSITY=4\' \n"
+ << " \'-q EventManager=1\' \n"
+ << " \'-q drawOpts=DATA/MC\' \n"
+ << " \n"
+ << " +e/-e : Increase/Decrease the default error "
+ "verbosity by 1. \n"
+ << " \n"
+ << " +v/-v : Increase/Decrease the default "
+ "logging verbosity by 1.\n"
+ << " \n\n"
+ << std::endl;
sleep(4);
- std::cout << "# nuiscomp Running Examples #"
- << "############################# \n"
- << " \n"
- << " 1. Generate cardfile comparisons with increased verbosity and only 50000 events \n\n"
- << " nuiscomp -c cardfile.card -o mycomp.root -n 50000 +v +v \n"
- << " \n\n"
- << " 2. Generate a comparison to MiniBooNE data using simple structure, saving it to outfile.root \n\n"
- << " nuiscomp -o outfile.root -i \'sample MiniBooNE_CCQE_XSec_1DQ2_nu NEUT:neutevents.root\' \n"
- << " \n\n"
- << " 3. Generate a comparison to MiniBooNE data using xml structure, reweight MaCCQE, and save the prediction to outfile.root \n\n"
- << " nuiscomp -o outfile.root -i \'sample name=\"MiniBooNE_CCQE_XSec_1DQ2_nu\" input=\"NEUT:neutevents.root\"\' \\ \n"
- << " -i \'sample name=\"MiniBooNE_CC1pip_XSec_1DQ2_nu\" input=\"NEUT:neutevents.root\"\' \\ \n"
- << " -i \'parameter name=\"MaCCQE\" nominal=\"1.0\" type=\"neut_parameter\"\' \n "
- << " \n\n"
- << " 4. Generate a comparison, using fake data from the MC predictions inside the fakedata.root \n\n"
- << " nuiscomp -c cardfile.card -o myfakecomp.root -d fakedata.root \n"
- << " \n\n"
- << " 5. Generate a comparison using fake data defined on the command line use fake parameters \n\n"
- << " nuiscomp -c cardfile.card -d MC -i \'fakeparameter name=\"MaCCQE\" nominal=\"1.0\"\' \n "
- << " -i \'parameter name=\"MaCCQE\" nominal=\"1.0\" type=\"neut_parameter\"' "
- << " \n\n"
- << std::endl;
+ std::cout
+ << "# nuiscomp Running Examples #"
+ << "############################# \n"
+ << " \n"
+ << " 1. Generate cardfile comparisons with increased verbosity and only "
+ "50000 events \n\n"
+ << " nuiscomp -c cardfile.card -o mycomp.root -n 50000 +v +v \n"
+ << " \n\n"
+ << " 2. Generate a comparison to MiniBooNE data using simple structure, "
+ "saving it to outfile.root \n\n"
+ << " nuiscomp -o outfile.root -i \'sample "
+ "MiniBooNE_CCQE_XSec_1DQ2_nu NEUT:neutevents.root\' \n"
+ << " \n\n"
+ << " 3. Generate a comparison to MiniBooNE data using xml structure, "
+ "reweight MaCCQE, and save the prediction to outfile.root \n\n"
+ << " nuiscomp -o outfile.root -i \'sample "
+ "name=\"MiniBooNE_CCQE_XSec_1DQ2_nu\" "
+ "input=\"NEUT:neutevents.root\"\' \\ \n"
+ << " -i \'sample "
+ "name=\"MiniBooNE_CC1pip_XSec_1DQ2_nu\" "
+ "input=\"NEUT:neutevents.root\"\' \\ \n"
+ << " -i \'parameter name=\"MaCCQE\" "
+ "nominal=\"1.0\" type=\"neut_parameter\"\' \n "
+ << " \n\n"
+ << " 4. Generate a comparison, using fake data from the MC predictions "
+ "inside the fakedata.root \n\n"
+ << " nuiscomp -c cardfile.card -o myfakecomp.root -d fakedata.root "
+ "\n"
+ << " \n\n"
+ << " 5. Generate a comparison using fake data defined on the command "
+ "line use fake parameters \n\n"
+ << " nuiscomp -c cardfile.card -d MC -i \'fakeparameter "
+ "name=\"MaCCQE\" nominal=\"1.0\"\' \n "
+ << " -i \'parameter name=\"MaCCQE\" "
+ "nominal=\"1.0\" type=\"neut_parameter\"' "
+ << " \n\n"
+ << std::endl;
sleep(4);
std::cout << "# NUISANCE Card Format Structure Examples # \n"
<< "########################################### \n"
<< "\n"
- << "The NUISANCE card can be defined as a simple text file, or an xml file. \n"
+ << "The NUISANCE card can be defined as a simple text file, or an "
+ "xml file. \n"
<< "Examples for both with relevant structures are given below. \n"
<< std::endl;
- std::cout << "# XML Card File Example # \n"
- << "cardfile.xml: \n"
- << ""
- << "\n"
- << " \n"
- << " \n"
- << " \n"
- << "\n"
- << " \n"
- << " \n"
- << " \n"
- << " \n"
- << " \n"
- << " \n"
- << " \n"
- << "\n"
- << " \n"
- << " \n"
- << "\n"
- << "\n"
- << " \n"
- << " \n"
- << " \n"
- << " \n"
- << " \n"
- << "\n"
- << " \n"
- << "\n"
- << " \n"
- << " \n"
- << " \n"
- << " \n"
- << " \n"
- << "\n"
- << " \n"
- << "\n"
- << " \n\n" << std::endl;
-
+ std::cout
+ << "# XML Card File Example # \n"
+ << "cardfile.xml: \n"
+ << ""
+ << "\n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << "\n"
+ << " \n"
+ << " "
+ "\n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << "\n"
+ << " \n"
+ << " \n"
+ << "\n"
+ << "\n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << "\n"
+ << " \n"
+ << "\n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << " \n"
+ << "\n"
+ << " \n"
+ << "\n"
+ << " \n\n"
+ << std::endl;
- std::cout << "# Simple Card File Example # \n"
- << "cardfile.card: \n"
- << "\n"
- << "# CONFIG STRUCTURE \n"
- << "# config name val \n"
- << "config VERBOSITY 4 \n"
- << "\n"
- << "# Sample Structure \n"
- << "# ID Corresponds to names given in src/FCN/SampleList.cxx \n"
- << "# TYPE is the generator type (NEUT,NUWRO,GENIE,GIBUU). \n"
- << "# FILE is the input generator events file. \n"
- << "# TYPE is optional and used to define options for a class. e.g. FREE \n"
- << "# NORM is optional and sets sample normalisations. \n"
- << "# sample ID TYPE:FILE TYPE 1.0 \n"
- << "\n"
- << "sample MiniBooNE_CCQE_XSec_1DQ2_nu GENIE:genieevents.root \n"
- << "sample MiniBooNE_CC1pip_XSec_1DQ2_nu GENIE:genieevents.root SHAPE \n"
- << "\n"
- << "\n"
- << "# Parameter Structure \n"
- << "# ID is the name of the dial in each generator RW engine \n"
- << "# TYPE is the dial type (neut,newer,genie,niwg,t2k,custom,norm) \n"
- << "# VAL is the nominal value in 1-sigma variation for the comparison \n"
- << "# TYPE_parameter ID VAL \n"
- << "\n"
- << "neut_parameter MaCCQE 0.5 \n"
- << "\n"
- << "# Fake Parameter Structure \n"
- << "# Sets values for fake data defined using the ‘MC’ flag. \n"
- << "# ID is the dial name, it MUST be specified before hand using a normal parameter structure \n"
- << "# VAL is the value to use for the fake data \n"
- << "# fake_parameter ID VAL \n"
- << "\n"
- << "fake_parameter MaCCQE 1.0 \n"
- << "\n" << std::endl;
+ std::cout
+ << "# Simple Card File Example # \n"
+ << "cardfile.card: \n"
+ << "\n"
+ << "# CONFIG STRUCTURE \n"
+ << "# config name val \n"
+ << "config VERBOSITY 4 \n"
+ << "\n"
+ << "# Sample Structure \n"
+ << "# ID Corresponds to names given in src/FCN/SampleList.cxx \n"
+ << "# TYPE is the generator type (NEUT,NUWRO,GENIE,GIBUU). \n"
+ << "# FILE is the input generator events file. \n"
+ << "# TYPE is optional and used to define options for a class. e.g. FREE "
+ " \n"
+ << "# NORM is optional and sets sample normalisations. \n"
+ << "# sample ID TYPE:FILE TYPE 1.0 \n"
+ << "\n"
+ << "sample MiniBooNE_CCQE_XSec_1DQ2_nu GENIE:genieevents.root \n"
+ << "sample MiniBooNE_CC1pip_XSec_1DQ2_nu GENIE:genieevents.root SHAPE \n"
+ << "\n"
+ << "\n"
+ << "# Parameter Structure \n"
+ << "# ID is the name of the dial in each generator RW engine \n"
+ << "# TYPE is the dial type (neut,newer,genie,niwg,t2k,custom,norm) \n"
+ << "# VAL is the nominal value in 1-sigma variation for the comparison \n"
+ << "# TYPE_parameter ID VAL \n"
+ << "\n"
+ << "neut_parameter MaCCQE 0.5 \n"
+ << "\n"
+ << "# Fake Parameter Structure \n"
+ << "# Sets values for fake data defined using the ‘MC’ flag. \n"
+ << "# ID is the dial name, it MUST be specified before hand using a "
+ "normal parameter structure \n"
+ << "# VAL is the value to use for the fake data \n"
+ << "# fake_parameter ID VAL \n"
+ << "\n"
+ << "fake_parameter MaCCQE 1.0 \n"
+ << "\n"
+ << std::endl;
exit(-1);
-
};
//*******************************
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
//*******************************
// Program status;
int status = 0;
// If No Arguments print commands
- if (argc == 1) printInputCommands();
+ if (argc == 1)
+ printInputCommands();
for (int i = 1; i < argc; ++i) {
// Cardfile
- if (!std::strcmp(argv[i], "-h")) printInputCommands();
- else break;
+ if (!std::strcmp(argv[i], "-h"))
+ printInputCommands();
+ else
+ break;
}
- // Read input arguments such as card file, parameter arguments, and fit routines
- LOG(FIT) << "Starting nuiscomp.exe" << std::endl;
+ // Read input arguments such as card file, parameter arguments, and fit
+ // routines
+ NUIS_LOG(FIT, "Starting nuiscomp.exe");
// Make minimizer class and run fit
- ComparisonRoutines* comp = new ComparisonRoutines(argc, argv);
+ ComparisonRoutines *comp = new ComparisonRoutines(argc, argv);
comp->Run();
delete comp;
// Show Final Status
- LOG(FIT) << "------------------------------------ -" << std::endl;
- LOG(FIT) << "Comparison Complete." << std::endl;
- LOG(FIT) << "------------------------------------ -" << std::endl;
+ NUIS_LOG(FIT, "------------------------------------ -");
+ NUIS_LOG(FIT, "Comparison Complete.");
+ NUIS_LOG(FIT, "------------------------------------ -");
return status;
}
diff --git a/app/nuisflat.cxx b/app/nuisflat.cxx
index 7c24b5a..25fa4ed 100644
--- a/app/nuisflat.cxx
+++ b/app/nuisflat.cxx
@@ -1,393 +1,391 @@
// 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 .
-*******************************************************************************/
+ * 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 .
+ *******************************************************************************/
#include "ComparisonRoutines.h"
-#include "InputUtils.h"
-#include "MeasurementBase.h"
#include "GenericFlux_Tester.h"
#include "GenericFlux_Vectors.h"
+#include "InputUtils.h"
+#include "MeasurementBase.h"
#include "Smearceptance_Tester.h"
// Global Arguments
std::string gOptInputFile = "";
std::string gOptFormat = "";
std::string gOptOutputFile = "";
std::string gOptType = "DEFAULT";
std::string gOptNumberEvents = "NULL";
std::string gOptCardInput = "";
std::string gOptOptions = "";
// Input Dial Vals
-std::vector fParams; ///< Vector of dial names.
+std::vector fParams; ///< Vector of dial names.
std::map fStateVals; ///< Map of dial states
-std::map fCurVals; ///< Map of dial values
-std::map fTypeVals; ///< Map of dial type enums.
+std::map fCurVals; ///< Map of dial values
+std::map fTypeVals; ///< Map of dial type enums.
// Fake Dial Vals
-std::map fFakeVals; ///< Map of fake data settings.
+std::map fFakeVals; ///< Map of fake data settings.
void SetupComparisonsFromXML();
void SetupRWEngine();
//*******************************
void PrintSyntax() {
//*******************************
std::cout << "nuisflat -i input [-f format] [-o outfile] [-n nevents] [-t "
"options] [-q con=val] \n";
std::cout
<< "\n Arguments : "
<< "\n\t -i input : Path to input vector of events to flatten"
<< "\n\t"
<< "\n\t This should be given in the same format a normal "
"input file"
<< "\n\t is given to NUISANCE. {e.g. NUWRO:eventsout.root}."
<< "\n\t"
- << "\n\t -f format : FlatTree format to output. If none given GenericVectors used."
+ << "\n\t -f format : FlatTree format to output. If none given "
+ "GenericVectors used."
<< "\n\t\t GenericFlux : Flat event summary format."
- << "\n\t\t GenericVectors : Standard event summary format with particle vectors."
+ << "\n\t\t GenericVectors : Standard event summary format with "
+ "particle vectors."
<< "\n\t "
- << "\n\t[-c crd.xml]: Input card file to override configs or set dial values."
+ << "\n\t[-c crd.xml]: Input card file to override configs or set dial "
+ "values."
<< "\n\t "
<< "\n\t[-o outfile]: Optional output file path. "
<< "\n\t "
<< "\n\t If none given, input.format.root is chosen."
<< "\n\t"
<< "\n\t[-n nevents]: Optional choice of Nevents to run over. Default is "
"all."
<< "\n\t"
<< "\n\t[-t options]: Pass OPTION to the FlatTree sample. "
<< "\n\t Similar to type field in comparison xml configs."
<< "\n\t"
<< "\n\t[-q con=val]: Configuration overrides." << std::endl;
exit(-1);
};
//____________________________________________________________________________
-void GetCommandLineArgs(int argc, char** argv) {
+void GetCommandLineArgs(int argc, char **argv) {
// Check for -h flag.
for (int i = 0; i < argc; i++) {
if ((!std::string(argv[i]).compare("-h")) ||
(!std::string(argv[i]).compare("-?")) ||
(!std::string(argv[i]).compare("--help")))
PrintSyntax();
}
// Format is nuwro -r run_number -n n events
std::vector args = GeneralUtils::LoadCharToVectStr(argc, argv);
// Parse input file
ParserUtils::ParseArgument(args, "-i", gOptInputFile, false);
if (gOptInputFile == "") {
- THROW("Need to provide a valid input file to nuisflat using -i flag!");
+ NUIS_ABORT("Need to provide a valid input file to nuisflat using -i flag!");
} else {
- LOG(FIT) << "Reading Input File = " << gOptInputFile << std::endl;
+ NUIS_LOG(FIT, "Reading Input File = " << gOptInputFile);
}
// Get Output Format
ParserUtils::ParseArgument(args, "-f", gOptFormat, false);
if (gOptFormat == "") {
gOptFormat = "GenericVectors";
- LOG(FIT) << "Saving flattree in default format = " << gOptFormat << std::endl;
+ NUIS_LOG(FIT, "Saving flattree in default format = " << gOptFormat);
} else {
- LOG(FIT) << "Saving flattree in format = " << gOptFormat << std::endl;
+ NUIS_LOG(FIT, "Saving flattree in format = " << gOptFormat);
}
// Get Output File
ParserUtils::ParseArgument(args, "-o", gOptOutputFile, false);
if (gOptOutputFile == "") {
gOptOutputFile = gOptInputFile + "." + gOptFormat + ".root";
- LOG(FIT) << "No output file given so saving nuisflat output to:"
- << gOptOutputFile << std::endl;
+ NUIS_LOG(FIT, "No output file given so saving nuisflat output to:"
+ << gOptOutputFile);
} else {
- LOG(FIT) << "Saving nuisflat output to " << gOptOutputFile << std::endl;
+ NUIS_LOG(FIT, "Saving nuisflat output to " << gOptOutputFile);
}
// Get N Events and Configs
nuisconfig configuration = Config::Get();
ParserUtils::ParseArgument(args, "-n", gOptNumberEvents, false);
if (gOptNumberEvents.compare("NULL")) {
configuration.OverrideConfig("MAXEVENTS=" + gOptNumberEvents);
}
std::vector configargs;
ParserUtils::ParseArgument(args, "-q", configargs);
for (size_t i = 0; i < configargs.size(); i++) {
configuration.OverrideConfig(configargs[i]);
}
ParserUtils::ParseArgument(args, "-c", gOptCardInput, false);
if (gOptCardInput != "") {
- QLOG(FIT, "Reading cardfile: " << gOptCardInput);
+ NUIS_LOG(FIT, "Reading cardfile: " << gOptCardInput);
configuration.LoadSettings(gOptCardInput, "");
}
ParserUtils::ParseArgument(args, "-t", gOptOptions, false);
if (gOptOptions != "") {
- QLOG(FIT, "Read options: \"" << gOptOptions << "\'");
+ NUIS_LOG(FIT, "Read options: \"" << gOptOptions << "\'");
}
return;
}
//*******************************
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
//*******************************
// Parse
GetCommandLineArgs(argc, argv);
// Make output file
- TFile* f = new TFile(gOptOutputFile.c_str(), "RECREATE");
+ TFile *f = new TFile(gOptOutputFile.c_str(), "RECREATE");
if (f->IsZombie()) {
- THROW("Cannot create output file!");
+ NUIS_ABORT("Cannot create output file!");
}
f->cd();
FitPar::Config().out = f;
// Create a new measurementbase class depending on the Format
- MeasurementBase* flattreecreator = NULL;
+ MeasurementBase *flattreecreator = NULL;
SetupComparisonsFromXML();
SetupRWEngine();
- //SetupFCN();
+ // SetupFCN();
// Make a new sample key for the format of interest.
nuiskey samplekey = Config::CreateKey("sample");
if (!gOptFormat.compare("GenericFlux")) {
samplekey.Set("name", "FlatTree");
samplekey.Set("input", gOptInputFile);
samplekey.Set("type", gOptType);
flattreecreator = new GenericFlux_Tester("FlatTree", gOptInputFile,
FitBase::GetRW(), gOptType, "");
} else if (!gOptFormat.compare("GenericVectors")) {
samplekey.Set("name", "FlatTree");
samplekey.Set("input", gOptInputFile);
samplekey.Set("type", gOptType);
flattreecreator = new GenericFlux_Vectors("FlatTree", gOptInputFile,
- FitBase::GetRW(), gOptType, "");
+ FitBase::GetRW(), gOptType, "");
} else {
- ERR(FTL) << "Unknown FlatTree format!" << std::endl;
+ NUIS_ERR(FTL, "Unknown FlatTree format!");
}
// Make the FlatTree reconfigure
flattreecreator->Reconfigure();
f->cd();
flattreecreator->Write();
f->Close();
// Show Final Status
- LOG(FIT) << "-------------------------------------" << std::endl;
- LOG(FIT) << "Flattree Generation Complete." << std::endl;
- LOG(FIT) << "-------------------------------------" << std::endl;
+ NUIS_LOG(FIT, "-------------------------------------");
+ NUIS_LOG(FIT, "Flattree Generation Complete.");
+ NUIS_LOG(FIT, "-------------------------------------");
return 0;
}
//*************************************
void SetupComparisonsFromXML() {
//*************************************
- LOG(FIT) << "Setting up nuiscomp" << std::endl;
+ NUIS_LOG(FIT, "Setting up nuiscomp");
// Setup Parameters ------------------------------------------
std::vector parkeys = Config::QueryKeys("parameter");
if (!parkeys.empty()) {
- LOG(FIT) << "Number of parameters : " << parkeys.size() << std::endl;
+ NUIS_LOG(FIT, "Number of parameters : " << parkeys.size());
}
for (size_t i = 0; i < parkeys.size(); i++) {
nuiskey key = parkeys.at(i);
// Check for type,name,nom
if (!key.Has("type")) {
- ERR(FTL) << "No type given for parameter " << i << std::endl;
- ERR(FTL) << "type='PARAMETER_TYPE'" << std::endl;
+ NUIS_ERR(FTL, "No type given for parameter " << i);
+ NUIS_ERR(FTL, "type='PARAMETER_TYPE'");
throw;
} else if (!key.Has("name")) {
- ERR(FTL) << "No name given for parameter " << i << std::endl;
- ERR(FTL) << "name='SAMPLE_NAME'" << std::endl;
+ NUIS_ERR(FTL, "No name given for parameter " << i);
+ NUIS_ERR(FTL, "name='SAMPLE_NAME'");
throw;
} else if (!key.Has("nominal")) {
- ERR(FTL) << "No nominal given for parameter " << i << std::endl;
- ERR(FTL) << "nominal='NOMINAL_VALUE'" << std::endl;
+ NUIS_ERR(FTL, "No nominal given for parameter " << i);
+ NUIS_ERR(FTL, "nominal='NOMINAL_VALUE'");
throw;
}
// Get Inputs
std::string partype = key.GetS("type");
std::string parname = key.GetS("name");
- double parnom = key.GetD("nominal");
- double parlow = parnom - 1;
+ double parnom = key.GetD("nominal");
+ double parlow = parnom - 1;
double parhigh = parnom + 1;
double parstep = 1;
// override if state not given
- if (!key.Has("state")){
- key.SetS("state","FIX");
+ if (!key.Has("state")) {
+ key.SetS("state", "FIX");
}
std::string parstate = key.GetS("state");
// Check for incomplete limtis
- int limdef = ((int)key.Has("low") +
- (int)key.Has("high") +
- (int)key.Has("step"));
-
- if (limdef > 0 and limdef < 3){
- ERR(FTL) << "Incomplete limit set given for parameter : " << parname << std::endl;
- ERR(FTL) << "Requires: low='LOWER_LIMIT' high='UPPER_LIMIT' step='STEP_SIZE' " << std::endl;
+ int limdef =
+ ((int)key.Has("low") + (int)key.Has("high") + (int)key.Has("step"));
+
+ if (limdef > 0 and limdef < 3) {
+ NUIS_ERR(FTL, "Incomplete limit set given for parameter : " << parname);
+ NUIS_ERR(
+ FTL,
+ "Requires: low='LOWER_LIMIT' high='UPPER_LIMIT' step='STEP_SIZE' ");
throw;
}
// Extra limits
if (key.Has("low")) {
- parlow = key.GetD("low");
+ parlow = key.GetD("low");
parhigh = key.GetD("high");
parstep = key.GetD("step");
- LOG(FIT) << "Read " << partype << " : "
- << parname << " = "
- << parnom << " : "
- << parlow << " < p < " << parhigh
- << " : " << parstate << std::endl;
+ NUIS_LOG(FIT, "Read " << partype << " : " << parname << " = " << parnom
+ << " : " << parlow << " < p < " << parhigh << " : "
+ << parstate);
} else {
- LOG(FIT) << "Read " << partype << " : "
- << parname << " = "
- << parnom << " : "
- << parstate << std::endl;
+ NUIS_LOG(FIT, "Read " << partype << " : " << parname << " = " << parnom
+ << " : " << parstate);
}
// Convert if required
if (parstate.find("ABS") != std::string::npos) {
- parnom = FitBase::RWAbsToSigma( partype, parname, parnom );
- parlow = FitBase::RWAbsToSigma( partype, parname, parlow );
- parhigh = FitBase::RWAbsToSigma( partype, parname, parhigh );
- parstep = FitBase::RWAbsToSigma( partype, parname, parstep );
+ parnom = FitBase::RWAbsToSigma(partype, parname, parnom);
+ parlow = FitBase::RWAbsToSigma(partype, parname, parlow);
+ parhigh = FitBase::RWAbsToSigma(partype, parname, parhigh);
+ parstep = FitBase::RWAbsToSigma(partype, parname, parstep);
} else if (parstate.find("FRAC") != std::string::npos) {
- parnom = FitBase::RWFracToSigma( partype, parname, parnom );
- parlow = FitBase::RWFracToSigma( partype, parname, parlow );
- parhigh = FitBase::RWFracToSigma( partype, parname, parhigh );
- parstep = FitBase::RWFracToSigma( partype, parname, parstep );
+ parnom = FitBase::RWFracToSigma(partype, parname, parnom);
+ parlow = FitBase::RWFracToSigma(partype, parname, parlow);
+ parhigh = FitBase::RWFracToSigma(partype, parname, parhigh);
+ parstep = FitBase::RWFracToSigma(partype, parname, parstep);
}
// Push into vectors
fParams.push_back(parname);
- fTypeVals[parname] = FitBase::ConvDialType(partype);;
- fCurVals[parname] = parnom;
+ fTypeVals[parname] = FitBase::ConvDialType(partype);
+ ;
+ fCurVals[parname] = parnom;
fStateVals[parname] = parstate;
-
}
// Setup Samples ----------------------------------------------
- std::vector samplekeys = Config::QueryKeys("sample");
+ std::vector samplekeys = Config::QueryKeys("sample");
if (!samplekeys.empty()) {
- LOG(FIT) << "Number of samples : " << samplekeys.size() << std::endl;
+ NUIS_LOG(FIT,"Number of samples : " << samplekeys.size());
}
for (size_t i = 0; i < samplekeys.size(); i++) {
nuiskey key = samplekeys.at(i);
// Get Sample Options
std::string samplename = key.GetS("name");
std::string samplefile = key.GetS("input");
- std::string sampletype =
- key.Has("type") ? key.GetS("type") : "DEFAULT";
+ std::string sampletype = key.Has("type") ? key.GetS("type") : "DEFAULT";
- double samplenorm =
- key.Has("norm") ? key.GetD("norm") : 1.0;
+ double samplenorm = key.Has("norm") ? key.GetD("norm") : 1.0;
// Print out
- LOG(FIT) << "Read Sample " << i << ". : "
- << samplename << " (" << sampletype << ") [Norm=" << samplenorm<<"]"<< std::endl
- << " -> input='" << samplefile << "'" << std::endl;
+ NUIS_LOG(FIT, "Read Sample " << i << ". : " << samplename << " ("
+ << sampletype << ") [Norm=" << samplenorm << "]" << std::endl
+ << " -> input='" << samplefile
+ << "'");
// If FREE add to parameters otherwise continue
if (sampletype.find("FREE") == std::string::npos) {
continue;
}
// Form norm dial from samplename + sampletype + "_norm";
std::string normname = samplename + "_norm";
// Check normname not already present
if (fTypeVals.find("normname") != fTypeVals.end()) {
continue;
}
// Add new norm dial to list if its passed above checks
fParams.push_back(normname);
fTypeVals[normname] = kNORM;
fStateVals[normname] = sampletype;
fCurVals[normname] = samplenorm;
-
}
// Setup Fake Parameters -----------------------------
std::vector fakekeys = Config::QueryKeys("fakeparameter");
if (!fakekeys.empty()) {
- LOG(FIT) << "Number of fake parameters : " << fakekeys.size() << std::endl;
+ NUIS_LOG(FIT,"Number of fake parameters : " << fakekeys.size());
}
for (size_t i = 0; i < fakekeys.size(); i++) {
nuiskey key = fakekeys.at(i);
// Check for type,name,nom
if (!key.Has("name")) {
- ERR(FTL) << "No name given for fakeparameter " << i << std::endl;
+ NUIS_ERR(FTL, "No name given for fakeparameter " << i);
throw;
} else if (!key.Has("nominal")) {
- ERR(FTL) << "No nominal given for fakeparameter " << i << std::endl;
+ NUIS_ERR(FTL, "No nominal given for fakeparameter " << i);
throw;
}
// Get Inputs
std::string parname = key.GetS("name");
- double parnom = key.GetD("nominal");
+ double parnom = key.GetD("nominal");
// Push into vectors
fFakeVals[parname] = parnom;
}
}
//*************************************
void SetupRWEngine() {
//*************************************
- LOG(FIT) << "Setting up FitWeight Engine" << std::endl;
+ NUIS_LOG(FIT,"Setting up FitWeight Engine");
for (UInt_t i = 0; i < fParams.size(); i++) {
std::string name = fParams[i];
FitBase::GetRW()->IncludeDial(name, fTypeVals.at(name));
}
for (UInt_t i = 0; i < fParams.size(); i++) {
std::string name = fParams[i];
- if (fCurVals.find(name) == fCurVals.end()) continue;
+ if (fCurVals.find(name) == fCurVals.end())
+ continue;
FitBase::GetRW()->SetDialValue(name, fCurVals.at(name));
}
FitBase::GetRW()->Reconfigure();
return;
-
}
diff --git a/app/nuismin.cxx b/app/nuismin.cxx
index afe4224..7b965d5 100644
--- a/app/nuismin.cxx
+++ b/app/nuismin.cxx
@@ -1,113 +1,141 @@
// 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 .
-*******************************************************************************/
-
-// Author: Callum Wilkinson 01/2014
+ * 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 .
+ *******************************************************************************/
+
+// Author: Callum Wilkinson 01/2014
// Patrick Stowell 09/2015
/**
- Usage: ./GSLminimizerWithReWeight.exe -c card file, where samples and parameters are defined
- -o output file, where the results of the fit are stored
- where:
+ Usage: ./GSLminimizerWithReWeight.exe -c card file, where samples and
+ parameters are defined -o output file, where the results of the fit are stored
+ where:
*/
#include "MinimizerRoutines.h"
//*******************************
-void printInputCommands(){
-//*******************************
-
- std::cout<<"ExtFit_minimizer.exe -c cardFile -o outFile [-f fitStategy] [-d fakeDataFile] [-i inputFile] [-q config_name=config_val] \n";
- std::cout<SaveNominal();
- if (FitPar::Config().GetParB("saveprefit")) min->SavePrefit();
+ if (FitPar::Config().GetParB("savenominal"))
+ min->SaveNominal();
+ if (FitPar::Config().GetParB("saveprefit"))
+ min->SavePrefit();
// Run the fit routines
min->Run();
// Save by default
min->SaveResults();
// Get Status
status = min->GetStatus();
-
+
// Show Final Status
- LOG(FIT)<<"-------------------------------------"<.
-*******************************************************************************/
+ * 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 .
+ *******************************************************************************/
#include "ComparisonRoutines.h"
#include "InputUtils.h"
#include "Smearceptance_Tester.h"
// Global Arguments
std::string gOptInputFile = "";
std::string gOptOutputFile = "";
std::string gOptType = "DEFAULT";
std::string gOptNumberEvents = "NULL";
std::string gOptCardInput = "";
std::string gOptOptions = "";
//*******************************
void PrintSyntax() {
//*******************************
std::cout << "nuisflat -i input [-o outfile] [-n nevents] [-t "
"options] [-q con=val] \n";
std::cout
<< "\n Arguments : "
<< "\n\t -i input : Path to input vector of events to flatten"
<< "\n\t"
<< "\n\t This should be given in the same format a normal "
"input file"
<< "\n\t is given to NUISANCE. {e.g. NUWRO:eventsout.root}."
<< "\n\t"
<< "\n\t[-c crd.xml]: Input card file to override configs or define "
"smearcepters."
<< "\n\t "
<< "\n\t[-o outfile]: Optional output file path. "
<< "\n\t "
<< "\n\t If none given, input.smear.root is chosen."
<< "\n\t"
<< "\n\t[-n nevents]: Optional choice of Nevents to run over. Default is "
"all."
<< "\n\t"
<< "\n\t[-t options]: Pass OPTION to the smearception sample. "
<< "\n\t Similar to type field in comparison xml configs."
<< "\n\t"
<< "\n\t[-q con=val]: Configuration overrides." << std::endl;
exit(-1);
};
//____________________________________________________________________________
-void GetCommandLineArgs(int argc, char** argv) {
+void GetCommandLineArgs(int argc, char **argv) {
// Check for -h flag.
for (int i = 0; i < argc; i++) {
if ((!std::string(argv[i]).compare("-h")) ||
(!std::string(argv[i]).compare("-?")) ||
(!std::string(argv[i]).compare("--help")))
PrintSyntax();
}
// Format is nuwro -r run_number -n n events
std::vector args = GeneralUtils::LoadCharToVectStr(argc, argv);
// Parse input file
ParserUtils::ParseArgument(args, "-i", gOptInputFile, false);
if (gOptInputFile == "") {
- THROW("Need to provide a valid input file to nuisflat using -i flag!");
+ NUIS_ABORT("Need to provide a valid input file to nuisflat using -i flag!");
} else {
- LOG(FIT) << "Reading Input File = " << gOptInputFile << std::endl;
+ NUIS_LOG(FIT, "Reading Input File = " << gOptInputFile);
gOptInputFile = InputUtils::PrependGuessedInputTypeToName(gOptInputFile);
}
// Get Output File
ParserUtils::ParseArgument(args, "-o", gOptOutputFile, false);
if (gOptOutputFile == "") {
gOptOutputFile = gOptInputFile + ".smear.root";
- LOG(FIT) << "No output file given so saving nuisflat output to:"
- << gOptOutputFile << std::endl;
+ NUIS_LOG(FIT, "No output file given so saving nuisflat output to:"
+ << gOptOutputFile);
} else {
- LOG(FIT) << "Saving nuisflat output to " << gOptOutputFile << std::endl;
+ NUIS_LOG(FIT, "Saving nuisflat output to " << gOptOutputFile);
}
// Get N Events and Configs
nuisconfig configuration = Config::Get();
ParserUtils::ParseArgument(args, "-n", gOptNumberEvents, false);
if (gOptNumberEvents.compare("NULL")) {
configuration.OverrideConfig("MAXEVENTS=" + gOptNumberEvents);
}
std::vector configargs;
ParserUtils::ParseArgument(args, "-q", configargs);
for (size_t i = 0; i < configargs.size(); i++) {
configuration.OverrideConfig(configargs[i]);
}
ParserUtils::ParseArgument(args, "-c", gOptCardInput, false);
if (gOptCardInput != "") {
- QLOG(FIT, "Reading cardfile: " << gOptCardInput);
+ NUIS_LOG(FIT, "Reading cardfile: " << gOptCardInput);
configuration.LoadSettings(gOptCardInput, "");
}
ParserUtils::ParseArgument(args, "-t", gOptOptions, false);
if (gOptOptions != "") {
- QLOG(FIT, "Read options: \"" << gOptOptions << "\'");
+ NUIS_LOG(FIT, "Read options: \"" << gOptOptions << "\'");
}
return;
}
void SetupRW() {
std::vector parkeys = Config::QueryKeys("parameter");
if (!parkeys.empty()) {
- LOG(FIT) << "Number of parameters : " << parkeys.size() << std::endl;
+ NUIS_LOG(FIT, "Number of parameters : " << parkeys.size());
}
std::vector Params;
std::map TypeVals;
std::map CurrVals;
for (size_t i = 0; i < parkeys.size(); i++) {
nuiskey key = parkeys.at(i);
// Check for type,name,nom
if (!key.Has("type")) {
- ERR(FTL) << "No type given for parameter " << i << std::endl;
- ERR(FTL) << "type='PARAMETER_TYPE'" << std::endl;
- throw;
+ NUIS_ERR(FTL, "No type given for parameter " << i);
+ NUIS_ABORT("type='PARAMETER_TYPE'");
} else if (!key.Has("name")) {
- ERR(FTL) << "No name given for parameter " << i << std::endl;
- ERR(FTL) << "name='SAMPLE_NAME'" << std::endl;
- throw;
+ NUIS_ERR(FTL, "No name given for parameter " << i);
+ NUIS_ABORT("name='SAMPLE_NAME'");
} else if (!key.Has("nominal")) {
- ERR(FTL) << "No nominal given for parameter " << i << std::endl;
- ERR(FTL) << "nominal='NOMINAL_VALUE'" << std::endl;
- throw;
+ NUIS_ERR(FTL, "No nominal given for parameter " << i);
+ NUIS_ABORT("nominal='NOMINAL_VALUE'");
}
// Get Inputs
std::string partype = key.GetS("type");
std::string parname = key.GetS("name");
double parnom = key.GetD("nominal");
// Push into vectors
Params.push_back(parname);
TypeVals[parname] = FitBase::ConvDialType(partype);
CurrVals[parname] = parnom;
}
for (UInt_t i = 0; i < Params.size(); i++) {
FitBase::GetRW()->IncludeDial(Params[i], TypeVals[Params[i]]);
FitBase::GetRW()->SetDialValue(Params[i], CurrVals[Params[i]]);
}
FitBase::GetRW()->Reconfigure();
}
//*******************************
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
//*******************************
// Parse
GetCommandLineArgs(argc, argv);
// Make output file
- TFile* f = new TFile(gOptOutputFile.c_str(), "RECREATE");
+ TFile *f = new TFile(gOptOutputFile.c_str(), "RECREATE");
if (f->IsZombie()) {
- THROW("Cannot create output file!");
+ NUIS_ABORT("Cannot create output file!");
}
f->cd();
Config::Get().out = f;
// Create a new measurementbase class depending on the Format
- MeasurementBase* flattreecreator = NULL;
+ MeasurementBase *flattreecreator = NULL;
// Make a new sample key for the format of interest.
nuiskey samplekey = Config::CreateKey("sample");
samplekey.Set("name", "FlatTree");
samplekey.Set("smearceptor", gOptOptions);
samplekey.Set("input", gOptInputFile);
samplekey.Set("type", gOptType);
if (gOptOptions == "") {
- THROW(
- "Attempting to flatten with Smearceptor, but no Smearceptor given. "
- "Please supply a -t option.");
+ NUIS_ABORT("Attempting to flatten with Smearceptor, but no Smearceptor given. "
+ "Please supply a -t option.");
}
if (gOptCardInput == "") {
- THROW(
- "Attempting to flatten with Smearceptor, but no card passed with "
- "Smearceptors configured. Please supply a -c option.");
+ NUIS_ABORT("Attempting to flatten with Smearceptor, but no card passed with "
+ "Smearceptors configured. Please supply a -c option.");
}
SetupRW();
flattreecreator = new Smearceptance_Tester(samplekey);
// Make the FlatTree reconfigure
flattreecreator->Reconfigure();
f->cd();
flattreecreator->Write();
f->Close();
// Show Final Status
- LOG(FIT) << "-------------------------------------" << std::endl;
- LOG(FIT) << "Flattree Generation Complete." << std::endl;
- LOG(FIT) << "-------------------------------------" << std::endl;
+ NUIS_LOG(FIT, "-------------------------------------");
+ NUIS_LOG(FIT, "Flattree Generation Complete.");
+ NUIS_LOG(FIT, "-------------------------------------");
return 0;
}
diff --git a/app/nuissplines.cxx b/app/nuissplines.cxx
index 90f8876..2ab79eb 100644
--- a/app/nuissplines.cxx
+++ b/app/nuissplines.cxx
@@ -1,97 +1,105 @@
// 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 .
-*******************************************************************************/
+ * 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 .
+ *******************************************************************************/
-// Author: Callum Wilkinson 01/2014
+// Author: Callum Wilkinson 01/2014
// Patrick Stowell 09/2015
/**
- Usage: ./GSLminimizerWithReWeight.exe -c card file, where samples and parameters are defined
- -o output file, where the results of the fit are stored
- where:
+ Usage: ./GSLminimizerWithReWeight.exe -c card file, where samples and
+ parameters are defined -o output file, where the results of the fit are stored
+ where:
*/
#include "SplineRoutines.h"
//*******************************
void printInputCommands(){
-//*******************************
- /*
- std::cout<<"ExtFit_splines.exe -c cardFile -f [spline_routines] [-q config_name=config_val] \n";
- std::cout<Run();
// Show Final Status
- LOG(FIT)<<"-------------------------------------"<.
-*******************************************************************************/
+ * 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 .
+ *******************************************************************************/
// Author: Patrick Stowell 09/2016
/*
- Usage: ./nuissyst -c card file -o output file, where the results of the throws are stored
- where:
+ Usage: ./nuissyst -c card file -o output file, where the results of the throws
+ are stored where:
*/
#include "SystematicRoutines.h"
//*******************************
-void printInputCommands(){
-//*******************************
-
- std::cout<<"nuissyst.exe -c cardFile -o outFile [-f fitStategy] [-d fakeDataFile] [-i inputFile] [-q config_name=config_val] \n";
- std::cout<Run();
-
-
+
// Show Final Status
- LOG(FIT)<<"-------------------------------------"< gOptEnergyRange;
int gOptNumberEvents = -1;
int gOptNumberTestEvents = 5E6;
std::string gOptGeneratorList = "Default";
std::string gOptCrossSections =
- "Default"; // If default this will look in
- // $NUISANCE/data/nuwro/default_params.txt
+ "Default"; // If default this will look in
+ // $NUISANCE/data/nuwro/default_params.txt
int gOptSeed = time(NULL);
std::string gOptTargetDef = "";
std::string gOptFluxDef = "";
std::string gOptOutputFile = "";
int gOptRunNumber = -1;
-void GetCommandLineArgs(int argc, char** argv);
+void GetCommandLineArgs(int argc, char **argv);
void PrintSyntax(void);
std::string GetDynamicModes(std::string list) {
- LOG(FIT) << "Using " << list << " to define interaction modes." << std::endl;
+ NUIS_LOG(FIT, "Using " << list << " to define interaction modes.");
std::map modes;
if (!list.compare("Default")) {
- modes["dyn_qel_cc"] = 1; // Quasi elastic charged current
- modes["dyn_qel_nc"] = 1; // Quasi elastic neutral current
- modes["dyn_res_cc"] = 1; // Resonant charged current
- modes["dyn_res_nc"] = 1; // Resonant neutral current
- modes["dyn_dis_cc"] = 1; // Deep inelastic charged current
- modes["dyn_dis_nc"] = 1; // Deep inelastic neutral current
- modes["dyn_coh_cc"] = 1; // Coherent charged current
- modes["dyn_coh_nc"] = 1; // Coherent neutral current
- modes["dyn_mec_cc"] = 0; // Meson exchange charged current
- modes["dyn_mec_nc"] = 0; // Meson exchange neutral current
+ modes["dyn_qel_cc"] = 1; // Quasi elastic charged current
+ modes["dyn_qel_nc"] = 1; // Quasi elastic neutral current
+ modes["dyn_res_cc"] = 1; // Resonant charged current
+ modes["dyn_res_nc"] = 1; // Resonant neutral current
+ modes["dyn_dis_cc"] = 1; // Deep inelastic charged current
+ modes["dyn_dis_nc"] = 1; // Deep inelastic neutral current
+ modes["dyn_coh_cc"] = 1; // Coherent charged current
+ modes["dyn_coh_nc"] = 1; // Coherent neutral current
+ modes["dyn_mec_cc"] = 0; // Meson exchange charged current
+ modes["dyn_mec_nc"] = 0; // Meson exchange neutral current
} else if (!list.compare("DefaultFree")) {
- modes["dyn_qel_cc"] = 1; // Quasi elastic charged current
- modes["dyn_qel_nc"] = 1; // Quasi elastic neutral current
- modes["dyn_res_cc"] = 1; // Resonant charged current
- modes["dyn_res_nc"] = 1; // Resonant neutral current
- modes["dyn_dis_cc"] = 1; // Deep inelastic charged current
- modes["dyn_dis_nc"] = 1; // Deep inelastic neutral current
- modes["dyn_coh_cc"] = 0; // Coherent charged current
- modes["dyn_coh_nc"] = 0; // Coherent neutral current
- modes["dyn_mec_cc"] = 0; // Meson exchange charged current
- modes["dyn_mec_nc"] = 0; // Meson exchange neutral current
+ modes["dyn_qel_cc"] = 1; // Quasi elastic charged current
+ modes["dyn_qel_nc"] = 1; // Quasi elastic neutral current
+ modes["dyn_res_cc"] = 1; // Resonant charged current
+ modes["dyn_res_nc"] = 1; // Resonant neutral current
+ modes["dyn_dis_cc"] = 1; // Deep inelastic charged current
+ modes["dyn_dis_nc"] = 1; // Deep inelastic neutral current
+ modes["dyn_coh_cc"] = 0; // Coherent charged current
+ modes["dyn_coh_nc"] = 0; // Coherent neutral current
+ modes["dyn_mec_cc"] = 0; // Meson exchange charged current
+ modes["dyn_mec_nc"] = 0; // Meson exchange neutral current
} else if (!list.compare("Default+MEC")) {
- modes["dyn_qel_cc"] = 1; // Quasi elastic charged current
- modes["dyn_qel_nc"] = 1; // Quasi elastic neutral current
- modes["dyn_res_cc"] = 1; // Resonant charged current
- modes["dyn_res_nc"] = 1; // Resonant neutral current
- modes["dyn_dis_cc"] = 1; // Deep inelastic charged current
- modes["dyn_dis_nc"] = 1; // Deep inelastic neutral current
- modes["dyn_coh_cc"] = 1; // Coherent charged current
- modes["dyn_coh_nc"] = 1; // Coherent neutral current
- modes["dyn_mec_cc"] = 1; // Meson exchange charged current
- modes["dyn_mec_nc"] = 1; // Meson exchange neutral current
+ modes["dyn_qel_cc"] = 1; // Quasi elastic charged current
+ modes["dyn_qel_nc"] = 1; // Quasi elastic neutral current
+ modes["dyn_res_cc"] = 1; // Resonant charged current
+ modes["dyn_res_nc"] = 1; // Resonant neutral current
+ modes["dyn_dis_cc"] = 1; // Deep inelastic charged current
+ modes["dyn_dis_nc"] = 1; // Deep inelastic neutral current
+ modes["dyn_coh_cc"] = 1; // Coherent charged current
+ modes["dyn_coh_nc"] = 1; // Coherent neutral current
+ modes["dyn_mec_cc"] = 1; // Meson exchange charged current
+ modes["dyn_mec_nc"] = 1; // Meson exchange neutral current
} else {
- THROW("Event generator list " << list << " not found!");
+ NUIS_ABORT("Event generator list " << list << " not found!");
}
std::string modestring = "";
for (std::map::iterator iter = modes.begin();
iter != modes.end(); iter++) {
std::cout << " -> " << iter->first << " : " << iter->second << std::endl;
modestring += " -p \"" + iter->first + "=" +
GeneralUtils::IntToStr(iter->second) + "\"";
}
return modestring;
}
std::string GetFluxDefinition(std::string flux, std::string out) {
- LOG(FIT) << "Using " << flux << " to define NuWro beam." << std::endl;
+ NUIS_LOG(FIT, "Using " << flux << " to define NuWro beam.");
// By default the flux is type 6 with a root file
std::vector fluxargs = GeneralUtils::ParseToStr(flux, ",");
if (fluxargs.size() < 2) {
- THROW(
- "Expected flux in the format: file.root,hist_name1[pdg1],... : "
- "reveived : "
- << flux);
+ NUIS_ABORT("Expected flux in the format: file.root,hist_name1[pdg1],... : "
+ "reveived : "
+ << flux);
}
// Build Map
std::map fluxmap;
fluxmap["beam_type"] = "6";
fluxmap["beam_inputroot"] = fluxargs[0];
fluxmap["beam_inputroot_nue"] = "";
fluxmap["beam_inputroot_nueb"] = "";
fluxmap["beam_inputroot_numu"] = "";
fluxmap["beam_inputroot_numub"] = "";
fluxmap["beam_inputroot_nutau"] = "";
fluxmap["beam_inputroot_nutaub"] = "";
// Split by beam bdgs
for (int i = 1; i < fluxargs.size(); i++) {
std::string histdef = fluxargs[i];
string::size_type open_bracket = histdef.find("[");
string::size_type close_bracket = histdef.find("]");
string::size_type ibeg = 0;
string::size_type iend = open_bracket;
string::size_type jbeg = open_bracket + 1;
string::size_type jend = close_bracket - 1;
std::string name = std::string(histdef.substr(ibeg, iend).c_str());
int pdg = atoi(histdef.substr(jbeg, jend).c_str());
if (pdg == 12)
fluxmap["beam_inputroot_nue"] = name;
else if (pdg == -12)
fluxmap["beam_inputroot_nueb"] = name;
else if (pdg == 14)
fluxmap["beam_inputroot_numu"] = name;
else if (pdg == -14)
fluxmap["beam_inputroot_numub"] = name;
else if (pdg == 16)
fluxmap["beam_inputroot_nutau"] = name;
else if (pdg == -16)
fluxmap["beam_inputroot_nutaub"] = name;
}
// Now create a new flux file matching the output file
std::cout << " -> Moving flux from '" + fluxmap["beam_inputroot"] +
"' to current directory to keep everything organised."
<< std::endl;
- TFile* fluxread = new TFile(fluxmap["beam_inputroot"].c_str(), "READ");
- TFile* fluxwrite = new TFile((out + ".flux.root").c_str(), "RECREATE");
+ TFile *fluxread = new TFile(fluxmap["beam_inputroot"].c_str(), "READ");
+ TFile *fluxwrite = new TFile((out + ".flux.root").c_str(), "RECREATE");
for (std::map::iterator iter = fluxmap.begin();
iter != fluxmap.end(); iter++) {
- TH1* temp = (TH1*)fluxread->Get(iter->second.c_str());
- if (!temp) continue;
- TH1D* cuthist = (TH1D*)temp->Clone();
+ TH1 *temp = (TH1 *)fluxread->Get(iter->second.c_str());
+ if (!temp)
+ continue;
+ TH1D *cuthist = (TH1D *)temp->Clone();
// Restrict energy range if required
if (gOptEnergyRange.size() == 2) {
for (int i = 0; i < cuthist->GetNbinsX(); i++) {
if (cuthist->GetXaxis()->GetBinCenter(i + 1) < gOptEnergyRange[0] or
cuthist->GetXaxis()->GetBinCenter(i + 1) > gOptEnergyRange[1]) {
cuthist->SetBinContent(i + 1, 0.0);
}
}
}
// Check Flux
if (cuthist->Integral() <= 0.0) {
- THROW("Flux histogram " << iter->second << " has integral <= 0.0");
+ NUIS_ABORT("Flux histogram " << iter->second << " has integral <= 0.0");
}
// Save
fluxwrite->cd();
cuthist->Write();
}
std::cout << " ->-> Saved to : " << (out + ".flux.root") << std::endl;
fluxmap["beam_inputroot"] = (out + ".flux.root");
fluxwrite->Close();
// Return a parameters string
std::string fluxstring = "";
for (std::map::iterator iter = fluxmap.begin();
iter != fluxmap.end(); iter++) {
std::cout << " -> " << iter->first << " : " << iter->second << std::endl;
fluxstring += " -p \"" + iter->first + "=" + iter->second + "\"";
}
return fluxstring;
}
std::string GetTargetDefinition(std::string target) {
- LOG(FIT) << "Defining NuWro Target from : " << target << std::endl;
+ NUIS_LOG(FIT, "Defining NuWro Target from : " << target);
// Target is given as either a single PDG, or a combo with the total number of
// nucleons
std::vector trgts = GeneralUtils::ParseToStr(target, ",");
std::string targetstring = "";
// Single Target
if (trgts.size() == 1) {
int PDG = GeneralUtils::StrToInt(trgts[0]);
int Z = TargetUtils::GetTargetZFromPDG(PDG);
int N = TargetUtils::GetTargetAFromPDG(PDG) - Z;
int TOTAL = 1;
targetstring += (" -p \"target_content=" + GeneralUtils::IntToStr(Z) + " " +
GeneralUtils::IntToStr(N) + " " +
GeneralUtils::IntToStr(TOTAL) + "x" + "\"");
// Combined target
} else if (trgts.size() > 1) {
int NUCLEONS = GeneralUtils::StrToInt(trgts[0]);
// Loop over all targets
for (size_t i = 1; i < trgts.size(); i++) {
// Extra PDG and W
std::string tgtdef = trgts[i];
string::size_type open_bracket = tgtdef.find("[");
string::size_type close_bracket = tgtdef.find("]");
string::size_type ibeg = 0;
string::size_type iend = open_bracket;
string::size_type jbeg = open_bracket + 1;
string::size_type jend = close_bracket - 1;
int PDG = atoi(tgtdef.substr(ibeg, iend).c_str());
double W = atof(tgtdef.substr(jbeg, jend).c_str());
// extract Z N
int Z = TargetUtils::GetTargetZFromPDG(PDG);
int A = TargetUtils::GetTargetAFromPDG(PDG);
int N = TargetUtils::GetTargetAFromPDG(PDG) - Z;
std::cout << "Target " << PDG << " Z" << Z << " N" << N << std::endl;
// extract weight
int TOTAL = round(double(NUCLEONS) * W / A);
if (i == 1) {
targetstring += (" -p \"target_content=" + GeneralUtils::IntToStr(Z) +
" " + GeneralUtils::IntToStr(N) + " " +
GeneralUtils::IntToStr(TOTAL) + "x" + "\"");
} else {
targetstring += (" -p \"target_content+=" + GeneralUtils::IntToStr(Z) +
" " + GeneralUtils::IntToStr(N) + " " +
GeneralUtils::IntToStr(TOTAL) + "x" + "\"");
}
}
// No target given!
} else {
- THROW("No target given : " << target);
+ NUIS_ABORT("No target given : " << target);
}
std::cout << " -> " << targetstring << std::endl;
return targetstring;
}
std::string GetEventAndSeedDefinition(int nevents, int ntestevents, int seed) {
std::string eventdef = "";
eventdef +=
" -p \"number_of_events=" + GeneralUtils::IntToStr(nevents) + "\"";
- eventdef += " -p \"number_of_test_events=" +
- GeneralUtils::IntToStr(ntestevents) + "\"";
+ eventdef +=
+ " -p \"number_of_test_events=" + GeneralUtils::IntToStr(ntestevents) +
+ "\"";
eventdef += " -p \"random_seed=" + GeneralUtils::IntToStr(seed) + "\"";
- LOG(FIT) << "Event Definition: " << std::endl;
- std::cout << " -> number_of_events : " << nevents << std::endl;
- std::cout << " -> number_of_test_events : " << ntestevents << std::endl;
- std::cout << " -> seed : " << seed << std::endl;
+ NUIS_LOG(FIT, "Event Definition: ");
+ NUIS_LOG(FIT, " -> number_of_events : " << nevents);
+ NUIS_LOG(FIT, " -> number_of_test_events : " << ntestevents);
+ NUIS_LOG(FIT, " -> seed : " << seed);
return eventdef;
}
//____________________________________________________________________________
-int main(int argc, char** argv) {
- LOG(FIT) << "==== RUNNING nuwro_nuisance Event Generator =====" << std::endl;
+int main(int argc, char **argv) {
+ NUIS_LOG(FIT, "==== RUNNING nuwro_nuisance Event Generator =====");
GetCommandLineArgs(argc, argv);
// Calculate the dynamic modes definition
std::string dynparamsdef = GetDynamicModes(gOptGeneratorList);
// Get Flux and Target definition
std::string fluxparamsdef = GetFluxDefinition(gOptFluxDef, gOptOutputFile);
std::string targetparamsdef = GetTargetDefinition(gOptTargetDef);
// Get Run Definition
std::string eventparamsdef = GetEventAndSeedDefinition(
gOptNumberEvents, gOptNumberTestEvents, gOptSeed);
// Run NuWro Externally!
- LOG(FIT) << "==== Actually running nuwro! ===" << std::endl;
+ NUIS_LOG(FIT, "==== Actually running nuwro! ===");
std::string nuwrocommand = "nuwro";
nuwrocommand += " -i " + gOptCrossSections;
nuwrocommand += " -o " + gOptOutputFile;
nuwrocommand += " " + fluxparamsdef;
nuwrocommand += " " + dynparamsdef;
nuwrocommand += " " + eventparamsdef;
nuwrocommand += " " + targetparamsdef;
std::cout << nuwrocommand << std::endl;
sleep(10);
system((nuwrocommand).c_str());
return 0;
}
//____________________________________________________________________________
-void GetCommandLineArgs(int argc, char** argv) {
+void GetCommandLineArgs(int argc, char **argv) {
// Check for -h flag.
for (int i = 0; i < argc; i++) {
- if (!std::string(argv[i]).compare("-h")) PrintSyntax();
+ if (!std::string(argv[i]).compare("-h"))
+ PrintSyntax();
}
// Format is nuwro -r run_number -n n events
std::vector args = GeneralUtils::LoadCharToVectStr(argc, argv);
ParserUtils::ParseArgument(args, "-n", gOptNumberEvents, false);
if (gOptNumberEvents == -1) {
- THROW("No event count passed to nuwro_NUISANCE!");
+ NUIS_ABORT("No event count passed to nuwro_NUISANCE!");
}
// Flux/Energy Specs
ParserUtils::ParseArgument(args, "-e", gOptEnergyDef, false);
gOptEnergyRange = GeneralUtils::ParseToDbl(gOptEnergyDef, ",");
ParserUtils::ParseArgument(args, "-f", gOptFluxDef, false);
if (gOptFluxDef.empty() and gOptEnergyRange.size() < 1) {
- THROW("No flux or energy range given to nuwro_nuisance!");
+ NUIS_ABORT("No flux or energy range given to nuwro_nuisance!");
} else if (gOptFluxDef.empty() and gOptEnergyRange.size() == 1) {
// Fixed energy, make sure -p is given
- THROW("nuwro_NUISANCE cannot yet do fixed energy!");
+ NUIS_ABORT("nuwro_NUISANCE cannot yet do fixed energy!");
} else if (gOptFluxDef.empty() and gOptEnergyRange.size() == 2) {
// Uniform energy range
- THROW("nuwro_NUISANCE cannot yet do a uniform energy range!");
+ NUIS_ABORT("nuwro_NUISANCE cannot yet do a uniform energy range!");
} else if (!gOptFluxDef.empty()) {
// Try to convert the flux definition if possible.
std::string convflux = BeamUtils::ConvertFluxIDs(gOptFluxDef);
- if (!convflux.empty()) gOptFluxDef = convflux;
+ if (!convflux.empty())
+ gOptFluxDef = convflux;
} else {
- THROW("Unknown flux energy range combination!");
+ NUIS_ABORT("Unknown flux energy range combination!");
}
ParserUtils::ParseArgument(args, "-t", gOptTargetDef, false);
if (gOptTargetDef.empty()) {
- THROW("No Target passed to nuwro_nuisance! use the '-t' argument.");
+ NUIS_ABORT("No Target passed to nuwro_nuisance! use the '-t' argument.");
} else {
std::string convtarget = TargetUtils::ConvertTargetIDs(gOptTargetDef);
- if (!convtarget.empty()) gOptTargetDef = convtarget;
+ if (!convtarget.empty())
+ gOptTargetDef = convtarget;
}
ParserUtils::ParseArgument(args, "-r", gOptRunNumber, false);
ParserUtils::ParseArgument(args, "-o", gOptOutputFile, false);
if (gOptOutputFile.empty()) {
- if (gOptRunNumber == -1) gOptRunNumber = 1;
- LOG(FIT) << "No output file given! Saving file to : nuwrogen."
- << gOptRunNumber << ".event.root" << std::endl;
+ if (gOptRunNumber == -1)
+ gOptRunNumber = 1;
+ NUIS_LOG(FIT, "No output file given! Saving file to : nuwrogen."
+ << gOptRunNumber << ".event.root");
gOptOutputFile =
"nuwrogen." + GeneralUtils::IntToStr(gOptRunNumber) + ".event.root";
} else {
// if no run number given leave as is, else add run number.
if (gOptRunNumber != -1) {
gOptOutputFile += "." + GeneralUtils::IntToStr(gOptRunNumber) + ".root";
} else {
gOptRunNumber = 0;
}
}
ParserUtils::ParseArgument(args, "--cross-section", gOptCrossSections, false);
if (!gOptCrossSections.compare("Default")) {
- LOG(FIT) << "No Parameters File passed. Using default NuWro one."
- << std::endl;
- char* const var = getenv("NUISANCE");
+ NUIS_LOG(FIT, "No Parameters File passed. Using default NuWro one.");
+ char *const var = getenv("NUISANCE");
if (!var) {
std::cout << "Cannot find top level directory! Set the NUISANCE "
"environmental variable"
<< std::endl;
exit(-1);
}
std::string topnuisancedir = string(var);
gOptCrossSections = topnuisancedir + "/nuwro/Default_params.txt";
}
ParserUtils::ParseArgument(args, "--event-generator-list", gOptGeneratorList,
false);
ParserUtils::ParseArgument(args, "--seed", gOptSeed, false);
ParserUtils::ParseArgument(args, "--test-events", gOptNumberTestEvents,
false);
// Final Check and output
if (args.size() > 0) {
PrintSyntax();
ParserUtils::CheckBadArguments(args);
}
- LOG(FIT) << "Generating NuWro Events with the following properties:"
- << std::endl
- << " -> Energy : " << gOptEnergyDef << " ("
- << gOptEnergyRange.size() << ")" << std::endl
- << " -> NEvents : " << gOptNumberEvents << std::endl
- << " -> NTestEvents : " << gOptNumberTestEvents << std::endl
- << " -> Generators : " << gOptGeneratorList << std::endl
- << " -> XSecPars : " << gOptCrossSections << std::endl
- << " -> Seed : " << gOptSeed << std::endl
- << " -> Target : " << gOptTargetDef << std::endl
- << " -> Flux : " << gOptFluxDef << std::endl
- << " -> Output : " << gOptOutputFile << std::endl
- << " -> Run : " << gOptRunNumber << std::endl;
+ NUIS_LOG(FIT, "Generating NuWro Events with the following properties:"
+ << std::endl
+ << " -> Energy : " << gOptEnergyDef << " ("
+ << gOptEnergyRange.size() << ")" << std::endl
+ << " -> NEvents : " << gOptNumberEvents << std::endl
+ << " -> NTestEvents : " << gOptNumberTestEvents << std::endl
+ << " -> Generators : " << gOptGeneratorList << std::endl
+ << " -> XSecPars : " << gOptCrossSections << std::endl
+ << " -> Seed : " << gOptSeed << std::endl
+ << " -> Target : " << gOptTargetDef << std::endl
+ << " -> Flux : " << gOptFluxDef << std::endl
+ << " -> Output : " << gOptOutputFile << std::endl
+ << " -> Run : " << gOptRunNumber);
return;
}
//____________________________________________________________________________
void PrintSyntax(void) {
- LOG(FIT) << "\n\n"
- << "Syntax:"
- << "\n"
- << "\n nuwro_nuisance [-h]"
- << "\n -n nev"
- << "\n -f flux_description"
- << "\n -t target_description"
- << "\n [ -r run_number ]"
- << "\n [ -o output_file ]"
- << "\n [ --cross-section /path/to/params.txt ]"
- << "\n [ --event-generator-list mode_definition ]"
- << "\n [ --seed seed_value ]"
- << "\n [ --test-events ntest ]"
- << "\n \n";
-
- LOG(FIT)
- << "\n\n Arguments:"
- << "\n"
- << "\n -n nev"
- << "\n -> Total number of events to generate (e.g. 2500000)"
- << "\n"
- << "\n -f flux_description"
- << "\n Definition of the flux to be read in from a ROOT file."
- << "\n"
- << "\n Multiple histograms can be read in from the same file using"
- << "\n the format '-f file.root,hist1[pdg1],hist2[pdg2]"
- << "\n e.g. \'-f "
- "./flux/myfluxfile.root,numu_flux[14],numubar_flux[-14]\'"
- << "\n"
- << "\n When passing in multiple histograms, the nuwro_nuisance will"
- << "\n generate a single file containing both sets of events with the"
- << "\n correct ratios for each set."
- << "\n"
- << "\n A flux can also be given according to any of the flux IDs shown"
- << "\n at the end of this help message."
- << "\n e.g. \' -f MINERvA_fhc_numu\' "
- << "\n"
- << "\n -t target_description"
- << "\n Definition of the target to be used. Multiple targets can be "
- "given."
- << "\n"
- << "\n To pass a single target just provide the target PDG"
- << "\n e.g. \' -t 1000060120 \'"
- << "\n"
- << "\n To pass a combined target provide a list containing the "
- "following"
- << "\n \' -t TotalNucleons,Target1[Weight1],Target2[Weight2],.. where "
- "the "
- << "\n TotalNucleons is the total nucleons combined, Target1 is the "
- "PDG "
- << "\n of the first target, and Weight1 is the fractional weight of "
- "the "
- << "\n first target."
- << "\n e.g. \' -t 13,1000060120[0.9231],1000010010[0.0769] \'"
- << "\n"
- << "\n Target can also be specified by the target IDs given at the "
- "end of"
- << "\n this help message."
- << "\n e.g. \' -t CH2 \'"
- << "\n"
- << "\n -r run_number"
- << "\n run number ID that can be used when generating large samples "
- "in small "
- << "\n jobs. Must be an integer. When given nuwro_nuisance will "
- "update the "
- << "\n output file from 'output.root' to 'output.root.run_number.root'"
- << "\n"
- << "\n -o output_file"
- << "\n Path to the output_file you want to save events to."
- << "\n"
- << "\n If this is not given but '-r' is then events will be saved to "
- << "\n the file 'nuwrogen.run_number.events.root'"
- << "\n"
- << "\n If a run number is given alongside '-o' then events will be "
- "saved "
- << "\n to 'output.root.run_number.root'"
- << "\n"
- << "\n --cross-section /path/to/params.txt"
- << "\n Path to the nuwro model definition. If this is not given, then "
- "this "
- << "\n will default to $NUISANCE/data/nuwro/Default_params.txt"
- << "\n"
- << "\n Look in $NUISANCE/data/nuwro/Default_params.txt for examples "
- "when "
- << "\n writing your own card files."
- << "\n"
- << "\n --event-generator-list mode_definition"
- << "\n Name of modes to run. This sets the dynamic mode settings in "
- "nuwro."
- << "\n e.g. --event-generator-list Default+MEC"
- << "\n"
- << "\n Allowed mode_definitions are given at the end of this help "
- "message."
- << "\n"
- << "\n --seed seed_value "
- << "\n Value to use as the seed. If seed isn't given, time(NULL) is "
- "used."
- << "\n"
- << "\n --test-events ntest "
- << "\n Sets the number of test events for Nuwro to use. If this "
- "option "
- << "\n isn't given then we assume 5E6 test events by default."
- << "\n\n";
+ NUIS_LOG(FIT, "\n\n"
+ << "Syntax:"
+ << "\n"
+ << "\n nuwro_nuisance [-h]"
+ << "\n -n nev"
+ << "\n -f flux_description"
+ << "\n -t target_description"
+ << "\n [ -r run_number ]"
+ << "\n [ -o output_file ]"
+ << "\n [ --cross-section /path/to/params.txt ]"
+ << "\n [ --event-generator-list mode_definition ]"
+ << "\n [ --seed seed_value ]"
+ << "\n [ --test-events ntest ]"
+ << "\n \n");
+
+ NUIS_LOG(
+ FIT,
+ "\n\n Arguments:"
+ << "\n"
+ << "\n -n nev"
+ << "\n -> Total number of events to generate (e.g. 2500000)"
+ << "\n"
+ << "\n -f flux_description"
+ << "\n Definition of the flux to be read in from a ROOT file."
+ << "\n"
+ << "\n Multiple histograms can be read in from the same file using"
+ << "\n the format '-f file.root,hist1[pdg1],hist2[pdg2]"
+ << "\n e.g. \'-f "
+ "./flux/myfluxfile.root,numu_flux[14],numubar_flux[-14]\'"
+ << "\n"
+ << "\n When passing in multiple histograms, the nuwro_nuisance "
+ "will"
+ << "\n generate a single file containing both sets of events with "
+ "the"
+ << "\n correct ratios for each set."
+ << "\n"
+ << "\n A flux can also be given according to any of the flux IDs "
+ "shown"
+ << "\n at the end of this help message."
+ << "\n e.g. \' -f MINERvA_fhc_numu\' "
+ << "\n"
+ << "\n -t target_description"
+ << "\n Definition of the target to be used. Multiple targets can "
+ "be "
+ "given."
+ << "\n"
+ << "\n To pass a single target just provide the target PDG"
+ << "\n e.g. \' -t 1000060120 \'"
+ << "\n"
+ << "\n To pass a combined target provide a list containing the "
+ "following"
+ << "\n \' -t TotalNucleons,Target1[Weight1],Target2[Weight2],.. "
+ "where "
+ "the "
+ << "\n TotalNucleons is the total nucleons combined, Target1 is "
+ "the "
+ "PDG "
+ << "\n of the first target, and Weight1 is the fractional weight "
+ "of "
+ "the "
+ << "\n first target."
+ << "\n e.g. \' -t 13,1000060120[0.9231],1000010010[0.0769] \'"
+ << "\n"
+ << "\n Target can also be specified by the target IDs given at "
+ "the "
+ "end of"
+ << "\n this help message."
+ << "\n e.g. \' -t CH2 \'"
+ << "\n"
+ << "\n -r run_number"
+ << "\n run number ID that can be used when generating large "
+ "samples "
+ "in small "
+ << "\n jobs. Must be an integer. When given nuwro_nuisance will "
+ "update the "
+ << "\n output file from 'output.root' to "
+ "'output.root.run_number.root'"
+ << "\n"
+ << "\n -o output_file"
+ << "\n Path to the output_file you want to save events to."
+ << "\n"
+ << "\n If this is not given but '-r' is then events will be saved "
+ "to "
+ << "\n the file 'nuwrogen.run_number.events.root'"
+ << "\n"
+ << "\n If a run number is given alongside '-o' then events will "
+ "be "
+ "saved "
+ << "\n to 'output.root.run_number.root'"
+ << "\n"
+ << "\n --cross-section /path/to/params.txt"
+ << "\n Path to the nuwro model definition. If this is not given, "
+ "then "
+ "this "
+ << "\n will default to $NUISANCE/data/nuwro/Default_params.txt"
+ << "\n"
+ << "\n Look in $NUISANCE/data/nuwro/Default_params.txt for "
+ "examples "
+ "when "
+ << "\n writing your own card files."
+ << "\n"
+ << "\n --event-generator-list mode_definition"
+ << "\n Name of modes to run. This sets the dynamic mode settings "
+ "in "
+ "nuwro."
+ << "\n e.g. --event-generator-list Default+MEC"
+ << "\n"
+ << "\n Allowed mode_definitions are given at the end of this help "
+ "message."
+ << "\n"
+ << "\n --seed seed_value "
+ << "\n Value to use as the seed. If seed isn't given, time(NULL) "
+ "is "
+ "used."
+ << "\n"
+ << "\n --test-events ntest "
+ << "\n Sets the number of test events for Nuwro to use. If this "
+ "option "
+ << "\n isn't given then we assume 5E6 test events by default."
+ << "\n\n");
std::cout << "-----------------" << std::endl;
TargetUtils::ListTargetIDs();
std::cout << "-----------------" << std::endl;
BeamUtils::ListFluxIDs();
std::cout << "-----------------" << std::endl;
- LOG(FIT) << "Allowed Mode Definitions:" << std::endl
- << " - Default : Default CC+NC modes, no MEC" << std::endl
- << " - Default+MEC : Default CC+NC modes + 2p2h MEC " << std::endl
- << " - DefaultFree : Default CC+NC modes, no Coherent or MEC "
- << std::endl;
- std::cout << "----------------" << std::endl;
+ NUIS_LOG(FIT, "Allowed Mode Definitions:"
+ << std::endl
+ << " - Default : Default CC+NC modes, no MEC" << std::endl
+ << " - Default+MEC : Default CC+NC modes + 2p2h MEC "
+ << std::endl
+ << " - DefaultFree : Default CC+NC modes, no Coherent or MEC "
+ << std::endl
+ << "----------------");
exit(0);
}
//____________________________________________________________________________
#endif
diff --git a/cmake/GENIESetup.cmake b/cmake/GENIESetup.cmake
index 77c4995..457eaa1 100644
--- a/cmake/GENIESetup.cmake
+++ b/cmake/GENIESetup.cmake
@@ -1,250 +1,251 @@
# 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 .
################################################################################
# TODO
# check system for libxml2
# check whether we need the includes
# check if we can use a subset of the GENIE libraries
include(${CMAKE_SOURCE_DIR}/cmake/parseConfigApp.cmake)
################################################################################
# Check Dependencies
################################################################################
################################# GENIE ######################################
if(GENIE STREQUAL "")
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 an environment variable"
" $ export GENIE=/path/to/GENIE")
endif()
if (BUILD_GEVGEN)
cmessage(STATUS "Building custom gevgen")
LIST(APPEND EXTRA_CXX_FLAGS -D__GEVGEN_ENABLED__)
endif()
-if(GENIE_EMPMEC_REWEIGHT)
- cmessage(STATUS "Enable EMPMEC dials")
- LIST(APPEND EXTRA_CXX_FLAGS -D__GENIE_EMP_MECRW_ENABLED)
-endif()
-
execute_process(COMMAND genie-config --version
OUTPUT_VARIABLE GENIE_VER OUTPUT_STRIP_TRAILING_WHITESPACE)
cmessage(STATUS "genie_ver: ${GENIE_VER}")
if(GENIE_VER VERSION_GREATER 3.0.0)
set(GENIE_POST_R3 1)
string(REPLACE "." "" GENIE_VERSION ${GENIE_VER})
cmessage(STATUS "set genie_post_r3")
endif()
if(NOT GENIE_POST_R3)
LIST(APPEND EXTRA_CXX_FLAGS -DGENIE_PRE_R3)
cmessage(STATUS "setting genie_pre_r3 ${EXTRA_CXX_FLAGS}")
+ if(GENIE_EMPMEC_REWEIGHT)
+ cmessage(STATUS "Enable EMPMEC dials")
+ LIST(APPEND EXTRA_CXX_FLAGS -D__GENIE_EMP_MECRW_ENABLED)
+ endif()
+else()
+ cmessage(STATUS "Enable EMPMEC dials")
+ LIST(APPEND EXTRA_CXX_FLAGS -D__GENIE_EMP_MECRW_ENABLED)
endif()
execute_process (COMMAND genie-config
--topsrcdir OUTPUT_VARIABLE GENIE_INCLUDES_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
#Allows for external override in the case where genie-config lies.
if(NOT DEFINED GENIE_LIB_DIR OR GENIE_LIB_DIR STREQUAL "")
#This looks like it should call libdir, but it strips the argument with -L from the response of --libs
GETLIBDIRS(genie-config --libs GENIE_LIB_DIR)
endif()
GETLIBS(genie-config --libs GENIE_LIBS)
cmessage(STATUS "GENIE version : ${GENIE_VERSION}")
cmessage(STATUS "GENIE libdir : ${GENIE_LIB_DIR}")
cmessage(STATUS "GENIE libs : ${GENIE_LIBS}")
string(REGEX MATCH "ReinSeghal" WASMATCHED ${GENIE_LIBS})
if(WASMATCHED AND GENIE_VERSION STREQUAL "210")
set(GENIE_SEHGAL ${GENIE_LIBS})
STRING(REPLACE "ReinSeghal" "ReinSehgal" GENIE_LIBS ${GENIE_SEHGAL})
cmessage(DEBUG "Fixed inconsistency in library naming: ${GENIE_LIBS}")
endif()
if(NOT USE_REWEIGHT)
SET(USING_GENIE_RW FALSE)
elseif(NOT GENIE_POST_R3)
LIST(FIND GENIE_LIBS GReWeight FOUND_GENIE_RW)
if(FOUND_GENIE_RW EQUAL -1)
cmessage(DEBUG "Did NOT find ReWeight library. Here are libs: ${GENIE_LIBS}")
SET(USING_GENIE_RW FALSE)
else()
SET(USING_GENIE_RW TRUE)
endif()
elseif(DEFINED GENIE_REWEIGHT AND NOT GENIE_REWEIGHT STREQUAL "")
LIST(FIND GENIE_LIBS GRwFwk FOUND_GENIE_RW)
if(FOUND_GENIE_RW EQUAL -1)
LIST(APPEND GENIE_LIBS GRwClc GRwFwk GRwIO)
cmessage(DEBUG "Force added ReWeight library. Here are libs: ${GENIE_LIBS}")
SET(USING_GENIE_RW TRUE)
else()
SET(USING_GENIE_RW FALSE)
endif()
endif()
if(USING_GENIE_RW)
cmessage(STATUS "Using GENIE ReWeight library.")
else()
cmessage(STATUS "Building without GENIE ReWeight support.")
- LIST(APPEND EXTRA_CXX_FLAGS -D__NO_GENIE_REWEIGHT__)
endif()
LIST(APPEND GENIE_LIBS -Wl,--end-group )
LIST(REVERSE GENIE_LIBS)
LIST(APPEND GENIE_LIBS -Wl,--start-group -Wl,--no-as-needed )
LIST(REVERSE GENIE_LIBS)
cmessage(DEBUG "GENIE_LIBS: ${GENIE_LIBS}")
################################ LHAPDF ######################################
if(LHAPDF_LIB STREQUAL "")
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 an environment variable $ export LHAPDF_LIB=/path/to/LHAPDF_libraries")
endif()
if(LHAPDF_INC STREQUAL "")
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 an environment variable $ export LHAPDF_INC=/path/to/LHAPDF_includes")
endif()
if(LHAPATH STREQUAL "")
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 an environment variable $ export LHAPATH=/path/to/LHAPATH")
endif()
################################ LIBXML ######################################
if(LIBXML2_LIB STREQUAL "")
GETLIBDIR(xml2-config --libs LIBXML2_LIB IGNORE_EMPTY_RESPONSE)
if(LIBXML2_LIB STREQUAL "")
- message(WARNING "Variable LIBXML2_LIB is not defined, as xml2-config was found and didn't report a library include path, it is likely that libxml2.so can be found in the standard system location, lets hope so.")
+ message(WARNING "Variable LIBXML2_LIB is not defined, as xml2-config was found and didn't report a library include path, it is likely that libxml2.so can be found in the standard system location, lets hope so. Alternativly, a location can be forced by configering with -DLIBXML2_LIB=/path/to/LIBXML2_libraries or as an environment variable LIBXML2_LIB.")
endif()
endif()
if(LIBXML2_INC STREQUAL "")
- GETINCDIR(xml2-config --cflags LIBXML2_INC)
+ GETINCDIR(xml2-config --cflags LIBXML2_INC IGNORE_EMPTY_RESPONSE)
if(LIBXML2_INC STREQUAL "")
- message(FATAL_ERROR "Variable LIBXML2_INC is not defined and could not be found with xml2-config. The location of a pre-built libxml2 install must be defined either as $ cmake -DLIBXML2_INC=/path/to/LIBXML2_includes or as an environment variable $ export LIBXML2_INC=/path/to/LIBXML2_includes")
+ message(WARNING "Variable LIBXML2_INC is not defined, as xml2-config was found and didn't report an include path, it is likely that libxml2.so can be found in the standard system location, lets hope so. Alternativly, a location can be forced by configering with -DLIBXML2_INC=/path/to/LIBXML2_includes or as an environment variable LIBXML2_INC.")
endif()
endif()
############################### log4cpp ######################################
if(LOG4CPP_LIB STREQUAL "")
- GETLIBDIR(log4cpp-config --libs LOG4CPP_LIB)
+ GETLIBDIR(log4cpp-config --libs LOG4CPP_LIB IGNORE_EMPTY_RESPONSE)
if(LOG4CPP_LIB STREQUAL "")
- message(FATAL_ERROR "Variable LOG4CPP_LIB is not defined and could not be found with log4cpp-config. The location of a pre-built log4cpp install must be defined either as $ cmake -DLOG4CPP_LIB=/path/to/LOG4CPP_libraries or as an environment variable $ export LOG4CPP_LIB=/path/to/LOG4CPP_libraries")
+ message(WARNING "Variable LOG4CPP_LIB is not defined, as xml2-config was found and didn't report a library include path, it is likely that liblog4cpp.so can be found in the standard system location, lets hope so. Alternativly, a location can be forced by configering with -DLOG4CPP_LIB=/path/to/LOG4CPP_libraries or as an environment variable LOG4CPP_LIB.")
endif()
endif()
if(LOG4CPP_INC STREQUAL "")
- GETINCDIR(log4cpp-config --cflags LOG4CPP_INC)
+ GETINCDIR(log4cpp-config --cflags LOG4CPP_INC IGNORE_EMPTY_RESPONSE)
if(LOG4CPP_INC STREQUAL "")
- message(FATAL_ERROR "Variable LOG4CPP_INC is not defined and could not be found with log4cpp-config. The location of a pre-built log4cpp install must be defined either as $ cmake -DLOG4CPP_INC=/path/to/LOG4CPP_includes or as an environment variable $ export LOG4CPP_INC=/path/to/LOG4CPP_includes")
+ message(WARNING "Variable LOG4CPP_LIB is not defined, as xml2-config was found and didn't report an include path, it is likely that log4cpp headers can be found in the standard system location, lets hope so. Alternativly, a location can be forced by configering with -DLOG4CPP_INC=/path/to/LOG4CPP_includes or as an environment variable LOG4CPP_INC.")
endif()
endif()
################################################################################
# Set the compiler defines
LIST(APPEND EXTRA_CXX_FLAGS -D__GENIE_ENABLED__ -D__GENIE_VERSION__=${GENIE_VERSION})
LIST(APPEND EXTRA_LIBS ${GENIE_LIBS})
############################### GSL ######################################
if(GENIE_POST_R3)
if(GSL_LIB STREQUAL "")
GETLIBDIR(gsl-config --libs GSL_LIB)
if(GSL_LIB STREQUAL "")
message(FATAL_ERROR "Variable GSL_LIB is not defined and could not be found with gsl-config. The location of a pre-built gsl install must be defined either as $ cmake -DGSL_LIB=/path/to/GSL_libraries or as an environment variable $ export GSL_LIB=/path/to/GSL_libraries")
endif()
endif()
if(GSL_INC STREQUAL "")
GETINCDIR(gsl-config --cflags GSL_INC)
if(GSL_INC STREQUAL "")
message(FATAL_ERROR "Variable GSL_INC is not defined and could not be found with gsl-config. The location of a pre-built gsl install must be defined either as $ cmake -DGSL_INC=/path/to/GSL_includes or as an environment variable $ export GSL_INC=/path/to/GSL_includes")
endif()
endif()
GETLIBS(gsl-config --libs GSL_LIB_LIST)
if(USING_GENIE_RW AND GENIE_REWEIGHT STREQUAL "")
message(FATAL_ERROR "Variable GENIE_REWEIGHT is not defined. When using GENIE v3+, we require the reweight product to be built and accessible via the environment variable GENIE_REWEIGHT")
endif()
endif()
################################################################################
LIST(APPEND EXTRA_LIBS LHAPDF xml2 log4cpp)
LIST(APPEND EXTRA_LINK_DIRS
${GENIE_LIB_DIR}
${LHAPDF_LIB}
${LOG4CPP_LIB})
# Append only if we have found GENIE ReWeight
if(NOT GENIE_POST_R3)
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES
${GENIE_INCLUDES_DIR}
${GENIE_INCLUDES_DIR}/GHEP
${GENIE_INCLUDES_DIR}/Ntuple)
if(USING_GENIE_RW)
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES ${GENIE_INCLUDES_DIR}/ReWeight)
endif()
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES
${GENIE_INCLUDES_DIR}/Apps
${GENIE_INCLUDES_DIR}/FluxDrivers
${GENIE_INCLUDES_DIR}/EVGDrivers
${LHAPDF_INC}
${LIBXML2_INC}
${LOG4CPP_INC})
else()
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES
${GENIE_INCLUDES_DIR})
if(USING_GENIE_RW)
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES ${GENIE_REWEIGHT}/src)
endif()
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES ${GSL_INC}
${LHAPDF_INC}
${LIBXML2_INC}
${LOG4CPP_INC})
if(USING_GENIE_RW)
LIST(APPEND EXTRA_LINK_DIRS
${GENIE_REWEIGHT}/lib)
endif()
LIST(APPEND EXTRA_LINK_DIRS
${GSL_LIB}
)
LIST(APPEND EXTRA_LIBS ${GSL_LIB_LIST})
endif()
if(USE_PYTHIA8)
set(NEED_PYTHIA8 TRUE)
set(NEED_ROOTPYTHIA8 TRUE)
else()
set(NEED_PYTHIA6 TRUE)
set(NEED_ROOTPYTHIA6 TRUE)
endif()
-set(NEED_ROOTEVEGEN TRUE)
+set(NEED_ROOTEVEGEN FALSE)
SET(USE_GENIE TRUE CACHE BOOL "Whether to enable GENIE (reweight) support. Requires external libraries. " FORCE)
diff --git a/cmake/NEUTSetup.cmake b/cmake/NEUTSetup.cmake
index 3cd85c6..eb4dd92 100644
--- a/cmake/NEUTSetup.cmake
+++ b/cmake/NEUTSetup.cmake
@@ -1,145 +1,209 @@
# 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 .
################################################################################
-if(NEUT_ROOT STREQUAL "")
- cmessage(FATAL_ERROR "Variable NEUT_ROOT is not defined. Please export environment variable NEUT_ROOT or configure with -DNEUT_ROOT=/path/to/NEUT. This must be set to point to a prebuilt NEUT instance.")
-endif()
+include(cmake/parseConfigApp.cmake)
-if(CERN STREQUAL "")
- cmessage(FATAL_ERROR "Variable CERN is not defined. Please export environment variable CERN or configure with -DCERN=/path/to/CERNLIB. This must be set to point to a prebuilt CERNLIB instance.")
-endif()
+find_program(NEUTCONFIG NAMES neut-config)
-if(CERN_LEVEL STREQUAL "")
- cmessage(FATAL_ERROR "Variable CERN_LEVEL is not defined. Please export environment variable CERN_LEVEL or configure with -DCERN_LEVEL=XXXX (likely to be 2005).")
-endif()
+LIST(APPEND EXTRA_CXX_FLAGS -DNEED_FILL_NEUT_COMMONS)
-if(${NEUT_VERSION} VERSION_LESS 5.4.0)
- set(NEUT_LIB_DIR ${NEUT_ROOT}/lib/Linux_pc)
+SET(HAVENEUTCONFIG FALSE)
+# We are dealing with shiny NEUT
+if(NOT "${NEUTCONFIG}" STREQUAL "NEUTCONFIG-NOTFOUND")
+ SET(HAVENEUTCONFIG TRUE)
+ cmessage(STATUS "Found neut-config, using it to determine configuration.")
else()
- set(NEUT_LIB_DIR ${NEUT_ROOT}/lib)
+ cmessage(STATUS "Failed to find neut-config, assuming older NEUT build.")
endif()
-set(NEUT_CLASS ${NEUT_ROOT}/src/neutclass)
-
-LIST(APPEND EXTRA_CXX_FLAGS -D__NEUT_ENABLED__ -DNEUT_VERSION=${NEUT_VERSION})
-
-LIST(APPEND EXTRA_CXX_FLAGS
- -I${NEUT_ROOT}/include
- -I${NEUT_ROOT}/src/neutclass
- -I${NEUT_ROOT}/src/reweight)
-
-LIST(APPEND EXTRA_LINK_DIRS
- ${NEUT_LIB_DIR}
- ${CERN}/${CERN_LEVEL}/lib
- ${NEUT_ROOT}/src/reweight)
-
-if(${NEUT_VERSION} VERSION_EQUAL 5.4.2)
- LIST(APPEND EXTRA_LIBS
- -Wl,--as-needed
- NReWeight
- -Wl,--start-group
- neutcore_5.4.2
- nuccorspl_5.4.2 #typo in NEUT, may hopefully disappear
- nuceff_5.4.2
- partnuck_5.4.2
- skmcsvc_5.4.2
- tauola_5.4.2
- HT2p2h_5.4.0
- N1p1h_5.4.0
- -Wl,--end-group
- jetset74
- pdflib804
- mathlib
- packlib
- pawlib)
-
- LIST(APPEND EXTRA_CXX_FLAGS -DNEUT_COMMON_QEAV)
-elseif(${NEUT_VERSION} VERSION_EQUAL 5.4.0)
- LIST(APPEND EXTRA_LIBS
- -Wl,--as-needed
- NReWeight
- -Wl,--start-group
- neutcore_5.4.0
- nuccorspl_5.4.0 #typo in NEUT, may hopefully disappear
- nuceff_5.4.0
- partnuck_5.4.0
- skmcsvc_5.4.0
- tauola_5.4.0
- HT2p2h_5.4.0
- N1p1h_5.4.0
- specfunc_5.4.0
- radcorr_5.4.0
- gfortran
- -Wl,--end-group
- jetset74
- pdflib804
- mathlib
- packlib
- pawlib)
-else()
- LIST(APPEND EXTRA_LIBS
- -Wl,--as-needed
- NReWeight
- -Wl,--start-group
- neutcore
- nuccorrspl
- nuceff
- partnuck
- skmcsvc
- tauola
- -Wl,--end-group
- jetset74
- pdflib804
- mathlib
- packlib
- pawlib)
-endif()
+if(HAVENEUTCONFIG)
+ execute_process (COMMAND neut-config
+ --version OUTPUT_VARIABLE NEUT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND neut-config
+ --incdir OUTPUT_VARIABLE NEUT_INCLUDE_DIRS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND neut-config
+ --libdir OUTPUT_VARIABLE NEUT_LINK_DIRS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ GETLIBDIRS(neut-config --cernflags CERN_LIB_DIR)
+ LIST(APPEND NEUT_LINK_DIRS ${CERN_LIB_DIR})
+ GETLIBS(neut-config --cernflags CERN_LIBS)
+
+ if(USE_REWEIGHT)
+ execute_process (COMMAND neut-config
+ --rwlibflags OUTPUT_VARIABLE NEUT_RWLIBS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ GETLIBS(neut-config --rwlibflags NEUT_RWLIBS)
+ LIST(APPEND NEUT_LIBS ${NEUT_RWLIBS})
+ else()
+ GETLIBS(neut-config --libflags NEUT_GENLIBS)
+ GETLIBS(neut-config --iolibflags NEUT_LIBS)
+ LIST(APPEND NEUT_LIBS ${NEUT_IOLIBS})
+ LIST(APPEND NEUT_LIBS ${NEUT_GENLIBS})
+ endif()
+
+ LIST(APPEND NEUT_LIBS ${CERN_LIBS};gfortran)
+ LIST(APPEND EXTRA_LIBS ${NEUT_LIBS})
+
+ PrefixList(NEUT_INCLUDE_DIRS "-I" ${NEUT_INCLUDE_DIRS})
+ LIST(APPEND EXTRA_CXX_FLAGS ${NEUT_INCLUDE_DIRS} -D__NEUT_ENABLED__ -DNEUT_VERSION=${NEUT_VERSION})
+
+ LIST(APPEND EXTRA_LINK_DIRS ${NEUT_LINK_DIRS})
+
+ cmessage(STATUS "NEUT")
+ cmessage(STATUS " Version : ${NEUT_VERSION}")
+ cmessage(STATUS " Flags : ${NEUT_CXX_FLAGS}")
+ cmessage(STATUS " Includes : ${NEUT_INCLUDE_DIRS}")
+ cmessage(STATUS " Link Dirs : ${NEUT_LINK_DIRS}")
+ cmessage(STATUS " Libs : ${NEUT_LIBS}")
+
+
+else() # Everything better be set up already
+
+ if(NEUT_ROOT STREQUAL "")
+ cmessage(FATAL_ERROR "Variable NEUT_ROOT is not defined. Please export environment variable NEUT_ROOT or configure with -DNEUT_ROOT=/path/to/NEUT. This must be set to point to a prebuilt NEUT instance.")
+ endif()
+
+ if(CERN STREQUAL "")
+ cmessage(FATAL_ERROR "Variable CERN is not defined. Please export environment variable CERN or configure with -DCERN=/path/to/CERNLIB. This must be set to point to a prebuilt CERNLIB instance.")
+ endif()
+
+ if(CERN_LEVEL STREQUAL "")
+ cmessage(FATAL_ERROR "Variable CERN_LEVEL is not defined. Please export environment variable CERN_LEVEL or configure with -DCERN_LEVEL=XXXX (likely to be 2005).")
+ endif()
+
+ if(${NEUT_VERSION} VERSION_LESS 5.4.0)
+ set(NEUT_LIB_DIR ${NEUT_ROOT}/lib/Linux_pc)
+ else()
+ set(NEUT_LIB_DIR ${NEUT_ROOT}/lib)
+ endif()
+
+ set(NEUT_CLASS ${NEUT_ROOT}/src/neutclass)
+
+ LIST(APPEND EXTRA_CXX_FLAGS -D__NEUT_ENABLED__ -DNEUT_VERSION=${NEUT_VERSION})
+
+ LIST(APPEND EXTRA_CXX_FLAGS
+ -I${NEUT_ROOT}/include
+ -I${NEUT_ROOT}/src/neutclass
+ -I${NEUT_ROOT}/src/reweight)
+
+ LIST(APPEND EXTRA_LINK_DIRS
+ ${NEUT_LIB_DIR}
+ ${CERN}/${CERN_LEVEL}/lib
+ ${NEUT_ROOT}/src/reweight)
+
+ if(${NEUT_VERSION} VERSION_EQUAL 5.4.2)
+ LIST(APPEND EXTRA_LIBS
+ -Wl,--as-needed
+ NReWeight
+ -Wl,--start-group
+ neutcore_5.4.2
+ nuccorspl_5.4.2 #typo in NEUT, may hopefully disappear
+ nuceff_5.4.2
+ partnuck_5.4.2
+ skmcsvc_5.4.2
+ tauola_5.4.2
+ HT2p2h_5.4.0
+ N1p1h_5.4.0
+ -Wl,--end-group
+ jetset74
+ pdflib804
+ mathlib
+ packlib
+ pawlib)
+
+ LIST(APPEND EXTRA_CXX_FLAGS -DNEUT_COMMON_QEAV)
+ elseif(${NEUT_VERSION} VERSION_EQUAL 5.4.0)
+ LIST(APPEND EXTRA_LIBS
+ -Wl,--as-needed
+ NReWeight
+ -Wl,--start-group
+ neutcore_5.4.0
+ nuccorspl_5.4.0 #typo in NEUT, may hopefully disappear
+ nuceff_5.4.0
+ partnuck_5.4.0
+ skmcsvc_5.4.0
+ tauola_5.4.0
+ HT2p2h_5.4.0
+ N1p1h_5.4.0
+ specfunc_5.4.0
+ radcorr_5.4.0
+ gfortran
+ -Wl,--end-group
+ jetset74
+ pdflib804
+ mathlib
+ packlib
+ pawlib)
+ else()
+ LIST(APPEND EXTRA_LIBS
+ -Wl,--as-needed
+ NReWeight
+ -Wl,--start-group
+ neutcore
+ nuccorrspl
+ nuceff
+ partnuck
+ skmcsvc
+ tauola
+ -Wl,--end-group
+ jetset74
+ pdflib804
+ mathlib
+ packlib
+ pawlib)
+ endif()
+
+ set(NEUT_ROOT_LIBS)
-set(NEUT_ROOT_LIBS)
+ LIST(APPEND NEUT_ROOT_LIBS
+ ${NEUT_CLASS}/neutctrl.so
+ ${NEUT_CLASS}/neutfsivert.so)
-LIST(APPEND NEUT_ROOT_LIBS
- ${NEUT_CLASS}/neutctrl.so
- ${NEUT_CLASS}/neutfsivert.so)
+ # Check for new versions of NEUT with NUCLEON FSI
+ if(EXISTS "${NEUT_CLASS}/neutnucfsistep.so")
+ set(NEUT_NUCFSI 1)
+ LIST(APPEND EXTRA_CXX_FLAGS -DNEUT_NUCFSI_ENABLED)
-# Check for new versions of NEUT with NUCLEON FSI
-if(EXISTS "${NEUT_CLASS}/neutnucfsistep.so")
- set(NEUT_NUCFSI 1)
- LIST(APPEND EXTRA_CXX_FLAGS -DNEUT_NUCFSI_ENABLED)
+ LIST(APPEND NEUT_ROOT_LIBS
+ ${NEUT_CLASS}/neutnucfsistep.so
+ ${NEUT_CLASS}/neutnucfsivert.so
+ )
+ endif()
+
+ if(${NEUT_VERSION} VERSION_LESS 5.4.0)
+ LIST(APPEND NEUT_ROOT_LIBS
+ ${NEUT_CLASS}/neutrootTreeSingleton.so)
+ endif()
LIST(APPEND NEUT_ROOT_LIBS
- ${NEUT_CLASS}/neutnucfsistep.so
- ${NEUT_CLASS}/neutnucfsivert.so
+ ${NEUT_CLASS}/neutvtx.so
+ ${NEUT_CLASS}/neutfsipart.so
+ ${NEUT_CLASS}/neutpart.so
+ ${NEUT_CLASS}/neutvect.so
)
-endif()
-if(${NEUT_VERSION} VERSION_LESS 5.4.0)
- LIST(APPEND NEUT_ROOT_LIBS
- ${NEUT_CLASS}/neutrootTreeSingleton.so)
+ foreach(OBJ ${NEUT_ROOT_LIBS})
+ LIST(APPEND EXTRA_SHAREDOBJS ${OBJ})
+ endforeach()
endif()
-
-LIST(APPEND NEUT_ROOT_LIBS
- ${NEUT_CLASS}/neutvtx.so
- ${NEUT_CLASS}/neutfsipart.so
- ${NEUT_CLASS}/neutpart.so
- ${NEUT_CLASS}/neutvect.so
- )
-
-foreach(OBJ ${NEUT_ROOT_LIBS})
- LIST(APPEND EXTRA_SHAREDOBJS ${OBJ})
-endforeach()
diff --git a/cmake/NuWroSetup.cmake b/cmake/NuWroSetup.cmake
index f649bff..af9d455 100644
--- a/cmake/NuWroSetup.cmake
+++ b/cmake/NuWroSetup.cmake
@@ -1,112 +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 .
################################################################################
if(NOT NUWRO_INPUT_FILE STREQUAL "")
if(NOT EXISTS ${NUWRO_INPUT_FILE})
cmessage(FATAL_ERROR "Expected -DNUWRO_INPUT_FILE to point to a valid input file. Cannot find: '${NUWRO_INPUT_FILE}'")
endif()
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
BuildROOTProject(NuWro_event1 ${NUWRO_INPUT_FILE} "event,vec,vect,particle,flags,params,line" STATIC)
SET(ROOTLIBNAME "libNuWro_event1.a")
else(CMAKE_BUILD_TYPE MATCHES RELEASE)
BuildROOTProject(NuWro_event1 ${NUWRO_INPUT_FILE} "event,vec,vect,particle,flags,params,line" SHARED)
SET(ROOTLIBNAME "libNuWro_event1.so")
endif()
ADD_CUSTOM_TARGET(NuWro_event1HeaderLink ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_BINARY_DIR}/NuWro_event1/event.h
${CMAKE_BINARY_DIR}/NuWro_event1/event1.h
DEPENDS NuWro_event1)
LIST(APPEND EXTRA_CXX_FLAGS -D__NUWRO_ENABLED__)
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/NuWro_event1)
LIST(APPEND EXTRA_LINK_DIRS ${CMAKE_BINARY_DIR})
LIST(APPEND EXTRA_LIBS NuWro_event1)
LIST(APPEND PROJECTWIDE_EXTRA_DEPENDENCIES NuWro_event1HeaderLink )
install(TARGETS NuWro_event1 DESTINATION lib)
SET(NUWRO_BUILT_FROM_FILE TRUE)
else()
if(NUWRO STREQUAL "")
cmessage(FATAL_ERROR "Variable NUWRO is not defined. "
"This must be set to point to a prebuilt NuWro instance.")
endif()
# If you are using a version of NuWro without reweighting use this to compile.
if(USE_NuWro_RW)
if(NUWRO_INC STREQUAL "")
cmessage(FATAL_ERROR "Variable NUWRO_INC is not defined. "
"This must be set to point to an installed NuWro instance.")
endif()
LIST(APPEND EXTRA_CXX_FLAGS -D__NUWRO_ENABLED__ -D__NUWRO_REWEIGHT_ENABLED__)
if(USE_NuWro_SRW_Event)
LIST(APPEND EXTRA_CXX_FLAGS -D__USE_NUWRO_SRW_EVENTS__)
endif()
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES
${NUWRO}/src
${NUWRO}/src/reweight
${NUWRO_INC}/nuwro)
LIST(APPEND EXTRA_LINK_DIRS ${NUWRO}/build/${CMAKE_SYSTEM_NAME}/lib)
LIST(APPEND EXTRA_LIBS reweight event)
else ()
LIST(APPEND EXTRA_CXX_FLAGS -D__NUWRO_ENABLED__)
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES ${NUWRO}/src)
if(NOT EXISTS ${NUWRO}/bin/event1.so)
if(EXISTS ${NUWRO}/build/${CMAKE_SYSTEM_NAME}/lib)
if(NUWRO_INC STREQUAL "")
cmessage(FATAL_ERROR "Variable NUWRO_INC is not defined. "
"This must be set to point to an installed NuWro instance.")
endif()
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES ${NUWRO_INC}/nuwro)
LIST(APPEND EXTRA_LINK_DIRS ${NUWRO}/build/${CMAKE_SYSTEM_NAME}/lib)
- LIST(APPEND EXTRA_LIBS event)
+ LIST(APPEND EXTRA_LIBS -Wl,--no-as-needed event -Wl,--as-needed)
else()
cmessage(FATAL_ERROR "Expected to find the NuWro event library in: ${NUWRO}/bin/event1.so, or if using NuWro with reweight support: ${NUWRO}/build/${CMAKE_SYSTEM_NAME}/lib/libevent.a. Is NuWro built?")
endif()
else()
- LIST(APPEND EXTRA_SHAREDOBJS ${NUWRO}/bin/event1.so)
+ LIST(APPEND EXTRA_SHAREDOBJS -Wl,--no-as-needed ${NUWRO}/bin/event1.so -Wl,--as-needed)
endif()
endif()
set(NEED_PYTHIA6 TRUE)
set(NEED_ROOTPYTHIA6 TRUE)
endif()
-
diff --git a/cmake/ReweightEnginesSetup.cmake b/cmake/ReweightEnginesSetup.cmake
index f72d2ac..31dc580 100644
--- a/cmake/ReweightEnginesSetup.cmake
+++ b/cmake/ReweightEnginesSetup.cmake
@@ -1,93 +1,97 @@
# 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 .
################################################################################
+if(NOT USE_REWEIGHT)
+ LIST(APPEND EXTRA_CXX_FLAGS -D__NO_REWEIGHT__)
+endif()
+
################################## T2K ######################################
if(USE_T2K)
include(${CMAKE_SOURCE_DIR}/cmake/T2KSetup.cmake)
cmessage(STATUS "Using T2K Reweight engine.")
set(USE_T2K TRUE CACHE BOOL "Whether to enable T2KReWeight support. Requires external libraries. " FORCE)
endif()
################################## NIWG ######################################
if(USE_NIWG)
include(${CMAKE_SOURCE_DIR}/cmake/NIWGSetup.cmake)
cmessage(STATUS "Using NIWG Reweight engine.")
set(USE_NIWG TRUE CACHE BOOL "Whether to enable (T2K) NIWG ReWeight support. Requires external libraries. " FORCE)
endif()
################################## MINERvA ######################################
if(USE_MINERvA_RW)
include(${CMAKE_SOURCE_DIR}/cmake/MINERvASetup.cmake)
cmessage(STATUS "Using MINERvA Reweight engine.")
set(USE_MINERvA_RW TRUE CACHE BOOL "Whether to enable MINERvA ReWeight support. " FORCE)
endif()
################################## NEUT ######################################
if(USE_NEUT)
include(${CMAKE_SOURCE_DIR}/cmake/NEUTSetup.cmake)
cmessage(STATUS "Using NEUT Reweight engine.")
set(USE_NEUT TRUE CACHE BOOL "Whether to enable NEUT (reweight) support. Requires external libraries. " FORCE)
endif()
################################# NuWro ######################################
if(USE_NuWro)
include(${CMAKE_SOURCE_DIR}/cmake/NuWroSetup.cmake)
cmessage(STATUS "Using NuWro Reweight engine.")
set(USE_NuWro TRUE CACHE BOOL "Whether to enable NuWro support. " FORCE)
endif()
################################## GENIE #####################################
if(USE_GENIE)
include(${CMAKE_SOURCE_DIR}/cmake/GENIESetup.cmake)
cmessage(STATUS "Using GENIE.")
set(USE_GENIE TRUE CACHE BOOL "Whether to enable GENIE support. Requires external libraries. " FORCE)
endif()
################################################################################
################################ NOvARwgt ####################################
if(USE_NOvARwgt)
include(${CMAKE_SOURCE_DIR}/cmake/NOvARwgtSetup.cmake)
cmessage(STATUS "Using NOvARwgt Reweight engine.")
set(USE_NOvARwgt TRUE CACHE BOOL "Whether to enable NOvARwgt (reweight) support. Requires external libraries. " FORCE)
endif()
################################################################################
################################ Prob3++ ####################################
include(${CMAKE_SOURCE_DIR}/cmake/Prob3++Setup.cmake)
################################################################################
cmessage(STATUS "Reweight engine include directories: ${RWENGINE_INCLUDE_DIRECTORIES}")
if(NEED_ROOTEVEGEN)
cmessage(STATUS "Require ROOT eve generation libraries")
LIST(REVERSE ROOT_LIBS)
LIST(APPEND ROOT_LIBS
Gui
Ged
Geom
TreePlayer
EG
Eve)
LIST(REVERSE ROOT_LIBS)
endif()
if(NEED_ROOTPYTHIA6)
cmessage(STATUS "Require ROOT Pythia6 libraries")
LIST(APPEND ROOT_LIBS
EGPythia6)
endif()
LIST(APPEND EXTRA_LIBS ${ROOT_LIBS})
diff --git a/cmake/parseConfigApp.cmake b/cmake/parseConfigApp.cmake
index 2f72ce5..887f08e 100644
--- a/cmake/parseConfigApp.cmake
+++ b/cmake/parseConfigApp.cmake
@@ -1,148 +1,185 @@
function(GETFIRSTMATCHINGDELMIMMEDDIR DELIM CONFIGAPP ARG DIR_OUT FAILURE_IS_NOT_ERROR)
- cmessage(DEBUG "CONFIGAPP: ${CONFIGAPP}, ARG: ${ARG} DIR_OUT: ${DIR_OUT}, FAILURE_IS_NOT_ERROR: ${FAILURE_IS_NOT_ERROR}")
-
if(DELIM STREQUAL "")
cmessage(FATAL_ERROR "GETFIRSTMATCHINGDELMIMMEDDIR Passed no delimiter. This is a build configuration bug in NUISANCE, please report to the developers.")
endif()
if(CONFIGAPP STREQUAL "")
cmessage(FATAL_ERROR "GETFIRSTMATCHINGDELMIMMEDDIR Passed no configuration application. This is a build configuration bug in NUISANCE, please report to the developers.")
endif()
SET(CONFIGAPP_LOCATION "CONFIGAPP_LOCATION-NOTFOUND")
find_program(CONFIGAPP_LOCATION ${CONFIGAPP})
if(NOT CONFIGAPP_LOCATION STREQUAL "CONFIGAPP_LOCATION-NOTFOUND")
execute_process (COMMAND ${CONFIGAPP_LOCATION}
${ARG} OUTPUT_VARIABLE CONFIGAPP_RESPONSE_RAW OUTPUT_STRIP_TRAILING_WHITESPACE)
cmessage(DEBUG "${CONFIGAPP_LOCATION} ${ARG} responded with: \"${CONFIGAPP_RESPONSE_RAW}\"")
if(CONFIGAPP_RESPONSE_RAW STREQUAL "")
if(FAILURE_IS_NOT_ERROR)
cmessage(DEBUG "\"${CONFIGAPP_LOCATION} ${ARG}\" produced no output and was expected to.")
set(${DIR_OUT} "" PARENT_SCOPE)
else()
cmessage(FATAL_ERROR "\"${CONFIGAPP_LOCATION} ${ARG}\" produced no output and was required to.")
endif()
else()
string(REGEX MATCH "${DELIM}\([^ ]+\)" PARSE_CONFIGAPP_RESPONSE_MATCH ${CONFIGAPP_RESPONSE_RAW})
if(NOT PARSE_CONFIGAPP_RESPONSE_MATCH)
if(FAILURE_IS_NOT_ERROR)
cmessage(DEBUG "Couldn't find ${DELIM} flag, found: \"${CONFIGAPP_RESPONSE_RAW}\"")
set(${CMAKE_MATCH_1} "")
else()
- cmessage(FATAL_ERROR "Expected to be able to parse the result of ${CONFIGAPP} ${ARG} to a lib directory, but couldn't find a ${DELIM} flag, found: \"${CONFIGAPP_RESPONSE_RAW}\"")
+ cmessage(FATAL_ERROR "Expected to be able to parse the result of ${CONFIGAPP} ${ARG} to a directory, but couldn't find a ${DELIM} flag, found: \"${CONFIGAPP_RESPONSE_RAW}\"")
endif()
endif()
set(${DIR_OUT} ${CMAKE_MATCH_1} PARENT_SCOPE)
endif()
else()
cmessage(FATAL_ERROR "[ERROR]: Failed to find dependency configuration application: \"${CONFIGAPP}\"")
endif()
endfunction()
#Uselike GETLIBDIR(gsl-config --libs GSL_LIB_DIR)
function(GETLIBDIR CONFIGAPP ARG LIBDIR_OUT)
if(ARGN)
set(FAILURE_IS_NOT_ERROR TRUE)
else()
set(FAILURE_IS_NOT_ERROR FALSE)
endif()
GETFIRSTMATCHINGDELMIMMEDDIR(
"-L"
${CONFIGAPP}
${ARG}
MATCHING_DIR
${FAILURE_IS_NOT_ERROR})
set(${LIBDIR_OUT} ${MATCHING_DIR} PARENT_SCOPE)
endfunction()
#Uselike GETINCDIR(gsl-config --cflags GSL_INC_DIR)
function(GETINCDIR CONFIGAPP ARG INCDIR_OUT)
if(ARGN)
set(FAILURE_IS_NOT_ERROR TRUE)
else()
set(FAILURE_IS_NOT_ERROR FALSE)
endif()
GETFIRSTMATCHINGDELMIMMEDDIR(
"-I"
${CONFIGAPP}
${ARG}
MATCHING_DIR
${FAILURE_IS_NOT_ERROR})
set(${INCDIR_OUT} ${MATCHING_DIR} PARENT_SCOPE)
endfunction()
function(GETALLMATCHINGDELMIMMEDDIR DELIM CONFIGAPP ARG LIST_OUT)
if(DELIM STREQUAL "")
cmessage(FATAL_ERROR "GETALLMATCHINGDELMIMMEDDIR Passed no delimiter. This is a build configuration bug in NUISANCE, please report to the developers.")
endif()
if(CONFIGAPP STREQUAL "")
cmessage(FATAL_ERROR "GETALLMATCHINGDELMIMMEDDIR Passed no configuration application. This is a build configuration bug in NUISANCE, please report to the developers.")
endif()
- #cmessage(WARNING "DELIM: ${DELIM}, CONFIGAPP: ${CONFIGAPP}, ARG: ${ARG}, LIST_OUT: ${LIST_OUT}")
-
SET(CONFIGAPP_LOCATION "CONFIGAPP_LOCATION-NOTFOUND")
find_program(CONFIGAPP_LOCATION ${CONFIGAPP})
if(NOT CONFIGAPP_LOCATION STREQUAL "CONFIGAPP_LOCATION-NOTFOUND")
execute_process (COMMAND ${CONFIGAPP_LOCATION}
${ARG} OUTPUT_VARIABLE CONFIGAPP_RESPONSE_RAW OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" CONFIGAPP_RESPONSE_LIST "${CONFIGAPP_RESPONSE_RAW}")
- # cmessage(WARNING "CONFIGAPP_RESPONSE_RAW: ${CONFIGAPP_RESPONSE_RAW}, CONFIGAPP_RESPONSE_LIST: ${CONFIGAPP_RESPONSE_LIST}")
-
set(LIST_BUILD)
foreach(I ${CONFIGAPP_RESPONSE_LIST})
if(I)
string(REGEX MATCH "^${DELIM}" WASMATCHED ${I})
if(WASMATCHED)
string(REPLACE "${DELIM}" "" I_STRIPPED "${I}")
LIST(APPEND LIST_BUILD ${I_STRIPPED})
endif()
endif()
endforeach()
set(${LIST_OUT} ${LIST_BUILD} PARENT_SCOPE)
else()
cmessage(FATAL_ERROR "[ERROR]: Failed to find dependency configuration application: \"${CONFIGAPP}\"")
endif()
endfunction()
#Uselike GETLIBDIRS(gsl-config --libs GSL_LIB_DIR)
function(GETLIBDIRS CONFIGAPP ARG LIBDIR_OUT)
GETALLMATCHINGDELMIMMEDDIR(
"-L"
${CONFIGAPP}
${ARG}
MATCHING_DIR)
set(${LIBDIR_OUT} ${MATCHING_DIR} PARENT_SCOPE)
endfunction()
#Uselike GETINCDIRS(gsl-config --cflags GSL_INC_DIR)
function(GETINCDIRS CONFIGAPP ARG INCDIR_OUT)
GETALLMATCHINGDELMIMMEDDIR(
"-I"
${CONFIGAPP}
${ARG}
MATCHING_DIR)
set(${INCDIR_OUT} ${MATCHING_DIR} PARENT_SCOPE)
endfunction()
#Uselike GETLIBS(gsl-config --libs GSL_LIB_DIR)
function(GETLIBS CONFIGAPP ARG LIBLIST_OUT)
- #cmessage(WARNING "LIBLIST_OUT: ${LIBLIST_OUT}")
GETALLMATCHINGDELMIMMEDDIR(
"-l"
${CONFIGAPP}
${ARG}
MATCHING_ITEMS)
set(${LIBLIST_OUT} ${MATCHING_ITEMS} PARENT_SCOPE)
- #cmessage(WARNING "LIBLIST_OUT: ${LIBLIST_OUT}: ${${LIBLIST_OUT}}")
+endfunction()
+
+function(BuildFlagString OUTPUTLIST DELIMITER)
+ LIST(APPEND INPUT_LIST ${ARGN})
+ if(NOT DELIMITER STREQUAL "")
+ string(STRIP ${DELIMITER} DELIMITER)
+ endif()
+ if(NOT "${INPUT_LIST}" STREQUAL "")
+ string(REPLACE ";" " ${DELIMITER}" LIST_STR "${DELIMITER}${INPUT_LIST}")
+ string(STRIP "${LIST_STR}" LIST_STR)
+ set(${OUTPUTLIST} ${LIST_STR} PARENT_SCOPE)
+ else()
+ set(${OUTPUTLIST} PARENT_SCOPE)
+ endif()
+endfunction()
+
+#Here we want to look for linker flags in a list of libraries and escape them
+function(BuildLibraryFlagString OUTPUTLIST)
+ set(INPUT_LIST ${ARGN})
+ BuildFlagString(NEED_SCRUB_LINKOPTS "-l" ${INPUT_LIST})
+ string(REPLACE "-l-" "-" LIST_STR ${NEED_SCRUB_LINKOPTS})
+ set(${OUTPUTLIST} ${LIST_STR} PARENT_SCOPE)
+endfunction()
+
+function(CatStringsIfNotEmpty OUTPUT_STRING)
+ set(BUILD_STR)
+ foreach(I ${ARGN})
+ if(NOT I STREQUAL "")
+ set(BUILD_STR "${BUILD_STR} ${I}")
+ endif()
+ endforeach()
+ if(NOT BUILD_STR STREQUAL "")
+ string(STRIP "${BUILD_STR}" BUILD_STR)
+ endif()
+ set(${OUTPUT_STRING} ${BUILD_STR} PARENT_SCOPE)
+endfunction()
+
+function(PrefixList OUTPUT_LIST PREFIX)
+ set(${OUTPUT_LIST})
+ foreach(I ${ARGN})
+ if(NOT I STREQUAL "")
+ LIST(APPEND ${OUTPUT_LIST} "${PREFIX}${I}")
+ endif()
+ endforeach()
+ set(${OUTPUT_LIST} ${${OUTPUT_LIST}} PARENT_SCOPE)
endfunction()
diff --git a/cmake/pythia6Setup.cmake b/cmake/pythia6Setup.cmake
index 1a89b0c..3a496e6 100644
--- a/cmake/pythia6Setup.cmake
+++ b/cmake/pythia6Setup.cmake
@@ -1,29 +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 .
################################################################################
if(NEED_PYTHIA6)
+
+ if(DEFINED ENV{PYTHIA6_LIBRARY} AND PYTHIA6 STREQUAL "")
+ SET(PYTHIA6 $ENV{PYTHIA6_LIBRARY} CACHE PATH
+ "Path to directory containing libPythia6.so. Overrides environment variable \$PYTHIA6 <>"
+ FORCE)
+ endif()
+
if(PYTHIA6 STREQUAL "")
cmessage(FATAL_ERROR "Variable PYTHIA6 is not defined. This must be set to point to a prebuilt PYTHIA6 instance, please set the \$PYTHIA6 environment variable or configure with -DPYTHIA6=/path/to/pythia6.")
endif()
LIST(APPEND EXTRA_LINK_DIRS ${PYTHIA6})
LIST(APPEND EXTRA_LIBS Pythia6 gfortran)
endif()
diff --git a/parameters/config.xml b/parameters/config.xml
index 4ca539e..05044e1 100644
--- a/parameters/config.xml
+++ b/parameters/config.xml
@@ -1,231 +1,233 @@
-
-
+
+
diff --git a/src/ANL/ANL_CC1npip_XSec_1DEnu_nu.cxx b/src/ANL/ANL_CC1npip_XSec_1DEnu_nu.cxx
index 5a796ed..070d4dc 100644
--- a/src/ANL/ANL_CC1npip_XSec_1DEnu_nu.cxx
+++ b/src/ANL/ANL_CC1npip_XSec_1DEnu_nu.cxx
@@ -1,140 +1,142 @@
// 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 .
-*******************************************************************************/
+ * 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 .
+ *******************************************************************************/
/**
- * Radecky et al. Phys Rev D, 3rd series, volume 25, number 5, 1 March 1982, p 1161-1173
-*/
+ * Radecky et al. Phys Rev D, 3rd series, volume 25, number 5, 1 March 1982, p
+ * 1161-1173
+ */
#include "ANL_CC1npip_XSec_1DEnu_nu.h"
-
//********************************************************************
ANL_CC1npip_XSec_1DEnu_nu::ANL_CC1npip_XSec_1DEnu_nu(nuiskey samplekey) {
-//********************************************************************
+ //********************************************************************
// Sample overview ---------------------------------------------------
- std::string descrip = "ANL CC1npip Event Rate 1DQ2 nu sample. \n" \
- "Target: D2 \n" \
- "Flux: \n" \
+ std::string descrip = "ANL CC1npip Event Rate 1DQ2 nu sample. \n"
+ "Target: D2 \n"
+ "Flux: \n"
"Signal: \n";
// Setup common settings
fSettings = LoadSampleSettings(samplekey);
fSettings.SetDescription(descrip);
fSettings.SetXTitle("E_{#nu} (GeV)");
fSettings.SetYTitle("#sigma (cm^{2}/nucleon)");
fSettings.SetAllowedTypes("FIX/DIAG", "FIX,FREE,SHAPE/DIAG");
fSettings.SetEnuRange(0.0, 1.5);
fSettings.SetS("norm_error", "0.20");
fSettings.DefineAllowedTargets("D,H");
// plot information
fSettings.SetTitle("ANL #nu_mu CC1n#pi^{+}");
fSettings.DefineAllowedSpecies("numu");
// User can specifiy to use uncorrected data
UseCorrectedData = !fSettings.Found("name", "Uncorr");
// User can specify "W14" for W < 1.4 GeV cut
// "W16" for W < 1.6 GeV cut
// The default is W < 2.0
- if (fSettings.Found("name", "W14Cut")) wTrueCut = 1.4;
- else if (fSettings.Found("name", "W16Cut")) wTrueCut = 1.6;
- else wTrueCut = 10.0;
-
+ if (fSettings.Found("name", "W14Cut"))
+ wTrueCut = 1.4;
+ else if (fSettings.Found("name", "W16Cut"))
+ wTrueCut = 1.6;
+ else
+ wTrueCut = 10.0;
// Flag for bad combo
if (UseCorrectedData && wTrueCut == 1.6) {
- ERR(FTL) << "Can not run ANL CC1pi+1n W < 1.6 GeV with CORRECTION, because the data DOES NOT EXIST" << std::endl;
- ERR(FTL) << "Correction exists for W < 1.4 GeV and no W cut data ONLY" << std::endl;
- ERR(FTL) << "Reverting to using uncorrected data!" << std::endl;
+ NUIS_ERR(WRN, "Can not run ANL CC1pi+1n W < 1.6 GeV with CORRECTION, because "
+ "the data DOES NOT EXIST");
+ NUIS_ERR(WRN, "Correction exists for W < 1.4 GeV and no W cut data ONLY");
+ NUIS_ERR(WRN, "Reverting to using uncorrected data!");
UseCorrectedData = false;
}
// Now read in different data depending on what the user has specified
- std::string DataLocation = GeneralUtils::GetTopLevelDir() + "/data/ANL/CC1pip_on_n/";
+ std::string DataLocation =
+ GeneralUtils::GetTopLevelDir() + "/data/ANL/CC1pip_on_n/";
// If we're using corrected data
if (UseCorrectedData) {
if (wTrueCut == 1.4) {
DataLocation += "anl82corr-numu-n-to-mu-n-piplus-lowW_edges.txt";
// No W cut
} else {
DataLocation += "anl82corr-numu-n-to-mu-n-piplus-noW_edges.txt";
}
// If we're using raw uncorrected data
} else {
if (wTrueCut == 1.4) {
DataLocation += "anl82-numu-cc1npip-14Wcut.txt";
} else if (wTrueCut == 1.6) {
DataLocation += "anl82-numu-cc1npip-16Wcut.txt";
} else if (wTrueCut == 10.0) {
DataLocation += "anl82-numu-cc1npip-noWcut.txt";
}
}
fSettings.SetDataInput(DataLocation);
-
FinaliseSampleSettings();
// Scaling Setup ---------------------------------------------------
// ScaleFactor automatically setup for DiffXSec/cm2/Nucleon
- fScaleFactor = (GetEventHistogram()->Integral("width") * 1E-38 * 2.0 / 1.0 / (fNEvents + 0.));
+ fScaleFactor = (GetEventHistogram()->Integral("width") * 1E-38 * 2.0 / 1.0 /
+ (fNEvents + 0.));
// Plot Setup -------------------------------------------------------
- SetDataFromTextFile( fSettings.GetDataInput() );
+ SetDataFromTextFile(fSettings.GetDataInput());
SetCovarFromDiagonal();
// Final setup ---------------------------------------------------
FinaliseMeasurement();
-
};
-
void ANL_CC1npip_XSec_1DEnu_nu::FillEventVariables(FitEvent *event) {
- if (event->NumFSParticle(2112) == 0 || event->NumFSParticle(211) == 0 || event->NumFSParticle(13) == 0) {
+ if (event->NumFSParticle(2112) == 0 || event->NumFSParticle(211) == 0 ||
+ event->NumFSParticle(13) == 0) {
return;
}
- TLorentzVector Pnu = event->GetNeutrinoIn()->fP;
- TLorentzVector Pn = event->GetHMFSParticle(2112)->fP;
+ TLorentzVector Pnu = event->GetNeutrinoIn()->fP;
+ TLorentzVector Pn = event->GetHMFSParticle(2112)->fP;
TLorentzVector Ppip = event->GetHMFSParticle(211)->fP;
- TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
+ TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
double hadMass = FitUtils::MpPi(Pn, Ppip);
- double Enu = -1.0;
+ double Enu = -1.0;
// ANL has a W cuts at 1.4, 1.6 and no w cut
// This is set by user, or defaults to 2.0
if (hadMass < wTrueCut * 1000.) {
Enu = Pnu.E() / 1.E3;
}
fXVar = Enu;
return;
};
bool ANL_CC1npip_XSec_1DEnu_nu::isSignal(FitEvent *event) {
return SignalDef::isCC1pi3Prong(event, 14, 211, 2112, EnuMin, EnuMax);
}
-
diff --git a/src/ANL/ANL_CC1pi0_XSec_1DEnu_nu.cxx b/src/ANL/ANL_CC1pi0_XSec_1DEnu_nu.cxx
index d083565..fe39e89 100644
--- a/src/ANL/ANL_CC1pi0_XSec_1DEnu_nu.cxx
+++ b/src/ANL/ANL_CC1pi0_XSec_1DEnu_nu.cxx
@@ -1,136 +1,137 @@
// 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 .
*******************************************************************************/
/**
* Radecky et al. Phys Rev D, 3rd series, volume 25, number 5, 1 March 1982, p 1161-1173
*/
#include "ANL_CC1pi0_XSec_1DEnu_nu.h"
//********************************************************************
ANL_CC1pi0_XSec_1DEnu_nu::ANL_CC1pi0_XSec_1DEnu_nu(nuiskey samplekey) {
//********************************************************************
// Sample overview ---------------------------------------------------
std::string descrip = "ANL CC1pi0 Event Rate 1DQ2 nu sample. \n" \
"Target: D2 \n" \
"Flux: \n" \
"Signal: \n";
// Setup common settings
fSettings = LoadSampleSettings(samplekey);
fSettings.SetDescription(descrip);
fSettings.SetXTitle("E_{#nu} (GeV)");
fSettings.SetYTitle("#sigma (cm^{2}/neutron)");
fSettings.SetAllowedTypes("FIX/DIAG", "FIX,FREE,SHAPE/DIAG");
fSettings.SetEnuRange(0.0, 1.5);
fSettings.SetS("norm_error", "0.20");
fSettings.DefineAllowedTargets("D,H");
// plot information
fSettings.SetTitle("ANL #nu_mu CC1#pi^{0}");
fSettings.DefineAllowedSpecies("numu");
// User can specifiy to use uncorrected data
UseCorrectedData = !fSettings.Found("name", "Uncorr");
// User can specify "W14" for W < 1.4 GeV cut
// "W16" for W < 1.6 GeV cut
// The default is W < 2.0
if (fSettings.Found("name", "W14Cut")) wTrueCut = 1.4;
else if (fSettings.Found("name", "W16Cut")) wTrueCut = 1.6;
else wTrueCut = 10.0;
// Flag for bad combo
if (UseCorrectedData && wTrueCut == 1.6) {
- ERR(FTL) << "Can not run ANL CC1pi+1n W < 1.6 GeV with CORRECTION, because the data DOES NOT EXIST" << std::endl;
- ERR(FTL) << "Correction exists for W < 1.4 GeV and no W cut data ONLY" << std::endl;
- ERR(FTL) << "Reverting to using uncorrected data!" << std::endl;
+ NUIS_ERR(WRN, "Can not run ANL CC1pi0 W < 1.6 GeV with CORRECTION, because "
+ "the data DOES NOT EXIST");
+ NUIS_ERR(WRN, "Correction exists for W < 1.4 GeV and no W cut data ONLY");
+ NUIS_ERR(WRN, "Reverting to using uncorrected data!");
UseCorrectedData = false;
}
// Now read in different data depending on what the user has specified
std::string DataLocation = GeneralUtils::GetTopLevelDir() + "/data/ANL/CC1pi0_on_n/";
// If we're using corrected data
if (UseCorrectedData) {
if (wTrueCut == 1.4) {
DataLocation += "anl82corr-numu-n-to-mu-p-pi0-lowW_edges.txt";
} else if (wTrueCut == 10.0) {
DataLocation += "anl82corr-numu-n-to-mu-p-pi0-noW_edges.txt";
}
// If we're using raw uncorrected data
} else {
if (wTrueCut == 1.4) {
DataLocation += "anl82-numu-cc1pi0-14Wcut.txt";
} else if (wTrueCut == 1.6) {
DataLocation += "anl82-numu-cc1pi0-16Wcut.txt";
} else if (wTrueCut == 10.0) {
DataLocation += "anl82-numu-cc1pi0-noWcut.txt";
}
}
fSettings.SetDataInput(DataLocation);
FinaliseSampleSettings();
// Scaling Setup ---------------------------------------------------
// ScaleFactor automatically setup for DiffXSec/cm2/Nucleon
fScaleFactor = (GetEventHistogram()->Integral("width") * 1E-38 * 2.0 / 1.0 / (fNEvents + 0.));
// Plot Setup -------------------------------------------------------
SetDataFromTextFile( fSettings.GetDataInput() );
SetCovarFromDiagonal();
// Final setup ---------------------------------------------------
FinaliseMeasurement();
};
void ANL_CC1pi0_XSec_1DEnu_nu::FillEventVariables(FitEvent *event) {
if (event->NumFSParticle(2212) == 0 || event->NumFSParticle(111) == 0 || event->NumFSParticle(13) == 0) {
return;
}
TLorentzVector Pnu = event->GetNeutrinoIn()->fP;
TLorentzVector Pp = event->GetHMFSParticle(2212)->fP;
TLorentzVector Ppi0 = event->GetHMFSParticle(111)->fP;
TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
double hadMass = FitUtils::MpPi(Pp, Ppi0);
double Enu = -1.0;
if (hadMass/1000. < wTrueCut) {
Enu = Pnu.E()/1.E3;
}
fXVar = Enu;
return;
};
bool ANL_CC1pi0_XSec_1DEnu_nu::isSignal(FitEvent *event) {
return SignalDef::isCC1pi3Prong(event, 14, 111, 2212, EnuMin, EnuMax);
}
diff --git a/src/ANL/ANL_CC1ppip_XSec_1DEnu_nu.cxx b/src/ANL/ANL_CC1ppip_XSec_1DEnu_nu.cxx
index 1a0b143..fa5af57 100644
--- a/src/ANL/ANL_CC1ppip_XSec_1DEnu_nu.cxx
+++ b/src/ANL/ANL_CC1ppip_XSec_1DEnu_nu.cxx
@@ -1,138 +1,139 @@
// 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 .
*******************************************************************************/
/**
* Radecky et al. Phys Rev D, 3rd series, volume 25, number 5, 1 March 1982, p 1161-1173
*/
#include "ANL_CC1ppip_XSec_1DEnu_nu.h"
//********************************************************************
ANL_CC1ppip_XSec_1DEnu_nu::ANL_CC1ppip_XSec_1DEnu_nu(nuiskey samplekey) {
//********************************************************************
// Sample overview ---------------------------------------------------
std::string descrip = "ANL CC1pip XSec Enu nu sample. \n" \
"Target: D2 \n" \
"Flux: \n" \
"Signal: \n";
// Setup common settings
fSettings = LoadSampleSettings(samplekey);
fSettings.SetDescription(descrip);
fSettings.SetXTitle("E_{#nu} (GeV)");
fSettings.SetYTitle("#sigma (cm^{2}/nucleon)");
fSettings.SetAllowedTypes("FIX/DIAG", "FIX,FREE,SHAPE/DIAG");
fSettings.SetEnuRange(0.0, 6.0);
fSettings.SetS("norm_error", "0.20");
fSettings.DefineAllowedTargets("D,H");
// plot information
fSettings.SetTitle("ANL #nu_mu CC1#pi^{0}");
fSettings.DefineAllowedSpecies("numu");
// User can specifiy to use uncorrected data
UseCorrectedData = !fSettings.Found("name", "Uncorr");
// User can specify "W14" for W < 1.4 GeV cut
// "W16" for W < 1.6 GeV cut
// The default is no W cut
if (fSettings.Found("name", "W14Cut")) wTrueCut = 1.4;
else if (fSettings.Found("name", "W16Cut")) wTrueCut = 1.6;
else wTrueCut = 10.0;
// Flag for bad combo
if (UseCorrectedData && wTrueCut == 1.6) {
- ERR(FTL) << "Can not run ANL CC1pi+1p W < 1.6 GeV with CORRECTION, because the data DOES NOT EXIST" << std::endl;
- ERR(FTL) << "Correction exists for W < 1.4 GeV and no W cut data ONLY" << std::endl;
- ERR(FTL) << "Reverting to using uncorrected data!" << std::endl;
+ NUIS_ERR(WRN, "Can not run ANL CC1pi+1p W < 1.6 GeV with CORRECTION, because "
+ "the data DOES NOT EXIST");
+ NUIS_ERR(WRN, "Correction exists for W < 1.4 GeV and no W cut data ONLY");
+ NUIS_ERR(WRN, "Reverting to using uncorrected data!");
UseCorrectedData = false;
}
// Now read in different data depending on what the user has specified
std::string DataLocation = GeneralUtils::GetTopLevelDir() + "/data/ANL/CC1pip_on_p/";
// If we're using corrected data
if (UseCorrectedData) {
if (wTrueCut == 1.4) {
DataLocation += "anl82corr-numu-p-to-mu-p-piplus-lowW_edges.txt";
} else if (wTrueCut == 10.0) {
DataLocation += "anl82corr-numu-p-to-mu-p-piplus-noW_edges.txt";
}
// If we're using raw uncorrected data
} else {
if (wTrueCut == 1.4) {
DataLocation += "anl82-numu-cc1ppip-14Wcut.txt";
} else if (wTrueCut == 1.6) {
DataLocation += "anl82-numu-cc1ppip-16Wcut.txt";
} else if (wTrueCut == 10.0) {
DataLocation += "anl82-numu-cc1ppip-noWcut.txt";
}
}
fSettings.SetDataInput(DataLocation);
FinaliseSampleSettings();
// Scaling Setup ---------------------------------------------------
// ScaleFactor automatically setup for DiffXSec/cm2/Nucleon
fScaleFactor = (GetEventHistogram()->Integral("width") * 1E-38 * 2.0 / 1.0 / (fNEvents + 0.));
// Plot Setup -------------------------------------------------------
SetDataFromTextFile( fSettings.GetDataInput() );
SetCovarFromDiagonal();
// Final setup ---------------------------------------------------
FinaliseMeasurement();
};
void ANL_CC1ppip_XSec_1DEnu_nu::FillEventVariables(FitEvent *event) {
if (event->NumFSParticle(2212) == 0 || event->NumFSParticle(211) == 0 || event->NumFSParticle(13) == 0) {
return;
}
TLorentzVector Pnu = event->GetNeutrinoIn()->fP;
TLorentzVector Pp = event->GetHMFSParticle(2212)->fP;
TLorentzVector Ppip = event->GetHMFSParticle(211)->fP;
TLorentzVector Pmu = event->GetHMFSParticle(13)->fP;
double hadMass = FitUtils::MpPi(Pp, Ppip);
double Enu = -1.0;
// ANL has a W cuts at 1.4, 1.6 and no w cut
// This is set by user, or defaults to 2.0
if (hadMass/1000. < wTrueCut) {
Enu = Pnu.E()/1.E3;
}
fXVar = Enu;
return;
}
bool ANL_CC1ppip_XSec_1DEnu_nu::isSignal(FitEvent *event) {
return SignalDef::isCC1pi3Prong(event, 14, 211, 2212, EnuMin, EnuMax);
}
diff --git a/src/Config/NuisConfig.cxx b/src/Config/NuisConfig.cxx
index 38ca696..c1d3915 100644
--- a/src/Config/NuisConfig.cxx
+++ b/src/Config/NuisConfig.cxx
@@ -1,817 +1,817 @@
// 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 .
*******************************************************************************/
#include "NuisConfig.h"
#include "FitLogger.h"
#include "GeneralUtils.h"
#include "TXMLEngine.h"
namespace Config {
nuisconfig &Get() { return nuisconfig::GetConfig(); };
std::string GetPar(std::string const &name) { return Get().GetConfig(name); }
bool HasPar(std::string const &name) { return Get().HasConfig(name); }
std::string GetParS(std::string const &name) { return Get().GetConfigS(name); }
int GetParI(std::string const &name) { return Get().GetConfigI(name); }
bool GetParB(std::string const &name) { return Get().GetConfigB(name); }
float GetParF(std::string const &name) { return Get().GetConfigF(name); }
double GetParD(std::string const &name) { return Get().GetConfigD(name); }
void SetPar(std::string const &name, std::string const &val) {
Get().SetConfig(name, val);
}
void SetPar(std::string const &name, char const *val) {
Get().SetConfig(name, val);
}
void SetPar(std::string const &name, bool val) { Get().SetConfig(name, val); }
void SetPar(std::string const &name, int val) { Get().SetConfig(name, val); }
void SetPar(std::string const &name, float val) { Get().SetConfig(name, val); }
void SetPar(std::string const &name, double val) { Get().SetConfig(name, val); }
}
namespace FitPar {
std::string GetDataBase() { return GeneralUtils::GetTopLevelDir() + "/data/"; };
nuisconfig &Config() { return Config::Get(); };
}
nuisconfig *nuisconfig::m_nuisconfigInstance = NULL;
nuisconfig &nuisconfig::GetConfig(void) {
if (!m_nuisconfigInstance) m_nuisconfigInstance = new nuisconfig;
return *m_nuisconfigInstance;
};
// Main Class Definition
nuisconfig::nuisconfig() {
// Load default Parameters
std::string filename =
(GeneralUtils::GetTopLevelDir() + "/parameters/config.xml");
std::cout << "[ NUISANCE ]: Loading DEFAULT settings from : " << filename;
// Create XML Engine
fXML = new TXMLEngine;
fXML->SetSkipComments(true);
// Load in documents
fXMLDocs.push_back(fXML->ParseFile(filename.c_str(), 1000000));
if (!fXMLDocs[0]) {
- THROW("Cannot Read Parameters File!");
+ NUIS_ABORT("Cannot Read Parameters File!");
}
// Setup Main XML Node to be the first file read
fMainNode = fXML->DocGetRootElement(fXMLDocs[0]);
// Print result
std::cout << " -> DONE." << std::endl;
}
nuisconfig::~nuisconfig() {
// Should really delete XML objects here but we don't
}
void nuisconfig::LoadSettings(std::string const &filename,
std::string const &state) {
// Open file and see if its XML
std::cout << "[ NUISANCE ]: Trying to parse file : " << filename;
StopTalking();
XMLDocPointer_t readdoc = fXML->ParseFile(filename.c_str(), 1000000);
StartTalking();
// If it is parse it as a nice XML config file
if (readdoc) {
std::cout << " -> Found XML file." << std::endl;
LoadXMLSettings(filename, state);
// Otherwise its an old simple card file
} else {
std::cout << " -> Assuming its a simple card file." << std::endl;
LoadCardSettings(filename, state);
}
}
void nuisconfig::LoadXMLSettings(std::string const &filename,
std::string const &state) {
std::cout << "[ NUISANCE ]: Loading XML settings from : " << filename
<< std::endl;
// Add new file to xml docs list
fXMLDocs.push_back(fXML->ParseFile(filename.c_str(), 1000000));
if (!fXMLDocs.back()) {
- THROW("Failed to read: " << filename);
+ NUIS_ABORT("Failed to read: " << filename);
}
// Loop over children and add
XMLNodePointer_t child =
fXML->GetChild(fXML->DocGetRootElement(fXMLDocs.back()));
// // Here we manually load all the children from the card file into our root
// node
if (!child) {
- THROW("CANNOT Find child inside settings file!");
+ NUIS_ABORT("CANNOT Find child inside settings file!");
}
while (child) {
// SPECIAL CONFIG CASE
// If its a config node, then remove previous attributes, overriding old
// value
if (!std::string(fXML->GetNodeName(child)).compare("config")) {
// Loop over attribues
XMLAttrPointer_t attr1 = fXML->GetFirstAttr(child);
while (attr1) {
// If a valid attribute name is given then compare
if (!GetConfigS(fXML->GetAttrName(attr1)).empty()) {
// Get full list of present configs
std::vector confignodes = GetNodes("config");
// Loop over present configs and compare
for (size_t i = 0; i < confignodes.size(); i++) {
// If we already have this config, free the old attribute
if (fXML->HasAttr(confignodes[i], fXML->GetAttrName(attr1))) {
fXML->FreeAttr(confignodes[i], fXML->GetAttrName(attr1));
break;
}
}
}
// Move onto next config attribute
attr1 = fXML->GetNextAttr(attr1);
}
}
TString nodeStr;
fXML->SaveSingleNode(child, &nodeStr);
XMLNodePointer_t copyNode = fXML->ReadSingleNode(nodeStr.Data());
// std::cout << "copying node..." << std::endl;
// PrintXML(copyNode);
// Add this child to the main config list
fXML->AddChild(fMainNode, copyNode);
// std::cout << "Done, was it added?" << std::endl;
// PrintXML(fMainNode);
// Get Next Child
child = fXML->GetNext(child);
}
std::cout << " -> DONE." << std::endl;
}
void nuisconfig::LoadCardSettings(std::string const &filename,
std::string const &state) {
std::cout << "[ NUISANCE ]: Loading simple config from : " << filename;
// Build XML Config from the card file by parsing each line
std::vector cardlines =
GeneralUtils::ParseFileToStr(filename, "\n");
int linecount = 0;
// Loop over all input lines
for (std::vector::iterator iter = cardlines.begin();
iter != cardlines.end(); iter++) {
std::string line = (*iter);
linecount++;
// Skip Comments
if (line.empty()) continue;
if (line.c_str()[0] == '#') continue;
// Parse whitespace
std::vector strvct = GeneralUtils::ParseToStr(line, " ");
if (strvct.empty()) continue;
// Get Identifier
std::string id = strvct[0];
// Build backwards compatible xml configs
// Sample structure
if (!id.compare("sample")) {
CreateSampleNodeFromLine(line);
}
// Any parameter structure
if (id.find("_parameter") != std::string::npos) {
CreateParameterNodeFromLine(line);
}
// Any covar structure
if (!id.compare("covar") || !id.compare("pull") || !id.compare("throw")) {
CreatePullNodeFromLine(line);
}
// Any config structure
if (!id.compare("config")) {
CreateOldConfigNodeFromLine(line);
}
}
std::cout << " -> DONE." << std::endl;
}
XMLNodePointer_t nuisconfig::CreateSampleNodeFromLine(std::string const &line) {
// Create new node entry
XMLNodePointer_t samplenode = CreateNode("sample");
// Parse line
std::vector strvct = GeneralUtils::ParseToStr(line, " ");
// Add line elements to the node
// name input type norm
if (strvct.size() > 1) Set(samplenode, "name", strvct[1]);
if (strvct.size() > 2) Set(samplenode, "input", strvct[2]);
if (strvct.size() > 3) Set(samplenode, "type", strvct[3]);
if (strvct.size() > 4) Set(samplenode, "norm", strvct[4]);
return samplenode;
}
XMLNodePointer_t nuisconfig::CreateParameterNodeFromLine(
std::string const &line) {
// Create new node entry
XMLNodePointer_t parnode = CreateNode("parameter");
// Parse line
std::vector strvct = GeneralUtils::ParseToStr(line, " ");
// Add line elements to the node
// type name nominal [low] [high] [step] state
if (strvct.size() > 0) Set(parnode, "type", strvct[0]);
if (strvct.size() > 1) Set(parnode, "name", strvct[1]);
if (strvct.size() > 2) Set(parnode, "nominal", strvct[2]);
// If free structure
if (strvct.size() == 7) {
Set(parnode, "low", strvct[3]);
Set(parnode, "high", strvct[4]);
Set(parnode, "step", strvct[5]);
Set(parnode, "state", strvct[6]);
// Fixed param structure
} else if (strvct.size() == 3) {
Set(parnode, "state", "FIX");
} else if (strvct.size() == 4) {
Set(parnode, "state", strvct[3]);
}
return parnode;
}
XMLNodePointer_t nuisconfig::CreatePullNodeFromLine(std::string const &line) {
// Create new node entry
XMLNodePointer_t parnode = CreateNode("covar");
// Parse line
std::vector strvct = GeneralUtils::ParseToStr(line, " ");
// Add line elements to the node
// name input type
if (strvct.size() > 1) Set(parnode, "name", strvct[1]);
if (strvct.size() > 2) Set(parnode, "input", strvct[2]);
if (strvct.size() > 3) Set(parnode, "type", strvct[3]);
return parnode;
}
XMLNodePointer_t nuisconfig::CreateOldConfigNodeFromLine(
std::string const &line) {
// Create new node entry
XMLNodePointer_t confignode = CreateNode("config");
// Parse line
std::vector strvct = GeneralUtils::ParseToStr(line, " ");
// Add line elements to the node
// name value
if (strvct.size() > 2) Set(confignode, strvct[1], strvct[2]);
return confignode;
}
void nuisconfig::FinaliseSettings(std::string const &name) {
std::cout << "[ NUISANCE ]: Finalising run settings";
WriteSettings(name);
// Save full config to file
RemoveEmptyNodes();
RemoveIdenticalNodes();
std::cout << " -> DONE." << std::endl;
}
void nuisconfig::WriteSettings(std::string const &outputname) {
// Create a New XML Doc
XMLDocPointer_t newxmldoc = fXML->NewDoc();
fXML->DocSetRootElement(newxmldoc, fMainNode);
// Save document to file
if (GetConfigB("SaveParsedXMLFile")) {
fXML->SaveDoc(newxmldoc, outputname.c_str());
}
}
void nuisconfig::PrintXML(XMLNodePointer_t node, int indent) {
if (!node) {
node = fMainNode;
}
std::stringstream ss("");
for (int i = 0; i < indent; ++i) {
ss << " ";
}
std::cout << ss.str() << "<" << fXML->GetNodeName(node) << std::flush;
XMLAttrPointer_t attr = fXML->GetFirstAttr(node);
while (attr) {
std::cout << " " << fXML->GetAttrName(attr) << "=\""
<< fXML->GetAttrValue(attr) << "\"" << std::flush;
attr = fXML->GetNextAttr(attr);
}
if (!fXML->GetChild(node)) {
std::cout << " />" << std::endl;
return;
}
std::cout << " >" << std::endl;
XMLNodePointer_t child = fXML->GetChild(node);
while (child) {
PrintXML(child, indent + 1);
child = fXML->GetNext(child);
}
std::cout << ss.str() << "" << fXML->GetNodeName(node) << ">" << std::endl;
}
XMLNodePointer_t nuisconfig::CreateNode(std::string const &name) {
return fXML->NewChild(fMainNode, 0, name.c_str());
}
XMLNodePointer_t nuisconfig::CreateNode(XMLNodePointer_t node,
std::string const &name) {
return fXML->NewChild(node, 0, name.c_str());
}
XMLNodePointer_t nuisconfig::GetNode(XMLNodePointer_t node,
std::string const &type) {
/// Loop over all children
XMLNodePointer_t child = fXML->GetChild(node);
while (child != 0) {
/// Get nodes for given type (if type empty return all)
if (std::string(fXML->GetNodeName(child)) == type.c_str() or type.empty()) {
return child;
}
// Next child
child = fXML->GetNext(child);
}
// Child not found
return 0;
}
void nuisconfig::RemoveEmptyNodes() {
std::vector nodelist = Config::Get().GetNodes();
for (size_t i = 0; i < nodelist.size(); i++) {
if (fXML->IsEmptyNode(nodelist[i])) {
std::cout << "Removing empty node: " << fXML->GetNodeName(nodelist[i])
<< ", with child ?" << bool(fXML->GetChild(nodelist[i]))
<< std::endl;
RemoveNode(nodelist[i]);
}
}
}
void nuisconfig::RemoveIdenticalNodes() {
std::vector removed;
// Loop over all nodes and check for identical nodes
std::vector nodelist = Config::Get().GetNodes();
for (size_t i = 0; i < nodelist.size(); i++) {
for (size_t j = 0; j < nodelist.size(); j++) {
if (i == j) continue;
XMLNodePointer_t node1 = nodelist[i];
XMLNodePointer_t node2 = nodelist[j];
// Check node already removed.
if (std::find(removed.begin(), removed.end(), node1) != removed.end()) {
continue;
}
if (std::find(removed.begin(), removed.end(), node2) != removed.end()) {
continue;
}
// Check matching
if (!MatchingNodes(node1, node2)) {
continue;
}
if (std::string(fXML->GetNodeName(node1)).compare("config") and
fXML->IsEmptyNode(node1)) {
// Matching so print out warning
std::cout << "Matching nodes given! Removing node1!" << std::endl
<< "Node 1" << std::endl;
PrintNode(node1);
std::cout << "Node 2" << std::endl;
PrintNode(node2);
}
// Remove node
removed.push_back(node1);
}
}
// Now go through and remove this node.
for (size_t i = 0; i < removed.size(); i++) {
RemoveNode(removed.at(i));
}
return;
}
void nuisconfig::RemoveNode(XMLNodePointer_t node) {
std::cout << "[INFO]: Removing node: " << fXML->GetNodeName(node)
<< std::endl;
fXML->FreeAllAttr(node);
fXML->CleanNode(node);
fXML->FreeNode(node);
fXML->UnlinkNode(node);
}
void nuisconfig::PrintNode(XMLNodePointer_t node) {
// Print Node Name
std::cout << fXML->GetNodeName(node) << std::endl;
// Loop and print all attributes
XMLAttrPointer_t attr = fXML->GetFirstAttr(node);
while (attr != 0) {
std::cout << " -> " << fXML->GetAttrName(attr) << " : "
<< fXML->GetAttrValue(attr) << std::endl;
attr = fXML->GetNextAttr(attr);
}
}
bool nuisconfig::MatchingNodes(XMLNodePointer_t node1, XMLNodePointer_t node2) {
bool matching = true;
XMLAttrPointer_t attr = fXML->GetFirstAttr(node1);
while (attr != 0) {
if (GetS(node2, fXML->GetAttrName(attr)) != fXML->GetAttrValue(attr))
matching = false;
attr = fXML->GetNextAttr(attr);
}
return matching;
}
XMLNodePointer_t nuisconfig::GetNode(std::string const &type) {
return GetNode(fMainNode, type);
}
std::vector nuisconfig::GetNodes(XMLNodePointer_t node,
std::string const &type) {
// Create new vector for nodes
std::vector nodelist;
/// Loop over all children
XMLNodePointer_t child = fXML->GetChild(node);
while (child != 0) {
/// Get nodes for given type (if type empty return all)
if (std::string(fXML->GetNodeName(child)) == type.c_str() or type.empty()) {
nodelist.push_back(child);
}
// Next child
child = fXML->GetNext(child);
}
// return list
return nodelist;
}
std::vector nuisconfig::GetNodes(std::string const &type) {
return GetNodes(fMainNode, type);
}
void nuisconfig::Set(XMLNodePointer_t node, std::string const &name,
std::string const &val) {
// Remove and re-add attribute
if (fXML->HasAttr(node, name.c_str())) {
fXML->FreeAttr(node, name.c_str());
}
fXML->NewAttr(node, 0, name.c_str(), val.c_str());
}
void nuisconfig::Set(XMLNodePointer_t node, std::string const &name,
char const *val) {
Set(node, name, std::string(val));
}
void nuisconfig::Set(XMLNodePointer_t node, std::string const &name, bool val) {
Set(node, name, GeneralUtils::BoolToStr(val));
}
void nuisconfig::Set(XMLNodePointer_t node, std::string const &name, int val) {
Set(node, name, GeneralUtils::IntToStr(val));
}
void nuisconfig::Set(XMLNodePointer_t node, std::string const &name,
float val) {
Set(node, name, GeneralUtils::DblToStr(val));
}
void nuisconfig::Set(XMLNodePointer_t node, std::string const &name,
double val) {
Set(node, name, GeneralUtils::DblToStr(val));
}
void nuisconfig::SetS(XMLNodePointer_t node, std::string const &name,
std::string const &val) {
Set(node, name, val);
}
void nuisconfig::SetB(XMLNodePointer_t node, std::string const &name,
bool val) {
Set(node, name, GeneralUtils::BoolToStr(val));
}
void nuisconfig::SetI(XMLNodePointer_t node, std::string const &name, int val) {
Set(node, name, GeneralUtils::IntToStr(val));
}
void nuisconfig::SetF(XMLNodePointer_t node, std::string const &name,
float val) {
Set(node, name, GeneralUtils::DblToStr(val));
}
void nuisconfig::SetD(XMLNodePointer_t node, std::string const &name,
double val) {
Set(node, name, GeneralUtils::DblToStr(val));
}
bool nuisconfig::Has(XMLNodePointer_t node, std::string const &name) {
// If node empty return empty
if (node == 0) return false;
// Search attributes
XMLAttrPointer_t attr = fXML->GetFirstAttr(node);
bool found = false;
// Loop over all attributes
while (attr != 0) {
// Find value of correct name
if (std::string(fXML->GetAttrName(attr)) == name.c_str()) {
found = true;
break;
}
// Next Attribute
attr = fXML->GetNextAttr(attr);
}
return found;
}
std::string nuisconfig::Get(XMLNodePointer_t node, std::string const &name) {
// If node empty return empty
if (node == 0) return "";
// Get Attribute from child with name
XMLAttrPointer_t attr = fXML->GetFirstAttr(node);
std::string temp = "";
// Loop over all attributes
while (attr != 0) {
// If valid match then save
if (std::string(fXML->GetAttrName(attr)) == name.c_str()) {
temp = fXML->GetAttrValue(attr);
}
// Next Attribute
attr = fXML->GetNextAttr(attr);
}
return temp;
}
std::string nuisconfig::GetS(XMLNodePointer_t node, std::string const &name) {
return Get(node, name);
}
bool nuisconfig::GetB(XMLNodePointer_t node, std::string const &name) {
std::string tempattr = Get(node, name);
return GeneralUtils::StrToBool(tempattr);
}
int nuisconfig::GetI(XMLNodePointer_t node, std::string const &name) {
std::string tempattr = Get(node, name);
return GeneralUtils::StrToInt(tempattr);
}
float nuisconfig::GetF(XMLNodePointer_t node, std::string const &name) {
std::string tempattr = Get(node, name);
return GeneralUtils::StrToDbl(tempattr);
}
double nuisconfig::GetD(XMLNodePointer_t node, std::string const &name) {
std::string tempattr = Get(node, name);
return GeneralUtils::StrToDbl(tempattr);
}
std::vector nuisconfig::GetVS(XMLNodePointer_t node,
std::string const &name,
const char *del) {
std::string tempattr = Get(node, name);
return GeneralUtils::ParseToStr(tempattr, del);
}
// std::vector nuisconfig::GetVB(XMLNodePointer_t node,
// std::string name,
// const char* del) {
// std::string tempattr = Get(node, name);
// return GeneralUtils::ParseToBool(tempattr, del);
// }
std::vector nuisconfig::GetVI(XMLNodePointer_t node,
std::string const &name, const char *del) {
std::string tempattr = Get(node, name);
return GeneralUtils::ParseToInt(tempattr, del);
}
// std::vector nuisconfig::GetVF(XMLNodePointer_t node,
// std::string name,
// const char* del) {
// std::string tempattr = Get(node, name);
// return GeneralUtils::ParseToDouble(tempattr, del);
// }
std::vector nuisconfig::GetVD(XMLNodePointer_t node,
std::string const &name,
char const *del) {
std::string tempattr = Get(node, name);
return GeneralUtils::ParseToDbl(tempattr, del);
}
std::vector nuisconfig::GetAllKeysForNode(XMLNodePointer_t node) {
//bool matching = true;
XMLAttrPointer_t attr = fXML->GetFirstAttr(node);
std::vector keys;
while (attr != 0) {
if (!std::string(fXML->GetAttrName(attr)).empty()) {
keys.push_back(std::string(fXML->GetAttrName(attr)));
}
attr = fXML->GetNextAttr(attr);
}
return keys;
}
XMLNodePointer_t nuisconfig::GetConfigNode(std::string const &name) {
// Loop over children and look for name
XMLNodePointer_t child = fXML->GetChild(fMainNode);
while (child != 0) {
// Select only config parameters
if (!std::string(fXML->GetNodeName(child)).compare("config")) {
// Loop over config attributes and search for name
XMLAttrPointer_t attr = fXML->GetFirstAttr(child);
while (attr != 0) {
// Save name value
if (std::string(fXML->GetAttrName(attr)) == name.c_str()) {
return child;
}
// Get Next Attribute
attr = fXML->GetNextAttr(attr);
}
}
// Next Child
child = fXML->GetNext(child);
}
return 0;
}
void nuisconfig::SetConfig(std::string const &name, std::string const &val) {
XMLNodePointer_t node = GetConfigNode(name);
if (!node) node = CreateNode("config");
Set(node, name, val);
}
void nuisconfig::SetConfig(std::string const &name, char const *val) {
SetConfig(name, std::string(val));
}
void nuisconfig::SetConfig(std::string const &name, bool val) {
XMLNodePointer_t node = GetConfigNode(name);
if (!node) node = CreateNode("config");
Set(node, name, val);
}
void nuisconfig::SetConfig(std::string const &name, int val) {
XMLNodePointer_t node = GetConfigNode(name);
if (!node) node = CreateNode("config");
Set(node, name, val);
}
void nuisconfig::SetConfig(std::string const &name, float val) {
XMLNodePointer_t node = GetConfigNode(name);
if (!node) node = CreateNode("config");
Set(node, name, val);
}
void nuisconfig::SetConfig(std::string const &name, double val) {
XMLNodePointer_t node = GetConfigNode(name);
if (!node) node = CreateNode("config");
Set(node, name, val);
}
void nuisconfig::OverrideConfig(std::string const &conf) {
std::vector opts = GeneralUtils::ParseToStr(conf, "=");
SetConfig(opts[0], opts[1]);
}
std::string nuisconfig::GetConfig(std::string const &name) {
XMLNodePointer_t node = GetConfigNode(name);
if (!node) return "";
XMLAttrPointer_t attr = fXML->GetFirstAttr(node);
std::string temp = "";
// Loop config attributes
while (attr != 0) {
// Find match
if (std::string(fXML->GetAttrName(attr)) == name.c_str()) {
temp = fXML->GetAttrValue(attr);
}
// Get Next Attribute
attr = fXML->GetNextAttr(attr);
}
return temp;
}
bool nuisconfig::HasConfig(std::string const &name) {
return bool(GetConfigNode(name));
}
std::string nuisconfig::GetConfigS(std::string const &name) {
return GetConfig(name);
}
bool nuisconfig::GetConfigB(std::string const &name) {
std::string pars = GetConfig(name);
return GeneralUtils::StrToBool(pars);
}
int nuisconfig::GetConfigI(std::string const &name) {
std::string pars = GetConfig(name);
return GeneralUtils::StrToInt(pars);
}
float nuisconfig::GetConfigF(std::string const &name) {
std::string pars = GetConfig(name);
return GeneralUtils::StrToDbl(pars);
}
double nuisconfig::GetConfigD(std::string const &name) {
std::string pars = GetConfig(name);
return GeneralUtils::StrToDbl(pars);
}
std::string nuisconfig::GetParDIR(std::string const &parName) {
std::string outstr = this->GetParS(parName);
// Make replacements in the string
const int nfiletypes = 2;
const std::string filetypes[nfiletypes] = {"@data", "@nuisance"};
std::string filerepl[nfiletypes] = {FitPar::GetDataBase(),
FitPar::GetDataBase() + "/../"};
for (int i = 0; i < nfiletypes; i++) {
std::string findstring = filetypes[i];
std::string replstring = filerepl[i];
if (outstr.find(findstring) != std::string::npos) {
outstr.replace(outstr.find(findstring), findstring.size(), filerepl[i]);
break;
}
}
return outstr;
};
diff --git a/src/Electron/ElectronScattering_DurhamData.cxx b/src/Electron/ElectronScattering_DurhamData.cxx
index 7e7b616..7d8cf8c 100644
--- a/src/Electron/ElectronScattering_DurhamData.cxx
+++ b/src/Electron/ElectronScattering_DurhamData.cxx
@@ -1,486 +1,483 @@
// 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 .
*******************************************************************************/
#include "ElectronScattering_DurhamData.h"
//********************************************************************
ElectronScattering_DurhamData::ElectronScattering_DurhamData(
nuiskey samplekey) {
//********************************************************************
// Sample overview ---------------------------------------------------
std::string descrip =
"Electron Scattering Durham Data sample. \n"
"Target: Multiple \n"
"Flux: Energy should match data being handled \n"
"Signal: Any event with an electron in the final state \n";
fSettings = LoadSampleSettings(samplekey);
fSettings.SetDescription(descrip);
fSettings.DefineAllowedSpecies("electron");
fSettings.SetTitle("Electron");
fSettings.SetAllowedTypes("FIX/DIAG", "FIX,FREE,SHAPE/DIAG/NORM/MASK");
fSettings.SetXTitle("q0");
fSettings.SetYTitle("#sigma");
fIsNoWidth = true;
FinaliseSampleSettings();
// Plot Setup -------------------------------------------------------
SetDataFromName(fSettings.GetS("originalname"));
SetCovarFromDiagonal();
// Scaling Setup ---------------------------------------------------
// ScaleFactor automatically setup for DiffXSec/cm2/Nucleon
// fScaleFactor = ((GetEventHistogram()->Integral("width") * 1E-38 / (fNEvents
// + 0.)) / TotalIntegratedFlux());
EnuMin = fZLowLim;
EnuMax = fZHighLim;
double sigscale = GetEventHistogram()->Integral() * 1E-38 / double(fNEvents) /
TotalIntegratedFlux();
// double dangle = 2 * M_PI * fabs((1. - cos(fYLowLim * M_PI / 180.)) - (1. -
// cos(fYHighLim * M_PI / 180.)));
// fScaleFactor = sigscale / dangle / fZCenter;
fScaleFactor = sigscale;
std::cout << "Event Integral = " << GetEventHistogram()->Integral()
<< std::endl;
std::cout << "Flux Integral = " << TotalIntegratedFlux() << std::endl;
std::cout << "FNEvents = " << fNEvents << std::endl;
std::cout << "Z Limits = " << fZLowLim << " " << fZHighLim << std::endl;
std::cout << "sigscale = " << sigscale << std::endl;
std::cout << "fZCenter = " << fZCenter << std::endl;
std::cout << "ScaleFactor = " << fScaleFactor << std::endl;
// Finish up
FinaliseMeasurement();
};
//********************************************************************
void ElectronScattering_DurhamData::SetDataFromName(std::string name) {
//********************************************************************
// Data Should be given in the format
// Electron_Z_A_Energy_Theta_Source
std::vector splitstring = GeneralUtils::ParseToStr(name, "_");
std::string zstring = splitstring[1];
std::string astring = splitstring[2];
std::string estring = splitstring[3];
std::string tstring = splitstring[4];
std::string sstring = splitstring[5];
fYCenter = GeneralUtils::StrToDbl(tstring);
fZCenter = GeneralUtils::StrToDbl(estring);
// Create effective E and Theta bin Edges
std::vector thetabinedges;
std::vector ebinedges;
int nthetabins = FitPar::Config().GetParI("Electron_NThetaBins");
int nebins = FitPar::Config().GetParI("Electron_NEnergyBins");
double thetawidth = FitPar::Config().GetParD("Electron_ThetaWidth");
double ewidth = FitPar::Config().GetParD("Electron_EnergyWidth");
for (int i = -nthetabins; i <= nthetabins; i++) {
thetabinedges.push_back(fYCenter + thetawidth * (double(i)));
}
for (int i = -nebins; i <= nebins; i++) {
double newval = fZCenter + ewidth * (double(i));
if (newval < 0.0) newval = 0.0;
if (newval < GetEventHistogram()->GetXaxis()->GetXmin())
newval = GetEventHistogram()->GetXaxis()->GetXmin();
if (newval > GetEventHistogram()->GetXaxis()->GetXmax())
newval = GetEventHistogram()->GetXaxis()->GetXmax();
if (std::find(ebinedges.begin(), ebinedges.end(), newval) !=
ebinedges.end())
continue;
ebinedges.push_back(newval);
}
// Determine target
std::string target = "";
if (!zstring.compare("6") && !astring.compare("12"))
target = "12C.dat";
else if (!zstring.compare("8") && !astring.compare("16"))
target = "16O.dat";
else {
- ERR(FTL) << "Target not supported in electron scattering module!"
- << std::endl;
- throw;
+ NUIS_ABORT("Target not supported in electron scattering module!"
+ );
}
// Fill Data Points
std::string line;
std::ifstream mask((FitPar::GetDataBase() + "/Electron/" + target).c_str(),
std::ifstream::in);
if (!mask.good()) {
- ERR(FTL) << "Failed to open e-scattering database file: "
- << (FitPar::GetDataBase() + "/Electron/" + target) << std::endl;
- throw;
+ NUIS_ABORT("Failed to open e-scattering database file: "
+ << (FitPar::GetDataBase() + "/Electron/" + target));
}
int i = 0;
std::vector pointx;
std::vector errorx;
std::vector pointy;
std::vector errory;
double scalef = 1.E-38 * 1.E5;
while (std::getline(mask >> std::ws, line, '\n')) {
// std::cout << "Line = " << line << std::endl;
if (line.empty()) continue;
std::vector lineentries = GeneralUtils::ParseToStr(line, " ");
// std::cout << "Checking : " << line << std::endl;
if (zstring.compare(lineentries[0])) continue;
if (astring.compare(lineentries[1])) continue;
if (estring.compare(lineentries[2])) continue;
if (tstring.compare(lineentries[3])) continue;
if (sstring.compare(lineentries[7])) continue;
// std::cout << "Registering data point : " << line << std::endl;
// std::cout << "Adding Graph Point : " <<
// GeneralUtils::StrToDbl(lineentries[4]) << " " <<
// GeneralUtils::StrToDbl(lineentries[5]) << std::endl;
// Loop through x and y points and find a place to insert
if (pointx.empty()) {
pointx.push_back(GeneralUtils::StrToDbl(lineentries[4]));
errorx.push_back(0.0);
pointy.push_back(GeneralUtils::StrToDbl(lineentries[5]) * scalef);
errory.push_back(GeneralUtils::StrToDbl(lineentries[6]) * scalef);
} else {
for (size_t j = 0; j < pointx.size(); j++) {
if (GeneralUtils::StrToDbl(lineentries[4]) < pointx[j] && j == 0) {
// std::cout << "Inserting at start point iterator " << std::endl;
pointx.insert(pointx.begin() + j,
GeneralUtils::StrToDbl(lineentries[4]));
errorx.insert(errorx.begin() + j, 0.0);
pointy.insert(pointy.begin() + j,
GeneralUtils::StrToDbl(lineentries[5]) * scalef);
errory.insert(errory.begin() + j,
GeneralUtils::StrToDbl(lineentries[6]) * scalef);
break;
} else if (GeneralUtils::StrToDbl(lineentries[4]) > pointx[j] &&
j == pointx.size() - 1) {
// std::cout << "Pushing back data point " << std::endl;
pointx.push_back(GeneralUtils::StrToDbl(lineentries[4]));
errorx.push_back(0.0);
pointy.push_back(GeneralUtils::StrToDbl(lineentries[5]) * scalef);
errory.push_back(GeneralUtils::StrToDbl(lineentries[6]) * scalef);
break;
} else if (GeneralUtils::StrToDbl(lineentries[4]) > pointx[j - 1] &&
GeneralUtils::StrToDbl(lineentries[4]) < pointx[j]) {
// std::cout << "Inserting at point iterator = " << j << std::endl;
pointx.insert(pointx.begin() + j,
GeneralUtils::StrToDbl(lineentries[4]));
errorx.insert(errorx.begin() + j, 0.0);
pointy.insert(pointy.begin() + j,
GeneralUtils::StrToDbl(lineentries[5]) * scalef);
errory.insert(errory.begin() + j,
GeneralUtils::StrToDbl(lineentries[6]) * scalef);
break;
}
}
}
// pointx.push_back(GeneralUtils::StrToDbl(lineentries[4]));
// errorx.push_back(0.0);
// pointy.push_back(GeneralUtils::StrToDbl(lineentries[5]));
// errory.push_back(GeneralUtils::StrToDbl(lineentries[6]));
i++;
}
if (!pointx.size() || (pointx.size() != errorx.size()) || !pointy.size() ||
(pointy.size() != errory.size())) {
- ERR(FTL) << "Failed to find dataset: " << name << "{"
+ NUIS_ABORT("Failed to find dataset: " << name << "{"
<< "Z: " << zstring << ", A: " << astring << ", E: " << estring
<< ", CTheta: " << tstring << ", PubID: " << sstring
<< " } in file: "
- << (FitPar::GetDataBase() + "/Electron/" + target) << std::endl;
- throw;
+ << (FitPar::GetDataBase() + "/Electron/" + target));
}
// for (uint i = 0; i < pointx.size(); i++) {
// std::cout << "Q0 Point " << i << " = " << pointx[i] << std::endl;
// }
fDataGraph = new TGraphErrors(pointx.size(), &pointx[0], &pointy[0],
&errorx[0], &errory[0]);
fDataGraph->SetNameTitle((fName + "_data_GRAPH").c_str(),
(fName + "_data_GRAPH").c_str());
// Now form an effective data and mc histogram
std::vector q0binedges;
const double* x = fDataGraph->GetX();
// Loop over graph and get mid way point between each data point.
for (int i = 0; i < fDataGraph->GetN(); i++) {
// std::cout << "X Point = " << x[i] << std::endl;
if (i == 0) {
// First point set lower width as half distance to point above
q0binedges.push_back(x[0] - ((x[1] - x[0]) / 2.0));
} else if (i == fDataGraph->GetN() - 1) {
// Last point set upper width as half distance to point above.
q0binedges.push_back(x[i] - ((x[i] - x[i - 1]) / 2.0));
q0binedges.push_back(x[i] + ((x[i] - x[i - 1]) / 2.0));
} else {
// Set half distance to point below
q0binedges.push_back(x[i] - ((x[i] - x[i - 1]) / 2.0));
}
}
// Bubble Sort
// for (uint i = 0; i < q0binedges.size(); i++) {
// std::cout << "Q0 Edge " << i << " = " << q0binedges[i] << std::endl;
// }
// for (uint i = 0; i < ebinedges.size(); i++) {
// std::cout << "e Edge " << i << " = " << ebinedges[i] << std::endl;
// }
// for (uint i = 0; i < thetabinedges.size(); i++) {
// std::cout << "theta Edge " << i << " = " << thetabinedges[i] <<
// std::endl;
// }
// Form the data hist, mchist, etc
fDataHist = new TH1D((fName + "_data").c_str(), (fName + "_data").c_str(),
q0binedges.size() - 1, &q0binedges[0]);
fMCHist = (TH1D*)fDataHist->Clone("MC");
const double* y = fDataGraph->GetY();
const double* ey = fDataGraph->GetEY();
for (int i = 0; i < fDataGraph->GetN(); i++) {
// std::cout << "Setting Data Bin " << i + 1 << " to " << y[i] << " +- " <<
// ey[i] << std::endl;
fDataHist->SetBinContent(i + 1, y[i]);
fDataHist->SetBinError(i + 1, ey[i]);
fMCHist->SetBinContent(i + 1, 0.0);
fMCHist->SetBinError(i + 1, 0.0);
}
fMCScan_Q0vsThetavsE =
new TH3D((fName + "_MC_q0vsthetavse").c_str(), "MC_q0vsthetavse",
q0binedges.size() - 1, &q0binedges[0], thetabinedges.size() - 1,
&thetabinedges[0], ebinedges.size() - 1, &ebinedges[0]);
fMCScan_Q0vsThetavsE->Reset();
fMCScan_Q0vsTheta = new TH2D(
(fName + "_MC_q0vstheta").c_str(), "MC_q0vstheta", q0binedges.size() - 1,
&q0binedges[0], thetabinedges.size() - 1, &thetabinedges[0]);
fMCScan_Q0vsTheta->Reset();
fMCScan_Q0vsE =
new TH2D((fName + "_MC_q0vse").c_str(), "MC_q0vse", q0binedges.size() - 1,
&q0binedges[0], ebinedges.size() - 1, &ebinedges[0]);
fMCScan_Q0vsE->Reset();
fXLowLim = fMCScan_Q0vsThetavsE->GetXaxis()->GetBinLowEdge(1);
fXHighLim = fMCScan_Q0vsThetavsE->GetXaxis()->GetBinLowEdge(
fMCScan_Q0vsThetavsE->GetNbinsX() + 2);
fYLowLim = fMCScan_Q0vsThetavsE->GetYaxis()->GetBinLowEdge(1);
fYHighLim = fMCScan_Q0vsThetavsE->GetYaxis()->GetBinLowEdge(
fMCScan_Q0vsThetavsE->GetNbinsY() + 2);
fZLowLim = fMCScan_Q0vsThetavsE->GetZaxis()->GetBinLowEdge(1);
fZHighLim = fMCScan_Q0vsThetavsE->GetZaxis()->GetBinLowEdge(
fMCScan_Q0vsThetavsE->GetNbinsZ() + 2);
std::cout << "Sample " << name << "initialised: "
<< "{" << fXLowLim << "--" << fXHighLim << ", " << fYLowLim << "--"
<< fYHighLim << ", " << fZLowLim << "--" << fZHighLim << "}"
<< std::endl;
}
//********************************************************************
void ElectronScattering_DurhamData::FillEventVariables(FitEvent* event) {
//********************************************************************
if (event->NumFSParticle(11) == 0) return;
FitParticle* ein = event->PartInfo(0);
FitParticle* eout = event->GetHMFSParticle(11);
double q0 = fabs(ein->fP.E() - eout->fP.E()) / 1000.0;
double E = ein->fP.E() / 1000.0;
double theta = ein->fP.Vect().Angle(eout->fP.Vect()) * 180. / M_PI;
fXVar = q0;
fYVar = theta;
fZVar = E;
return;
};
//********************************************************************
bool ElectronScattering_DurhamData::isSignal(FitEvent* event) {
//********************************************************************
if (event->NumFSParticle(11) == 0) {
std::cout << "Ev Cut due to no FS electron." << std::endl;
return false;
}
// std::cout << "fXVar = " << fXVar << " " << fXLowLim << " " << fXHighLim <<
// std::endl;
// std::cout << "fYVar = " << fYVar << " " << fYLowLim << " " << fYHighLim <<
// std::endl;
// std::cout << "fZVar = " << fZVar << " " << fZLowLim << " " << fZHighLim <<
// std::endl;
// std::cout << "iWeight: " << event->InputWeight << std::endl;
if (fXVar < fXLowLim or fXVar > fXHighLim) {
// std::cout << "Ev Cut due to X lims: " << fXLowLim << " -- " << fXHighLim
// << " !<> " << fXVar << std::endl;
return false;
}
if (fYVar < fYLowLim or fYVar > fYHighLim) {
// std::cout << "Ev Cut due to Y lims: " << fYLowLim << " -- " << fYHighLim
// << " !<> " << fXVar << std::endl;
return false;
}
if (fZVar < fZLowLim or fZVar > fZHighLim) {
// std::cout << "Ev Cut due to Z lims: " << fZLowLim << " -- " << fZHighLim
// << " !<> " << fXVar << std::endl;
return false;
}
return true;
};
//********************************************************************
void ElectronScattering_DurhamData::FillHistograms() {
//********************************************************************
Measurement1D::FillHistograms();
if (Signal) {
fMCScan_Q0vsThetavsE->Fill(fXVar, fYVar, fZVar);
fMCScan_Q0vsTheta->Fill(fXVar, fYVar);
fMCScan_Q0vsE->Fill(fXVar, fZVar);
}
}
// Weight = 1.0;
// if (Signal) {
// fMCHist->Fill(fXVar, Weight);
// fMCFine->Fill(fXVar, Weight);
// fMCStat->Fill(fXVar, 1.0);
// if (fMCHist_Modes) fMCHist_Modes->Fill(Mode, fXVar, Weight);
// }
// }
void ElectronScattering_DurhamData::ResetAll() {
Measurement1D::ResetAll();
fMCScan_Q0vsThetavsE->Reset();
fMCScan_Q0vsTheta->Reset();
fMCScan_Q0vsE->Reset();
}
void ElectronScattering_DurhamData::ApplyNormScale(double norm) {
Measurement1D::ApplyNormScale(norm);
fMCScan_Q0vsThetavsE->Scale(1.0 / norm);
fMCScan_Q0vsTheta->Scale(1.0 / norm);
fMCScan_Q0vsE->Scale(1.0 / norm);
}
//********************************************************************
void ElectronScattering_DurhamData::ScaleEvents() {
//********************************************************************
Measurement1D::ScaleEvents();
/*
fMCScan_Q0vsThetavsE->Scale(fScaleFactor, "width");
// Project into fMCScan_Q0vsTheta
for (int x = 0; x < fMCScan_Q0vsThetavsE->GetNbinsX(); x++) {
for (int y = 0; y < fMCScan_Q0vsThetavsE->GetNbinsY(); y++) {
double total = 0.;
for (int z = 0; z < fMCScan_Q0vsThetavsE->GetNbinsZ(); z++) {
double zwidth = fMCScan_Q0vsThetavsE->GetZaxis()->GetBinWidth(z + 1);
total += fMCScan_Q0vsThetavsE->GetBinContent(x + 1, y + 1, z + 1) *
zwidth;
}
fMCScan_Q0vsTheta->SetBinContent(x + 1, y + 1, total);
}
}
// Project into fMCScan_Q0vsE
for (int x = 0; x < fMCScan_Q0vsThetavsE->GetNbinsX(); x++) {
for (int z = 0; z < fMCScan_Q0vsThetavsE->GetNbinsZ(); z++) {
double total = 0.;
for (int y = 0; y < fMCScan_Q0vsThetavsE->GetNbinsY(); y++) {
double ywidth = fMCScan_Q0vsThetavsE->GetYaxis()->GetBinWidth(y + 1);
total += fMCScan_Q0vsThetavsE->GetBinContent(x + 1, y + 1, z + 1) *
ywidth;
}
fMCScan_Q0vsE->SetBinContent(x + 1, z + 1, total);
}
}
// Project fMCScan_Q0vsTheta into MC Hist
for (int x = 0; x < fMCScan_Q0vsTheta->GetNbinsX(); x++) {
double total = 0.;
for (int y = 0; y < fMCScan_Q0vsTheta->GetNbinsY(); y++) {
double ywidth = fMCScan_Q0vsTheta->GetYaxis()->GetBinWidth(y + 1);
total += fMCScan_Q0vsTheta->GetBinContent(x + 1, y + 1);
}
double xwidth = fMCScan_Q0vsTheta->GetXaxis()->GetBinWidth(x + 1);
fMCHist->SetBinContent(x + 1, total * xwidth);
}
fMCHist->Scale(fDataHist->Integral() / fMCHist->Integral());
*/
}
//********************************************************************
int ElectronScattering_DurhamData::GetNDOF() {
//********************************************************************
return fDataGraph->GetN();
}
void ElectronScattering_DurhamData::Write(std::string drawOpts) {
Measurement1D::Write(drawOpts);
fMCScan_Q0vsThetavsE->Write();
fMCScan_Q0vsTheta->Write();
fMCScan_Q0vsE->Write();
fDataGraph->Write();
}
double ElectronScattering_DurhamData::GetLikelihood() { return 0.0; }
void ElectronScattering_DurhamData::SetFitOptions(std::string opt) { return; }
TH1D* ElectronScattering_DurhamData::GetMCHistogram(void) { return fMCHist; }
TH1D* ElectronScattering_DurhamData::GetDataHistogram(void) {
return fDataHist;
}
diff --git a/src/FCN/JointFCN.cxx b/src/FCN/JointFCN.cxx
index fcd5fac..64d00b6 100755
--- a/src/FCN/JointFCN.cxx
+++ b/src/FCN/JointFCN.cxx
@@ -1,1126 +1,1123 @@
#include "JointFCN.h"
#include "FitUtils.h"
#include
//***************************************************
JointFCN::JointFCN(TFile *outfile) {
//***************************************************
fOutputDir = gDirectory;
if (outfile)
Config::Get().out = outfile;
std::vector samplekeys = Config::QueryKeys("sample");
LoadSamples(samplekeys);
std::vector covarkeys = Config::QueryKeys("covar");
LoadPulls(covarkeys);
fCurIter = 0;
fMCFilled = false;
fIterationTree = false;
fDialVals = NULL;
fNDials = 0;
fUsingEventManager = FitPar::Config().GetParB("EventManager");
fOutputDir->cd();
}
//***************************************************
JointFCN::JointFCN(std::vector samplekeys, TFile *outfile) {
//***************************************************
fOutputDir = gDirectory;
if (outfile)
Config::Get().out = outfile;
LoadSamples(samplekeys);
fCurIter = 0;
fMCFilled = false;
fOutputDir->cd();
fIterationTree = false;
fDialVals = NULL;
fNDials = 0;
fUsingEventManager = FitPar::Config().GetParB("EventManager");
fOutputDir->cd();
}
//***************************************************
JointFCN::~JointFCN() {
//***************************************************
// Delete Samples
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
delete exp;
}
for (PullListConstIter iter = fPulls.begin(); iter != fPulls.end(); iter++) {
ParamPull *pull = *iter;
delete pull;
}
// Sort Tree
if (fIterationTree)
DestroyIterationTree();
if (fDialVals)
delete fDialVals;
if (fSampleLikes)
delete fSampleLikes;
};
//***************************************************
void JointFCN::CreateIterationTree(std::string name, FitWeight *rw) {
//***************************************************
- LOG(FIT) << " Creating new iteration container! " << std::endl;
+ NUIS_LOG(FIT, " Creating new iteration container! ");
DestroyIterationTree();
fIterationTreeName = name;
// Add sample likelihoods and ndof
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
std::string name = exp->GetName();
std::string liketag = name + "_likelihood";
fNameValues.push_back(liketag);
fCurrentValues.push_back(0.0);
std::string ndoftag = name + "_ndof";
fNameValues.push_back(ndoftag);
fCurrentValues.push_back(0.0);
}
// Add Pull terms
for (PullListConstIter iter = fPulls.begin(); iter != fPulls.end(); iter++) {
ParamPull *pull = *iter;
std::string name = pull->GetName();
std::string liketag = name + "_likelihood";
fNameValues.push_back(liketag);
fCurrentValues.push_back(0.0);
std::string ndoftag = name + "_ndof";
fNameValues.push_back(ndoftag);
fCurrentValues.push_back(0.0);
}
// Add Likelihoods
fNameValues.push_back("total_likelihood");
fCurrentValues.push_back(0.0);
fNameValues.push_back("total_ndof");
fCurrentValues.push_back(0.0);
// Setup Containers
fSampleN = fSamples.size() + fPulls.size();
fSampleLikes = new double[fSampleN];
fSampleNDOF = new int[fSampleN];
// Add Dials
std::vector dials = rw->GetDialNames();
for (size_t i = 0; i < dials.size(); i++) {
fNameValues.push_back(dials[i]);
fCurrentValues.push_back(0.0);
}
fNDials = dials.size();
fDialVals = new double[fNDials];
// Set IterationTree Flag
fIterationTree = true;
}
//***************************************************
void JointFCN::DestroyIterationTree() {
//***************************************************
fIterationCount.clear();
fCurrentValues.clear();
fNameValues.clear();
fIterationValues.clear();
}
//***************************************************
void JointFCN::WriteIterationTree() {
//***************************************************
- LOG(FIT) << "Writing iteration tree" << std::endl;
+ NUIS_LOG(FIT, "Writing iteration tree");
// Make a new TTree
TTree *itree =
new TTree(fIterationTreeName.c_str(), fIterationTreeName.c_str());
double *vals = new double[fNameValues.size()];
int count = 0;
itree->Branch("iteration", &count, "Iteration/I");
for (size_t i = 0; i < fNameValues.size(); i++) {
itree->Branch(fNameValues[i].c_str(), &vals[i],
(fNameValues[i] + "/D").c_str());
}
// Fill Iterations
for (size_t i = 0; i < fIterationValues.size(); i++) {
std::vector itervals = fIterationValues[i];
// Fill iteration state
count = fIterationCount[i];
for (size_t j = 0; j < itervals.size(); j++) {
vals[j] = itervals[j];
}
// Save to TTree
itree->Fill();
}
// Write to file
itree->Write();
}
//***************************************************
void JointFCN::FillIterationTree(FitWeight *rw) {
//***************************************************
// Loop over samples count
int count = 0;
for (int i = 0; i < fSampleN; i++) {
fCurrentValues[count++] = fSampleLikes[i];
fCurrentValues[count++] = double(fSampleNDOF[i]);
}
// Fill Totals
fCurrentValues[count++] = fLikelihood;
fCurrentValues[count++] = double(fNDOF);
// Loop Over Parameter Counts
rw->GetAllDials(fDialVals, fNDials);
for (int i = 0; i < fNDials; i++) {
fCurrentValues[count++] = double(fDialVals[i]);
}
// Push Back Into Container
fIterationCount.push_back(fCurIter);
fIterationValues.push_back(fCurrentValues);
}
//***************************************************
double JointFCN::DoEval(const double *x) {
//***************************************************
// WEIGHT ENGINE
fDialChanged = FitBase::GetRW()->HasRWDialChanged(x);
FitBase::GetRW()->UpdateWeightEngine(x);
if (fDialChanged) {
FitBase::GetRW()->Reconfigure();
FitBase::EvtManager().ResetWeightFlags();
}
if (LOG_LEVEL(REC)) {
FitBase::GetRW()->Print();
}
// SORT SAMPLES
ReconfigureSamples();
// GET TEST STAT
fLikelihood = GetLikelihood();
fNDOF = GetNDOF();
// PRINT PROGRESS
- LOG(FIT) << "Current Stat (iter. " << this->fCurIter << ") = " << fLikelihood
- << std::endl;
+ NUIS_LOG(FIT, "Current Stat (iter. " << this->fCurIter << ") = " << fLikelihood);
// UPDATE TREE
- if (fIterationTree) FillIterationTree(FitBase::GetRW());
+ if (fIterationTree)
+ FillIterationTree(FitBase::GetRW());
return fLikelihood;
}
//***************************************************
int JointFCN::GetNDOF() {
//***************************************************
int totaldof = 0;
int count = 0;
// Total number of Free bins in each MC prediction
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
int dof = exp->GetNDOF();
// Save Seperate DOF
if (fIterationTree) {
fSampleNDOF[count] = dof;
}
// Add to total
totaldof += dof;
count++;
}
// Loop over pulls
for (PullListConstIter iter = fPulls.begin(); iter != fPulls.end(); iter++) {
ParamPull *pull = *iter;
double dof = pull->GetLikelihood();
// Save seperate DOF
if (fIterationTree) {
fSampleNDOF[count] = dof;
}
// Add to total
totaldof += dof;
count++;
}
// Set Data Variable
if (fIterationTree) {
fSampleNDOF[count] = totaldof;
}
return totaldof;
}
//***************************************************
double JointFCN::GetLikelihood() {
//***************************************************
- LOG(MIN) << std::left << std::setw(43) << "Getting likelihoods..."
- << " : "
- << "-2logL" << std::endl;
+ NUIS_LOG(MIN, std::left << std::setw(43) << "Getting likelihoods..."
+ << " : "
+ << "-2logL");
// Loop and add up likelihoods in an uncorrelated way
double like = 0.0;
int count = 0;
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
double newlike = exp->GetLikelihood();
int ndof = exp->GetNDOF();
// Save seperate likelihoods
if (fIterationTree) {
fSampleLikes[count] = newlike;
}
- LOG(MIN) << "-> " << std::left << std::setw(40) << exp->GetName() << " : "
- << newlike << "/" << ndof << std::endl;
+ NUIS_LOG(MIN, "-> " << std::left << std::setw(40) << exp->GetName() << " : "
+ << newlike << "/" << ndof);
// Add Weight Scaling
// like *= FitBase::GetRW()->GetSampleLikelihoodWeight(exp->GetName());
// Add to total
like += newlike;
count++;
}
// Loop over pulls
for (PullListConstIter iter = fPulls.begin(); iter != fPulls.end(); iter++) {
ParamPull *pull = *iter;
double newlike = pull->GetLikelihood();
// Save seperate likelihoods
if (fIterationTree) {
fSampleLikes[count] = newlike;
}
// Add to total
like += newlike;
count++;
}
// Set Data Variable
fLikelihood = like;
if (fIterationTree) {
fSampleLikes[count] = fLikelihood;
}
return like;
};
void JointFCN::LoadSamples(std::vector samplekeys) {
- LOG(MIN) << "Loading Samples : " << samplekeys.size() << std::endl;
+ NUIS_LOG(MIN, "Loading Samples : " << samplekeys.size());
for (size_t i = 0; i < samplekeys.size(); i++) {
nuiskey key = samplekeys[i];
// Get Sample Options
std::string samplename = key.GetS("name");
std::string samplefile = key.GetS("input");
std::string sampletype = key.GetS("type");
std::string fakeData = "";
- LOG(MIN) << "Loading Sample : " << samplename << std::endl;
+ NUIS_LOG(MIN, "Loading Sample : " << samplename);
fOutputDir->cd();
MeasurementBase *NewLoadedSample = SampleUtils::CreateSample(key);
if (!NewLoadedSample) {
- ERR(FTL) << "Could not load sample provided: " << samplename << std::endl;
- ERR(FTL) << "Check spelling with that in src/FCN/SampleList.cxx"
- << std::endl;
+ NUIS_ERR(FTL, "Could not load sample provided: " << samplename);
+ NUIS_ERR(FTL, "Check spelling with that in src/FCN/SampleList.cxx");
throw;
} else {
fSamples.push_back(NewLoadedSample);
}
}
}
//***************************************************
void JointFCN::LoadPulls(std::vector pullkeys) {
//***************************************************
for (size_t i = 0; i < pullkeys.size(); i++) {
nuiskey key = pullkeys[i];
std::string pullname = key.GetS("name");
std::string pullfile = key.GetS("input");
std::string pulltype = key.GetS("type");
fOutputDir->cd();
fPulls.push_back(new ParamPull(pullname, pullfile, pulltype));
}
}
//***************************************************
void JointFCN::ReconfigureSamples(bool fullconfig) {
//***************************************************
int starttime = time(NULL);
- LOG(REC) << "Starting Reconfigure iter. " << this->fCurIter << std::endl;
+ NUIS_LOG(REC, "Starting Reconfigure iter. " << this->fCurIter);
// std::cout << fUsingEventManager << " " << fullconfig << " " << fMCFilled <<
// std::endl;
// Event Manager Reconf
if (fUsingEventManager) {
if (!fullconfig && fMCFilled)
ReconfigureFastUsingManager();
else
ReconfigureUsingManager();
} else {
// Loop over all Measurement Classes
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
// If RW Either do signal or full reconfigure.
if (fDialChanged or !fMCFilled or fullconfig) {
if (!fullconfig and fMCFilled)
exp->ReconfigureFast();
else
exp->Reconfigure();
// If RW Not needed just do normalisation
} else {
exp->Renormalise();
}
}
}
// Loop over pulls and update
for (PullListConstIter iter = fPulls.begin(); iter != fPulls.end(); iter++) {
ParamPull *pull = *iter;
pull->Reconfigure();
}
fMCFilled = true;
- LOG(MIN) << "Finished Reconfigure iter. " << fCurIter << " in "
- << time(NULL) - starttime << "s" << std::endl;
+ NUIS_LOG(MIN, "Finished Reconfigure iter. " << fCurIter << " in "
+ << time(NULL) - starttime << "s");
fCurIter++;
}
//***************************************************
void JointFCN::ReconfigureSignal() {
//***************************************************
ReconfigureSamples(false);
}
//***************************************************
void JointFCN::ReconfigureAllEvents() {
//***************************************************
FitBase::GetRW()->Reconfigure();
FitBase::EvtManager().ResetWeightFlags();
ReconfigureSamples(true);
}
std::vector JointFCN::GetInputList() {
std::vector InputList;
fIsAllSplines = true;
MeasListConstIter iterSam = fSamples.begin();
for (; iterSam != fSamples.end(); iterSam++) {
MeasurementBase *exp = (*iterSam);
std::vector subsamples = exp->GetSubSamples();
for (size_t i = 0; i < subsamples.size(); i++) {
InputHandlerBase *inp = subsamples[i]->GetInput();
if (std::find(InputList.begin(), InputList.end(), inp) ==
InputList.end()) {
if (subsamples[i]->GetInput()->GetType() != kSPLINEPARAMETER)
fIsAllSplines = false;
InputList.push_back(subsamples[i]->GetInput());
}
}
}
return InputList;
}
std::vector JointFCN::GetSubSampleList() {
std::vector SampleList;
MeasListConstIter iterSam = fSamples.begin();
for (; iterSam != fSamples.end(); iterSam++) {
MeasurementBase *exp = (*iterSam);
std::vector subsamples = exp->GetSubSamples();
for (size_t i = 0; i < subsamples.size(); i++) {
SampleList.push_back(subsamples[i]);
}
}
return SampleList;
}
//***************************************************
void JointFCN::ReconfigureUsingManager() {
//***************************************************
// 'Slow' Event Manager Reconfigure
- LOG(REC) << "Event Manager Reconfigure" << std::endl;
+ NUIS_LOG(REC, "Event Manager Reconfigure");
int timestart = time(NULL);
// Reset all samples
MeasListConstIter iterSam = fSamples.begin();
for (; iterSam != fSamples.end(); iterSam++) {
MeasurementBase *exp = (*iterSam);
exp->ResetAll();
}
// If we are siving signal, reset all containers.
bool savesignal = (FitPar::Config().GetParB("SignalReconfigures"));
if (savesignal) {
// Reset all of our event signal vectors
fSignalEventBoxes.clear();
fSignalEventFlags.clear();
fSampleSignalFlags.clear();
fSignalEventSplines.clear();
}
// Make sure we have a list of inputs
if (fInputList.empty()) {
fInputList = GetInputList();
fSubSampleList = GetSubSampleList();
}
// If all inputs are splines make sure the readers are told
// they need to be reconfigured.
std::vector::iterator inp_iter = fInputList.begin();
if (fIsAllSplines) {
for (; inp_iter != fInputList.end(); inp_iter++) {
InputHandlerBase *curinput = (*inp_iter);
// Tell reader in each BaseEvent it needs a Reconfigure next weight calc.
BaseFitEvt *curevent = curinput->FirstBaseEvent();
if (curevent->fSplineRead) {
curevent->fSplineRead->SetNeedsReconfigure(true);
}
}
}
// MAIN INPUT LOOP ====================
int fillcount = 0;
int inputcount = 0;
inp_iter = fInputList.begin();
// Loop over each input in manager
for (; inp_iter != fInputList.end(); inp_iter++) {
InputHandlerBase *curinput = (*inp_iter);
// Get event information
FitEvent *curevent = curinput->FirstNuisanceEvent();
curinput->CreateCache();
int i = 0;
int nevents = curinput->GetNEvents();
int countwidth = nevents / 10;
// Start event loop iterating until we get a NULL pointer.
while (curevent) {
// Get Event Weight
// The reweighting weight
curevent->RWWeight = FitBase::GetRW()->CalcWeight(curevent);
// The Custom weight and reweight
curevent->Weight =
curevent->RWWeight * curevent->InputWeight * curevent->CustomWeight;
if (LOGGING(REC)) {
if (countwidth && (i % countwidth == 0)) {
- QLOG(REC, curinput->GetName()
+ NUIS_LOG(REC, curinput->GetName()
<< " : Processed " << i << " events. [M, W] = ["
<< curevent->Mode << ", " << curevent->Weight << "]");
}
}
// Setup flag for if signal found in at least one sample
bool foundsignal = false;
// Create a new signal bitset for this event
std::vector signalbitset(fSubSampleList.size());
// Create a new signal box vector for this event
std::vector signalboxes;
// Start measurement iterator
size_t measitercount = 0;
std::vector::iterator meas_iter =
fSubSampleList.begin();
// Loop over all subsamples (sub in JointMeas)
for (; meas_iter != fSubSampleList.end(); meas_iter++) {
MeasurementBase *curmeas = (*meas_iter);
// Compare input pointers, to current input, skip if not.
// Pointer tells us if it matches without doing ID checks.
if (curinput != curmeas->GetInput()) {
if (savesignal) {
// Set bit to 0 as definitely not signal
signalbitset[measitercount] = 0;
}
// Count up what measurement we are on.
measitercount++;
// Skip sample as input not signal.
continue;
}
// Fill events for matching inputs.
MeasurementVariableBox *box = curmeas->FillVariableBox(curevent);
bool signal = curmeas->isSignal(curevent);
curmeas->SetSignal(signal);
curmeas->FillHistograms(curevent->Weight);
// If its Signal tally up fills
if (signal) {
fillcount++;
}
// If we are saving signal/splines fill the bitset
if (savesignal) {
signalbitset[measitercount] = signal;
}
// If signal save a clone of the event box for use later.
if (savesignal and signal) {
foundsignal = true;
signalboxes.push_back(box->CloneSignalBox());
}
// Keep track of Measurement we are on.
measitercount++;
}
// Once we've filled the measurements, if saving signal
// push back if any sample flagged this event as signal
if (savesignal) {
fSignalEventFlags.push_back(foundsignal);
}
// Save the vector of signal boxes for this event
if (savesignal && foundsignal) {
fSignalEventBoxes.push_back(signalboxes);
fSampleSignalFlags.push_back(signalbitset);
}
// If all inputs are splines we can save the spline coefficients
// for fast in memory reconfigures later.
if (fIsAllSplines && savesignal && foundsignal) {
// Make temp vector to push back with
std::vector coeff;
for (size_t l = 0; l < (UInt_t)curevent->fSplineRead->GetNPar(); l++) {
coeff.push_back(curevent->fSplineCoeff[l]);
}
// Push back to signal event splines. Kept in sync with
// fSignalEventBoxes size.
// int splinecount = fSignalEventSplines.size();
fSignalEventSplines.push_back(coeff);
// if (splinecount % 1000 == 0) {
// std::cout << "Pushed Back Coeff " << splinecount << " : ";
// for (size_t l = 0; l < fSignalEventSplines[splinecount].size(); l++)
// {
// std::cout << " " << fSignalEventSplines[splinecount][l];
// }
// std::cout << std::endl;
// }
}
// Clean up vectors once done with this event
signalboxes.clear();
signalbitset.clear();
// Iterate to the next event.
curevent = curinput->NextNuisanceEvent();
i++;
}
// curinput->RemoveCache();
// Keep track of what input we are on.
inputcount++;
}
// End of Event Loop ===============================
// Now event loop is finished loop over all Measurements
// Converting Binned events to XSec Distributions
iterSam = fSamples.begin();
for (; iterSam != fSamples.end(); iterSam++) {
MeasurementBase *exp = (*iterSam);
exp->ConvertEventRates();
}
// Print out statements on approximate memory usage for profiling.
- LOG(REC) << "Filled " << fillcount << " signal events." << std::endl;
+ NUIS_LOG(REC, "Filled " << fillcount << " signal events.");
if (savesignal) {
int mem = ( // sizeof(fSignalEventBoxes) +
// fSignalEventBoxes.size() * sizeof(fSignalEventBoxes.at(0)) +
sizeof(MeasurementVariableBox1D) * fillcount) *
1E-6;
- LOG(REC) << " -> Saved " << fillcount
- << " signal boxes for faster access. (~" << mem << " MB)"
- << std::endl;
+ NUIS_LOG(REC, " -> Saved " << fillcount << " signal boxes for faster access. (~"
+ << mem << " MB)");
if (fIsAllSplines and !fSignalEventSplines.empty()) {
int splmem = sizeof(float) * fSignalEventSplines.size() *
fSignalEventSplines[0].size() * 1E-6;
- LOG(REC) << " -> Saved " << fillcount << " " << fSignalEventSplines.size()
- << " spline sets into memory. (~" << splmem << " MB)"
- << std::endl;
+ NUIS_LOG(REC, " -> Saved " << fillcount << " " << fSignalEventSplines.size()
+ << " spline sets into memory. (~" << splmem
+ << " MB)");
}
}
- LOG(REC) << "Time taken ReconfigureUsingManager() : "
- << time(NULL) - timestart << std::endl;
+ NUIS_LOG(REC,
+ "Time taken ReconfigureUsingManager() : " << time(NULL) - timestart);
// Check SignalReconfigures works for all samples
if (savesignal) {
double likefull = GetLikelihood();
ReconfigureFastUsingManager();
double likefast = GetLikelihood();
if (fabs(likefull - likefast) > 0.0001) {
- ERROR(FTL, "Fast and Full Likelihoods DIFFER! : " << likefull << " : "
- << likefast);
- ERROR(FTL, "This means some samples you are using are not setup to use "
- "SignalReconfigures=1");
- ERROR(FTL, "Please turn OFF signal reconfigures.");
+ NUIS_ERR(FTL, "Fast and Full Likelihoods DIFFER! : " << likefull << " : "
+ << likefast);
+ NUIS_ERR(FTL, "This means some samples you are using are not setup to use "
+ "SignalReconfigures=1");
+ NUIS_ERR(FTL, "Please turn OFF signal reconfigures.");
throw;
} else {
- LOG(FIT)
- << "Likelihoods for FULL and FAST match. Will use FAST next time."
- << std::endl;
+ NUIS_LOG(FIT,
+ "Likelihoods for FULL and FAST match. Will use FAST next time.");
}
}
};
//***************************************************
void JointFCN::ReconfigureFastUsingManager() {
//***************************************************
- LOG(FIT) << " -> Doing FAST using manager" << std::endl;
+ NUIS_LOG(FIT, " -> Doing FAST using manager");
// Get Start time for profilling
int timestart = time(NULL);
// Reset all samples
MeasListConstIter iterSam = fSamples.begin();
for (; iterSam != fSamples.end(); iterSam++) {
MeasurementBase *exp = (*iterSam);
exp->ResetAll();
}
// Check for saved variables if not do a full reconfigure.
if (fSignalEventFlags.empty()) {
- ERR(WRN) << "Signal Flags Empty! Using normal manager." << std::endl;
+ NUIS_ERR(WRN, "Signal Flags Empty! Using normal manager.");
ReconfigureUsingManager();
return;
}
bool fFillNuisanceEvent =
FitPar::Config().GetParB("FullEventOnSignalReconfigure");
// Setup fast vector iterators.
std::vector::iterator inpsig_iter = fSignalEventFlags.begin();
- std::vector >::iterator box_iter =
+ std::vector>::iterator box_iter =
fSignalEventBoxes.begin();
- std::vector >::iterator spline_iter =
+ std::vector>::iterator spline_iter =
fSignalEventSplines.begin();
- std::vector >::iterator samsig_iter =
+ std::vector>::iterator samsig_iter =
fSampleSignalFlags.begin();
int splinecount = 0;
// Setup stuff for logging
int fillcount = 0;
// This is just the total number of events
- //int nevents = fSignalEventFlags.size();
+ // int nevents = fSignalEventFlags.size();
// This is the number of events that are signal
int nevents = fSignalEventBoxes.size();
int countwidth = nevents / 10;
// If All Splines tell splines they need a reconfigure.
std::vector::iterator inp_iter = fInputList.begin();
if (fIsAllSplines) {
- LOG(REC) << "All Spline Inputs so using fast spline loop." << std::endl;
+ NUIS_LOG(REC, "All Spline Inputs so using fast spline loop.");
for (; inp_iter != fInputList.end(); inp_iter++) {
InputHandlerBase *curinput = (*inp_iter);
// Tell each fSplineRead in BaseFitEvent to reconf next weight calc
BaseFitEvt *curevent = curinput->FirstBaseEvent();
if (curevent->fSplineRead)
curevent->fSplineRead->SetNeedsReconfigure(true);
}
}
// Loop over all possible spline inputs
double *coreeventweights = new double[fSignalEventBoxes.size()];
splinecount = 0;
inp_iter = fInputList.begin();
inpsig_iter = fSignalEventFlags.begin();
spline_iter = fSignalEventSplines.begin();
// Loop over all signal flags
// For each valid signal flag add one to splinecount
// Get Splines from that count and add to weight
// Add splinecount
int sigcount = 0;
// #pragma omp parallel for shared(splinecount,sigcount)
for (uint iinput = 0; iinput < fInputList.size(); iinput++) {
InputHandlerBase *curinput = fInputList[iinput];
BaseFitEvt *curevent = curinput->FirstBaseEvent();
// Loop over the events in each input
for (int i = 0; i < curinput->GetNEvents(); i++) {
double rwweight = 0.0;
// If the event is a signal event
if (fSignalEventFlags[sigcount]) {
// Get Event Info
if (!fIsAllSplines) {
if (fFillNuisanceEvent) {
curevent = curinput->GetNuisanceEvent(i);
} else {
curevent = curinput->GetBaseEvent(i);
}
} else {
curevent->fSplineCoeff = &fSignalEventSplines[splinecount][0];
}
curevent->RWWeight = FitBase::GetRW()->CalcWeight(curevent);
curevent->Weight =
curevent->RWWeight * curevent->InputWeight * curevent->CustomWeight;
rwweight = curevent->Weight;
coreeventweights[splinecount] = rwweight;
if (countwidth && ((splinecount % countwidth) == 0)) {
- QLOG(REC, curinput->GetName()
- << " : Processed " << i << " events. W = "
- << curevent->Weight << std::endl);
+ NUIS_LOG(REC, curinput->GetName()
+ << " : Processed " << i
+ << " events. W = " << curevent->Weight << std::endl);
}
// #pragma omp atomic
splinecount++;
}
// #pragma omp atomic
sigcount++;
}
}
- LOG(SAM) << "Processed event weights." << std::endl;
+ NUIS_LOG(SAM, "Processed event weights.");
// #pragma omp barrier
// Reset Iterators
inpsig_iter = fSignalEventFlags.begin();
spline_iter = fSignalEventSplines.begin();
box_iter = fSignalEventBoxes.begin();
samsig_iter = fSampleSignalFlags.begin();
int nsplineweights = splinecount;
splinecount = 0;
// Start of Fast Event Loop ============================
// Start input iterators
// Loop over number of inputs
for (int ispline = 0; ispline < nsplineweights; ispline++) {
double rwweight = coreeventweights[ispline];
// Get iterators for this event
std::vector::iterator subsamsig_iter = (*samsig_iter).begin();
std::vector::iterator subbox_iter =
(*box_iter).begin();
// Loop over all sub measurements.
std::vector::iterator meas_iter = fSubSampleList.begin();
for (; meas_iter != fSubSampleList.end(); meas_iter++, subsamsig_iter++) {
MeasurementBase *curmeas = (*meas_iter);
// If event flagged as signal for this sample fill from the box.
if (*subsamsig_iter) {
curmeas->SetSignal(true);
curmeas->FillHistogramsFromBox((*subbox_iter), rwweight);
// Move onto next box if there is one.
subbox_iter++;
fillcount++;
}
}
if (ispline % countwidth == 0) {
- LOG(REC) << "Filled " << ispline << " sample weights." << std::endl;
+ NUIS_LOG(REC, "Filled " << ispline << " sample weights.");
}
// Iterate over the main signal event containers.
samsig_iter++;
box_iter++;
spline_iter++;
splinecount++;
}
// End of Fast Event Loop ===================
- LOG(SAM) << "Filled sample distributions." << std::endl;
+ NUIS_LOG(SAM, "Filled sample distributions.");
// Now loop over all Measurements
// Convert Binned events
iterSam = fSamples.begin();
for (; iterSam != fSamples.end(); iterSam++) {
MeasurementBase *exp = (*iterSam);
exp->ConvertEventRates();
}
// Cleanup coreeventweights
delete coreeventweights;
// Print some reconfigure profiling.
- LOG(REC) << "Filled " << fillcount << " signal events." << std::endl;
- LOG(REC) << "Time taken ReconfigureFastUsingManager() : "
- << time(NULL) - timestart << std::endl;
+ NUIS_LOG(REC, "Filled " << fillcount << " signal events.");
+ NUIS_LOG(REC,
+ "Time taken ReconfigureFastUsingManager() : " << time(NULL) - timestart);
}
//***************************************************
void JointFCN::Write() {
//***************************************************
// Save a likelihood/ndof plot
- LOG(MIN) << "Writing likelihood plot.." << std::endl;
+ NUIS_LOG(MIN, "Writing likelihood plot...");
std::vector likes;
std::vector ndofs;
std::vector names;
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
double like = exp->GetLikelihood();
double ndof = exp->GetNDOF();
std::string name = exp->GetName();
likes.push_back(like);
ndofs.push_back(ndof);
names.push_back(name);
}
if (likes.size()) {
TH1D likehist = TH1D("likelihood_hist", "likelihood_hist", likes.size(),
0.0, double(likes.size()));
TH1D ndofhist =
TH1D("ndof_hist", "ndof_hist", ndofs.size(), 0.0, double(ndofs.size()));
TH1D divhist = TH1D("likedivndof_hist", "likedivndof_hist", likes.size(),
0.0, double(likes.size()));
for (int i = 0; i < likehist.GetNbinsX(); i++) {
likehist.SetBinContent(i + 1, likes[i]);
ndofhist.SetBinContent(i + 1, ndofs[i]);
if (ndofs[i] != 0.0) {
divhist.SetBinContent(i + 1, likes[i] / ndofs[i]);
}
likehist.GetXaxis()->SetBinLabel(i + 1, names[i].c_str());
ndofhist.GetXaxis()->SetBinLabel(i + 1, names[i].c_str());
divhist.GetXaxis()->SetBinLabel(i + 1, names[i].c_str());
}
likehist.Write();
ndofhist.Write();
divhist.Write();
}
// Loop over individual experiments and call Write
- LOG(MIN) << "Writing each of the data classes..." << std::endl;
+ NUIS_LOG(MIN, "Writing each of the data classes...");
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
exp->Write();
}
// Save Pull Terms
for (PullListConstIter iter = fPulls.begin(); iter != fPulls.end(); iter++) {
ParamPull *pull = *iter;
pull->Write();
}
if (FitPar::Config().GetParB("EventManager")) {
// Get list of inputs
std::map fInputs =
FitBase::EvtManager().GetInputs();
std::map::const_iterator iterInp;
for (iterInp = fInputs.begin(); iterInp != fInputs.end(); iterInp++) {
InputHandlerBase *input = (iterInp->second);
input->GetFluxHistogram()->Write();
input->GetXSecHistogram()->Write();
input->GetEventHistogram()->Write();
}
}
};
//***************************************************
void JointFCN::SetFakeData(std::string fakeinput) {
//***************************************************
- LOG(MIN) << "Setting fake data from " << fakeinput << std::endl;
+ NUIS_LOG(MIN, "Setting fake data from " << fakeinput);
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
exp->SetFakeDataValues(fakeinput);
}
return;
}
//***************************************************
void JointFCN::ThrowDataToy() {
//***************************************************
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
exp->ThrowDataToy();
}
return;
}
//***************************************************
std::vector JointFCN::GetAllNames() {
//***************************************************
// Vect of all likelihoods and total
std::vector namevect;
// Loop over samples first
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
// Get Likelihoods and push to vector
namevect.push_back(exp->GetName());
}
// Loop over pulls second
for (PullListConstIter iter = fPulls.begin(); iter != fPulls.end(); iter++) {
ParamPull *pull = *iter;
// Push back to vector
namevect.push_back(pull->GetName());
}
// Finally add the total
namevect.push_back("total");
return namevect;
}
//***************************************************
std::vector JointFCN::GetAllLikelihoods() {
//***************************************************
// Vect of all likelihoods and total
std::vector likevect;
double total_likelihood = 0.0;
- LOG(MIN) << "Likelihoods : " << std::endl;
+ NUIS_LOG(MIN, "Likelihoods : ");
// Loop over samples first
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
// Get Likelihoods and push to vector
double singlelike = exp->GetLikelihood();
likevect.push_back(singlelike);
total_likelihood += singlelike;
// Print Out
- LOG(MIN) << "-> " << std::left << std::setw(40) << exp->GetName() << " : "
- << singlelike << std::endl;
+ NUIS_LOG(MIN, "-> " << std::left << std::setw(40) << exp->GetName() << " : "
+ << singlelike);
}
// Loop over pulls second
for (PullListConstIter iter = fPulls.begin(); iter != fPulls.end(); iter++) {
ParamPull *pull = *iter;
// Push back to vector
double singlelike = pull->GetLikelihood();
likevect.push_back(singlelike);
total_likelihood += singlelike;
// Print Out
- LOG(MIN) << "-> " << std::left << std::setw(40) << pull->GetName() << " : "
- << singlelike << std::endl;
+ NUIS_LOG(MIN, "-> " << std::left << std::setw(40) << pull->GetName() << " : "
+ << singlelike);
}
// Finally add the total likelihood
likevect.push_back(total_likelihood);
return likevect;
}
//***************************************************
std::vector JointFCN::GetAllNDOF() {
//***************************************************
// Vect of all ndof and total
std::vector ndofvect;
int total_ndof = 0;
// Loop over samples first
for (MeasListConstIter iter = fSamples.begin(); iter != fSamples.end();
iter++) {
MeasurementBase *exp = *iter;
// Get Likelihoods and push to vector
int singlendof = exp->GetNDOF();
ndofvect.push_back(singlendof);
total_ndof += singlendof;
}
// Loop over pulls second
for (PullListConstIter iter = fPulls.begin(); iter != fPulls.end(); iter++) {
ParamPull *pull = *iter;
// Push back to vector
int singlendof = pull->GetNDOF();
ndofvect.push_back(singlendof);
total_ndof += singlendof;
}
// Finally add the total ndof
ndofvect.push_back(total_ndof);
return ndofvect;
}
diff --git a/src/FCN/MinimizerFCN.h b/src/FCN/MinimizerFCN.h
index e5e9dea..c86fa75 100755
--- a/src/FCN/MinimizerFCN.h
+++ b/src/FCN/MinimizerFCN.h
@@ -1,82 +1,81 @@
#ifndef _MINIMIZER_FCN_H_
#define _MINIMIZER_FCN_H_
/*!
* \addtogroup FCN
* @{
*/
#include
#include
#include "FitLogger.h"
#include "JointFCN.h"
//! Wrapper for JointFCN to make ROOT minimization behave sensibly.
class MinimizerFCN{
public:
// Empty Construction
MinimizerFCN(){
fFCN = NULL;
}
// Construct from function
MinimizerFCN(JointFCN* f){
SetFCN(f);
};
// Destroy (Doesn't delete FCN)
~MinimizerFCN(){
};
/*
inline double Up() const
{
return 1.;
}
*/
// Set FCN
inline void SetFCN(JointFCN* f)
{
fFCN = f;
};
// Get FCN
inline JointFCN* GetFCN() const
{
return fFCN;
};
// Wrapper for jointFCN Eval
inline double DoEval(const double *x) const
{
if (!fFCN){
- ERR(FTL) << "No FCN Found in MinimizerFCN!" << endl;
- ERR(FTL) << "Exiting! " << endl;
- throw;
+ NUIS_ERR(FTL,"No FCN Found in MinimizerFCN!");
+ NUIS_ABORT("Exiting!");
}
return fFCN->DoEval(x);
};
// Func Operator for vectors
inline double operator() (const std::vector & x) const
{
double* x_array = new double[x.size()];
return this->DoEval(x_array);
};
// Func Operator for arrays
inline double operator() (const double *x) const
{
return this->DoEval(x);
};
private:
JointFCN* fFCN;
};
/*! @} */
#endif // _MINIMIZER_FCN_H_
diff --git a/src/FCN/SampleList.cxx b/src/FCN/SampleList.cxx
index 3771f60..e0f3fcf 100644
--- a/src/FCN/SampleList.cxx
+++ b/src/FCN/SampleList.cxx
@@ -1,1440 +1,1431 @@
#include "SampleList.h"
#ifndef __NO_ANL__
#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_Evt_1DcosmuStar_nu.h"
#include "ANL_NC1ppim_XSec_1DEnu_nu.h"
// ANL CC2pi 1pim1pip (mm, even more exotic!)
#include "ANL_CC2pi_1pim1pip_Evt_1Dpmu_nu.h"
#include "ANL_CC2pi_1pim1pip_Evt_1Dppim_nu.h"
#include "ANL_CC2pi_1pim1pip_Evt_1Dppip_nu.h"
#include "ANL_CC2pi_1pim1pip_Evt_1Dpprot_nu.h"
#include "ANL_CC2pi_1pim1pip_XSec_1DEnu_nu.h"
// ANL CC2pi 1pip1pip (mm, even more exotic!)
#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"
#include "ANL_CC2pi_1pip1pip_XSec_1DEnu_nu.h"
// ANL CC2pi 1pip1pi0 (mm, even more exotic!)
#include "ANL_CC2pi_1pip1pi0_Evt_1Dpmu_nu.h"
#include "ANL_CC2pi_1pip1pi0_Evt_1Dppi0_nu.h"
#include "ANL_CC2pi_1pip1pi0_Evt_1Dppip_nu.h"
#include "ANL_CC2pi_1pip1pi0_Evt_1Dpprot_nu.h"
#include "ANL_CC2pi_1pip1pi0_XSec_1DEnu_nu.h"
#endif
#ifndef __NO_ArgoNeuT__
// ArgoNeuT CC1Pi
+#include "ArgoNeuT_CC1Pi_XSec_1Dpmu_antinu.h"
#include "ArgoNeuT_CC1Pi_XSec_1Dpmu_nu.h"
+#include "ArgoNeuT_CC1Pi_XSec_1Dthetamu_antinu.h"
#include "ArgoNeuT_CC1Pi_XSec_1Dthetamu_nu.h"
-#include "ArgoNeuT_CC1Pi_XSec_1Dthetapi_nu.h"
+#include "ArgoNeuT_CC1Pi_XSec_1Dthetamupi_antinu.h"
#include "ArgoNeuT_CC1Pi_XSec_1Dthetamupi_nu.h"
-#include "ArgoNeuT_CC1Pi_XSec_1Dpmu_antinu.h"
-#include "ArgoNeuT_CC1Pi_XSec_1Dthetamu_antinu.h"
#include "ArgoNeuT_CC1Pi_XSec_1Dthetapi_antinu.h"
-#include "ArgoNeuT_CC1Pi_XSec_1Dthetamupi_antinu.h"
+#include "ArgoNeuT_CC1Pi_XSec_1Dthetapi_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"
#endif
#ifndef __NO_BNL__
// 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"
#endif
#ifndef __NO_FNAL__
// 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"
#endif
#ifndef __NO_BEBC__
// 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"
#endif
#ifndef __NO_GGM__
// GGM CC1ppip
#include "GGM_CC1ppip_Evt_1DQ2_nu.h"
#include "GGM_CC1ppip_XSec_1DEnu_nu.h"
#endif
#ifndef __NO_MiniBooNE__
// MiniBooNE CCQE
#include "MiniBooNE_CCQE_XSec_1DQ2_antinu.h"
#include "MiniBooNE_CCQE_XSec_1DQ2_nu.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"
#endif
#ifndef __NO_MicroBooNE__
#include "MicroBooNE_CCInc_XSec_2DPcos_nu.h"
#endif
#ifndef __NO_MINERvA__
// 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"
// 2018 MINERvA CC0pi STV
#include "MINERvA_CC0pinp_STV_XSec_1D_nu.h"
// 2018 MINERvA CC0pi 2D
-#include "MINERvA_CC0pi_XSec_2D_nu.h"
#include "MINERvA_CC0pi_XSec_1D_2018_nu.h"
+#include "MINERvA_CC0pi_XSec_2D_nu.h"
// 2018 MINERvA CC0pi 2D antinu
#include "MINERvA_CC0pi_XSec_2D_antinu.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"
// 2017 data update
#include "MINERvA_CC1pip_XSec_1D_2017Update.h"
// MINERvA CCNpi+
#include "MINERvA_CCNpip_XSec_1DEnu_nu.h"
#include "MINERvA_CCNpip_XSec_1DQ2_nu.h"
#include "MINERvA_CCNpip_XSec_1DTpi_nu.h"
#include "MINERvA_CCNpip_XSec_1Dpmu_nu.h"
#include "MINERvA_CCNpip_XSec_1Dth_nu.h"
#include "MINERvA_CCNpip_XSec_1Dthmu_nu.h"
// MINERvA CC1pi0
#include "MINERvA_CC1pi0_XSec_1DEnu_antinu.h"
#include "MINERvA_CC1pi0_XSec_1DQ2_antinu.h"
#include "MINERvA_CC1pi0_XSec_1DTpi0_antinu.h"
#include "MINERvA_CC1pi0_XSec_1Dpmu_antinu.h"
#include "MINERvA_CC1pi0_XSec_1Dppi0_antinu.h"
#include "MINERvA_CC1pi0_XSec_1Dth_antinu.h"
#include "MINERvA_CC1pi0_XSec_1Dthmu_antinu.h"
// MINERvA CC1pi0 neutrino
#include "MINERvA_CC1pi0_XSec_1D_nu.h"
// MINERvA CCINC
#include "MINERvA_CCinc_XSec_1DEnu_ratio.h"
#include "MINERvA_CCinc_XSec_1Dx_ratio.h"
#include "MINERvA_CCinc_XSec_2DEavq3_nu.h"
// MINERvA CCDIS
#include "MINERvA_CCDIS_XSec_1DEnu_ratio.h"
#include "MINERvA_CCDIS_XSec_1Dx_ratio.h"
// MINERvA CCCOH pion
#include "MINERvA_CCCOHPI_XSec_1DEnu_antinu.h"
-#include "MINERvA_CCCOHPI_XSec_1DEnu_antinu.h"
#include "MINERvA_CCCOHPI_XSec_1DEpi_antinu.h"
#include "MINERvA_CCCOHPI_XSec_1DQ2_antinu.h"
#include "MINERvA_CCCOHPI_XSec_1DEpi_nu.h"
#include "MINERvA_CCCOHPI_XSec_1DQ2_nu.h"
#include "MINERvA_CCCOHPI_XSec_1Dth_nu.h"
-#include "MINERvA_CCCOHPI_XSec_1Dth_nu.h"
#include "MINERvA_CCCOHPI_XSec_joint.h"
#include "MINERvA_CC0pi_XSec_1DQ2_TgtRatio_nu.h"
#include "MINERvA_CC0pi_XSec_1DQ2_Tgt_nu.h"
#endif
#ifndef __NO_T2K__
// T2K CC0pi 2016
-#include "T2K_CC0pi_XSec_2DPcos_nu.h"
+#include "T2K_CC0pi_XSec_2DPcos_nu_I.h"
+#include "T2K_CC0pi_XSec_2DPcos_nu_II.h"
// T2K CC-inclusive with full acceptance 2018
#include "T2K_CCinc_XSec_2DPcos_nu_nonuniform.h"
// T2K STV CC0pi 2018
-#include "T2K_CC0pi_XSec_2DPcos_nu_nonuniform.h"
-#include "T2K_CC0pinp_STV_XSec_1Ddpt_nu.h"
-#include "T2K_CC0pinp_STV_XSec_1Ddphit_nu.h"
-#include "T2K_CC0pinp_STV_XSec_1Ddat_nu.h"
#include "T2K_CC0pi1p_XSec_3DPcoscos_nu_nonuniform.h"
-#include "T2K_CC0pinp_ifk_XSec_3Dinfp_nu.h"
+#include "T2K_CC0pinp_STV_XSec_1Ddat_nu.h"
+#include "T2K_CC0pinp_STV_XSec_1Ddphit_nu.h"
+#include "T2K_CC0pinp_STV_XSec_1Ddpt_nu.h"
#include "T2K_CC0pinp_ifk_XSec_3Dinfa_nu.h"
#include "T2K_CC0pinp_ifk_XSec_3Dinfip_nu.h"
+#include "T2K_CC0pinp_ifk_XSec_3Dinfp_nu.h"
// T2K CC1pi+ on CH
-#include "T2K_CC1pip_CH_XSec_2Dpmucosmu_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_1DAdlerPhi_nu.h"
#include "T2K_CC1pip_CH_XSec_1DCosThAdler_nu.h"
+#include "T2K_CC1pip_CH_XSec_1DQ2_nu.h"
+#include "T2K_CC1pip_CH_XSec_1Dppi_nu.h"
+#include "T2K_CC1pip_CH_XSec_1Dthmupi_nu.h"
+#include "T2K_CC1pip_CH_XSec_1Dthpi_nu.h"
+#include "T2K_CC1pip_CH_XSec_2Dpmucosmu_nu.h"
//#include "T2K_CC1pip_CH_XSec_1Dthq3pi_nu.h"
//#include "T2K_CC1pip_CH_XSec_1DWrec_nu.h"
//#include "T2K_CC1pip_CH_XSec_1Dq3_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"
-
#endif
#ifndef __NO_SciBooNE__
// SciBooNE COH studies
#include "SciBooNE_CCCOH_1TRK_1DQ2_nu.h"
#include "SciBooNE_CCCOH_1TRK_1Dpmu_nu.h"
#include "SciBooNE_CCCOH_1TRK_1Dthetamu_nu.h"
#include "SciBooNE_CCCOH_MuPiNoVA_1DQ2_nu.h"
+#include "SciBooNE_CCCOH_MuPiNoVA_1Dpmu_nu.h"
+#include "SciBooNE_CCCOH_MuPiNoVA_1Dthetamu_nu.h"
#include "SciBooNE_CCCOH_MuPiNoVA_1Dthetapi_nu.h"
#include "SciBooNE_CCCOH_MuPiNoVA_1Dthetapr_nu.h"
-#include "SciBooNE_CCCOH_MuPiNoVA_1Dthetamu_nu.h"
-#include "SciBooNE_CCCOH_MuPiNoVA_1Dpmu_nu.h"
#include "SciBooNE_CCCOH_MuPiVA_1DQ2_nu.h"
#include "SciBooNE_CCCOH_MuPiVA_1Dpmu_nu.h"
#include "SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu.h"
#include "SciBooNE_CCCOH_MuPr_1DQ2_nu.h"
#include "SciBooNE_CCCOH_MuPr_1Dpmu_nu.h"
#include "SciBooNE_CCCOH_MuPr_1Dthetamu_nu.h"
#include "SciBooNE_CCCOH_STOPFINAL_1DQ2_nu.h"
#include "SciBooNE_CCCOH_STOP_NTrks_nu.h"
#endif
#ifndef __NO_K2K__
// K2K NC1pi0
#include "K2K_NC1pi0_Evt_1Dppi0_nu.h"
#endif
// 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 "GenericFlux_Vectors.h"
#include "ElectronFlux_FlatTree.h"
#include "ElectronScattering_DurhamData.h"
#include "MCStudy_KaonPreSelection.h"
#include "MCStudy_MuonValidation.h"
#include "OfficialNIWGPlots.h"
#include "T2K2017_FakeData.h"
#include "Simple_Osc.h"
#include "Smear_SVDUnfold_Propagation_Osc.h"
#include "FitWeight.h"
#include "NuisConfig.h"
#include "NuisKey.h"
#ifdef __USE_DYNSAMPLES__
#include "TRegexp.h"
#include
// linux
#include
DynamicSampleFactory::DynamicSampleFactory() : NSamples(0), NManifests(0) {
LoadPlugins();
- QLOG(FIT, "Loaded " << NSamples << " from " << NManifests
- << " shared object libraries.");
+ NUIS_LOG(FIT, "Loaded " << NSamples << " from " << NManifests
+ << " shared object libraries.");
}
-DynamicSampleFactory* DynamicSampleFactory::glblDSF = NULL;
+DynamicSampleFactory *DynamicSampleFactory::glblDSF = NULL;
DynamicSampleFactory::PluginManifest::~PluginManifest() {
for (size_t i_it = 0; i_it < Instances.size(); ++i_it) {
(*(DSF_DestroySample))(Instances[i_it]);
}
}
-std::string EnsureTrailingSlash(std::string const& inp) {
+std::string EnsureTrailingSlash(std::string const &inp) {
if (!inp.length()) {
return "/";
}
if (inp[inp.length() - 1] == '/') {
return inp;
}
return inp + "/";
}
void DynamicSampleFactory::LoadPlugins() {
std::vector SearchDirectories;
if (Config::HasPar("dynamic_sample.path")) {
SearchDirectories =
GeneralUtils::ParseToStr(Config::GetParS("dynamic_sample.path"), ":");
}
- char const* envPath = getenv("NUISANCE_DS_PATH");
+ char const *envPath = getenv("NUISANCE_DS_PATH");
if (envPath) {
std::vector envPaths = GeneralUtils::ParseToStr(envPath, ":");
for (size_t ep_it = 0; ep_it < envPaths.size(); ++ep_it) {
SearchDirectories.push_back(envPaths[ep_it]);
}
}
if (!SearchDirectories.size()) {
- char const* pwdPath = getenv("PWD");
+ char const *pwdPath = getenv("PWD");
if (pwdPath) {
SearchDirectories.push_back(pwdPath);
}
}
for (size_t sp_it = 0; sp_it < SearchDirectories.size(); ++sp_it) {
std::string dirpath = EnsureTrailingSlash(SearchDirectories[sp_it]);
- QLOG(FIT, "Searching for dynamic sample manifests in: " << dirpath);
+ NUIS_LOG(FIT, "Searching for dynamic sample manifests in: " << dirpath);
Ssiz_t len = 0;
- DIR* dir;
- struct dirent* ent;
+ DIR *dir;
+ struct dirent *ent;
dir = opendir(dirpath.c_str());
if (dir != NULL) {
TRegexp matchExp("*.so", true);
while ((ent = readdir(dir)) != NULL) {
if (matchExp.Index(TString(ent->d_name), &len) != Ssiz_t(-1)) {
- QLOG(FIT, "\tFound shared object: "
- << ent->d_name << " checking for relevant methods...");
+ NUIS_LOG(FIT, "\tFound shared object: "
+ << ent->d_name
+ << " checking for relevant methods...");
- void* dlobj =
+ void *dlobj =
dlopen((dirpath + ent->d_name).c_str(), RTLD_NOW | RTLD_GLOBAL);
- char const* dlerr_cstr = dlerror();
+ char const *dlerr_cstr = dlerror();
std::string dlerr;
if (dlerr_cstr) {
dlerr = dlerr_cstr;
}
if (dlerr.length()) {
- ERROR(WRN, "\tDL Load Error: " << dlerr);
+ NUIS_ERR(WRN, "\tDL Load Error: " << dlerr);
continue;
}
PluginManifest plgManif;
plgManif.dllib = dlobj;
plgManif.soloc = (dirpath + ent->d_name);
plgManif.DSF_NSamples =
reinterpret_cast(dlsym(dlobj, "DSF_NSamples"));
dlerr = "";
dlerr_cstr = dlerror();
if (dlerr_cstr) {
dlerr = dlerr_cstr;
}
if (dlerr.length()) {
- ERROR(WRN, "\tFailed to load symbol \"DSF_NSamples\" from "
- << (dirpath + ent->d_name) << ": " << dlerr);
+ NUIS_ERR(WRN, "\tFailed to load symbol \"DSF_NSamples\" from "
+ << (dirpath + ent->d_name) << ": " << dlerr);
dlclose(dlobj);
continue;
}
plgManif.DSF_GetSampleName = reinterpret_cast(
dlsym(dlobj, "DSF_GetSampleName"));
dlerr = "";
dlerr_cstr = dlerror();
if (dlerr_cstr) {
dlerr = dlerr_cstr;
}
if (dlerr.length()) {
- ERROR(WRN, "\tFailed to load symbol \"DSF_GetSampleName\" from "
- << (dirpath + ent->d_name) << ": " << dlerr);
+ NUIS_ERR(WRN, "\tFailed to load symbol \"DSF_GetSampleName\" from "
+ << (dirpath + ent->d_name) << ": " << dlerr);
dlclose(dlobj);
continue;
}
plgManif.DSF_GetSample = reinterpret_cast(
dlsym(dlobj, "DSF_GetSample"));
dlerr = "";
dlerr_cstr = dlerror();
if (dlerr_cstr) {
dlerr = dlerr_cstr;
}
if (dlerr.length()) {
- ERROR(WRN, "\tFailed to load symbol \"DSF_GetSample\" from "
- << (dirpath + ent->d_name) << ": " << dlerr);
+ NUIS_ERR(WRN, "\tFailed to load symbol \"DSF_GetSample\" from "
+ << (dirpath + ent->d_name) << ": " << dlerr);
dlclose(dlobj);
continue;
}
plgManif.DSF_DestroySample = reinterpret_cast(
dlsym(dlobj, "DSF_DestroySample"));
dlerr = "";
dlerr_cstr = dlerror();
if (dlerr_cstr) {
dlerr = dlerr_cstr;
}
if (dlerr.length()) {
- ERROR(WRN, "Failed to load symbol \"DSF_DestroySample\" from "
- << (dirpath + ent->d_name) << ": " << dlerr);
+ NUIS_ERR(WRN, "Failed to load symbol \"DSF_DestroySample\" from "
+ << (dirpath + ent->d_name) << ": " << dlerr);
dlclose(dlobj);
continue;
}
plgManif.NSamples = (*(plgManif.DSF_NSamples))();
- QLOG(FIT, "\tSuccessfully loaded dynamic sample manifest: "
- << plgManif.soloc << ". Contains " << plgManif.NSamples
- << " samples.");
+ NUIS_LOG(FIT, "\tSuccessfully loaded dynamic sample manifest: "
+ << plgManif.soloc << ". Contains "
+ << plgManif.NSamples << " samples.");
for (size_t smp_it = 0; smp_it < plgManif.NSamples; ++smp_it) {
- char const* smp_name = (*(plgManif.DSF_GetSampleName))(smp_it);
+ char const *smp_name = (*(plgManif.DSF_GetSampleName))(smp_it);
if (!smp_name) {
- THROW("Could not load sample " << smp_it << " / "
- << plgManif.NSamples << " from "
- << plgManif.soloc);
+ NUIS_ABORT("Could not load sample "
+ << smp_it << " / " << plgManif.NSamples << " from "
+ << plgManif.soloc);
}
if (Samples.count(smp_name)) {
- ERROR(WRN, "Already loaded a sample named: \""
- << smp_name << "\". cannot load duplciates. This "
- "sample will be skipped.");
+ NUIS_ERR(WRN, "Already loaded a sample named: \""
+ << smp_name
+ << "\". cannot load duplciates. This "
+ "sample will be skipped.");
continue;
}
plgManif.SamplesProvided.push_back(smp_name);
Samples[smp_name] = std::make_pair(plgManif.soloc, smp_it);
- QLOG(FIT, "\t\t" << smp_name);
+ NUIS_LOG(FIT, "\t\t" << smp_name);
}
if (plgManif.SamplesProvided.size()) {
Manifests[plgManif.soloc] = plgManif;
NSamples += plgManif.SamplesProvided.size();
NManifests++;
} else {
dlclose(dlobj);
}
}
}
closedir(dir);
} else {
- ERROR(WRN, "Tried to open non-existant directory.");
+ NUIS_ERR(WRN, "Tried to open non-existant directory.");
}
}
}
-DynamicSampleFactory& DynamicSampleFactory::Get() {
+DynamicSampleFactory &DynamicSampleFactory::Get() {
if (!glblDSF) {
glblDSF = new DynamicSampleFactory();
}
return *glblDSF;
}
void DynamicSampleFactory::Print() {
- std::map > ManifestSamples;
+ std::map> ManifestSamples;
- for (std::map >::iterator smp_it =
+ for (std::map>::iterator smp_it =
Samples.begin();
smp_it != Samples.end(); ++smp_it) {
if (!ManifestSamples.count(smp_it->second.first)) {
ManifestSamples[smp_it->second.first] = std::vector();
}
ManifestSamples[smp_it->second.first].push_back(smp_it->first);
}
- QLOG(FIT, "Dynamic sample manifest: ");
- for (std::map >::iterator m_it =
+ NUIS_LOG(FIT, "Dynamic sample manifest: ");
+ for (std::map>::iterator m_it =
ManifestSamples.begin();
m_it != ManifestSamples.end(); ++m_it) {
- QLOG(FIT, "\tLibrary " << m_it->first << " contains: ");
+ NUIS_LOG(FIT, "\tLibrary " << m_it->first << " contains: ");
for (size_t s_it = 0; s_it < m_it->second.size(); ++s_it) {
- QLOG(FIT, "\t\t" << m_it->second[s_it]);
+ NUIS_LOG(FIT, "\t\t" << m_it->second[s_it]);
}
}
}
-bool DynamicSampleFactory::HasSample(std::string const& name) {
+bool DynamicSampleFactory::HasSample(std::string const &name) {
return Samples.count(name);
}
-bool DynamicSampleFactory::HasSample(nuiskey& samplekey) {
+bool DynamicSampleFactory::HasSample(nuiskey &samplekey) {
return HasSample(samplekey.GetS("name"));
}
-MeasurementBase* DynamicSampleFactory::CreateSample(nuiskey& samplekey) {
+MeasurementBase *DynamicSampleFactory::CreateSample(nuiskey &samplekey) {
if (!HasSample(samplekey)) {
- ERROR(WRN, "Asked to load unknown sample: \"" << samplekey.GetS("name")
- << "\".");
+ NUIS_ERR(WRN, "Asked to load unknown sample: \"" << samplekey.GetS("name")
+ << "\".");
return NULL;
}
std::pair sample = Samples[samplekey.GetS("name")];
- QLOG(SAM, "\tLoading sample " << sample.second << " from " << sample.first);
+ NUIS_LOG(SAM,
+ "\tLoading sample " << sample.second << " from " << sample.first);
return (*(Manifests[sample.first].DSF_GetSample))(sample.second, &samplekey);
}
DynamicSampleFactory::~DynamicSampleFactory() { Manifests.clear(); }
#endif
//! 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,
+MeasurementBase *CreateSample(std::string name, std::string file,
std::string type, std::string fkdt,
- FitWeight* rw) {
+ FitWeight *rw) {
nuiskey samplekey = Config::CreateKey("sample");
samplekey.Set("name", name);
samplekey.Set("input", file);
samplekey.Set("type", type);
return CreateSample(samplekey);
}
-MeasurementBase* CreateSample(nuiskey samplekey) {
+MeasurementBase *CreateSample(nuiskey samplekey) {
#ifdef __USE_DYNSAMPLES__
if (DynamicSampleFactory::Get().HasSample(samplekey)) {
- QLOG(SAM, "Instantiating dynamic sample...");
+ NUIS_LOG(SAM, "Instantiating dynamic sample...");
- MeasurementBase* ds = DynamicSampleFactory::Get().CreateSample(samplekey);
+ MeasurementBase *ds = DynamicSampleFactory::Get().CreateSample(samplekey);
if (ds) {
- QLOG(SAM, "Done.");
+ NUIS_LOG(SAM, "Done.");
return ds;
}
- THROW("Failed to instantiate dynamic sample.");
+ NUIS_ABORT("Failed to instantiate dynamic sample.");
}
#endif
- FitWeight* rw = FitBase::GetRW();
+ 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
-*/
+ /*
+ ANL CCQE Samples
+ */
#ifndef __NO_ANL__
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
#endif
#ifndef __NO_ArgoNeuT__
- if (!name.compare("ArgoNeuT_CCInc_XSec_1Dpmu_antinu")) {
+ 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));
} else if (!name.compare("ArgoNeuT_CC1Pi_XSec_1Dpmu_nu")) {
return (new ArgoNeuT_CC1Pi_XSec_1Dpmu_nu(samplekey));
} else if (!name.compare("ArgoNeuT_CC1Pi_XSec_1Dthetamu_nu")) {
return (new ArgoNeuT_CC1Pi_XSec_1Dthetamu_nu(samplekey));
} else if (!name.compare("ArgoNeuT_CC1Pi_XSec_1Dthetapi_nu")) {
return (new ArgoNeuT_CC1Pi_XSec_1Dthetapi_nu(samplekey));
} else if (!name.compare("ArgoNeuT_CC1Pi_XSec_1Dthetamupi_nu")) {
return (new ArgoNeuT_CC1Pi_XSec_1Dthetamupi_nu(samplekey));
} else if (!name.compare("ArgoNeuT_CC1Pi_XSec_1Dpmu_antinu")) {
return (new ArgoNeuT_CC1Pi_XSec_1Dpmu_antinu(samplekey));
} else if (!name.compare("ArgoNeuT_CC1Pi_XSec_1Dthetamu_antinu")) {
return (new ArgoNeuT_CC1Pi_XSec_1Dthetamu_antinu(samplekey));
} else if (!name.compare("ArgoNeuT_CC1Pi_XSec_1Dthetapi_antinu")) {
return (new ArgoNeuT_CC1Pi_XSec_1Dthetapi_antinu(samplekey));
} else if (!name.compare("ArgoNeuT_CC1Pi_XSec_1Dthetamupi_antinu")) {
return (new ArgoNeuT_CC1Pi_XSec_1Dthetamupi_antinu(samplekey));
/*
BNL Samples
*/
} else
#endif
#ifndef __NO_BNL__
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
#endif
#ifndef __NO_FNAL__
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
#endif
#ifndef __NO_BEBC__
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
#endif
#ifndef __NO_GGM__
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
#endif
#ifndef __NO_MiniBooNE__
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")) {
return (new MiniBooNE_NCEL_XSec_Treco_nu(samplekey));
} else
#endif
#ifndef __NO_MicroBooNE__
- /*
- MicroBooNE Samples
- */
-
- /*
- MicroBooNE CCinclusive
- */
- if (!name.compare("MicroBooNE_CCInc_XSec_2DPcos_nu")) {
+ /*
+ MicroBooNE Samples
+ */
+
+ /*
+ MicroBooNE CCinclusive
+ */
+ if (!name.compare("MicroBooNE_CCInc_XSec_2DPcos_nu")) {
return (new MicroBooNE_CCInc_XSec_2DPcos_nu(samplekey));
} else
#endif
#ifndef __NO_MINERvA__
- /*
- MINERvA Samples
- */
+ /*
+ MINERvA Samples
+ */
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_CC0pinp_STV_XSec_1Dpmu_nu") ||
- !name.compare("MINERvA_CC0pinp_STV_XSec_1Dthmu_nu") ||
- !name.compare("MINERvA_CC0pinp_STV_XSec_1Dpprot_nu") ||
- !name.compare("MINERvA_CC0pinp_STV_XSec_1Dthprot_nu") ||
- !name.compare("MINERvA_CC0pinp_STV_XSec_1Dpnreco_nu") ||
- !name.compare("MINERvA_CC0pinp_STV_XSec_1Ddalphat_nu") ||
- !name.compare("MINERvA_CC0pinp_STV_XSec_1Ddpt_nu") ||
+ !name.compare("MINERvA_CC0pinp_STV_XSec_1Dthmu_nu") ||
+ !name.compare("MINERvA_CC0pinp_STV_XSec_1Dpprot_nu") ||
+ !name.compare("MINERvA_CC0pinp_STV_XSec_1Dthprot_nu") ||
+ !name.compare("MINERvA_CC0pinp_STV_XSec_1Dpnreco_nu") ||
+ !name.compare("MINERvA_CC0pinp_STV_XSec_1Ddalphat_nu") ||
+ !name.compare("MINERvA_CC0pinp_STV_XSec_1Ddpt_nu") ||
!name.compare("MINERvA_CC0pinp_STV_XSec_1Ddphit_nu")) {
return (new MINERvA_CC0pinp_STV_XSec_1D_nu(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_TgtCH_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));
// Dan Ruterbories measurements of late 2018
- } else if ( !name.compare("MINERvA_CC0pi_XSec_2Dptpz_nu")) {
+ } else if (!name.compare("MINERvA_CC0pi_XSec_2Dptpz_nu")) {
return (new MINERvA_CC0pi_XSec_2D_nu(samplekey));
- } else if ( !name.compare("MINERvA_CC0pi_XSec_1Dpt_nu") ||
- !name.compare("MINERvA_CC0pi_XSec_1Dpz_nu") ||
- !name.compare("MINERvA_CC0pi_XSec_1DQ2QE_nu") ||
- !name.compare("MINERvA_CC0pi_XSec_1DEnuQE_nu")) {
+ } else if (!name.compare("MINERvA_CC0pi_XSec_1Dpt_nu") ||
+ !name.compare("MINERvA_CC0pi_XSec_1Dpz_nu") ||
+ !name.compare("MINERvA_CC0pi_XSec_1DQ2QE_nu") ||
+ !name.compare("MINERvA_CC0pi_XSec_1DEnuQE_nu")) {
return (new MINERvA_CC0pi_XSec_1D_2018_nu(samplekey));
-
// C. Patrick's early 2018 measurements
- } else if ( !name.compare("MINERvA_CC0pi_XSec_2Dptpz_antinu") ||
- !name.compare("MINERvA_CC0pi_XSec_2DQ2QEEnuQE_antinu") ||
- !name.compare("MINERvA_CC0pi_XSec_2DQ2QEEnuTrue_antinu")) {
+ } else if (!name.compare("MINERvA_CC0pi_XSec_2Dptpz_antinu") ||
+ !name.compare("MINERvA_CC0pi_XSec_2DQ2QEEnuQE_antinu") ||
+ !name.compare("MINERvA_CC0pi_XSec_2DQ2QEEnuTrue_antinu")) {
return (new MINERvA_CC0pi_XSec_2D_antinu(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));
} else if (!name.compare("MINERvA_CC1pip_XSec_1DTpi_nu_2017") ||
!name.compare("MINERvA_CC1pip_XSec_1Dth_nu_2017") ||
!name.compare("MINERvA_CC1pip_XSec_1Dpmu_nu_2017") ||
!name.compare("MINERvA_CC1pip_XSec_1Dthmu_nu_2017") ||
!name.compare("MINERvA_CC1pip_XSec_1DQ2_nu_2017") ||
!name.compare("MINERvA_CC1pip_XSec_1DEnu_nu_2017")) {
return (new MINERvA_CC1pip_XSec_1D_2017Update(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));
} else if (!name.compare("MINERvA_CCNpip_XSec_1Dthmu_nu")) {
return (new MINERvA_CCNpip_XSec_1Dthmu_nu(samplekey));
} else if (!name.compare("MINERvA_CCNpip_XSec_1Dpmu_nu")) {
return (new MINERvA_CCNpip_XSec_1Dpmu_nu(samplekey));
} else if (!name.compare("MINERvA_CCNpip_XSec_1DQ2_nu")) {
return (new MINERvA_CCNpip_XSec_1DQ2_nu(samplekey));
} else if (!name.compare("MINERvA_CCNpip_XSec_1DEnu_nu")) {
return (new MINERvA_CCNpip_XSec_1DEnu_nu(samplekey));
/*
MINERvA CC1pi0 anti-nu
*/
// 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));
// MINERvA CC1pi0 nu
} else if (!name.compare("MINERvA_CC1pi0_XSec_1DTpi_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1Dth_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1Dpmu_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1Dthmu_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1DQ2_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1DEnu_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1DWexp_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1DPPi0Mass_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1DPPi0MassDelta_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1DCosAdler_nu") ||
!name.compare("MINERvA_CC1pi0_XSec_1DPhiAdler_nu")) {
return (new MINERvA_CC1pi0_XSec_1D_nu(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));
/*
CCDIS
*/
} else if (!name.compare("MINERvA_CCDIS_XSec_1Dx_ratio_C12_CH") ||
!name.compare("MINERvA_CCDIS_XSec_1Dx_ratio_Fe56_CH") ||
!name.compare("MINERvA_CCDIS_XSec_1Dx_ratio_Pb208_CH")) {
return (new MINERvA_CCDIS_XSec_1Dx_ratio(samplekey));
} else if (!name.compare("MINERvA_CCDIS_XSec_1DEnu_ratio_C12_CH") ||
!name.compare("MINERvA_CCDIS_XSec_1DEnu_ratio_Fe56_CH") ||
!name.compare("MINERvA_CCDIS_XSec_1DEnu_ratio_Pb208_CH")) {
return (new MINERvA_CCDIS_XSec_1DEnu_ratio(samplekey));
/*
CC-COH
*/
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1DEnu_nu")) {
return (new MINERvA_CCCOHPI_XSec_1DEnu_nu(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1DEpi_nu")) {
return (new MINERvA_CCCOHPI_XSec_1DEpi_nu(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1Dth_nu")) {
return (new MINERvA_CCCOHPI_XSec_1Dth_nu(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1DQ2_nu")) {
return (new MINERvA_CCCOHPI_XSec_1DQ2_nu(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1DEnu_antinu")) {
return (new MINERvA_CCCOHPI_XSec_1DEnu_antinu(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1DEpi_antinu")) {
return (new MINERvA_CCCOHPI_XSec_1DEpi_antinu(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1Dth_antinu")) {
return (new MINERvA_CCCOHPI_XSec_1Dth_antinu(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1DQ2_antinu")) {
return (new MINERvA_CCCOHPI_XSec_1DQ2_antinu(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1DEnu_joint")) {
return (new MINERvA_CCCOHPI_XSec_joint(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1DEpi_joint")) {
return (new MINERvA_CCCOHPI_XSec_joint(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1Dth_joint")) {
return (new MINERvA_CCCOHPI_XSec_joint(samplekey));
} else if (!name.compare("MINERvA_CCCOHPI_XSec_1DQ2_joint")) {
return (new MINERvA_CCCOHPI_XSec_joint(samplekey));
/*
T2K Samples
*/
} else
#endif
#ifndef __NO_T2K__
- 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));
+ if (!name.compare("T2K_CC0pi_XSec_2DPcos_nu_I")) {
+ return (new T2K_CC0pi_XSec_2DPcos_nu_I(samplekey));
- } else if (!name.compare("T2K_CC0pi_XSec_2DPcos_nu_nonuniform")) {
- return (new T2K_CC0pi_XSec_2DPcos_nu_nonuniform(samplekey));
+ } else if (!name.compare("T2K_CC0pi_XSec_2DPcos_nu_II")) {
+ return (new T2K_CC0pi_XSec_2DPcos_nu_II(samplekey));
} else if (!name.compare("T2K_CCinc_XSec_2DPcos_nu_nonuniform")) {
return (new T2K_CCinc_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_2Dpmucosmu_nu")) {
+ return (new T2K_CC1pip_CH_XSec_2Dpmucosmu_nu(samplekey));
- } else if (!name.compare("T2K_CC1pip_CH_XSec_2Dpmucosmu_nu")) {
- return (new T2K_CC1pip_CH_XSec_2Dpmucosmu_nu(samplekey));
+ } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dppi_nu")) {
+ return (new T2K_CC1pip_CH_XSec_1Dppi_nu(samplekey));
- } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dppi_nu")) {
- return (new T2K_CC1pip_CH_XSec_1Dppi_nu(samplekey));
-
- } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthpi_nu")) {
+ } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthpi_nu")) {
return (new T2K_CC1pip_CH_XSec_1Dthpi_nu(samplekey));
- } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthmupi_nu")) {
+ } else if (!name.compare("T2K_CC1pip_CH_XSec_1Dthmupi_nu")) {
return (new T2K_CC1pip_CH_XSec_1Dthmupi_nu(samplekey));
- } else if (!name.compare("T2K_CC1pip_CH_XSec_1DQ2_nu")) {
+ } else if (!name.compare("T2K_CC1pip_CH_XSec_1DQ2_nu")) {
return (new T2K_CC1pip_CH_XSec_1DQ2_nu(samplekey));
- } else if (!name.compare("T2K_CC1pip_CH_XSec_1DAdlerPhi_nu")) {
+ } else if (!name.compare("T2K_CC1pip_CH_XSec_1DAdlerPhi_nu")) {
return (new T2K_CC1pip_CH_XSec_1DAdlerPhi_nu(samplekey));
- } else if (!name.compare("T2K_CC1pip_CH_XSec_1DCosThAdler_nu")) {
+ } else if (!name.compare("T2K_CC1pip_CH_XSec_1DCosThAdler_nu")) {
return (new T2K_CC1pip_CH_XSec_1DCosThAdler_nu(samplekey));
// Maybe something for the future: were in Raquel's thesis
//} else if (!name.compare("T2K_CC1pip_CH_XSec_1Dq3_nu")) {
- //return (new T2K_CC1pip_CH_XSec_1Dq3_nu(file, rw, type, fkdt));
+ // return (new T2K_CC1pip_CH_XSec_1Dq3_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));
+ // 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));
+ // 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));
} else if (!name.compare("T2K_CC0pinp_STV_XSec_1Ddphit_nu")) {
return (new T2K_CC0pinp_STV_XSec_1Ddphit_nu(samplekey));
} else if (!name.compare("T2K_CC0pinp_STV_XSec_1Ddat_nu")) {
return (new T2K_CC0pinp_STV_XSec_1Ddat_nu(samplekey));
} else if (!name.compare("T2K_CC0pi1p_XSec_3DPcoscos_nu_nonuniform")) {
return (new T2K_CC0pi1p_XSec_3DPcoscos_nu_nonuniform(samplekey));
} else if (!name.compare("T2K_CC0pinp_ifk_XSec_3Dinfp_nu")) {
return (new T2K_CC0pinp_ifk_XSec_3Dinfp_nu(samplekey));
} else if (!name.compare("T2K_CC0pinp_ifk_XSec_3Dinfa_nu")) {
return (new T2K_CC0pinp_ifk_XSec_3Dinfa_nu(samplekey));
} else if (!name.compare("T2K_CC0pinp_ifk_XSec_3Dinfip_nu")) {
return (new T2K_CC0pinp_ifk_XSec_3Dinfip_nu(samplekey));
-
// SciBooNE COH studies
} else
#endif
#ifndef __NO_SciBooNE__
if (!name.compare("SciBooNE_CCCOH_STOP_NTrks_nu")) {
return (new SciBooNE_CCCOH_STOP_NTrks_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_1TRK_1DQ2_nu")) {
return (new SciBooNE_CCCOH_1TRK_1DQ2_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_1TRK_1Dpmu_nu")) {
return (new SciBooNE_CCCOH_1TRK_1Dpmu_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_1TRK_1Dthetamu_nu")) {
return (new SciBooNE_CCCOH_1TRK_1Dthetamu_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPr_1DQ2_nu")) {
return (new SciBooNE_CCCOH_MuPr_1DQ2_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPr_1Dpmu_nu")) {
return (new SciBooNE_CCCOH_MuPr_1Dpmu_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPr_1Dthetamu_nu")) {
return (new SciBooNE_CCCOH_MuPr_1Dthetamu_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPiVA_1DQ2_nu")) {
return (new SciBooNE_CCCOH_MuPiVA_1DQ2_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPiVA_1Dpmu_nu")) {
return (new SciBooNE_CCCOH_MuPiVA_1Dpmu_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu")) {
return (new SciBooNE_CCCOH_MuPiVA_1Dthetamu_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPiNoVA_1DQ2_nu")) {
return (new SciBooNE_CCCOH_MuPiNoVA_1DQ2_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPiNoVA_1Dthetapr_nu")) {
return (new SciBooNE_CCCOH_MuPiNoVA_1Dthetapr_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPiNoVA_1Dthetapi_nu")) {
return (new SciBooNE_CCCOH_MuPiNoVA_1Dthetapi_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPiNoVA_1Dthetamu_nu")) {
return (new SciBooNE_CCCOH_MuPiNoVA_1Dthetamu_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_MuPiNoVA_1Dpmu_nu")) {
return (new SciBooNE_CCCOH_MuPiNoVA_1Dpmu_nu(samplekey));
} else if (!name.compare("SciBooNE_CCCOH_STOPFINAL_1DQ2_nu")) {
return (new SciBooNE_CCCOH_STOPFINAL_1DQ2_nu(samplekey));
/*
K2K Samples
*/
/*
NC1pi0
*/
} else
#endif
#ifndef __NO_K2K__
if (!name.compare("K2K_NC1pi0_Evt_1Dppi0_nu")) {
return (new K2K_NC1pi0_Evt_1Dppi0_nu(samplekey));
/*
Fake Studies
*/
} else
#endif
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.find("GenericVectors_") != std::string::npos) {
return (new GenericFlux_Vectors(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);
} else if (name.find("MuonValidation_") != std::string::npos) {
return (new MCStudy_MuonValidation(name, file, rw, type, fkdt));
} else if (!name.compare("NIWGOfficialPlots")) {
return (new OfficialNIWGPlots(samplekey));
} else if (!name.compare("Simple_Osc")) {
return (new Simple_Osc(samplekey));
} else if (!name.compare("Smear_SVDUnfold_Propagation_Osc")) {
return (new Smear_SVDUnfold_Propagation_Osc(samplekey));
} else {
- THROW("Error: No such sample: " << name << std::endl);
+ NUIS_ABORT("Error: No such sample: " << name << std::endl);
}
// Return NULL if no sample loaded.
return NULL;
}
-}
+} // namespace SampleUtils
diff --git a/src/FCN/sample_list.xml b/src/FCN/sample_list.xml
index d8301e1..d6d9442 100644
--- a/src/FCN/sample_list.xml
+++ b/src/FCN/sample_list.xml
@@ -1,415 +1,415 @@
-
+
\ No newline at end of file
diff --git a/src/FitBase/EventManager.cxx b/src/FitBase/EventManager.cxx
index b159527..771a4ba 100644
--- a/src/FitBase/EventManager.cxx
+++ b/src/FitBase/EventManager.cxx
@@ -1,142 +1,140 @@
// 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 .
*******************************************************************************/
#include "EventManager.h"
EventManager* EventManager::m_evtmgrInstance = NULL;
EventManager& EventManager::Get(void) {
if (!m_evtmgrInstance) {
m_evtmgrInstance = new EventManager;
}
return *m_evtmgrInstance;
}
FitWeight* EventManager::GetRW() { return fRW; };
InputHandlerBase* EventManager::GetInput(int infile) { return finputs[infile]; };
FitEvent* EventManager::GetEvent(int infile, int i) {
/*
finputs[infile]->ReadEvent(i);
FitEvent* evtpt = finputs[infile]->GetEventPointer();
// If we don't need a full reweight
if (!frwneeded[infile][i]) {
evtpt->Weight = calc_rw[infile][i];
// if we do need a full reweight
} else {
evtpt->RWWeight = fRW->CalcWeight(evtpt);
evtpt->Weight = evtpt->RWWeight * evtpt->InputWeight;
calc_rw[infile][i] = evtpt->Weight;
frwneeded[infile][i] = false;
}
*/
return NULL;
}
double EventManager::GetEventWeight(int infile, int i) {
/*
if (!frwneeded[infile][i]) {
return calc_rw[infile][i];
}
finputs[infile]->GetTreeEntry(i);
FitEvent* evtpt = finputs[infile]->GetEventPointer();
double Weight = fRW->CalcWeight(evtpt) * evtpt->InputWeight;
calc_rw[infile][i] = Weight;
frwneeded[infile][i] = false;
*/
double Weight = 1.0;
return Weight;
}
std::map EventManager::GetInputs() { return finputs; }
InputHandlerBase* EventManager::AddInput(std::string handle, std::string infile) {
// Expect INPUTTYPE:FileLocation(s)
std::vector file_descriptor =
GeneralUtils::ParseToStr(infile, ":");
if (file_descriptor.size() != 2) {
- ERR(FTL) << "File descriptor had no filetype declaration: \"" << infile
- << "\". expected \"FILETYPE:file.root\"" << std::endl;
- throw;
+ NUIS_ABORT("File descriptor had no filetype declaration: \"" << infile
+ << "\". expected \"FILETYPE:file.root\"");
}
InputUtils::InputType inpType =
InputUtils::ParseInputType(file_descriptor[0]);
int id = GetInputID(file_descriptor[1]);
if ((uint)id != fid.size()) {
- LOG(SAM) << "Event manager already contains " << file_descriptor[1]
- << std::endl;
+ NUIS_LOG(SAM,"Event manager already contains " << file_descriptor[1]);
return finputs[id];
}
fid[file_descriptor[1]] = id;
finputs[id] = InputUtils::CreateInputHandler(handle, inpType, file_descriptor[1]);
frwneeded[id] = std::vector(finputs[id]->GetNEvents(), true);
calc_rw[id] = std::vector