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
16 changes: 16 additions & 0 deletions README/ReleaseNotes/v642/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ The following people have contributed to this new version:

## Deprecation and Removal

* The method `RooRealVar::removeRange()` and the corresponding method in `RooErrorVar` that were deprecated in ROOT 6.40 are now removed.
* The overloads of `RooAbsReal::createChi2()` and `RooAbsReal::chi2FitTo()` that take unbinned **RooDataSet** data objects were deprecated in ROOT 6.40 and are now removed.
* The **RooStats::HybridPlot** class and the related **HybridResult::GetPlot** method were deprecated in ROOT 6.40 and are now removed.

## Python Interface

## I/O
Expand All @@ -51,6 +55,18 @@ The following people have contributed to this new version:

## RooFit

### Removal of the the constant term optimization for legacy test statistic classes

The **RooFit::Optimize()** option (constant term optimization) has been deprecated in ROOT 6.40 its functionality was now removed.
The `RooFit::Optimize()` and `RooMinimizer::optimizeConst()` methods are kept for API consistency across ROOT versions, but they have no effect anymore.

This option only affected the `legacy` evaluation backend.

The default vectorized CPU evaluation backend (introduced in ROOT 6.32) already performs these optimizations automatically and is not affected by this change.
Users are strongly encouraged to switch to the vectorized CPU backend if they are still using the legacy backend.

If the vectorized backend does not work for a given use case, **please report it by opening an issue on the ROOT GitHub repository**.

## Graphics and GUI

## Geometry
Expand Down
2 changes: 0 additions & 2 deletions roofit/roofitcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ if(roofit_legacy_eval_backend)
src/RooChi2Var.cxx
src/RooNLLVar.cxx
src/RooRealMPFE.cxx
src/RooXYChi2Var.cxx
)
endif()

Expand Down Expand Up @@ -471,7 +470,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore
)

# The following definitions are PUBLIC so they can also be used in ROOT-internal tests
target_compile_definitions(RooFitCore PUBLIC ROOFIT_BUILDS_ITSELF)

if(roofit_legacy_eval_backend)
target_compile_definitions(RooFitCore PUBLIC ROOFIT_LEGACY_EVAL_BACKEND)
Expand Down
27 changes: 0 additions & 27 deletions roofit/roofitcore/inc/RooAbsReal.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,33 +192,6 @@ class RooAbsReal : public RooAbsArg {
return RooFit::makeOwningPtr(createChi2Impl(data, *RooFit::Detail::createCmdList(&cmdArgs...)));
}

// Chi^2 fits to X-Y datasets
virtual RooFit::OwningPtr<RooFitResult> chi2FitTo(RooDataSet& xydata, const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
const RooCmdArg& arg3={}, const RooCmdArg& arg4={}, const RooCmdArg& arg5={},
const RooCmdArg& arg6={}, const RooCmdArg& arg7={}, const RooCmdArg& arg8={})
#ifndef ROOFIT_BUILDS_ITSELF
R__DEPRECATED(6, 42, "To fit 2D data with errors in and `x` and `y`, use specialized tools like TGraphErrors::Fit(), or build an explicit likelihood model with RooFit.")
#endif
;
virtual RooFit::OwningPtr<RooFitResult> chi2FitTo(RooDataSet& xydata, const RooLinkedList& cmdList)
#ifndef ROOFIT_BUILDS_ITSELF
R__DEPRECATED(6, 42, "To fit 2D data with errors in and `x` and `y`, use specialized tools like TGraphErrors::Fit(), or build an explicit likelihood model with RooFit.")
#endif
;

virtual RooFit::OwningPtr<RooAbsReal> createChi2(RooDataSet& data, const RooLinkedList& cmdList)
#ifndef ROOFIT_BUILDS_ITSELF
R__DEPRECATED(6, 42, "To fit 2D data with errors in and `x` and `y`, use specialized tools like TGraphErrors::Fit(), or build an explicit likelihood model with RooFit.")
#endif
;
virtual RooFit::OwningPtr<RooAbsReal> createChi2(RooDataSet& data, const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
const RooCmdArg& arg3={}, const RooCmdArg& arg4={}, const RooCmdArg& arg5={},
const RooCmdArg& arg6={}, const RooCmdArg& arg7={}, const RooCmdArg& arg8={})
#ifndef ROOFIT_BUILDS_ITSELF
R__DEPRECATED(6, 42, "To fit 2D data with errors in and `x` and `y`, use specialized tools like TGraphErrors::Fit(), or build an explicit likelihood model with RooFit.")
#endif
;

virtual RooFit::OwningPtr<RooAbsReal> createProfile(const RooArgSet& paramsOfInterest) ;


Expand Down
6 changes: 1 addition & 5 deletions roofit/roofitcore/inc/RooErrorVar.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ class RooErrorVar : public RooAbsRealLValue {

// Set infinite fit range limits
void removeMin(const char* name=nullptr);
void removeMax(const char* name=nullptr);
void removeRange(const char *name = nullptr)
R__DEPRECATED(6, 42,
"\"removeRange\" was a misleading name."
" Please use \"removeMin()\" and \"removeMax()\" instead, for the same effect.");
void removeMax(const char *name = nullptr);

using RooAbsRealLValue::operator= ;
using RooAbsRealLValue::setVal ;
Expand Down
6 changes: 1 addition & 5 deletions roofit/roofitcore/inc/RooGlobalFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,7 @@ RooCmdArg IntegrateBins(double precision);

// RooAbsPdf::fitTo arguments
RooCmdArg PrefitDataFraction(double data_ratio = 0.0) ;
RooCmdArg Optimize(Int_t flag=2)
#ifndef ROOFIT_BUILDS_ITSELF
R__DEPRECATED(6, 42, "Please use the default \"cpu\" likelihood evaluation backend if you want all optimizations.")
#endif
;
RooCmdArg Optimize(Int_t flag = 2);

class EvalBackend : public RooCmdArg {
public:
Expand Down
6 changes: 1 addition & 5 deletions roofit/roofitcore/inc/RooMinimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,7 @@ class RooMinimizer : public TObject {
void setPrintLevel(int newLevel);

// Setters on _fcn
void optimizeConst(int flag)
#ifndef ROOFIT_BUILDS_ITSELF
R__DEPRECATED(6, 42, "Please use the default \"cpu\" likelihood evaluation backend if you want all optimizations.")
#endif
;
void optimizeConst(int flag);
void setEvalErrorWall(bool flag) { _cfg.doEEWall = flag; }
void setRecoverFromNaNStrength(double strength);
void setOffsetting(bool flag);
Expand Down
7 changes: 1 addition & 6 deletions roofit/roofitcore/inc/RooRealVar.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,7 @@ class RooRealVar : public RooAbsRealLValue {
/// Remove lower range limit for binning with given name. Empty name means default range.
void removeMin(const char* name=nullptr);
/// Remove upper range limit for binning with given name. Empty name means default range.
void removeMax(const char* name=nullptr);
/// Remove range limits for binning with given name. Empty name means default range.
void removeRange(const char* name=nullptr)
R__DEPRECATED(6, 42,
"\"removeRange\" was a misleading name."
" Please use \"removeMin()\" and \"removeMax()\" instead, for the same effect.");
void removeMax(const char *name = nullptr);

// I/O streaming interface (machine readable)
bool readFromStream(std::istream& is, bool compact, bool verbose=false) override ;
Expand Down
123 changes: 41 additions & 82 deletions roofit/roofitcore/src/FitHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#ifdef ROOFIT_LEGACY_EVAL_BACKEND
#include "RooChi2Var.h"
#include "RooNLLVar.h"
#include "RooXYChi2Var.h"
#endif

using RooFit::Detail::RooNLLVarNew;
Expand Down Expand Up @@ -921,11 +920,9 @@ std::unique_ptr<RooAbsReal> createNLL(RooAbsPdf &pdf, RooAbsData &data, const Ro
return nll;
}

std::unique_ptr<RooAbsReal> createChi2(RooAbsReal &real, RooAbsData &data, const RooLinkedList &cmdList)
std::unique_ptr<RooAbsReal> createChi2(RooAbsReal &real, RooDataHist &data, const RooLinkedList &cmdList)
{
#ifdef ROOFIT_LEGACY_EVAL_BACKEND
const bool isDataHist = dynamic_cast<RooDataHist const *>(&data);

RooCmdConfig pc("createChi2(" + std::string(real.GetName()) + ")");

pc.defineInt("numcpu", "NumCPU", 0, 1);
Expand All @@ -934,92 +931,53 @@ std::unique_ptr<RooAbsReal> createChi2(RooAbsReal &real, RooAbsData &data, const

RooAbsTestStatistic::Configuration cfg;

if (isDataHist) {
// Construct Chi2
RooAbsReal::setEvalErrorLoggingMode(RooAbsReal::CollectErrors);
std::string baseName = "chi2_" + std::string(real.GetName()) + "_" + data.GetName();

// Clear possible range attributes from previous fits.
real.removeStringAttribute("fitrange");

pc.defineInt("etype", "DataError", 0, (Int_t)RooDataHist::Auto);
pc.defineInt("extended", "Extended", 0, extendedFitDefault);
pc.defineInt("split_range", "SplitRange", 0, 0);
pc.defineDouble("integrate_bins", "IntegrateBins", 0, -1);
pc.defineString("addCoefRange", "SumCoefRange", 0, "");
pc.allowUndefined();

pc.process(cmdList);
if (!pc.ok(true)) {
return nullptr;
}

bool extended = false;
if (auto pdf = dynamic_cast<RooAbsPdf const *>(&real)) {
extended = interpretExtendedCmdArg(*pdf, pc.getInt("extended"));
}
// Construct Chi2
RooAbsReal::setEvalErrorLoggingMode(RooAbsReal::CollectErrors);
std::string baseName = "chi2_" + std::string(real.GetName()) + "_" + data.GetName();

RooDataHist::ErrorType etype = static_cast<RooDataHist::ErrorType>(pc.getInt("etype"));
// Clear possible range attributes from previous fits.
real.removeStringAttribute("fitrange");

const char *rangeName = pc.getString("rangeName", nullptr, true);
const char *addCoefRangeName = pc.getString("addCoefRange", nullptr, true);
int splitRange = pc.getInt("splitRange");
pc.defineInt("etype", "DataError", 0, (Int_t)RooDataHist::Auto);
pc.defineInt("extended", "Extended", 0, extendedFitDefault);
pc.defineInt("split_range", "SplitRange", 0, 0);
pc.defineDouble("integrate_bins", "IntegrateBins", 0, -1);
pc.defineString("addCoefRange", "SumCoefRange", 0, "");
pc.allowUndefined();

// Set the fitrange attribute of th PDF, add observables ranges for plotting
resetFitrangeAttributes(real, data, baseName, rangeName, splitRange);
pc.process(cmdList);
if (!pc.ok(true)) {
return nullptr;
}

cfg.rangeName = rangeName ? rangeName : "";
cfg.nCPU = pc.getInt("numcpu");
cfg.interleave = RooFit::Interleave;
cfg.verbose = static_cast<bool>(pc.getInt("verbose"));
cfg.cloneInputData = false;
cfg.integrateOverBinsPrecision = pc.getDouble("integrate_bins");
cfg.addCoefRangeName = addCoefRangeName ? addCoefRangeName : "";
cfg.splitCutRange = static_cast<bool>(splitRange);
auto chi2 = std::make_unique<RooChi2Var>(baseName.c_str(), baseName.c_str(), real,
static_cast<RooDataHist &>(data), extended, etype, cfg);
bool extended = false;
if (auto pdf = dynamic_cast<RooAbsPdf const *>(&real)) {
extended = interpretExtendedCmdArg(*pdf, pc.getInt("extended"));
}

RooAbsReal::setEvalErrorLoggingMode(RooAbsReal::PrintErrors);
RooDataHist::ErrorType etype = static_cast<RooDataHist::ErrorType>(pc.getInt("etype"));

return chi2;
} else {
pc.defineInt("integrate", "Integrate", 0, 0);
pc.defineObject("yvar", "YVar", 0, nullptr);
pc.defineInt("interleave", "NumCPU", 1, 0);

// Process and check varargs
pc.process(cmdList);
if (!pc.ok(true)) {
return nullptr;
}
const char *rangeName = pc.getString("rangeName", nullptr, true);
const char *addCoefRangeName = pc.getString("addCoefRange", nullptr, true);
int splitRange = pc.getInt("splitRange");

// Decode command line arguments
bool integrate = pc.getInt("integrate");
RooRealVar *yvar = static_cast<RooRealVar *>(pc.getObject("yvar"));
const char *rangeName = pc.getString("rangeName", nullptr, true);
Int_t numcpu = pc.getInt("numcpu");
Int_t numcpu_strategy = pc.getInt("interleave");
// strategy 3 works only for RooSimultaneous.
if (numcpu_strategy == 3 && !real.InheritsFrom("RooSimultaneous")) {
oocoutW(&real, Minimization) << "Cannot use a NumCpu Strategy = 3 when the pdf is not a RooSimultaneous, "
"falling back to default strategy = 0"
<< std::endl;
numcpu_strategy = 0;
}
RooFit::MPSplit interl = (RooFit::MPSplit)numcpu_strategy;
bool verbose = pc.getInt("verbose");
// Set the fitrange attribute of th PDF, add observables ranges for plotting
resetFitrangeAttributes(real, data, baseName, rangeName, splitRange);

cfg.rangeName = rangeName ? rangeName : "";
cfg.nCPU = numcpu;
cfg.interleave = interl;
cfg.verbose = verbose;
cfg.verbose = false;
cfg.rangeName = rangeName ? rangeName : "";
cfg.nCPU = pc.getInt("numcpu");
cfg.interleave = RooFit::Interleave;
cfg.verbose = static_cast<bool>(pc.getInt("verbose"));
cfg.cloneInputData = false;
cfg.integrateOverBinsPrecision = pc.getDouble("integrate_bins");
cfg.addCoefRangeName = addCoefRangeName ? addCoefRangeName : "";
cfg.splitCutRange = static_cast<bool>(splitRange);
auto chi2 = std::make_unique<RooChi2Var>(baseName.c_str(), baseName.c_str(), real, static_cast<RooDataHist &>(data),
extended, etype, cfg);

std::string name = "chi2_" + std::string(real.GetName()) + "_" + data.GetName();
RooAbsReal::setEvalErrorLoggingMode(RooAbsReal::PrintErrors);

return std::make_unique<RooXYChi2Var>(name.c_str(), name.c_str(), real, static_cast<RooDataSet &>(data), yvar,
integrate, cfg);
}
return chi2;
#else
throw std::runtime_error("createChi2() is not supported without the legacy evaluation backend");
return nullptr;
Expand Down Expand Up @@ -1109,8 +1067,9 @@ std::unique_ptr<RooFitResult> fitTo(RooAbsReal &real, RooAbsData &data, const Ro

std::unique_ptr<RooAbsReal> nll;
if (chi2) {
nll = std::unique_ptr<RooAbsReal>{isDataHist ? real.createChi2(static_cast<RooDataHist &>(data), nllCmdList)
: real.createChi2(static_cast<RooDataSet &>(data), nllCmdList)};
if (isDataHist) {
nll = std::unique_ptr<RooAbsReal>{real.createChi2(static_cast<RooDataHist &>(data), nllCmdList)};
}
} else {
nll = std::unique_ptr<RooAbsReal>{dynamic_cast<RooAbsPdf &>(real).createNLL(data, nllCmdList)};
}
Expand Down
3 changes: 2 additions & 1 deletion roofit/roofitcore/src/FitHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <memory>

class RooAbsData;
class RooDataHist;
class RooAbsPdf;
class RooAbsReal;
class RooCmdConfig;
Expand All @@ -32,7 +33,7 @@ void defineMinimizationOptions(RooCmdConfig &pc);
std::unique_ptr<RooFitResult> minimize(RooAbsReal &model, RooAbsReal &nll, RooAbsData const &data, RooCmdConfig const &pc);

std::unique_ptr<RooAbsReal> createNLL(RooAbsPdf &pdf, RooAbsData &data, const RooLinkedList &cmdList);
std::unique_ptr<RooAbsReal> createChi2(RooAbsReal &real, RooAbsData &data, const RooLinkedList &cmdList);
std::unique_ptr<RooAbsReal> createChi2(RooAbsReal &real, RooDataHist &data, const RooLinkedList &cmdList);

std::unique_ptr<RooFitResult> fitTo(RooAbsReal &pdf, RooAbsData &data, const RooLinkedList &cmdList, bool chi2);

Expand Down
6 changes: 0 additions & 6 deletions roofit/roofitcore/src/RooAbsPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,6 @@ double RooAbsPdf::extendedTerm(RooAbsData const& data, bool weightSquared, bool
* <tr><td> **codegen_no_grad** <td> **Experimental** - Same as **codegen**, but doesn't generate and compile the gradient code and use the regular numerical differentiation instead.
* This is expected to be slower, but useful for debugging problems with the analytic gradient.
* </table>
* <tr><td> `Optimize(bool flag)` <td> Activate constant term optimization.
* Only relevant for `legacy` evaluation backend and off by default, as the default `cpu` backend already includes this optimization unconditionally.
* \warning Deprecated option that will be removed in ROOT 6.42!
* <tr><td> `SplitRange(bool flag)` <td> Use separate fit ranges in a simultaneous fit. Actual range name for each subsample is assumed to
* be `rangeName_indexState`, where `indexState` is the state of the master index category of the simultaneous fit.
* Using `Range("range"), SplitRange()` as switches, different ranges could be set like this:
Expand Down Expand Up @@ -980,9 +977,6 @@ std::unique_ptr<RooAbsReal> RooAbsPdf::createNLLImpl(RooAbsData &data, const Roo
* </table>
*
* <tr><td> `InitialHesse(bool flag)` <td> Flag controls if HESSE before MIGRAD as well, off by default
* <tr><td> `Optimize(bool flag)` <td> Activate constant term optimization of test statistic during minimization.
* Only relevant for `legacy` evaluation backend and off by default, as the default `cpu` backend already includes this optimization unconditionally.
* \warning Deprecated option that will be removed in ROOT 6.42!
* <tr><td> `Hesse(bool flag)` <td> Flag controls if HESSE is run after MIGRAD, on by default
* <tr><td> `Minos(bool flag)` <td> Flag controls if MINOS is run after HESSE, off by default
* <tr><td> `Minos(const RooArgSet& set)` <td> Only run MINOS on given subset of arguments
Expand Down
Loading
Loading