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
2 changes: 1 addition & 1 deletion roofit/roofitcore/inc/RooAbsCategory.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class RooAbsCategory : public RooAbsArg {
static const decltype(_stateNames)::value_type& invalidCategory();

private:
std::unique_ptr<TreeReadBuffer> _treeReadBuffer; //! A buffer for reading values from trees
TreeReadBuffer *_treeReadBuffer = nullptr; //! A buffer for reading values from trees

ClassDefOverride(RooAbsCategory, 4) // Abstract discrete variable
};
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofitcore/inc/RooAbsCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class RooAbsCollection : public TObject, public RooPrintable {
bool replaceImpl(const RooAbsArg& var1, const RooAbsArg& var2);

using HashAssistedFind = RooFit::Detail::HashAssistedFind;
mutable std::unique_ptr<HashAssistedFind> _hashAssistedFind; ///<!
mutable HashAssistedFind *_hashAssistedFind = nullptr; ///<!
std::size_t _sizeThresholdForMapSearch = 100; ///<!

void insert(RooAbsArg*);
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofitcore/inc/RooAbsReal.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ class RooAbsReal : public RooAbsArg {
TString _label; ///< Plot label for objects value
bool _forceNumInt = false; ///< Force numerical integration if flag set
std::unique_ptr<RooNumIntConfig> _specIntegratorConfig; // Numeric integrator configuration specific for this object
std::unique_ptr<TreeReadBuffer> _treeReadBuffer; //! A buffer for reading values from trees
TreeReadBuffer *_treeReadBuffer = nullptr; //! A buffer for reading values from trees
bool _selectComp = true; //! Component selection flag for RooAbsPdf::plotCompOn
mutable RooFit::UniqueId<RooArgSet>::Value_t _lastNormSetId = RooFit::UniqueId<RooArgSet>::nullval; ///<!

Expand Down
10 changes: 8 additions & 2 deletions roofit/roofitcore/src/RooAbsCategory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ RooAbsCategory::RooAbsCategory(const RooAbsCategory& other,const char* name) :

RooAbsCategory::~RooAbsCategory()
{

if (_treeReadBuffer) {
delete _treeReadBuffer;
}
_treeReadBuffer = nullptr;
}


Expand Down Expand Up @@ -486,8 +489,11 @@ void RooAbsCategory::attachToTree(TTree& tree, Int_t bufSize)
if (typeDetails != typeMap.end()) {
coutI(DataHandling) << "RooAbsCategory::attachToTree(" << GetName() << ") TTree " << typeName << " branch \"" << cleanName
<< "\" will be converted to int." << std::endl;
_treeReadBuffer = typeDetails->second();
_treeReadBuffer = typeDetails->second().release();
} else {
if (_treeReadBuffer) {
delete _treeReadBuffer;
}
_treeReadBuffer = nullptr;

if (typeName == "Int_t") {
Expand Down
23 changes: 18 additions & 5 deletions roofit/roofitcore/src/RooAbsCollection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ RooAbsCollection::~RooAbsCollection()
if(_ownCont){
deleteList() ;
}
if (_hashAssistedFind) {
delete _hashAssistedFind;
}
_hashAssistedFind = nullptr;
}


Expand All @@ -189,6 +193,9 @@ RooAbsCollection::~RooAbsCollection()

void RooAbsCollection::deleteList()
{
if (_hashAssistedFind) {
delete _hashAssistedFind;
}
_hashAssistedFind = nullptr;

// Built-in delete remaining elements
Expand Down Expand Up @@ -748,6 +755,9 @@ bool RooAbsCollection::remove(const RooAbsCollection& list, bool /*silent*/, boo

void RooAbsCollection::removeAll()
{
if (_hashAssistedFind) {
delete _hashAssistedFind;
}
_hashAssistedFind = nullptr;

if(_ownCont) {
Expand Down Expand Up @@ -920,7 +930,7 @@ RooAbsArg * RooAbsCollection::find(const char *name) const

if (_hashAssistedFind || _list.size() >= _sizeThresholdForMapSearch) {
if (!_hashAssistedFind || !_hashAssistedFind->isValid()) {
_hashAssistedFind = std::make_unique<HashAssistedFind>(_list.begin(), _list.end());
_hashAssistedFind = new HashAssistedFind{_list.begin(), _list.end()};
}

return _hashAssistedFind->find(nptr);
Expand All @@ -940,7 +950,7 @@ RooAbsArg * RooAbsCollection::find(const RooAbsArg& arg) const

if (_hashAssistedFind || _list.size() >= _sizeThresholdForMapSearch) {
if (!_hashAssistedFind || !_hashAssistedFind->isValid()) {
_hashAssistedFind = std::make_unique<HashAssistedFind>(_list.begin(), _list.end());
_hashAssistedFind = new HashAssistedFind{_list.begin(), _list.end()};
}

return _hashAssistedFind->find(nptr);
Expand Down Expand Up @@ -1617,10 +1627,13 @@ void RooAbsCollection::useHashMapForFind(bool flag) const
throw std::runtime_error(msg.str());
}
#endif
if (flag && !_hashAssistedFind)
_hashAssistedFind = std::make_unique<HashAssistedFind>(_list.begin(), _list.end());
if (!flag)
if (flag && !_hashAssistedFind) {
_hashAssistedFind = new HashAssistedFind{_list.begin(), _list.end()};
}
if (!flag && _hashAssistedFind) {
delete _hashAssistedFind;
_hashAssistedFind = nullptr;
}
}


Expand Down
13 changes: 11 additions & 2 deletions roofit/roofitcore/src/RooAbsReal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ RooAbsReal::RooAbsReal(const RooAbsReal& other, const char* name) :
////////////////////////////////////////////////////////////////////////////////
/// Destructor

RooAbsReal::~RooAbsReal() {}
RooAbsReal::~RooAbsReal()
{
if (_treeReadBuffer) {
delete _treeReadBuffer;
}
_treeReadBuffer = nullptr;
}


////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -3153,8 +3159,11 @@ void RooAbsReal::attachToTree(TTree& t, Int_t bufSize)
coutI(DataHandling) << "RooAbsReal::attachToTree(" << GetName() << ") TTree " << typeDetails->first << " branch " << GetName()
<< " will be converted to double precision." << std::endl ;
setAttribute(typeDetails->second.first.c_str(), true);
_treeReadBuffer = typeDetails->second.second();
_treeReadBuffer = typeDetails->second.second().release();
} else {
if (_treeReadBuffer) {
delete _treeReadBuffer;
}
_treeReadBuffer = nullptr;

if (!typeName.CompareTo("Double_t")) {
Expand Down
Loading