Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README/ReleaseNotes/v640/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ As part of this migration, the following build options are deprecated. From ROOT
## RooFit

- A new RooAbsPdf has been added: `RooStudentT`, which describes the location-scale student's t-distribution.
- The `RooNumber::setRangeEpsRel()` and `RooNumber::setRangeEpsAbs()` have been
introduced 2 years ago in 48637270a9113aa to customize range check behavior
to be like before ROOT 6.28, but this has not been proven necessary. Instead,
looking up the static variables with the epsilon values incurred significant
overhead in `RooAbsRealLValue::inRange()`, which is visible in many-parameter
fits. Therefore, these functions are removed.

## RDataFrame

Expand Down
1 change: 0 additions & 1 deletion roofit/roofitcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore
src/RooNumIntConfig.cxx
src/RooNumIntFactory.cxx
src/RooNumRunningInt.cxx
src/RooNumber.cxx
src/RooObjCacheManager.cxx
src/RooParamBinning.cxx
src/RooPlot.cxx
Expand Down
18 changes: 0 additions & 18 deletions roofit/roofitcore/inc/RooNumber.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,6 @@ class RooNumber {
constexpr static double infinity() { return std::numeric_limits<double>::infinity(); }
/// Return true if x is infinite by RooNumber internal specification.
constexpr static int isInfinite(double x) { return (x >= +infinity()) ? +1 : ((x <= -infinity()) ? -1 : 0); }

/// Set the relative epsilon that is used by range checks in RooFit,
/// e.g., in RooAbsRealLValue::inRange().
inline static void setRangeEpsRel(double epsRel) { staticRangeEpsRel() = epsRel; }
/// Get the relative epsilon that is used by range checks in RooFit,
/// e.g., in RooAbsRealLValue::inRange().
inline static double rangeEpsRel() { return staticRangeEpsRel(); }

/// Set the absolute epsilon that is used by range checks in RooFit,
/// e.g., in RooAbsRealLValue::inRange().
inline static void setRangeEpsAbs(double epsRel) { staticRangeEpsAbs() = epsRel; }
/// Get the absolute epsilon that is used by range checks in RooFit,
/// e.g., in RooAbsRealLValue::inRange().
inline static double rangeEpsAbs() { return staticRangeEpsAbs(); }

private:
static double &staticRangeEpsRel();
static double &staticRangeEpsAbs();
};

#endif
39 changes: 6 additions & 33 deletions roofit/roofitcore/src/RooAbsRealLValue.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,6 @@ RooAbsRealLValue::RooAbsRealLValue(const RooAbsRealLValue& other, const char* na
////////////////////////////////////////////////////////////////////////////////
/// Return true if the input value is within our fit range. Otherwise, return
/// false and write a clipped value into clippedValPtr if it is non-zero.
///
/// Implements the following check to see if the value x is in the range [a, b]:
/// check if `[x - eps * x, x + eps * x]` overlaps with `[a, b]`, where the
/// parameter `eps` is defined as:
/// ```
/// std::max(RooNumber::rangeEpsRel() * std::abs(x), RooNumber::rangeEpsAbs())
/// ```
/// By default, RooNumber::rangeEpsRel() and RooNumber::rangeEpsRel() are set to zero.
/// You can change them with RooNumber::setRangeEpsRel(double) and RooNumber::setRangeEpsAbs(double),
/// but this should be only done if there is no other solution.
bool RooAbsRealLValue::inRange(double value, const char* rangeName, double* clippedValPtr) const
{
// double range = getMax() - getMin() ; // ok for +/-INFINITY
Expand All @@ -99,15 +89,13 @@ bool RooAbsRealLValue::inRange(double value, const char* rangeName, double* clip
double min = binning.lowBound() ;
double max = binning.highBound() ;

const double epsilon = std::max(RooNumber::rangeEpsRel() * std::abs(value), RooNumber::rangeEpsAbs());

// test this value against our upper fit limit
if(!RooNumber::isInfinite(max) && value > (max+epsilon)) {
if(!RooNumber::isInfinite(max) && value > max) {
clippedValue = max;
isInRange = false ;
}
// test this value against our lower fit limit
if(!RooNumber::isInfinite(min) && value < min-epsilon) {
if(!RooNumber::isInfinite(min) && value < min) {
clippedValue = min ;
isInRange = false ;
}
Expand All @@ -132,12 +120,8 @@ void RooAbsRealLValue::inRange(std::span<const double> values, std::string const
const bool infiniteMin = RooNumber::isInfinite(min);
const bool infiniteMax = RooNumber::isInfinite(max);

const double epsRel = RooNumber::rangeEpsRel();
const double epsAbs = RooNumber::rangeEpsAbs();

for(std::size_t i = 0; i < values.size(); ++i) {
const double eps = std::max(epsRel * std::abs(values[i]), epsAbs);
out[i] = out[i] && ((infiniteMax | (values[i] <= (max+eps))) && (infiniteMin | (values[i] >= (min-eps))));
out[i] = out[i] && ((infiniteMax | (values[i] <= max)) && (infiniteMin | (values[i] >= min)));
}

}
Expand Down Expand Up @@ -500,29 +484,18 @@ bool RooAbsRealLValue::fitRangeOKForPlotting() const
/// Check if current value is inside range with given name. Multiple comma-separated
/// ranges can be passed. In this case, it will be checked if the value is in any of
/// these ranges.
///
/// Implements the following check to see if the value x is in the range [a, b]:
/// check if `[x - eps * x, x + eps * x]` overlaps with `[a, b]`, where the
/// parameter `eps` is defined as:
/// ```
/// std::max(RooNumber::rangeEpsRel() * std::abs(x), RooNumber::rangeEpsAbs())
/// ```
/// By default, RooNumber::rangeEpsRel() and RooNumber::rangeEpsRel() are set to zero.
/// You can change them with RooNumber::setRangeEpsRel(double) and RooNumber::setRangeEpsAbs(double),
/// but this should be only done if there is no other solution.
bool RooAbsRealLValue::inRange(const char* name) const
{
const double val = getVal() ;
const double epsilon = std::max(RooNumber::rangeEpsRel() * std::abs(val), RooNumber::rangeEpsAbs());
if (!name || name[0] == '\0') {
const auto minMax = getRange(nullptr);
return minMax.first - epsilon <= val && val <= minMax.second + epsilon;
return minMax.first <= val && val <= minMax.second;
}

const auto& ranges = ROOT::Split(name, ",");
return std::any_of(ranges.begin(), ranges.end(), [val,epsilon,this](const std::string& range){
return std::any_of(ranges.begin(), ranges.end(), [val,this](const std::string& range){
const auto minMax = this->getRange(range.c_str());
return minMax.first - epsilon <= val && val <= minMax.second + epsilon;
return minMax.first <= val && val <= minMax.second;
});
}

Expand Down
37 changes: 0 additions & 37 deletions roofit/roofitcore/src/RooNumber.cxx

This file was deleted.

Loading