Skip to content
Open
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
1 change: 1 addition & 0 deletions README/ReleaseNotes/v644/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The following people have contributed to this new version:
* The TMVA deep learning methods `MethodDL` (`TMVA::Types::kDL`) and `MethodDNN` (`TMVA::Types::kDNN`), together with all classes in the `TMVA::DNN` namespace and their helper classes `TMVA::Monitoring` and `Pattern`, are deprecated and will be removed in ROOT 6.46. Neural networks are nowadays trained with dedicated machine learning libraries, so maintaining a separate implementation with its own CPU, CUDA and cuDNN backends is no longer justified. Users are encouraged to train their models directly with these libraries, which integrate well with ROOT via the `ROOT.Experimental.ML.RDataLoader`, and to use SOFIE for inference in C++. The `TMVA_CNN_Classification` and `TMVA_RNN_Classification` tutorials are removed already, and the other TMVA tutorials do not use these methods anymore.
We are aware that models trained with these methods may be stored in TMVA XML weight files and still be evaluated via `TMVA::Reader` in production workflows. If you need to keep running such models after ROOT 6.46, please reach out to the ROOT team by opening a [GitHub issue](https://github.com/root-project/root/issues) or posting on the [ROOT forum](https://root-forum.cern.ch/), so that a migration path to SOFIE can be provided.
* The build options `tmva-cpu`, `tmva-gpu`, `tmva-cudnn` and `use_gsl_cblas` only affect the deprecated TMVA deep learning methods, so they are deprecated as well and will be removed in ROOT 6.46. The `tmva-cpu` option is now `OFF` by default, also with `-Dall=ON`, so `MethodDL` runs on a single thread without BLAS and `MethodDNN` cannot be trained, unless ROOT is configured with `-Dtmva-cpu=ON`. Evaluating existing weight files with `TMVA::Reader` works in both cases.
* The `RooHistFunc::cloneAndOwnDataHist()` and `RooHistPdf::cloneAndOwnDataHist()` were removed without deprecation period. They were only introduced in ROOT 6.28 and are redundant with the `RooHistFunc` and `RooHistPdf` constructors that take a `std::unique_ptr<RooDataHist>`, introduced also in 6.28.

## Build system

Expand Down
5 changes: 0 additions & 5 deletions roofit/roofitcore/inc/RooHistFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ class RooHistFunc : public RooAbsReal {
return *_dataHist ;
}

/// Replaces underlying RooDataHist with a clone, which is now owned, and returns the clone.
/// If the underlying RooDataHist is already owned, then that is returned instead of being cloned.
RooDataHist* cloneAndOwnDataHist(const char* newname="");

/// Get total bin volume spanned by this hist function.
/// In 1-d, this is e.g. the range spanned on the x-axis.
double totVolume() const;
Expand Down Expand Up @@ -117,7 +113,6 @@ class RooHistFunc : public RooAbsReal {
Int_t _intOrder = 0; ///< Interpolation order
bool _cdfBoundaries = false; ///< Use boundary conditions for CDFs.
mutable double _totVolume = 0.0; ///<! Total volume of space (product of ranges of observables)
bool _unitNorm = false; ///<! Assume contents is unit normalized (for use as pdf cache)

private:
inline void initializeOwnedDataHist(std::unique_ptr<RooDataHist> &&dataHist)
Expand Down
4 changes: 0 additions & 4 deletions roofit/roofitcore/inc/RooHistPdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ class RooHistPdf : public RooAbsPdf {
return *_dataHist ;
}

/// Replaces underlying RooDataHist with a clone, which is now owned, and returns the clone.
/// If the underlying RooDataHist is already owned, then that is returned instead of being cloned.
RooDataHist* cloneAndOwnDataHist(const char* newname="");

void setInterpolationOrder(Int_t order) {
// Set histogram interpolation order
_intOrder = order ;
Expand Down
10 changes: 1 addition & 9 deletions roofit/roofitcore/src/RooHistFunc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ RooHistFunc::RooHistFunc(const RooHistFunc& other, const char* name) :
_dataHist(other._dataHist),
_intOrder(other._intOrder),
_cdfBoundaries(other._cdfBoundaries),
_totVolume(other._totVolume),
_unitNorm(other._unitNorm)
_totVolume(other._totVolume)
{

_histObsList.addClone(other._histObsList) ;
Expand Down Expand Up @@ -247,13 +246,6 @@ double RooHistFunc::maxVal(Int_t code) const
return max*1.05 ;
}

RooDataHist* RooHistFunc::cloneAndOwnDataHist(const char* newname) {
if (_ownedDataHist) return _ownedDataHist.get();
_ownedDataHist.reset(static_cast<RooDataHist*>(_dataHist->Clone(newname)));
_dataHist = _ownedDataHist.get();
return _dataHist;
}

////////////////////////////////////////////////////////////////////////////////
/// Return the total volume spanned by the observables of the RooDataHist

Expand Down
23 changes: 11 additions & 12 deletions roofit/roofitcore/src/RooHistPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,6 @@ RooHistPdf::RooHistPdf(const RooHistPdf& other, const char* name) :
_histObsList.addClone(other._histObsList) ;
}

RooDataHist* RooHistPdf::cloneAndOwnDataHist(const char* newname) {
if (_ownedDataHist) return _ownedDataHist.get();
_ownedDataHist.reset(static_cast<RooDataHist*>(_dataHist->Clone(newname)));
_dataHist = _ownedDataHist.get();
return _dataHist;
}

void RooHistPdf::clampNegativeBins()
{
const std::size_t nBins = _dataHist->numEntries();
Expand All @@ -209,10 +202,16 @@ void RooHistPdf::clampNegativeBins()
"before constructing the RooHistPdf."
<< std::endl;

RooDataHist *dh = cloneAndOwnDataHist();
const bool hasSumW2 = dh->sumW2Array() != nullptr;
// We'll mutate the content of the RooDataHist, so we have to create an
// internal clone to avoid impacting other places that use the RooDataHist
if (!_ownedDataHist) {
_ownedDataHist.reset(static_cast<RooDataHist *>(_dataHist->Clone()));
_dataHist = _ownedDataHist.get();
}

const bool hasSumW2 = _dataHist->sumW2Array() != nullptr;
for (std::size_t i = 0; i < nBins; ++i) {
if (dh->weight(i) < 0.) {
if (_dataHist->weight(i) < 0.) {
// Keep the original bin error: clamping the content is a
// normalization-consistency measure, not a statement that the bin is
// now known exactly. The error still quantifies the statistical
Expand All @@ -223,8 +222,8 @@ void RooHistPdf::clampNegativeBins()
// for anyone retrieving the histogram via dataHist(), including any
// future per-bin MC-stat treatment, where a zero error would wrongly
// fix the bin at exactly zero.
const double wgtErr = hasSumW2 ? std::sqrt(std::max(dh->weightSquared(i), 0.)) : 0.;
dh->set(i, 0., wgtErr);
const double wgtErr = hasSumW2 ? std::sqrt(std::max(_dataHist->weightSquared(i), 0.)) : 0.;
_dataHist->set(i, 0., wgtErr);
}
}
}
Expand Down
34 changes: 18 additions & 16 deletions roofit/xroofit/src/xRooNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3847,22 +3847,24 @@ xRooNode xRooNode::Vary(const xRooNode &child)
if (!v->hasError())
v->setError(1);

std::shared_ptr<RooHistFunc> up(
static_cast<RooHistFunc *>(f->Clone(Form("%s_%s_up", f->GetName(), parName.Data()))));
std::shared_ptr<RooHistFunc> down(
static_cast<RooHistFunc *>(f->Clone(Form("%s_%s_down", f->GetName(), parName.Data()))));
// RooHistFunc doesn't clone it's data hist ... do it ourself (will be cloned again if imported into a ws)
#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00)
std::unique_ptr<RooDataHist> h1(
static_cast<RooDataHist *>(f->dataHist().Clone(Form("hist_%s", up->GetName()))));
std::unique_ptr<RooDataHist> h2(
static_cast<RooDataHist *>(f->dataHist().Clone(Form("hist_%s", down->GetName()))));
up->_dataHist = dynamic_cast<RooDataHist *>(f->dataHist().Clone(Form("hist_%s", up->GetName())));
down->_dataHist = dynamic_cast<RooDataHist *>(f->dataHist().Clone(Form("hist_%s", down->GetName())));
#else
up->cloneAndOwnDataHist(TString::Format("hist_%s", up->GetName()));
down->cloneAndOwnDataHist(TString::Format("hist_%s", down->GetName()));
#endif
auto upName = TString::Format("%s_%s_up", f->GetName(), parName.Data());
auto upHistName = TString::Format("hist_%s", upName.Data());
auto downName = TString::Format("%s_%s_down", f->GetName(), parName.Data());
auto downHistName = TString::Format("hist_%s", downName.Data());

// RooHistFunc doesn't clone it's data hist ... do it ourself
// (will be cloned again if imported into a ws)
auto up = std::make_shared<RooHistFunc>(upName, f->GetTitle(), f->variables(),
std::make_unique<RooDataHist>(f->dataHist(), upHistName),
f->getInterpolationOrder());
up->setCdfBoundaries(f->getCdfBoundaries());

auto down = std::make_shared<RooHistFunc>(downName, f->GetTitle(), f->variables(),

std::make_unique<RooDataHist>(f->dataHist(), downHistName),
f->getInterpolationOrder());
down->setCdfBoundaries(f->getCdfBoundaries());

auto ups = std::dynamic_pointer_cast<RooHistFunc>(acquire(up, false, true));
auto downs = std::dynamic_pointer_cast<RooHistFunc>(acquire(down, false, true));
#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00)
Expand Down
Loading