Page MenuHomeHEPForge

No OneTemporary

diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 6c50dac..9f9457b 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -1,169 +1,169 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NUISANCE.
#
# NUISANCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NUISANCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
################################################################################
set(TARGETS_TO_BUILD)
if(USE_MINIMIZER)
add_executable(nuismin nuismin.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuismin)
target_link_libraries(nuismin ${MODULETargets})
target_link_libraries(nuismin ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(nuismin ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuismin PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
add_executable(nuissplines nuissplines.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuissplines)
target_link_libraries(nuissplines ${MODULETargets})
target_link_libraries(nuissplines ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(nuissplines ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuissplines PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
endif()
include_directories(${RWENGINE_INCLUDE_DIRECTORIES})
include_directories(${CMAKE_SOURCE_DIR}/src/Routines)
include_directories(${CMAKE_SOURCE_DIR}/src/InputHandler)
include_directories(${CMAKE_SOURCE_DIR}/src/Genie)
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
include_directories(${CMAKE_SOURCE_DIR}/src/Utils)
include_directories(${CMAKE_SOURCE_DIR}/src/Splines)
include_directories(${CMAKE_SOURCE_DIR}/src/Reweight)
include_directories(${CMAKE_SOURCE_DIR}/src/FCN)
include_directories(${CMAKE_SOURCE_DIR}/src/MCStudies)
include_directories(${EXP_INCLUDE_DIRECTORIES})
-if (USE_NuWro)
+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 (BUILD_GEVGEN)
add_executable(gevgen_nuisance gEvGen_NUISANCE.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};gevgen_nuisance)
target_link_libraries(gevgen_nuisance ${MODULETargets})
target_link_libraries(gevgen_nuisance ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(gevgen_nuisance ${ROOT_LIBS})
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
include_directories(${GENIE_INCLUDES}/Apps)
include_directories(${GENIE_INCLUDES}/FluxDrivers)
include_directories(${GENIE_INCLUDES}/EVGDrivers)
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(gevgen_nuisance PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
endif()
if (USE_GiBUU)
add_executable(DumpGiBUUEvents DumpGiBUUEvents.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};DumpGiBUUEvents)
target_link_libraries(DumpGiBUUEvents ${MODULETargets})
target_link_libraries(DumpGiBUUEvents ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(DumpGiBUUEvents ${ROOT_LIBS})
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(DumpGiBUUEvents PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
endif()
add_executable(nuiscomp nuiscomp.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuiscomp)
target_link_libraries(nuiscomp ${MODULETargets})
target_link_libraries(nuiscomp ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(nuiscomp ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuiscomp PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
add_executable(nuisflat nuisflat.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuisflat)
target_link_libraries(nuisflat ${MODULETargets})
target_link_libraries(nuisflat ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(nuisflat ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuisflat PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
add_executable(nuissyst nuissyst.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};nuissyst)
target_link_libraries(nuissyst ${MODULETargets})
target_link_libraries(nuissyst ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(nuissyst ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(nuissyst PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
if(USE_GENIE)
add_executable(PrepareGENIE PrepareGENIE.cxx)
set(TARGETS_TO_BUILD ${TARGETS_TO_BUILD};PrepareGENIE)
target_link_libraries(PrepareGENIE ${MODULETargets})
target_link_libraries(PrepareGENIE ${CMAKE_DEPENDLIB_FLAGS})
# target_link_libraries(PrepareGENIE ${ROOT_LIBS})
if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
set_target_properties(PrepareGENIE PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
endif()
endif()
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()
install(TARGETS ${TARGETS_TO_BUILD} DESTINATION bin)
diff --git a/app/PrepareNuwroEvents.cxx b/app/PrepareNuwroEvents.cxx
index d33a2dc..b8778a8 100644
--- a/app/PrepareNuwroEvents.cxx
+++ b/app/PrepareNuwroEvents.cxx
@@ -1,298 +1,299 @@
#include <stdio.h>
#include <stdlib.h>
#include "event1.h"
-#include "params_all.h"
-#include "params.h"
+//Hopefully we don't need these as they're included above.
+// #include "params_all.h"
+// #include "params.h"
#include "TFile.h"
#include "TH1D.h"
#include "TTree.h"
#include "PlotUtils.h"
#include "FitLogger.h"
void printInputCommands(){ return; };
void CreateRateHistograms(std::string inputs, bool force_out);
void HaddNuwroFiles(std::vector<std::string>& inputs, bool force_out);
//*******************************
int main(int argc, char* argv[]){
//*******************************
-
+
// If No Arguments print commands
if (argc == 1) printInputCommands();
std::vector<std::string> inputfiles;
bool force_output = false;
-
+
// Get Inputs
for (int i = 1; i< argc; ++i){
if (!std::strcmp(argv[i], "-h")) printInputCommands();
else if (!std::strcmp(argv[i], "-f")) force_output = true;
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();
}
CreateRateHistograms(inputfiles[0], force_output);
-
+
LOG(FIT) << "Finished NUWRO Prep." << std::endl;
};
//*******************************
void CreateRateHistograms(std::string inputs, bool force_out){
//*******************************
// Open root file
TFile* inRootFile = new TFile(inputs.c_str(), "UPDATE");
TTree* nuwrotree = (TTree*) inRootFile->Get("treeout");
-
+
// Get Flux Histogram
event* evt = NULL;
nuwrotree->SetBranchAddress("e",&evt);
nuwrotree->GetEntry(0);
int fluxtype = evt->par.beam_type;
std::map<int, TH1D*> fluxlist;
std::map<int, TH1D*> eventlist;
std::vector<int> allpdg;
std::map<int, int> nevtlist;
std::map<int, double> 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;
if (fluxtype == 0){
-
+
std::string fluxstring = evt->par.beam_energy;
std::vector<double> 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;
-
+
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;
-
+
fluxplot = new TH1D("fluxplot","fluxplot", fluxvals.size()-4, Elow, Ehigh);
for (uint j = 2; j < fluxvals.size(); j++){
LOG(DEB) << j <<" "<<fluxvals[j]<<endl;
fluxplot->SetBinContent(j-1, fluxvals[j]);
}
} else { // For monoenergetic fluxes
LOG(FIT) << "Adding mono-energetic nuwro flux "
<< "pdg: " << pdg
<< " E: " << Elow
<< std::endl;
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]->SetNameTitle("FluxHist",
"FluxHist");
-
+
// Prep empty total events
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();
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<std::string> fluxlines = GeneralUtils::ParseToStr(fluxstring, "\n");
for (uint i = 0; i < fluxlines.size(); i++){
-
+
std::vector<double> 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;
-
+
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]->SetNameTitle("FluxHist",
"FluxHist");
-
+
// Prep empty total events
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();
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;
-
+
for (int i = 0; i < nevents; i++){
nuwrotree->GetEntry(i);
// Get Variables
- Enu = evt->in[0].E() / 1000.0;
+ 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 = "
+ << " : E, W, PDG = "
<< Enu << ", " << TotXSec << ", "
<< pdg << std::endl;
-
+
}
TH1D* zeroevents = (TH1D*) eventlist[0]->Clone();
-
+
// 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;
-
+
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);
+ eventlist[pdg] -> Write("",TObject::kOverwrite);
}
// Tidy up
inRootFile->Close();
fluxlist.clear();
eventlist.clear();
// Exit Program
return;
}
-//*******************************
+//*******************************
void HaddNuwroFiles(std::vector<std::string>& inputs, bool force_out){
//*******************************
// Get output file name
std::string outputname = inputs[0];
// Make command line string
std::string cmd = "hadd ";
if (force_out) cmd += "-f ";
- for (UInt_t i = 0; i < inputs.size(); i++){
+ for (UInt_t i = 0; i < inputs.size(); i++){
cmd += inputs[i] + " ";
}
LOG(FIT) <<" Running HADD from ExtFit_PrepareNuwro: "<<cmd<<std::endl;
// Start HADD
system(cmd.c_str());
-
+
// Return name of output file
inputs.clear();
inputs.push_back( outputname );
return;
}
-
+
diff --git a/cmake/GENIESetup.cmake b/cmake/GENIESetup.cmake
index 4992c1c..1fdb3dd 100644
--- a/cmake/GENIESetup.cmake
+++ b/cmake/GENIESetup.cmake
@@ -1,150 +1,150 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NUISANCE.
#
# NUISANCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NUISANCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
################################################################################
# TODO
# check system for libxml2
# check whether we need the includes
# check if we can use a subset of the GENIE libraries
################################################################################
# Check Dependencies
################################################################################
################################# GENIE ######################################
if(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 and environment vairable"
" $ export GENIE=/path/to/GENIE")
endif()
if (BUILD_GEVGEN)
cmessage(STATUS "Building custom gevgen")
LIST(APPEND EXTRA_CXX_FLAGS -D__GEVGEN_ENABLED__)
endif()
# Extract GENIE VERSION
execute_process (COMMAND ${CMAKE_SOURCE_DIR}/cmake/getgenieversion.sh ${GENIE}
OUTPUT_VARIABLE GENIE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND genie-config
--libs OUTPUT_VARIABLE GENIE_LD_FLAGS_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND genie-config
--topsrcdir OUTPUT_VARIABLE GENIE_INCLUDES_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "-L\([^ ]+\) \(.*\)$" PARSE_GENIE_LIBS_MATCH ${GENIE_LD_FLAGS_STR})
cmessage(DEBUG "genie-config --libs: ${GENIE_LD_FLAGS_STR}")
if(NOT PARSE_GENIE_LIBS_MATCH)
cmessage(FATAL_ERROR "Expected to be able to parse the result of genie-config --libs to a lib directory and a list of libraries to include, but got: \"${GENIE_LD_FLAGS_STR}\"")
endif()
set(GENIE_LIB_DIR ${CMAKE_MATCH_1})
set(GENIE_LIBS_RAW ${CMAKE_MATCH_2})
string(REPLACE "-l" "" GENIE_LIBS_STRIPED "${GENIE_LIBS_RAW}")
cmessage(STATUS "GENIE version : ${GENIE_VERSION}")
cmessage(STATUS "GENIE libdir : ${GENIE_LIB_DIR}")
cmessage(STATUS "GENIE libs : ${GENIE_LIBS_STRIPED}")
string(REGEX MATCH "ReinSeghal" WASMATCHED ${GENIE_LIBS_STRIPED})
if(WASMATCHED AND GENIE_VERSION STREQUAL "210")
set(GENIE_SEHGAL ${GENIE_LIBS_STRIPED})
STRING(REPLACE "ReinSeghal" "ReinSehgal" GENIE_LIBS_STRIPED ${GENIE_SEHGAL})
cmessage(DEBUG "Fixed inconsistency in library naming: ${GENIE_LIBS_STRIPED}")
endif()
string(REGEX MATCH "ReWeight" WASMATCHED ${GENIE_LIBS_STRIPED})
if(NOT WASMATCHED)
set(GENIE_LIBS_STRIPED "GReWeight ${GENIE_LIBS_STRIPED}")
cmessage(DEBUG "Force added ReWeight library: ${GENIE_LIBS_STRIPED}")
endif()
string(REPLACE " " ";" GENIE_LIBS_LIST "${GENIE_LIBS_STRIPED}")
cmessage(DEBUG "genie-config --libs -- MATCH1: ${CMAKE_MATCH_1}")
cmessage(DEBUG "genie-config --libs -- MATCH2: ${CMAKE_MATCH_2}")
cmessage(DEBUG "genie-config --libs -- libs stripped: ${GENIE_LIBS_STRIPED}")
cmessage(DEBUG "genie-config --libs -- libs list: ${GENIE_LIBS_LIST}")
################################ 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 and environment vairable $ 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 and environment vairable $ 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 and environment variable $ export LHAPATH=/path/to/LHAPATH")
endif()
################################ LIBXML ######################################
if(LIBXML2_LIB STREQUAL "")
cmessage(FATAL_ERROR "Variable LIBXML2_LIB is not defined. The location of a pre-built libxml2 install must be defined either as $ cmake -DLIBXML2_LIB=/path/to/LIBXML2_libraries or as and environment vairable $ export LIBXML2_LIB=/path/to/LIBXML2_libraries")
endif()
if(LIBXML2_INC STREQUAL "")
cmessage(FATAL_ERROR "Variable LIBXML2_INC is not defined. The location of a pre-built libxml2 install must be defined either as $ cmake -DLIBXML2_INC=/path/to/LIBXML2_includes or as and environment vairable $ export LIBXML2_INC=/path/to/LIBXML2_includes")
endif()
############################### log4cpp ######################################
if(LOG4CPP_LIB STREQUAL "")
cmessage(FATAL_ERROR "Variable LOG4CPP_LIB is not defined. The location of a pre-built log4cpp install must be defined either as $ cmake -DLOG4CPP_LIB=/path/to/LOG4CPP_libraries or as and environment vairable $ export LOG4CPP_LIB=/path/to/LOG4CPP_libraries")
endif()
-if(GENIE_LOG4CPP_INC STREQUAL "")
- cmessage(FATAL_ERROR "Variable GENIE_LOG4CPP_INC is not defined. The location of a pre-built log4cpp install must be defined either as $ cmake -DGENIE_LOG4CPP_INC=/path/to/LOG4CPP_includes or as and environment vairable $ export LOG4CPP_INC=/path/to/LOG4CPP_includes")
+if(LOG4CPP_INC STREQUAL "")
+ cmessage(FATAL_ERROR "Variable LOG4CPP_INC is not defined. The location of a pre-built log4cpp install must be defined either as $ cmake -DGENIE_LOG4CPP_INC=/path/to/LOG4CPP_includes or as and environment vairable $ export LOG4CPP_INC=/path/to/LOG4CPP_includes")
endif()
################################################################################
LIST(APPEND EXTRA_CXX_FLAGS -D__GENIE_ENABLED__ -D__GENIE_VERSION__=${GENIE_VERSION})
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES
${GENIE_INCLUDES_DIR}
${GENIE_INCLUDES_DIR}/GHEP
${GENIE_INCLUDES_DIR}/Ntuple
${GENIE_INCLUDES_DIR}/ReWeight
${GENIE_INCLUDES_DIR}/Apps
${GENIE_INCLUDES_DIR}/FluxDrivers
${GENIE_INCLUDES_DIR}/EVGDrivers
${LHAPDF_INC}
${LIBXML2_INC}
- ${GENIE_LOG4CPP_INC})
+ ${LOG4CPP_INC})
SAYVARS()
LIST(APPEND EXTRA_LINK_DIRS
${GENIE_LIB_DIR}
${LHAPDF_LIB}
${LIBXML2_LIB}
${LOG4CPP_LIB})
#LIST(REVERSE EXTRA_LIBS)
#LIST(REVERSE GENIE_LIBS_LIST)
LIST(APPEND EXTRA_LIBS ${GENIE_LIBS_LIST})
#LIST(REVERSE EXTRA_LIBS)
LIST(APPEND EXTRA_LIBS LHAPDF xml2 log4cpp)
set(NEED_PYTHIA6 TRUE)
set(NEED_ROOTPYTHIA6 TRUE)
set(NEED_ROOTEVEGEN TRUE)
SET(USE_GENIE TRUE CACHE BOOL "Whether to enable GENIE (reweight) support. Requires external libraries. <FALSE>" FORCE)
diff --git a/cmake/NuWroSetup.cmake b/cmake/NuWroSetup.cmake
index 52c93e4..711fdc1 100644
--- a/cmake/NuWroSetup.cmake
+++ b/cmake/NuWroSetup.cmake
@@ -1,87 +1,89 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NUISANCE.
#
# NUISANCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NUISANCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
################################################################################
-if(INPUT_NuWro_FILE)
+if(NOT NUWRO_INPUT_FILE STREQUAL "")
- if(NOT EXISTS ${INPUT_NuWro_FILE})
- cmessage(FATAL_ERROR "Expected -DBUILD_NuWro_FROM_FILE to point to a valid input file. Cannot find: '${INPUT_NuWro_FILE}'")
+ 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 ${INPUT_NuWro_FILE} "event,vec,vect,particle,flags,params,line" STATIC)
+ 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 ${INPUT_NuWro_FILE} "event,vec,vect,particle,flags,params,line" SHARED)
+ 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 RWENGINE_LINKER_FLAGS ${CMAKE_CURRENT_BINARY_DIR}/${ROOTLIBNAME})
+ LIST(APPEND EXTRA_LINK_DIRS ${CMAKE_BINARY_DIR})
- LIST(APPEND PROJECTWIDE_EXTRA_DEPENDENCIES NuWro_event1HeaderLink)
+ 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(NUWRO_INC STREQUAL "")
cmessage(FATAL_ERROR "Variable NUWRO_INC is not defined. "
"This must be set to point to an installed NuWro instance.")
endif()
# If you are using a version of NuWro without reweighting use this to compile.
if(USE_NuWro_RW)
LIST(APPEND EXTRA_CXX_FLAGS -D__NUWRO_ENABLED__ -D__NUWRO_REWEIGHT_ENABLED__)
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)
LIST(APPEND EXTRA_SHAREDOBJS ${NUWRO}/bin/event1.so)
endif()
set(NEED_PYTHIA6 TRUE)
set(NEED_ROOTPYTHIA6 TRUE)
endif()
diff --git a/cmake/cacheVariables.cmake b/cmake/cacheVariables.cmake
index 9f34264..f37d4f6 100644
--- a/cmake/cacheVariables.cmake
+++ b/cmake/cacheVariables.cmake
@@ -1,197 +1,197 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NUISANCE.
#
# NUISANCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NUISANCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
################################################################################
function(CheckAndSetDefaultEnv VARNAME DEFAULT CACHETYPE DOCSTRING ENVNAME)
#cmessage(DEBUG "Trying to assign variable ${VARNAME} into the cache.")
if(NOT DEFINED ${VARNAME})
if(DEFINED ENV{${ENVNAME}} AND NOT $ENV{${ENVNAME}} STREQUAL "")
set(${VARNAME} $ENV{${ENVNAME}} CACHE ${CACHETYPE} ${DOCSTRING})
cmessage(DEBUG " Read ${VARNAME} from ENVVAR ${ENVNAME} as $ENV{${ENVNAME}}.")
else()
set(${VARNAME} ${DEFAULT} CACHE ${CACHETYPE} ${DOCSTRING})
endif()
else()
set(${VARNAME} ${${VARNAME}} CACHE ${CACHETYPE} ${DOCSTRING})
unset(${VARNAME})
endif()
cmessage(CACHE "--Set cache variable: \"${VARNAME}\" to \"${${VARNAME}}\", in cache ${CACHETYPE}.")
endfunction()
function(CheckAndSetDefaultCache VARNAME DEFAULT CACHETYPE DOCSTRING)
# cmessage(DEBUG "Trying to assign variable ${VARNAME} into the cache.")
if(NOT DEFINED ${VARNAME})
set(${VARNAME} ${DEFAULT} CACHE ${CACHETYPE} ${DOCSTRING})
else()
set(${VARNAME} ${${VARNAME}} CACHE ${CACHETYPE} ${DOCSTRING})
unset(${VARNAME})
endif()
cmessage(CACHE "--Set cache variable: \"${VARNAME}\" to \"${${VARNAME}}\", in cache ${CACHETYPE}.")
endfunction()
function(CheckAndSetDefault VARNAME DEFAULT)
# cmessage(DEBUG "Trying to assign variable ${VARNAME}.")
if(NOT DEFINED ${VARNAME})
set(${VARNAME} ${DEFAULT} PARENT_SCOPE)
set(${VARNAME} ${DEFAULT})
endif()
cmessage(CACHE "--Set variable: \"${VARNAME}\" to \"${${VARNAME}}\".")
endfunction()
CheckAndSetDefaultCache(VERBOSE TRUE BOOL "Whether to configure loudly.")
set (CMAKE_SKIP_BUILD_RPATH TRUE)
#Changes default install path to be a subdirectory of the build dir.
#Can set build dir at configure time with -DCMAKE_INSTALL_PREFIX=/install/path
if(CMAKE_INSTALL_PREFIX STREQUAL "" OR CMAKE_INSTALL_PREFIX STREQUAL
"/usr/local")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
elseif(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE DEBUG)
elseif(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG)
endif()
CheckAndSetDefaultCache(USE_HEPMC FALSE BOOL "Whether to enable HepMC input support. <FALSE>")
CheckAndSetDefaultEnv(HEPMC "" PATH "Path to HepMC source tree root directory. Overrides environment variable \$HEPMC <>" HEPMC)
CheckAndSetDefaultCache(HEPMC_MOMUNIT "GEV" STRING "HepMC momentum units [MEV|GEV]. <GEV>")
CheckAndSetDefaultCache(HEPMC_LENUNIT "CM" STRING "HepMC momentum units [MM|CM]. <CM>")
CheckAndSetDefaultCache(HEPMC_USED_EP FALSE INTERNAL "Whether the we built HepMC or not. <FALSE>")
CheckAndSetDefaultCache(USE_NEUT FALSE BOOL "Whether to enable NEUT (reweight) support. Requires external libraries. <FALSE>")
CheckAndSetDefaultEnv(NEUT_ROOT "" PATH "Path to NEUT source tree root directory. Overrides environment variable \$NEUT_ROOT <>" NEUT_ROOT)
CheckAndSetDefaultEnv(CERN "" PATH "Path to CERNLIB source tree root directory that NEUT was built against. Overrides environment variable \$CERN <>" CERN)
CheckAndSetDefaultEnv(CERN_LEVEL "" STRING "CERNLIB Library version. Overrides environment variable \$CERN_LEVEL <>" CERN_LEVEL)
CheckAndSetDefaultCache(USE_NuWro FALSE BOOL "Whether to enable NuWro support. <FALSE>")
CheckAndSetDefaultEnv(NUWRO "" PATH "Path to NuWro source tree root directory. Overrides environment variable \$NUWRO <>" NUWRO)
CheckAndSetDefaultEnv(NUWRO_INC "" PATH "Path to NuWro installed includes directory, needs to contain \"params_all.h\". Overrides environment variable \$NUWRO_INC <>" NUWRO_INC)
CheckAndSetDefaultCache(NUWRO_INPUT_FILE "" FILEPATH "Path to an input NuWro event vector, which can be used to build NuWro i/o libraries. <>")
CheckAndSetDefaultCache(NUWRO_BUILT_FROM_FILE FALSE INTERNAL "Whether the NuWro libraries were built by NUISANCE. <FALSE>")
CheckAndSetDefaultCache(USE_NuWro_RW FALSE BOOL "Whether to try and build support for NuWro reweighting. <FALSE>")
CheckAndSetDefaultCache(USE_GENIE FALSE BOOL "Whether to enable GENIE (reweight) support. Requires external libraries. <FALSE>")
CheckAndSetDefaultEnv(GENIE "" PATH "Path to GENIE source tree root directory. Overrides environment variable \$GENIE <>" GENIE)
CheckAndSetDefaultEnv(LHAPDF_LIB "" PATH "Path to pre-built LHAPDF libraries. Overrides environment variable \$LHAPDF_LIB. <>" LHAPDF_LIB)
CheckAndSetDefaultEnv(LHAPDF_INC "" PATH "Path to installed LHAPDF headers. Overrides environment variable \$LHAPDF_INC. <>" LHAPDF_INC)
CheckAndSetDefaultEnv(LHAPATH "" PATH "Path to LHA PDF inputs. Overrides environment variable \$LHAPATH. <>" LHAPATH)
CheckAndSetDefaultEnv(LIBXML2_LIB "" PATH "Path to pre-built LIBXML2 libraries. Overrides environment variable \$LIBXML2_LIB. <>" LIBXML2_LIB)
CheckAndSetDefaultEnv(LIBXML2_INC "" PATH "Path to installed LIBXML2 headers. Overrides environment variable \$LIBXML2_INC. <>" LIBXML2_INC)
CheckAndSetDefaultEnv(LOG4CPP_LIB "" PATH "Path to pre-built LOG4CPP libraries. Overrides environment variable \$LOG4CPP_LIB. <>" LOG4CPP_LIB)
-CheckAndSetDefaultEnv(GENIE_LOG4CPP_INC "" PATH "Path to installed LOG4CPP headers. Overrides environment variable \$LOG4CPP_INC. <>" LOG4CPP_INC)
+CheckAndSetDefaultEnv(LOG4CPP_INC "" PATH "Path to installed LOG4CPP headers. Overrides environment variable \$LOG4CPP_INC. <>" LOG4CPP_INC)
CheckAndSetDefaultCache(BUILD_GEVGEN FALSE BOOL "Whether to build nuisance_gevgen app.")
CheckAndSetDefaultCache(USE_T2K FALSE BOOL "Whether to enable T2KReWeight support. Requires external libraries. <FALSE>")
CheckAndSetDefaultEnv(T2KREWEIGHT "" PATH "Path to installed T2KREWEIGHTReWeight. Overrides environment variable \$T2KREWEIGHT. <>" T2KREWEIGHT)
CheckAndSetDefaultCache(USE_NIWG FALSE BOOL "Whether to enable (T2K) NIWG ReWeight support. Requires external libraries. <FALSE>")
CheckAndSetDefaultEnv(NIWG_ROOT "" PATH "Path to installed NIWGReWeight. Overrides environment variable \$NIWG. <>" NIWG)
CheckAndSetDefaultEnv(PYTHIA6 "" PATH "Path to directory containing libPythia6.so. Overrides environment variable \$PYTHIA6 <>" PYTHIA6)
CheckAndSetDefaultCache(USE_GiBUU TRUE BOOL "Whether to enable GiBUU event support. <TRUE>")
CheckAndSetDefaultCache(BUILD_GiBUU FALSE BOOL "Whether to build supporting GiBUU event tools along with a patched version of GiBUU. <FALSE>")
CheckAndSetDefaultCache(USE_NUANCE TRUE BOOL "Whether to enable NUANCE event support. <TRUE>")
CheckAndSetDefaultCache(NO_EXTERNAL_UPDATE TRUE BOOL "Whether to perform the update target for external dependencies. <TRUE>")
CheckAndSetDefaultCache(USE_GPERFTOOLS FALSE BOOL "Whether to compile in google performance tools. <TRUE>")
CheckAndSetDefault(NEED_PYTHIA6 FALSE)
CheckAndSetDefault(NEED_ROOTEVEGEN FALSE)
CheckAndSetDefault(NEED_ROOTPYTHIA6 FALSE)
CheckAndSetDefaultCache(USE_OMP FALSE BOOL "Whether to enable multicore features (there currently are none...). <FALSE>")
CheckAndSetDefault(NO_EXPERIMENTS FALSE)
cmessage(STATUS "NO_EXPERIMENTS: ${NO_EXPERIMENTS}")
CheckAndSetDefaultCache(NO_ANL ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build ANL samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_ArgoNeuT ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build ArgoNeuT samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_BEBC ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build BEBC samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_BNL ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build BNL samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_FNAL ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build FNAL samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_GGM ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build GGM samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_K2K ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build K2K samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_MINERvA ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build MINERvA samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_MiniBooNE ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build MiniBooNE samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_T2K ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build T2K samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_SciBooNE ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build SciBooNE samples. <-DNO_EXPERIMENTS=FALSE>")
function(SAYVARS)
LIST(APPEND VARS
USE_HEPMC
HEPMC
HEPMC_MOMUNIT
HEPMC_LENUNIT
HEPMC_USED_EP
USE_NEUT
NEUT_ROOT
CERN
CERN_LEVEL
USE_NuWro
NUWRO
NUWRO_INC
NUWRO_INPUT_FILE
NUWRO_BUILT_FROM_FILE
USE_GENIE
GENIE
LHAPDF_LIB
LHAPDF_INC
LIBXML2_LIB
LIBXML2_INC
LOG4CPP_LIB
GENIE_LOG4CPP_INC
BUILD_GEVGEN
USE_T2K
USE_NIWG
USE_GiBUU
BUILD_GiBUU
USE_NUANCE
NO_EXTERNAL_UPDATE
USE_GPERFTOOLS
NO_ANL
NO_ArgoNeuT
NO_BEBC
NO_BNL
NO_FNAL
NO_GGM
NO_K2K
NO_MINERvA
NO_MiniBooNE
NO_T2K
NO_SciBooNE)
foreach(v ${VARS})
if(DEFINED ${v})
cmessage(DEBUG "VARIABLE: \"${v}\" = \"${${v}}\"")
endif()
endforeach(v)
endfunction()
diff --git a/cmake/setup.sh.in b/cmake/setup.sh.in
index 959c3bc..9acb3f8 100644
--- a/cmake/setup.sh.in
+++ b/cmake/setup.sh.in
@@ -1,126 +1,130 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NUISANCE.
#
# NUISANCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NUISANCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
################################################################################
#!/bin/sh
if ! [[ ":$PATH:" == *":@CMAKE_INSTALL_PREFIX@/bin:"* ]]; then
export PATH=@CMAKE_INSTALL_PREFIX@/bin:$PATH
fi
if ! [[ ":$LD_LIBRARY_PATH:" == *":@CMAKE_INSTALL_PREFIX@/lib:"* ]]; then
export LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:$LD_LIBRARY_PATH
fi
if [[ ! "${ROOTSYS}" ]]; then
echo "[INFO]: Sourcing ROOT from: @CMAKE_ROOTSYS@"
source "@CMAKE_ROOTSYS@/bin/thisroot.sh"
fi
if [[ "@USE_NEUT@" != "FALSE" ]]; then
echo "[INFO]: Adding NEUT library paths to the environment."
export NEUT_ROOT=@NEUT_ROOT@
export CERN=@CERN@
export CERN_LEVEL=@CERN_LEVEL@
if ! [[ ":$LD_LIBRARY_PATH:" == *":${NEUT_ROOT}/lib/Linux_pc:"* ]]; then
export LD_LIBRARY_PATH=${NEUT_ROOT}/lib/Linux_pc:$LD_LIBRARY_PATH
fi
if ! [[ ":$LD_LIBRARY_PATH:" == *":${NEUT_ROOT}/src/reweight:"* ]]; then
export LD_LIBRARY_PATH=${NEUT_ROOT}/src/reweight:$LD_LIBRARY_PATH
fi
fi
if [[ "@USE_NuWro@" != "FALSE" ]]; then
- echo "[INFO]: Adding NuWro library paths to the environment."
- export NUWRO="@NUWRO@"
- if ! [[ ":$LD_LIBRARY_PATH:" == *":@NUWRO@/build/@CMAKE_SYSTEM_NAME@/lib:"* ]]; then
- export LD_LIBRARY_PATH=@NUWRO@/build/@CMAKE_SYSTEM_NAME@/lib:$LD_LIBRARY_PATH
+ if [[ "@NUWRO_BUILT_FROM_FILE@" == "FALSE" ]]; then
+ echo "[INFO]: Adding NuWro library paths to the environment."
+ export NUWRO="@NUWRO@"
+ if ! [[ ":$LD_LIBRARY_PATH:" == *":@NUWRO@/build/@CMAKE_SYSTEM_NAME@/lib:"* ]]; then
+ export LD_LIBRARY_PATH=@NUWRO@/build/@CMAKE_SYSTEM_NAME@/lib:$LD_LIBRARY_PATH
+ fi
+ else
+ echo "[INFO]: NuWro support included from input event file."
fi
fi
if [[ "@NEED_PYTHIA6@" != "FALSE" ]]; then
echo "[INFO]: Adding PYTHIA6 library paths to the environment."
export PYTHIA6="@PYTHIA6@"
if ! [[ ":$LD_LIBRARY_PATH:" == *":@PYTHIA6@:"* ]]; then
export LD_LIBRARY_PATH=@PYTHIA6@:$LD_LIBRARY_PATH
fi
fi
if [[ "@USE_GENIE@" != "FALSE" ]]; then
echo "[INFO]: Adding GENIE paths to the environment."
export GENIE="@GENIE@"
export LHAPDF_LIB="@LHAPDF_LIB@"
export LHAPDF_INC="@LHAPDF_INC@"
export LIBXML2_LIB="@LIBXML2_LIB@"
export LIBXML2_INC="@LIBXML2_INC@"
export LOG4CPP_LIB="@LOG4CPP_LIB@"
- export LOG4CPP_INC="@GENIE_LOG4CPP_INC@"
+ export LOG4CPP_INC="@LOG4CPP_INC@"
if [[ "@LHAPATH@" ]]; then
export LHAPATH="@LHAPATH@"
fi
if ! [[ ":$PATH:" == *":@GENIE@/bin:"* ]]; then
export PATH=@GENIE@/bin:$PATH
fi
if ! [[ ":$LD_LIBRARY_PATH:" == *":@GENIE@/lib:"* ]]; then
export LD_LIBRARY_PATH=@GENIE@/lib:$LD_LIBRARY_PATH
fi
if ! [[ ":$LD_LIBRARY_PATH:" == *":@LHAPDF_LIB@:"* ]]; then
export LD_LIBRARY_PATH=@LHAPDF_LIB@:$LD_LIBRARY_PATH
fi
if ! [[ ":$LD_LIBRARY_PATH:" == *":@LIBXML2_LIB@:"* ]]; then
export LD_LIBRARY_PATH=@LIBXML2_LIB@:$LD_LIBRARY_PATH
fi
if ! [[ ":$LD_LIBRARY_PATH:" == *":@LOG4CPP_LIB@:"* ]]; then
export LD_LIBRARY_PATH=@LOG4CPP_LIB@:$LD_LIBRARY_PATH
fi
fi
if [[ "@USE_NIWG@" != "FALSE" ]]; then
echo "[INFO]: Adding NIWG paths to the environment."
export NIWG=@NIWG_ROOT@
export NIWGREWEIGHT_INPUTS=@NIWG_ROOT@/inputs
if ! [[ ":$LD_LIBRARY_PATH:" == *":@NIWG_ROOT@:"* ]]; then
export LD_LIBRARY_PATH=${NIWG}:${LD_LIBRARY_PATH}
fi
fi
if [[ "@USE_T2K@" != "FALSE" ]]; then
echo "[INFO]: Adding T2K paths to the environment."
export T2KREWEIGHT=@T2KREWEIGHT@
if ! [[ ":$LD_LIBRARY_PATH:" == *":@T2KREWEIGHT@/lib:"* ]]; then
export LD_LIBRARY_PATH=${T2KREWEIGHT}/lib:${LD_LIBRARY_PATH}
fi
fi
if [[ "@BUILD_GiBUU@" != "FALSE" ]]; then
echo "[INFO]: Sourcing GiBUU tools."
source @CMAKE_BINARY_DIR@/GiBUUTools/src/GiBUUTools-build/Linux/setup.sh
fi
export NUISANCE="@CMAKE_SOURCE_DIR@"
diff --git a/src/InputHandler/NuWroInputHandler.cxx b/src/InputHandler/NuWroInputHandler.cxx
index 408d7b3..8afc4fd 100644
--- a/src/InputHandler/NuWroInputHandler.cxx
+++ b/src/InputHandler/NuWroInputHandler.cxx
@@ -1,472 +1,441 @@
#ifdef __NUWRO_ENABLED__
#include "NuWroInputHandler.h"
-NuWroGeneratorInfo::~NuWroGeneratorInfo(){
- delete fNuWroParticlePDGs;
-}
+NuWroGeneratorInfo::~NuWroGeneratorInfo() { delete fNuWroParticlePDGs; }
void NuWroGeneratorInfo::AddBranchesToTree(TTree* tn) {
- tn->Branch("NuWroParticlePDGs", &fNuWroParticlePDGs, "NuWroParticlePDGs/I");
+ tn->Branch("NuWroParticlePDGs", &fNuWroParticlePDGs, "NuWroParticlePDGs/I");
}
void NuWroGeneratorInfo::SetBranchesFromTree(TTree* tn) {
- tn->SetBranchAddress("NuWroParticlePDGs", &fNuWroParticlePDGs);
+ tn->SetBranchAddress("NuWroParticlePDGs", &fNuWroParticlePDGs);
}
void NuWroGeneratorInfo::AllocateParticleStack(int stacksize) {
- fNuWroParticlePDGs = new int[stacksize];
+ fNuWroParticlePDGs = new int[stacksize];
}
void NuWroGeneratorInfo::DeallocateParticleStack() {
- delete fNuWroParticlePDGs;
+ delete fNuWroParticlePDGs;
}
-void NuWroGeneratorInfo::FillGeneratorInfo(event* e) {
- Reset();
-}
+void NuWroGeneratorInfo::FillGeneratorInfo(event* e) { Reset(); }
void NuWroGeneratorInfo::Reset() {
- for (int i = 0; i < kMaxParticles; i++) {
- fNuWroParticlePDGs[i] = 0;
- }
+ for (int i = 0; i < kMaxParticles; i++) {
+ fNuWroParticlePDGs[i] = 0;
+ }
}
-NuWroInputHandler::NuWroInputHandler(std::string const& handle, std::string const& rawinputs) {
- LOG(SAM) << "Creating NuWroInputHandler : " << handle << std::endl;
-
- // Run a joint input handling
- fName = handle;
- fMaxEvents = FitPar::Config().GetParI("MAXEVENTS");
- fSaveExtra = false; //FitPar::Config().GetParB("NuWroSaveExtra");
- // Setup the TChain
- fNuWroTree = new TChain("treeout");
-
- // Loop over all inputs and grab flux, eventhist, and nevents
- std::vector<std::string> inputs = InputUtils::ParseInputFileList(rawinputs);
- for (size_t inp_it = 0; inp_it < inputs.size(); ++inp_it) {
-
- // Open File for histogram access
- TFile* inp_file = new TFile(inputs[inp_it].c_str(), "READ");
- if (!inp_file or inp_file->IsZombie()) {
- ERR(FTL) << "nuwro File IsZombie() at " << inputs[inp_it] << std::endl;
- throw;
- }
-
- // Get Flux/Event hist
- TH1D* fluxhist = (TH1D*)inp_file->Get(
- (PlotUtils::GetObjectWithName(inp_file, "FluxHist")).c_str());
- TH1D* eventhist = (TH1D*)inp_file->Get(
- (PlotUtils::GetObjectWithName(inp_file, "EvtHist")).c_str());
- if (!fluxhist or !eventhist) {
- ERR(FTL) << "nuwro FILE doesn't contain flux/xsec info" << std::endl;
- if (FitPar::Config().GetParB("regennuwro")) {
- ERR(FTL) << "Regen NuWro has not been added yet. Email the developers!" << std::endl;
- // ProcessNuWroInputFlux(inputs[inp_it]);
- throw;
- } else {
- ERR(FTL) << "If you would like NUISANCE to generate these for you "
- << "please set parameter regennuwro=1 and re-run." << std::endl;
- throw;
- }
- }
-
- // Get N Events
- TTree* nuwrotree = (TTree*)inp_file->Get("treeout");
- if (!nuwrotree) {
- ERR(FTL) << "treeout not located in nuwro file! " << inputs[inp_it] << std::endl;
- throw;
- }
- int nevents = nuwrotree->GetEntries();
-
- // Register input to form flux/event rate hists
- RegisterJointInput(inputs[inp_it], nevents, fluxhist, eventhist);
-
- // Add to TChain
- fNuWroTree->Add( inputs[inp_it].c_str() );
- }
-
- // Registor all our file inputs
- SetupJointInputs();
-
- // Setup Events
- fNuWroEvent = NULL;
- fNuWroTree->SetBranchAddress("e", &fNuWroEvent);
- fNuWroTree->GetEntry(0);
-
- fNUISANCEEvent = new FitEvent();
- fNUISANCEEvent->SetNuwroEvent(fNuWroEvent);
- fNUISANCEEvent->HardReset();
-
- if (fSaveExtra) {
- fNuWroInfo = new NuWroGeneratorInfo();
- fNUISANCEEvent->AddGeneratorInfo(fNuWroInfo);
- }
+int event1_nof(event* e, int pdg) {
+ int c = 0;
+ for (size_t i = 0; i < e->out.size(); i++)
+ if (e->out[i].pdg == pdg) c++;
+ return c;
+}
+NuWroInputHandler::NuWroInputHandler(std::string const& handle,
+ std::string const& rawinputs) {
+ LOG(SAM) << "Creating NuWroInputHandler : " << handle << std::endl;
+
+ // Run a joint input handling
+ fName = handle;
+ fMaxEvents = FitPar::Config().GetParI("MAXEVENTS");
+ fSaveExtra = false; // FitPar::Config().GetParB("NuWroSaveExtra");
+ // Setup the TChain
+ fNuWroTree = new TChain("treeout");
+
+ // Loop over all inputs and grab flux, eventhist, and nevents
+ std::vector<std::string> inputs = InputUtils::ParseInputFileList(rawinputs);
+ for (size_t inp_it = 0; inp_it < inputs.size(); ++inp_it) {
+ // Open File for histogram access
+ TFile* inp_file = new TFile(inputs[inp_it].c_str(), "READ");
+ if (!inp_file or inp_file->IsZombie()) {
+ ERR(FTL) << "nuwro File IsZombie() at " << inputs[inp_it] << std::endl;
+ throw;
+ }
+
+ // Get Flux/Event hist
+ TH1D* fluxhist = (TH1D*)inp_file->Get(
+ (PlotUtils::GetObjectWithName(inp_file, "FluxHist")).c_str());
+ TH1D* eventhist = (TH1D*)inp_file->Get(
+ (PlotUtils::GetObjectWithName(inp_file, "EvtHist")).c_str());
+ if (!fluxhist or !eventhist) {
+ ERR(FTL) << "nuwro FILE doesn't contain flux/xsec info" << std::endl;
+ if (FitPar::Config().GetParB("regennuwro")) {
+ ERR(FTL) << "Regen NuWro has not been added yet. Email the developers!"
+ << std::endl;
+ // ProcessNuWroInputFlux(inputs[inp_it]);
+ throw;
+ } else {
+ ERR(FTL) << "If you would like NUISANCE to generate these for you "
+ << "please set parameter regennuwro=1 and re-run."
+ << std::endl;
+ throw;
+ }
+ }
+
+ // Get N Events
+ TTree* nuwrotree = (TTree*)inp_file->Get("treeout");
+ if (!nuwrotree) {
+ ERR(FTL) << "treeout not located in nuwro file! " << inputs[inp_it]
+ << std::endl;
+ throw;
+ }
+ int nevents = nuwrotree->GetEntries();
+
+ // Register input to form flux/event rate hists
+ RegisterJointInput(inputs[inp_it], nevents, fluxhist, eventhist);
+
+ // Add to TChain
+ fNuWroTree->Add(inputs[inp_it].c_str());
+ }
+
+ // Registor all our file inputs
+ SetupJointInputs();
+
+ // Setup Events
+ fNuWroEvent = NULL;
+ fNuWroTree->SetBranchAddress("e", &fNuWroEvent);
+ fNuWroTree->GetEntry(0);
+
+ fNUISANCEEvent = new FitEvent();
+ fNUISANCEEvent->SetNuwroEvent(fNuWroEvent);
+ fNUISANCEEvent->HardReset();
+
+ if (fSaveExtra) {
+ fNuWroInfo = new NuWroGeneratorInfo();
+ fNUISANCEEvent->AddGeneratorInfo(fNuWroInfo);
+ }
};
-NuWroInputHandler::~NuWroInputHandler(){
- if (fNuWroTree) delete fNuWroTree;
+NuWroInputHandler::~NuWroInputHandler() {
+ if (fNuWroTree) delete fNuWroTree;
}
void NuWroInputHandler::CreateCache() {
- // fNuWroTree->SetCacheEntryRange(0, fNEvents);
- // fNuWroTree->AddBranchToCache("*", 1);
- // fNuWroTree->SetCacheSize(fCacheSize);
+ // fNuWroTree->SetCacheEntryRange(0, fNEvents);
+ // fNuWroTree->AddBranchToCache("*", 1);
+ // fNuWroTree->SetCacheSize(fCacheSize);
}
void NuWroInputHandler::RemoveCache() {
- // fNuWroTree->SetCacheEntryRange(0, fNEvents);
- // fNuWroTree->AddBranchToCache("*", 0);
- // fNuWroTree->SetCacheSize(0);
+ // fNuWroTree->SetCacheEntryRange(0, fNEvents);
+ // fNuWroTree->AddBranchToCache("*", 0);
+ // fNuWroTree->SetCacheSize(0);
}
-void NuWroInputHandler::ProcessNuWroInputFlux(const std::string file) {
-}
+void NuWroInputHandler::ProcessNuWroInputFlux(const std::string file) {}
-FitEvent* NuWroInputHandler::GetNuisanceEvent(const UInt_t entry, const bool lightweight) {
+FitEvent* NuWroInputHandler::GetNuisanceEvent(const UInt_t entry,
+ const bool lightweight) {
+ // Catch too large entries
+ if (entry >= (UInt_t)fNEvents) return NULL;
- // Catch too large entries
- if (entry >= (UInt_t)fNEvents) return NULL;
+ // Read Entry from TTree to fill NEUT Vect in BaseFitEvt;
+ fNuWroTree->GetEntry(entry);
- // Read Entry from TTree to fill NEUT Vect in BaseFitEvt;
- fNuWroTree->GetEntry(entry);
+ // Run NUISANCE Vector Filler
+ if (!lightweight) {
+ CalcNUISANCEKinematics();
+ }
- // Run NUISANCE Vector Filler
- if (!lightweight) {
- CalcNUISANCEKinematics();
- }
+ // Setup Input scaling for joint inputs
+ fNUISANCEEvent->InputWeight = GetInputWeight(entry);
- // Setup Input scaling for joint inputs
- fNUISANCEEvent->InputWeight = GetInputWeight(entry);
-
- return fNUISANCEEvent;
+ return fNUISANCEEvent;
}
-int NuWroInputHandler::ConvertNuwroMode (event * e) {
-
- Int_t proton_pdg, neutron_pdg, pion_pdg, pion_plus_pdg, pion_minus_pdg,
- lambda_pdg, eta_pdg, kaon_pdg, kaon_plus_pdg;
- proton_pdg = 2212;
- eta_pdg = 221;
- neutron_pdg = 2112;
- pion_pdg = 111;
- pion_plus_pdg = 211;
- pion_minus_pdg = -211;
- //O_16_pdg = 100069; // oznacznie z Neuta
- lambda_pdg = 3122;
- kaon_pdg = 311;
- kaon_plus_pdg = 321;
-
-
- if (e->flag.qel) // kwiazielastyczne oddziaływanie
- {
- if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
- {
- if (e->flag.cc)
- return -1;
- else
- {
- if (e->nof (proton_pdg))
- return -51;
- else if (e->nof (neutron_pdg))
- return -52; // sprawdzam dodatkowo ?
- }
- }
- else // oddziaływanie z neutrinem
- {
- if (e->flag.cc)
- return 1;
- else
- {
- if (e->nof (proton_pdg))
- return 51;
- else if (e->nof (neutron_pdg))
- return 52;
- }
- }
- }
-
- if (e->flag.mec) {
- if (e->flag.anty) return -2;
- else return 2;
- }
-
-
- if (e->flag.res) //rezonansowa produkcja: pojedynczy pion, pojed.eta, kaon, multipiony
- {
- Int_t liczba_pionow, liczba_kaonow;
-
- liczba_pionow =
- e->nof (pion_pdg) + e->nof (pion_plus_pdg) + e->nof (pion_minus_pdg);
- liczba_kaonow = e->nof (kaon_pdg) + e->nof (kaon_pdg);
-
- if (liczba_pionow > 1 || liczba_pionow == 0) // multipiony
- {
- if (e->flag.anty)
- {
- if (e->flag.cc)
- return -21;
- else
- return -41;
- }
- else
- {
- if (e->flag.cc)
- return 21;
- else
- return 41;
- }
- }
-
- if (liczba_pionow == 1)
- {
- if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
- {
- if (e->flag.cc)
- {
- if (e->nof (neutron_pdg) && e->nof (pion_minus_pdg))
- return -11;
- if (e->nof (neutron_pdg) && e->nof (pion_pdg))
- return -12;
- if (e->nof (proton_pdg) && e->nof (pion_minus_pdg))
- return -13;
- }
- else
- {
- if (e->nof (proton_pdg))
- {
- if (e->nof (pion_minus_pdg))
- return -33;
- else if (e->nof (pion_pdg))
- return -32;
- }
- else if (e->nof (neutron_pdg))
- {
- if (e->nof (pion_plus_pdg))
- return -34;
- else if (e->nof (pion_pdg))
- return -31;
- }
- }
- }
- else // oddziaływanie z neutrinem
- {
- if (e->flag.cc)
- {
- if (e->nof (proton_pdg) && e->nof (pion_plus_pdg))
- return 11;
- if (e->nof (proton_pdg) && e->nof (pion_pdg))
- return 12;
- if (e->nof (neutron_pdg) && e->nof (pion_plus_pdg))
- return 13;
- }
- else
- {
- if (e->nof (proton_pdg))
- {
- if (e->nof (pion_minus_pdg))
- return 33;
- else if (e->nof (pion_pdg))
- return 32;
- }
- else if (e->nof (neutron_pdg))
- {
- if (e->nof (pion_plus_pdg))
- return 34;
- else if (e->nof (pion_pdg))
- return 31;
- }
- }
- }
- }
-
- if (e->nof (eta_pdg)) // produkcja rezonansowa ety
- {
- if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
- {
- if (e->flag.cc)
- return -22;
- else
- {
- if (e->nof (neutron_pdg))
- return -42;
- else if (e->nof (proton_pdg))
- return -43; // sprawdzam dodatkowo ?
- }
- }
- else // oddziaływanie z neutrinem
- {
- if (e->flag.cc)
- return 22;
- else
- {
- if (e->nof (neutron_pdg))
- return 42;
- else if (e->nof (proton_pdg))
- return 43;
- }
- }
- }
-
- if (e->nof (lambda_pdg) == 1 && liczba_kaonow == 1) // produkcja rezonansowa kaonu
- {
- if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
- {
- if (e->flag.cc && e->nof (kaon_pdg))
- return -23;
- else
- {
- if (e->nof (kaon_pdg))
- return -44;
- else if (e->nof (kaon_plus_pdg))
- return -45;
- }
- }
- else // oddziaływanie z neutrinem
- {
- if (e->flag.cc && e->nof (kaon_plus_pdg))
- return 23;
- else
- {
- if (e->nof (kaon_pdg))
- return 44;
- else if (e->nof (kaon_plus_pdg))
- return 45;
- }
- }
-
-
- }
-
- }
-
- if (e->flag.coh) // koherentne oddziaływanie tylko na O(16)
- {
- Int_t _target;
- _target = e->par.nucleus_p + e->par.nucleus_n; // liczba masowa O(16)
-
- if (_target == 16)
- {
- if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
- {
- if (e->flag.cc && e->nof (pion_minus_pdg))
- return -16;
- else if (e->nof (pion_pdg))
- return -36;
- }
- else // oddziaływanie z neutrinem
- {
- if (e->flag.cc && e->nof (pion_plus_pdg))
- return 16;
- else if (e->nof (pion_pdg))
- return 36;
- }
- }
- }
-
- // gleboko nieelastyczne rozpraszanie
- if (e->flag.dis)
- {
- if (e->flag.anty)
- {
- if (e->flag.cc)
- return -26;
- else
- return -46;
- }
- else
- {
- if (e->flag.cc)
- return 26;
- else
- return 46;
- }
- }
-
- return 9999;
+int NuWroInputHandler::ConvertNuwroMode(event* e) {
+ Int_t proton_pdg, neutron_pdg, pion_pdg, pion_plus_pdg, pion_minus_pdg,
+ lambda_pdg, eta_pdg, kaon_pdg, kaon_plus_pdg;
+ proton_pdg = 2212;
+ eta_pdg = 221;
+ neutron_pdg = 2112;
+ pion_pdg = 111;
+ pion_plus_pdg = 211;
+ pion_minus_pdg = -211;
+ // O_16_pdg = 100069; // oznacznie z Neuta
+ lambda_pdg = 3122;
+ kaon_pdg = 311;
+ kaon_plus_pdg = 321;
+
+ if (e->flag.qel) // kwiazielastyczne oddziaływanie
+ {
+ if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
+ {
+ if (e->flag.cc)
+ return -1;
+ else {
+ if (event1_nof(e, proton_pdg))
+ return -51;
+ else if (event1_nof(e, neutron_pdg))
+ return -52; // sprawdzam dodatkowo ?
+ }
+ } else // oddziaływanie z neutrinem
+ {
+ if (e->flag.cc)
+ return 1;
+ else {
+ if (event1_nof(e, proton_pdg))
+ return 51;
+ else if (event1_nof(e, neutron_pdg))
+ return 52;
+ }
+ }
+ }
+
+ if (e->flag.mec) {
+ if (e->flag.anty)
+ return -2;
+ else
+ return 2;
+ }
+
+ if (e->flag.res) // rezonansowa produkcja: pojedynczy pion, pojed.eta, kaon,
+ // multipiony
+ {
+ Int_t liczba_pionow, liczba_kaonow;
+
+ liczba_pionow = event1_nof(e, pion_pdg) + event1_nof(e, pion_plus_pdg) +
+ event1_nof(e, pion_minus_pdg);
+ liczba_kaonow = event1_nof(e, kaon_pdg) + event1_nof(e, kaon_pdg);
+
+ if (liczba_pionow > 1 || liczba_pionow == 0) // multipiony
+ {
+ if (e->flag.anty) {
+ if (e->flag.cc)
+ return -21;
+ else
+ return -41;
+ } else {
+ if (e->flag.cc)
+ return 21;
+ else
+ return 41;
+ }
+ }
+
+ if (liczba_pionow == 1) {
+ if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
+ {
+ if (e->flag.cc) {
+ if (event1_nof(e, neutron_pdg) && event1_nof(e, pion_minus_pdg))
+ return -11;
+ if (event1_nof(e, neutron_pdg) && event1_nof(e, pion_pdg)) return -12;
+ if (event1_nof(e, proton_pdg) && event1_nof(e, pion_minus_pdg))
+ return -13;
+ } else {
+ if (event1_nof(e, proton_pdg)) {
+ if (event1_nof(e, pion_minus_pdg))
+ return -33;
+ else if (event1_nof(e, pion_pdg))
+ return -32;
+ } else if (event1_nof(e, neutron_pdg)) {
+ if (event1_nof(e, pion_plus_pdg))
+ return -34;
+ else if (event1_nof(e, pion_pdg))
+ return -31;
+ }
+ }
+ } else // oddziaływanie z neutrinem
+ {
+ if (e->flag.cc) {
+ if (event1_nof(e, proton_pdg) && event1_nof(e, pion_plus_pdg))
+ return 11;
+ if (event1_nof(e, proton_pdg) && event1_nof(e, pion_pdg)) return 12;
+ if (event1_nof(e, neutron_pdg) && event1_nof(e, pion_plus_pdg))
+ return 13;
+ } else {
+ if (event1_nof(e, proton_pdg)) {
+ if (event1_nof(e, pion_minus_pdg))
+ return 33;
+ else if (event1_nof(e, pion_pdg))
+ return 32;
+ } else if (event1_nof(e, neutron_pdg)) {
+ if (event1_nof(e, pion_plus_pdg))
+ return 34;
+ else if (event1_nof(e, pion_pdg))
+ return 31;
+ }
+ }
+ }
+ }
+
+ if (event1_nof(e, eta_pdg)) // produkcja rezonansowa ety
+ {
+ if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
+ {
+ if (e->flag.cc)
+ return -22;
+ else {
+ if (event1_nof(e, neutron_pdg))
+ return -42;
+ else if (event1_nof(e, proton_pdg))
+ return -43; // sprawdzam dodatkowo ?
+ }
+ } else // oddziaływanie z neutrinem
+ {
+ if (e->flag.cc)
+ return 22;
+ else {
+ if (event1_nof(e, neutron_pdg))
+ return 42;
+ else if (event1_nof(e, proton_pdg))
+ return 43;
+ }
+ }
+ }
+
+ if (event1_nof(e, lambda_pdg) == 1 &&
+ liczba_kaonow == 1) // produkcja rezonansowa kaonu
+ {
+ if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
+ {
+ if (e->flag.cc && event1_nof(e, kaon_pdg))
+ return -23;
+ else {
+ if (event1_nof(e, kaon_pdg))
+ return -44;
+ else if (event1_nof(e, kaon_plus_pdg))
+ return -45;
+ }
+ } else // oddziaływanie z neutrinem
+ {
+ if (e->flag.cc && event1_nof(e, kaon_plus_pdg))
+ return 23;
+ else {
+ if (event1_nof(e, kaon_pdg))
+ return 44;
+ else if (event1_nof(e, kaon_plus_pdg))
+ return 45;
+ }
+ }
+ }
+ }
+
+ if (e->flag.coh) // koherentne oddziaływanie tylko na O(16)
+ {
+ Int_t _target;
+ _target = e->par.nucleus_p + e->par.nucleus_n; // liczba masowa O(16)
+
+ if (_target == 16) {
+ if (e->flag.anty) // jeśli jest to oddziaływanie z antyneutrinem
+ {
+ if (e->flag.cc && event1_nof(e, pion_minus_pdg))
+ return -16;
+ else if (event1_nof(e, pion_pdg))
+ return -36;
+ } else // oddziaływanie z neutrinem
+ {
+ if (e->flag.cc && event1_nof(e, pion_plus_pdg))
+ return 16;
+ else if (event1_nof(e, pion_pdg))
+ return 36;
+ }
+ }
+ }
+
+ // gleboko nieelastyczne rozpraszanie
+ if (e->flag.dis) {
+ if (e->flag.anty) {
+ if (e->flag.cc)
+ return -26;
+ else
+ return -46;
+ } else {
+ if (e->flag.cc)
+ return 26;
+ else
+ return 46;
+ }
+ }
+
+ return 9999;
}
void NuWroInputHandler::CalcNUISANCEKinematics() {
- // std::cout << "NuWro Event Address " << fNuWroEvent << std::endl;
- // Reset all variables
- fNUISANCEEvent->ResetEvent();
- FitEvent* evt = fNUISANCEEvent;
-
- // Sort Event Info
- evt->fMode = ConvertNuwroMode(fNuWroEvent);
-
- if (abs(evt->fMode) > 60) {
- evt->fMode = 0;
-
- // Remove failed mode converts
- // return;
- }
-
- evt->Mode = evt->fMode;
- evt->fEventNo = 0.0;
- evt->fTotCrs = 0.0;
- evt->fTargetA = fNuWroEvent->par.nucleus_p + fNuWroEvent->par.nucleus_n;
- evt->fTargetZ = fNuWroEvent->par.nucleus_p;
- evt->fTargetH = 0;
- evt->fBound = (evt->fTargetA) == 1;
-
- // Check Particle Stack
- UInt_t npart_in = fNuWroEvent->in.size();
- UInt_t npart_out = fNuWroEvent->out.size();
- UInt_t npart_post = fNuWroEvent->post.size();
- UInt_t npart = npart_in + npart_out + npart_post;
- UInt_t kmax = evt->kMaxParticles;
-
- if (npart > kmax) {
- ERR(WRN) << "NUWRO has too many particles. Expanding stack." << std::endl;
- fNUISANCEEvent->ExpandParticleStack(npart);
- }
-
- // Sort Particles
- evt->fNParticles = 0;
- std::vector<particle>::iterator p_iter;
-
- // Initial State
- for (p_iter = fNuWroEvent->in.begin(); p_iter != fNuWroEvent->in.end(); p_iter++) {
- AddNuWroParticle(fNUISANCEEvent, (*p_iter), kInitialState);
- }
-
- // FSI State
- // for (size_t i = 0; i < npart_in; i++ ) {
- // AddNuWroParticle(fNUISANCEEvent, (*p_iter), kFSIState);
- // }
-
- // Final State
- for (p_iter = fNuWroEvent->post.begin(); p_iter != fNuWroEvent->post.end(); p_iter++) {
- AddNuWroParticle(fNUISANCEEvent, (*p_iter), kFinalState);
- }
-
- // Fill Generator Info
- if (fSaveExtra) fNuWroInfo->FillGeneratorInfo(fNuWroEvent);
-
- // Run Initial, FSI, Final, Other ordering.
- fNUISANCEEvent->OrderStack();
- return;
+ // std::cout << "NuWro Event Address " << fNuWroEvent << std::endl;
+ // Reset all variables
+ fNUISANCEEvent->ResetEvent();
+ FitEvent* evt = fNUISANCEEvent;
+
+ // Sort Event Info
+ evt->fMode = ConvertNuwroMode(fNuWroEvent);
+
+ if (abs(evt->fMode) > 60) {
+ evt->fMode = 0;
+
+ // Remove failed mode converts
+ // return;
+ }
+
+ evt->Mode = evt->fMode;
+ evt->fEventNo = 0.0;
+ evt->fTotCrs = 0.0;
+ evt->fTargetA = fNuWroEvent->par.nucleus_p + fNuWroEvent->par.nucleus_n;
+ evt->fTargetZ = fNuWroEvent->par.nucleus_p;
+ evt->fTargetH = 0;
+ evt->fBound = (evt->fTargetA) == 1;
+
+ // Check Particle Stack
+ UInt_t npart_in = fNuWroEvent->in.size();
+ UInt_t npart_out = fNuWroEvent->out.size();
+ UInt_t npart_post = fNuWroEvent->post.size();
+ UInt_t npart = npart_in + npart_out + npart_post;
+ UInt_t kmax = evt->kMaxParticles;
+
+ if (npart > kmax) {
+ ERR(WRN) << "NUWRO has too many particles. Expanding stack." << std::endl;
+ fNUISANCEEvent->ExpandParticleStack(npart);
+ }
+
+ // Sort Particles
+ evt->fNParticles = 0;
+ std::vector<particle>::iterator p_iter;
+
+ // Initial State
+ for (p_iter = fNuWroEvent->in.begin(); p_iter != fNuWroEvent->in.end();
+ p_iter++) {
+ AddNuWroParticle(fNUISANCEEvent, (*p_iter), kInitialState);
+ }
+
+ // FSI State
+ // for (size_t i = 0; i < npart_in; i++ ) {
+ // AddNuWroParticle(fNUISANCEEvent, (*p_iter), kFSIState);
+ // }
+
+ // Final State
+ for (p_iter = fNuWroEvent->post.begin(); p_iter != fNuWroEvent->post.end();
+ p_iter++) {
+ AddNuWroParticle(fNUISANCEEvent, (*p_iter), kFinalState);
+ }
+
+ // Fill Generator Info
+ if (fSaveExtra) fNuWroInfo->FillGeneratorInfo(fNuWroEvent);
+
+ // Run Initial, FSI, Final, Other ordering.
+ fNUISANCEEvent->OrderStack();
+ return;
}
-void NuWroInputHandler::AddNuWroParticle(FitEvent * evt, particle & p, int state) {
-
- // Add Mom
- evt->fParticleMom[evt->fNParticles][0] = p.p4().x;
- evt->fParticleMom[evt->fNParticles][1] = p.p4().y;
- evt->fParticleMom[evt->fNParticles][2] = p.p4().z;
- evt->fParticleMom[evt->fNParticles][3] = p.p4().t;
+void NuWroInputHandler::AddNuWroParticle(FitEvent* evt, particle& p,
+ int state) {
+ // Add Mom
+ evt->fParticleMom[evt->fNParticles][0] = static_cast<vect &>(p).x;
+ evt->fParticleMom[evt->fNParticles][1] = static_cast<vect &>(p).y;
+ evt->fParticleMom[evt->fNParticles][2] = static_cast<vect &>(p).z;
+ evt->fParticleMom[evt->fNParticles][3] = static_cast<vect &>(p).t;
- // Status/PDG
- evt->fParticleState[evt->fNParticles] = state;
- evt->fParticlePDG[evt->fNParticles] = p.pdg;
+ // Status/PDG
+ evt->fParticleState[evt->fNParticles] = state;
+ evt->fParticlePDG[evt->fNParticles] = p.pdg;
- // Add to particle count
- evt->fNParticles++;
+ // Add to particle count
+ evt->fNParticles++;
}
-void NuWroInputHandler::Print(){
-}
+void NuWroInputHandler::Print() {}
#endif
diff --git a/src/Utils/CMakeLists.txt b/src/Utils/CMakeLists.txt
index 4fe0501..eb5411e 100644
--- a/src/Utils/CMakeLists.txt
+++ b/src/Utils/CMakeLists.txt
@@ -1,91 +1,90 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NUISANCE.
#
# NUISANCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NUISANCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
################################################################################
set(HEADERFILES
FitLogger.h
FitParameters.h
FitUtils.h
GeneralUtils.h
ParserUtils.h
PlotUtils.h
StatUtils.h
SignalDef.h
NuisConfig.h
NuisKey.h
BeamUtils.h
TargetUtils.h
StackBase.h
StandardStacks.h
OpenMPWrapper.h
PhysConst.h
Initialiser.h
)
set(IMPLFILES
PythiaQuiet.f
FitLogger.cxx
FitParameters.cxx
FitUtils.cxx
GeneralUtils.cxx
PlotUtils.cxx
StatUtils.cxx
SignalDef.cxx
NuisConfig.cxx
NuisKey.cxx
BeamUtils.cxx
TargetUtils.cxx
StackBase.cxx
ParserUtils.cxx
StandardStacks.cxx
Initialiser.cxx
)
set(LIBNAME Utils)
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
add_library(${LIBNAME} STATIC ${IMPLFILES})
else(CMAKE_BUILD_TYPE MATCHES RELEASE)
add_library(${LIBNAME} SHARED ${IMPLFILES})
endif()
include_directories(${MINIMUM_INCLUDE_DIRECTORIES})
set_target_properties(${LIBNAME} PROPERTIES VERSION
"${NUISANCE_VERSION_MAJOR}.${NUISANCE_VERSION_MINOR}.${NUISANCE_VERSION_REVISION}")
#set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS ${ROOT_LD_FLAGS})
if(DEFINED PROJECTWIDE_EXTRA_DEPENDENCIES)
add_dependencies(${LIBNAME} ${PROJECTWIDE_EXTRA_DEPENDENCIES})
endif()
install(TARGETS ${LIBNAME} DESTINATION lib)
#Can uncomment this to install the headers... but is it really neccessary?
#install(FILES ${HEADERFILES} DESTINATION include)
set(MODULETargets ${MODULETargets} ${LIBNAME} PARENT_SCOPE)
-#add_executable(DumpROOTClassesFromVector DumpROOTClassesFromVector.cxx GeneralUtils.cxx FitLogger.cxx PythiaQuiet.f)
+add_executable(DumpROOTClassesFromVector DumpROOTClassesFromVector.cxx GeneralUtils.cxx FitLogger.cxx PythiaQuiet.f)
-#target_link_libraries(DumpROOTClassesFromVector ${ROOT_LIBS})
-#if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
-# set_target_properties(DumpROOTClassesFromVector PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
-#endif()
-#set_target_properties(DumpROOTClassesFromVector PROPERTIES LINK_FLAGS ${ROOT_LD_FLAGS})
+ target_link_libraries(DumpROOTClassesFromVector ${CMAKE_DEPENDLIB_FLAGS})
+ if(NOT "${CMAKE_LINK_FLAGS}" STREQUAL "")
+ set_target_properties(DumpROOTClassesFromVector PROPERTIES LINK_FLAGS ${CMAKE_LINK_FLAGS})
+ endif()
-#install(TARGETS DumpROOTClassesFromVector DESTINATION bin)
+install(TARGETS DumpROOTClassesFromVector DESTINATION bin)

File Metadata

Mime Type
text/x-diff
Expires
Thu, Apr 3, 8:06 PM (22 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4729190
Default Alt Text
(69 KB)

Event Timeline