Skip to content

Commit

Permalink
[RF] Prevent empty names for RooAbsArgs.
Browse files Browse the repository at this point in the history
- AbsArgs need a name to be indentified in datasets and PDF trees.
- This commit adds a check such that empty names cannot be used.
  • Loading branch information
hageboeck committed Jul 22, 2019
1 parent c5bc35b commit 5d31bf0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions roofit/roofitcore/src/RooAbsArg.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ RooAbsArg::RooAbsArg(const char *name, const char *title)
_ownedComponents(0), _prohibitServerRedirect(kFALSE), _eocache(0), _namePtr(0), _isConstant(kFALSE),
_localNoInhibitDirty(kFALSE), _myws(0)
{
if (name == nullptr || strlen(name) == 0) {
throw std::logic_error("Each RooFit object needs a name. "
"Objects representing the same entity (e.g. an observable 'x') are identified using their name.");
}
_namePtr = (TNamed*) RooNameReg::instance().constPtr(GetName()) ;
}

Expand Down

0 comments on commit 5d31bf0

Please sign in to comment.