Page MenuHomeHEPForge

No OneTemporary

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f7aebb..4cb0270 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,163 +1,165 @@
cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
project(ExternalDataFitter)
+enable_language(Fortran)
+
set (ExtFit_VERSION_MAJOR 1)
set (ExtFit_VERSION_MINOR 0) #The q+1'th letter of the alphabet
set (ExtFit_VERSION_REVISION 0)
set (ExtFit_VERSION_STRING "v${ExtFit_VERSION_MAJOR}r${ExtFit_VERSION_MINOR}")
if(${ExtFit_VERSION_REVISION} STRGREATER "0")
set (ExtFit_VERSION_STRING "${ExtFit_VERSION_STRING}p${ExtFit_VERSION_REVISION}")
endif()
set (VERBOSE TRUE)
set (CMAKE_SKIP_BUILD_RPATH TRUE)
include(${CMAKE_SOURCE_DIR}/cmake/cmessage.cmake)
if(NOT DEFINED USE_NEUT AND
NOT DEFINED USE_NuWro AND
NOT DEFINED USE_GENIE AND
NOT DEFINED USE_T2K AND
NOT DEFINED USE_NIWG AND
NOT DEFINED USE_GiBUU AND
NOT DEFINED USE_NUANCE)
cmessage(FATAL_ERROR "No reweight engines requested. Configure with at least "
"one of -DUSE_{NEUT,NuWro,GENIE,NIWG,T2K,GiBUU,NUANCE}.")
else()
cmessage(STATUS "Generator Input Support:
NEUT:${USE_NEUT},
NuWro:${USE_NuWro},
GENIE:${USE_GENIE},
NIWG:${USE_NIWG},
GiBUU:${USE_GiBUU},
NUANCE:${USE_NUANCE}")
endif()
#Changes default install path to be a subdirectory of the build dir.
#Can set build dir at configure time with -DCMAKE_INSTALL_PREFIX=/install/path
if(CMAKE_INSTALL_PREFIX STREQUAL "" OR CMAKE_INSTALL_PREFIX STREQUAL
"/usr/local")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
elseif(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
endif()
cmessage(STATUS "CMAKE_INSTALL_PREFIX: \"${CMAKE_INSTALL_PREFIX}\"")
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE DEBUG)
elseif(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG)
endif()
cmessage(STATUS "CMAKE_BUILD_TYPE: \"${CMAKE_BUILD_TYPE}\"")
################################################################################
# Check Dependencies
################################################################################
############################ Reweight Engines ################################
include(${CMAKE_SOURCE_DIR}/cmake/ReweightEnginesSetup.cmake)
################################## ROOT ######################################
include(${CMAKE_SOURCE_DIR}/cmake/ROOTSetup.cmake)
################################# Pythia6 ####################################
include(${CMAKE_SOURCE_DIR}/cmake/pythia6Setup.cmake)
################################## COMPILER ####################################
include(${CMAKE_SOURCE_DIR}/cmake/c++CompilerSetup.cmake)
################################################################################
################################# gperftools ###################################
include(${CMAKE_SOURCE_DIR}/cmake/gperfSetup.cmake)
################################### doxygen ###################################
include(${CMAKE_SOURCE_DIR}/cmake/docsSetup.cmake)
################################################################################
if(DEFINED USE_EXP AND USE_EXP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DINMEMORYEVENTCLASS")
endif()
if(DEFINED USE_GiBUU AND USE_GiBUU)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GiBUU_ENABLED__")
include(${CMAKE_SOURCE_DIR}/cmake/GiBUUSetup.cmake)
endif()
if(DEFINED USE_NUANCE AND USE_NUANCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__NUANCE_ENABLED__")
endif()
################################################################################
set(MINCODE
Routines
FCN)
set(CORE
MCStudies
FitBase
Splines
Utils
#Devel
)
###############
# Allow compilation against single experiment folder
# Add later..
##############
set(EXPERIMENTS
ANL
ArgoNeuT
BEBC
BNL
FNAL
GGM
K2K
MINERvA
MiniBooNE
T2K)
set(EXP_INCLUDE_DIRECTORIES)
foreach(edir ${EXPERIMENTS})
set(EXP_INCLUDE_DIRECTORIES ${EXP_INCLUDE_DIRECTORIES};${CMAKE_SOURCE_DIR}/src/${edir})
endforeach()
cmessage(STATUS "Included experiments: ${EXP_INCLUDE_DIRECTORIES}")
foreach(mdir ${MINCODE})
cmessage (STATUS "Configuring directory: src/${mdir}")
add_subdirectory(src/${mdir})
endforeach()
foreach(edir ${EXPERIMENTS})
cmessage (STATUS "Configuring directory: src/${edir}")
add_subdirectory(src/${edir})
endforeach()
foreach(cdir ${CORE})
cmessage (STATUS "Configuring directory: src/${cdir}")
add_subdirectory(src/${cdir})
endforeach()
cmessage(STATUS "Module targets: ${MODULETargets}")
add_subdirectory(app)
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})
diff --git a/src/Utils/CMakeLists.txt b/src/Utils/CMakeLists.txt
index 9b6a347..bd3a937 100644
--- a/src/Utils/CMakeLists.txt
+++ b/src/Utils/CMakeLists.txt
@@ -1,63 +1,63 @@
# 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
PlotUtils.h
StatUtils.h
SignalDef.h
)
set(IMPLFILES
+PythiaQuiet.f
FitLogger.cxx
FitParameters.cxx
FitUtils.cxx
GeneralUtils.cxx
PlotUtils.cxx
StatUtils.cxx
SignalDef.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(${RWENGINE_INCLUDE_DIRECTORIES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/FitBase)
set_target_properties(${LIBNAME} PROPERTIES VERSION
"${ExtFit_VERSION_MAJOR}.${ExtFit_VERSION_MINOR}.${ExtFit_VERSION_REVISION}")
set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS ${ROOT_LD_FLAGS})
install(TARGETS ${LIBNAME} DESTINATION lib)
#Can uncomment this to install the headers... but is it really neccessary?
#install(FILES ${HEADERFILES} DESTINATION include)
set(MODULETargets ${MODULETargets} ${LIBNAME} PARENT_SCOPE)
diff --git a/src/Utils/FitLogger.cxx b/src/Utils/FitLogger.cxx
index 0b4206d..eb0c7cf 100644
--- a/src/Utils/FitLogger.cxx
+++ b/src/Utils/FitLogger.cxx
@@ -1,164 +1,166 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NUISANCE.
*
* NUISANCE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NUISANCE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "FitLogger.h"
namespace FitPar{
unsigned int log_verb = 0; //!< Current VERBOSITY
unsigned int err_verb = 0; //!< Current ERROR VERBOSITY
bool use_colors = true; //!< Use BASH Terminal Colors Flag
bool super_rainbow_mode = true; //!< For when fitting gets boring.
unsigned int super_rainbow_mode_colour = 0;
std::streambuf *default_cout = std::cout.rdbuf();
std::streambuf *default_cerr = std::cerr.rdbuf();
std::ofstream redirect_stream("/dev/null");
}
std::ostream* logStream(&std::cout);
std::ostream* errStream(&std::cerr);
std::ofstream nullStream;
//******************************************
void LOG_VERB(std::string verb){
//******************************************
if (!verb.compare("DEB")) FitPar::log_verb=-1;
else if (!verb.compare("QUIET")) FitPar::log_verb=0;
else if (!verb.compare("FIT")) FitPar::log_verb=1;
else if (!verb.compare("MIN")) FitPar::log_verb=2;
else if (!verb.compare("SAM")) FitPar::log_verb=3;
else if (!verb.compare("REC")) FitPar::log_verb=4;
else if (!verb.compare("SIG")) FitPar::log_verb=5;
else if (!verb.compare("EVT")) FitPar::log_verb=6;
else FitPar::log_verb = GeneralUtils::StrToInt(verb);
return;
}
//******************************************
void ERR_VERB(std::string verb){
//******************************************
if (!verb.compare("ERRQUIET")) FitPar::err_verb=0;
else if (!verb.compare("FTL")) FitPar::err_verb=1;
else if (!verb.compare("WRN")) FitPar::err_verb=2;
else FitPar::log_verb = GeneralUtils::StrToInt(verb);
return;
}
//******************************************
bool LOG_LEVEL(int level){
//******************************************
if (FitPar::log_verb == (unsigned int) DEB){
return true;
}
if (FitPar::log_verb < (unsigned int) level){
return false;
}
return true;
}
//******************************************
std::ostream& LOG(int level)
//******************************************
{
if (FitPar::log_verb < (unsigned int)level &&
FitPar::log_verb != (unsigned int)DEB){
return nullStream;
} else {
if (FitPar::super_rainbow_mode and FitPar::use_colors){
switch(FitPar::super_rainbow_mode_colour){
case 1: std::cout<<RED;
case 2: std::cout<<GREEN;
case 3: std::cout<<YELLOW;
case 4: std::cout<<BLUE;
case 5: std::cout<<MAGENTA;
case 6: std::cout<<CYAN;
default: FitPar::super_rainbow_mode_colour = 0;
}
FitPar::super_rainbow_mode_colour++;
}
if (FitPar::use_colors){
switch(level){
case FIT: std::cout << BOLDGREEN; break;
case MIN: std::cout << BOLDBLUE; break;
case SAM: std::cout << MAGENTA; break;
case REC: std::cout << BLUE; break;
case SIG: std::cout << GREEN; break;
case DEB: std::cout << CYAN; break;
default: break;
}
}
switch(level){
case FIT: std::cout << "[LOG Fitter]: "; break;
case MIN: std::cout << "[LOG Minmzr]: "; break;
case SAM: std::cout << "[LOG Sample]: - "; break;
case REC: std::cout << "[LOG Reconf]: -- "; break;
case SIG: std::cout << "[LOG Signal]: --- "; break;
case EVT: std::cout << "[LOG Event ]: ---- "; break;
case DEB: std::cout << "[LOG DEBUG ]: "; break;
default: std::cout << "Log : "; break;
}
if (FitPar::use_colors or FitPar::super_rainbow_mode) std::cout << RESET;
return *logStream;
}
}
//******************************************
std::ostream& ERR(int level)
//******************************************
{
if (FitPar::use_colors) std::cerr << RED;
switch(level){
case FTL: std::cerr << "[ERR FATAL ]: "; break;
case WRN: std::cerr << "[ERR WARN ] : "; break;
}
if (FitPar::use_colors) std::cerr << RESET;
return *errStream;
}
void StopTalking(){
// Only redirect if we're not debugging
if (FitPar::log_verb == (unsigned int)DEB) return;
std::cout.rdbuf(FitPar::redirect_stream.rdbuf());
std::cerr.rdbuf(FitPar::redirect_stream.rdbuf());
+ shhpythiaitokay_();
}
void StartTalking(){
std::cout.rdbuf(FitPar::default_cout);
std::cerr.rdbuf(FitPar::default_cerr);
+ canihazpythia_();
}
diff --git a/src/Utils/FitLogger.h b/src/Utils/FitLogger.h
index c624fc2..b48f94a 100644
--- a/src/Utils/FitLogger.h
+++ b/src/Utils/FitLogger.h
@@ -1,113 +1,118 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NUISANCE.
*
* NUISANCE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NUISANCE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef FITLOGGER_HPP
#define FITLOGGER_HPP
// We still need a forward declaration of 'ostream' in order to
// swallow templated manipulators such as 'endl'.
#include <iosfwd>
#include <iostream>
#include <fstream>
#include <sstream>
#include "GeneralUtils.h"
#define RESET "\033[0m"
#define BLACK "\033[30m" /* Black */
#define RED "\033[31m" /* Red */
#define GREEN "\033[32m" /* Green */
#define YELLOW "\033[33m" /* Yellow */
#define BLUE "\033[34m" /* Blue */
#define MAGENTA "\033[35m" /* Magenta */
#define CYAN "\033[36m" /* Cyan */
#define WHITE "\033[37m" /* White */
#define BOLDBLACK "\033[1m\033[30m" /* Bold Black */
#define BOLDRED "\033[1m\033[31m" /* Bold Red */
#define BOLDGREEN "\033[1m\033[32m" /* Bold Green */
#define BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */
#define BOLDBLUE "\033[1m\033[34m" /* Bold Blue */
#define BOLDMAGENTA "\033[1m\033[35m" /* Bold Magenta */
#define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */
#define BOLDWHITE "\033[1m\033[37m" /* Bold White */
/*!
* \addtogroup FitBase
* @{
*/
namespace FitPar{
extern unsigned int log_verb; //!< Current VERBOSITY
extern unsigned int err_verb; //!< Current ERROR VERBOSITY
extern bool use_colors; //!< Use BASH Terminal Colors Flag
extern bool super_rainbow_mode; //!< For when fitting gets boring.
extern unsigned int super_rainbow_mode_colour;
extern std::streambuf *default_cout; //!< Where the STDOUT stream is currently directed
extern std::streambuf *default_cerr; //!< Where the STDERR stream is currently directed
extern std::ofstream redirect_stream; //!< Where should unwanted messages be thrown
}
extern std::ostream* logStream;
extern std::ostream* errStream;
extern std::ofstream nullStream;
/// Fitter VERBOSITY Enumerations
/// These go through the different depths of the fitter.
///
/// 0 QUIET - Little output.
/// 1 FIT - Top Level Minimizer Status
/// 2 MIN - Output from the FCN Minimizer Functions
/// 3 SAM - Output from each of the samples during setup etc
/// 4 REC - Output during each reconfigure. Percentage progress etc.
/// 5 SIG - Output during every signal event that is found.
/// 6 EVT - Output during every event.
/// -1 DEB - Will print only debugging info wherever a LOG(DEB) statement was made
enum log_levels { DEB=-1, QUIET, FIT, MIN, SAM, REC, SIG, EVT };
/// Fitter ERROR VERBOSITY Enumerations
///
/// 0 QUIET - No Error Output
/// 1 FTL - Show errors only if fatal
/// 2 WRN - Show Warning messages
enum err_levels { ERRQUIET=0, FTL, WRN };
bool LOG_LEVEL(int level);
//! Set LOG VERBOSITY from a string
void LOG_VERB(std::string verb);
inline void LOG_VERB(int verb){ FitPar::log_verb = verb; };
//! Set ERROR VERBOSITY from a string
void ERR_VERB(std::string verb);
inline void ERR_VERB(int verb){ FitPar::err_verb = verb; };
/// Logging Function. Use as a string stream. e.g. LOG(SAM) << "This sample is dope." << std::endl;
std::ostream& LOG(int level);
//! Error Function. Use as a string stream. e.g. ERR(FTL) << "The fit is completely buggered." << std::endl;
std::ostream& ERR(int level);
void StopTalking();
void StartTalking();
+extern "C" {
+ void shhpythiaitokay_(void);
+ void canihazpythia_(void);
+}
+
/*! @} */
#endif // FILELOGGER_HPP

File Metadata

Mime Type
text/x-diff
Expires
Thu, Apr 24, 6:38 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4875645
Default Alt Text
(16 KB)

Event Timeline