Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Materialize terror symbols #191

14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ foreach(policy ${policy_new})
endif()
endforeach()

# ignore JAVA_ROOT when find_package(Java 1.8 ...) called
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.27)
cmake_policy(SET CMP0144 OLD)
endif()

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
cmake_policy(SET CMP0135 OLD)
endif()
set(policy_old CMP0116 CMP0135 CMP0144)
foreach(policy ${policy_old})
if(POLICY ${policy})
cmake_policy(SET ${policy} OLD)
endif()
endforeach()

include(cmake/modules/CaptureCommandLine.cmake)

Expand Down
12 changes: 12 additions & 0 deletions README/ReleaseNotes/v632/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ They should be replaced with the suitable STL-compatible interfaces, or you can

- `RooWorkspace::componentIterator()`: use `RooWorkspace::components()` with range-based loop

### Deprecation of legacy test statistics classes in public interface

Instantiating the following classes and even including their header files is deprecated, and the headers will be removed in ROOT 6.34:

* RooAbsTestStatistic
* RooAbsOptTestStatistic
* RooNLLVar
* RooChi2Var
* RooXYChi2Var

Please use the higher-level functions `RooAbsPdf::createNLL()` and `RooAbsPdf::createChi2()` if you want to create objects that represent test statistics.

## 2D Graphics Libraries


Expand Down
5 changes: 5 additions & 0 deletions build/unix/makepchinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,11 @@ def makePCHInput():
allHeadersContent = getSTLIncludes()
allHeadersContent += getExtraIncludes(clingetpchList)

# Make sure we don't get warnings from the old RooFit test statistics
# headers that are deprecated. This line can be removed once the deprecaded
# headers are gone (ROOT 6.32.00):
allHeadersContent += "#define ROOFIT_BUILDS_ITSELF\n"

allLinkdefsContent = ""

# Loop over the dictionaries, ROOT modules
Expand Down
62 changes: 61 additions & 1 deletion cmake/modules/FindR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,70 @@
# R_INCLUDE_DIRS - the R include directories
# R_LIBRARIES - link these to use R
# R_ROOT_DIR - As reported by R
# R_EXECUTABLE - the R executable
# R_SCRIPT - the Rscript executable, which runs R non-interactively
#
# Autor: Omar Andres Zapata Mesa 31/05/2013
# Contributor: Blake Madden 2023-12-10

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_FIND_APPBUNDLE "LAST")
endif()

# Lists subdirectories in a directory
# https://stackoverflow.com/questions/7787823/cmake-how-to-get-the-name-of-all-subdirectories-of-a-directory
macro(SUBDIRLIST result curdir)
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
set(dirlist "")
foreach(child ${children})
if(IS_DIRECTORY ${curdir}/${child})
list(APPEND dirlist ${child})
endif()
endforeach()
set(${result} ${dirlist})
endmacro()

find_program(R_EXECUTABLE NAMES R R.exe)
find_program(R_SCRIPT NAMES Rscript Rscript.exe)

# If not found and we are on Windows, try to look for it in the default installation path
if(WIN32 AND R_EXECUTABLE MATCHES "R_EXECUTABLE-NOTFOUND")
GET_FILENAME_COMPONENT(RX64PATH "C:\\Program Files\\R" REALPATH)
GET_FILENAME_COMPONENT(RX86PATH "C:\\Program Files (x86)\\R" REALPATH)
# default 64-bit Windows installation
if(EXISTS "${RX64PATH}")
SUBDIRLIST(SUBDIRS "${RX64PATH}")
foreach(subdir ${SUBDIRS})
if(${subdir} MATCHES "R[-]([0-9][.]).*")
set(R_VERSIONED_SUBDIR "${subdir}")
if(EXISTS "${RX64PATH}\\${R_VERSIONED_SUBDIR}\\bin\\x64\\R.exe")
set(R_EXECUTABLE "${RX64PATH}\\${R_VERSIONED_SUBDIR}\\bin\\x64\\R.exe")
endif()
if(EXISTS "${RX64PATH}\\${R_VERSIONED_SUBDIR}\\bin\\x64\\Rscript.exe")
set(R_SCRIPT "${RX64PATH}\\${R_VERSIONED_SUBDIR}\\bin\\x64\\Rscript.exe")
endif()
break()
endif()
endforeach()
# ...or the 32-bit installation
elseif(EXISTS "${RX86PATH}")
SUBDIRLIST(SUBDIRS "${RX86PATH}")
foreach(subdir ${SUBDIRS})
if(${subdir} MATCHES "R[-]([0-9][.]).*")
set(R_VERSIONED_SUBDIR "${subdir}")
if(EXISTS "${RX86PATH}\\${R_VERSIONED_SUBDIR}\\bin\\x86\\R.exe")
set(R_EXECUTABLE "${RX86PATH}\\${R_VERSIONED_SUBDIR}\\bin\\x86\\R.exe")
endif()
if(EXISTS "${RX86PATH}\\${R_VERSIONED_SUBDIR}\\bin\\x86\\Rscript.exe")
set(R_SCRIPT "${RX86PATH}\\${R_VERSIONED_SUBDIR}\\bin\\x86\\Rscript.exe")
endif()
break()
endif()
endforeach()
endif()
endif()

#---searching R installtion unsing R executable
#---searching R installtion using R executable
if(R_EXECUTABLE)
execute_process(COMMAND ${R_EXECUTABLE} RHOME
OUTPUT_VARIABLE R_ROOT_DIR
Expand All @@ -35,6 +90,11 @@ if(R_EXECUTABLE)
find_library(R_LIBRARY R
HINTS ${R_ROOT_DIR}/lib
DOC "R library (example libR.a, libR.dylib, etc.).")
# On Windows, this may not be defined. Fall back to the library
# folder that holds the DLLs.
if(R_LIBRARY MATCHES "R_LIBRARY-NOTFOUND" AND EXISTS "${R_ROOT_DIR}\\library")
set(R_LIBRARY "${R_ROOT_DIR}\\library")
endif()
endif()

#---setting include dirs and libraries
Expand Down
17 changes: 8 additions & 9 deletions core/foundation/inc/TError.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@

class TVirtualMutex;

constexpr Int_t kUnset = -1;
constexpr Int_t kPrint = 0;
constexpr Int_t kInfo = 1000;
constexpr Int_t kWarning = 2000;
constexpr Int_t kError = 3000;
constexpr Int_t kBreak = 4000;
constexpr Int_t kSysError = 5000;
constexpr Int_t kFatal = 6000;

R__EXTERN const Int_t kUnset;
R__EXTERN const Int_t kPrint;
R__EXTERN const Int_t kInfo;
R__EXTERN const Int_t kWarning;
R__EXTERN const Int_t kError;
R__EXTERN const Int_t kBreak;
R__EXTERN const Int_t kSysError;
R__EXTERN const Int_t kFatal;

// TROOT sets the error ignore level handler, the system error message handler, and the error abort handler on
// construction such that the "Root.ErrorIgnoreLevel" environment variable is used for the ignore level
Expand Down
2 changes: 1 addition & 1 deletion core/foundation/src/RLogger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ inline bool RLogHandlerDefault::Emit(const RLogEntry &entry)
if (!entry.fLocation.fFuncName.empty())
strm << " in " << entry.fLocation.fFuncName;

static constexpr const int errorLevelOld[] = {kFatal /*unset*/, kFatal, kError, kWarning, kInfo, kInfo /*debug*/};
static const int errorLevelOld[] = {kFatal /*unset*/, kFatal, kError, kWarning, kInfo, kInfo /*debug*/};
(*::GetErrorHandler())(errorLevelOld[cappedLevel], entry.fLevel == ELogLevel::kFatal, strm.str().c_str(),
entry.fMessage.c_str());
return true;
Expand Down
9 changes: 9 additions & 0 deletions core/foundation/src/TError.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ to be replaced by the proper DefaultErrorHandler()
#include <cerrno>
#include <string>

const Int_t kUnset = -1;
const Int_t kPrint = 0;
const Int_t kInfo = 1000;
const Int_t kWarning = 2000;
const Int_t kError = 3000;
const Int_t kBreak = 4000;
const Int_t kSysError = 5000;
const Int_t kFatal = 6000;

Int_t gErrorIgnoreLevel = kUnset;
Int_t gErrorAbortLevel = kSysError+1;
Bool_t gPrintViaErrorHandler = kFALSE;
Expand Down
15 changes: 9 additions & 6 deletions math/mathmore/inc/Math/Polynomial.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,29 @@ class Polynomial : public ParamFunction<IParamGradFunction>,

// using ParamFunction::operator();


/**
Find the polynomial roots.
For n <= 4, the roots are found analytically while for larger order an iterative numerical method is used
The numerical method used is from GSL (see <A HREF="http://www.gnu.org/software/gsl/manual/gsl-ref_6.html#SEC53" )
The numerical method used is from GSL (see <A HREF="https://www.gnu.org/software/gsl/doc/html/poly.html">documentation</A> )
For the case of n = 4 by default an analytical algorithm is used from an implementation by
Andrew W. Steiner and Andy Buckley which is a translation from the original Cenrlib routine
(< HREF="https://cds.cern.ch/record/2050876/files/c208.html">RRTEQ4</A> ).
Note that depending on the coefficients the result could be not very accurate if the discriminant of the resolvent cubic
equation is very small. In that case it might be more robust to use the numerical method, by calling directly FindNumRoots()

*/
const std::vector<std::complex <double> > & FindRoots();


/**
Find the only the real polynomial roots.
For n <= 4, the roots are found analytically while for larger order an iterative numerical method is used
The numerical method used is from GSL (see <A HREF="http://www.gnu.org/software/gsl/manual/gsl-ref_6.html#SEC53" )
The numerical method used is from GSL (see <A HREF="https://www.gnu.org/software/gsl/doc/html/poly.html">documentation</A> )
*/
std::vector<double > FindRealRoots();


/**
Find the polynomial roots using always an iterative numerical methods
The numerical method used is from GSL (see <A HREF="http://www.gnu.org/software/gsl/manual/gsl-ref_6.html#SEC53" )
The numerical method used is from GSL (see <A HREF="https://www.gnu.org/software/gsl/doc/html/poly.html">documentation</A> )
*/
const std::vector<std::complex <double> > & FindNumRoots();

Expand Down
11 changes: 6 additions & 5 deletions math/mathmore/src/complex_quartic.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ gsl_poly_complex_solve_quartic (double a, double b, double c, double d,
disc = R2 - Q3;

// more numerical problems with this calculation of disc
// double CR2 = 729 * rcub * rcub;
// double CQ3 = 2916 * qcub * qcub * qcub;
// disc = (CR2 - CQ3) / 2125764.0;
//LM - use this since it fixes case reported in issue #6900 when disc is approx 0
// (needs to add additional test cases where disc is ~ 0)
double CR2 = 729 * rcub * rcub;
double CQ3 = 2916 * qcub * qcub * qcub;
disc = (CR2 - CQ3) / 2125764.0;


if (0 == R && 0 == Q)
Expand All @@ -162,7 +164,7 @@ gsl_poly_complex_solve_quartic (double a, double b, double c, double d,
u[1] = -rc / 3;
u[2] = -rc / 3;
}
else if (R2 == Q3)
else if (disc == 0)
{
double sqrtQ = sqrt (Q);
if (R > 0)
Expand Down Expand Up @@ -398,4 +400,3 @@ gsl_poly_complex_solve_quartic (double a, double b, double c, double d,

return 4;
}

1 change: 1 addition & 0 deletions math/mathmore/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ foreach(file ${TestMathMoreSource})
endforeach()

ROOT_ADD_GTEST(stressMathMoreUnit testStress.cxx StatFunction.cxx LIBRARIES Core MathCore MathMore)
ROOT_ADD_GTEST(testPolynomialRoots testPolynomialRoots LIBRARIES Core MathCore MathMore)
Loading