51#include <unordered_set>
68 template<
typename It_t>
74 for (
auto it = first; it != last; ++it) {
142 _allRRV(other._allRRV)
146 _list.reserve(other.
_list.size());
148 for (
auto item : other.
_list) {
160 _list(std::move(other._list)),
161 _ownCont(other._ownCont),
162 _name(std::move(other._name)),
163 _allRRV(other._allRRV),
164 _sizeThresholdForMapSearch(other._sizeThresholdForMapSearch)
199 for (
auto item :
_list) {
228 snapName.
Append(
"Snapshot of ") ;
282 if (&other==
this) return ;
284 for (
auto elem :
_list) {
285 auto theirs = other.
find(*elem);
286 if(!theirs)
continue;
288 elem->copyCache(theirs) ;
289 elem->setAttribute(
"Constant",theirs->isConstant()) ;
304 if (&other==
this)
return *
this;
307 if (
size()==1 &&
size() == other.
size() && forceIfSizeOne) {
313 for (
auto elem :
_list) {
314 auto theirs = other.
find(*elem);
315 if(!theirs)
continue;
317 elem->copyCache(theirs,
true) ;
330 if (&other==
this) return ;
333 auto iter2 = other.
_list.begin();
334 for (
auto iter1 =
_list.begin();
335 iter1 !=
_list.end() && iter2 != other.
_list.end();
342 auto theirs =
static_cast<RooRealVar*
>(*iter2);
345 (*iter2)->syncCache() ;
346 (*iter1)->copyCache(*iter2,
true,setValDirty) ;
370 coutE(ObjectHandling) <<
ClassName() <<
"::" <<
GetName() <<
"::addOwned: can only add to an owned list" << std::endl;
396 auto errMsg = std::string(
"RooAbsCollection::addOwned could not add the argument to the")
397 +
" collection! The ownership would not be well defined if we ignore this.";
398 coutE(ObjectHandling) << errMsg << std::endl;
399 throw std::runtime_error(errMsg);
419 coutE(ObjectHandling) <<
ClassName() <<
"::" <<
GetName() <<
"::addClone: can only add to an owned list" << std::endl;
446 coutE(ObjectHandling) <<
ClassName() <<
"::" <<
GetName() <<
"::add: cannot add to an owned list" << std::endl;
472 if(list.isOwning()) {
473 throw std::invalid_argument(
"Passing an owning RooAbsCollection by const& to"
474 " RooAbsCollection::addOwned is forbidden because the ownership"
475 " would be ambiguous! Please std::move() the RooAbsCollection in this case."
476 " Note that the passed RooAbsCollection is invalid afterwards.");
481 _list.reserve(
_list.size() + list._list.size());
483 for (
auto item : list._list) {
500 if(list.isOwning()) {
501 list._ownCont =
false;
503 if(list.empty())
return false;
508 auto errMsg = std::string(
"RooAbsCollection::addOwned could not add the argument to the")
509 +
" collection! The ownership would not be well defined if we ignore this.";
510 coutE(ObjectHandling) << errMsg << std::endl;
511 throw std::runtime_error(errMsg);
530 _list.reserve(
_list.size() + list._list.size());
532 for (
auto item : list._list) {
547 std::stringstream errMsg;
548 errMsg <<
"RooAbsCollection: cannot replace variables in a copied list";
549 coutE(ObjectHandling) << errMsg.str() << std::endl;
551 throw std::invalid_argument(errMsg.str());
555 for (
const auto * arg : other.
_list) {
557 auto found =
find(*arg);
558 if (found)
replace(*found,*arg);
568 auto var1It = std::find(
_list.begin(),
_list.end(), &var1);
570 if (var1It ==
_list.end()) {
571 coutE(ObjectHandling) <<
"RooAbsCollection: variable \"" <<
name <<
"\" is not in the list"
572 <<
" and cannot be replaced" << std::endl;
580 if(other !=
nullptr && other != &var1) {
581 coutE(ObjectHandling) <<
"RooAbsCollection: cannot replace \"" <<
name
582 <<
"\" with already existing \"" << var2.
GetName() <<
"\"" << std::endl;
611 std::string errMsg =
"RooAbsCollection: cannot replace variables in a copied list";
612 coutE(ObjectHandling) << errMsg << std::endl;
613 throw std::runtime_error(errMsg);
630 "RooAbsCollection::replace(RooAbsArg *, std::unique_ptr<RooAbsArg>) can't be used on a non-owning collection!";
631 coutE(ObjectHandling) << errMsg << std::endl;
632 throw std::runtime_error(errMsg);
635 bool success =
replaceImpl(*var1, *var2.release());
637 auto errMsg = std::string(
"RooAbsCollection::replace(RooAbsArg *, std::unique_ptr<RooAbsArg>) did not succeed!") +
638 "The ownership would not be well defined if we ignore this.";
639 coutE(ObjectHandling) << errMsg << std::endl;
640 throw std::runtime_error(errMsg);
656 const auto sizeBefore =
_list.size();
658 if (matchByNameOnly) {
661 return elm->GetName() ==
name;
663 std::set<RooAbsArg*> toBeDeleted;
667 if (nameMatch(elm)) {
668 toBeDeleted.insert(elm);
675 for (
auto arg : toBeDeleted)
678 _list.erase(std::remove(_list.begin(), _list.end(), &var), _list.end());
681 if (_hashAssistedFind && sizeBefore != _list.size()) {
682 _hashAssistedFind->erase(&var);
685 return sizeBefore != _list.size();
700 auto oldSize =
_list.size();
701 std::vector<const RooAbsArg*> markedItems;
703 if (matchByNameOnly) {
707 auto nameMatchAndMark = [&list, &markedItems](
const RooAbsArg* elm) {
708 if( list.contains(*elm) ) {
709 markedItems.push_back(elm);
719 auto argMatchAndMark = [&list, &markedItems](
const RooAbsArg* elm) {
720 if( list.containsInstance(*elm) ) {
721 markedItems.push_back(elm);
731 for(
auto& var : markedItems ) {
737 std::set<const RooAbsArg*> toBeDeleted(markedItems.begin(), markedItems.end());
738 for (
auto arg : toBeDeleted) {
743 return oldSize !=
_list.size();
777 for (
auto arg :
_list) {
793 selName.
Append(
"_selection") ;
797 for (
auto arg :
_list) {
820 for (
auto arg :
_list) {
821 if (refColl.
find(*arg))
851 selName.
Append(
"_selection") ;
854 const size_t bufSize = strlen(nameList) + 1;
855 std::vector<char> buf(bufSize);
856 strlcpy(buf.data(),nameList,bufSize) ;
857 char* wcExpr = strtok(buf.data(),
",") ;
861 cxcoutD(ObjectHandling) <<
"RooAbsCollection::selectByName(" <<
GetName() <<
") processing expression '" << wcExpr <<
"'" << std::endl;
864 for (
auto const* arg : *
this) {
867 cxcoutD(ObjectHandling) <<
"RooAbsCollection::selectByName(" <<
GetName() <<
") selected element " << arg->GetName() << std::endl;
872 wcExpr = strtok(
nullptr,
",") ;
887 if (
size() != otherColl.
size())
return false ;
891 return left->
namePtr() == right->namePtr();
894 return std::is_permutation(
_list.begin(),
_list.end(),
895 otherColl.
_list.begin(),
903template<
class Collection_t>
904RooAbsArg* findUsingNamePointer(
const Collection_t& coll,
const TNamed* ptr) {
905 auto findByNamePtr = [ptr](
const RooAbsArg* elm) {
906 return ptr == elm->namePtr();
909 auto item = std::find_if(coll.begin(), coll.end(), findByNamePtr);
911 return item != coll.end() ? *item :
nullptr;
926 if (!nptr)
return nullptr;
937 return findUsingNamePointer(
_list, nptr);
947 const auto nptr = arg.
namePtr();
958 return findUsingNamePointer(
_list, nptr);
965 const std::string theName(
name);
967 return elm->GetName() == theName;
969 return item !=
_list.end() ? item -
_list.begin() : -1;
981 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::getRealValue(" <<
GetName() <<
") ERROR no object with name '" <<
name <<
"' found" << std::endl;
986 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::getRealValue(" <<
GetName() <<
") ERROR object '" <<
name <<
"' is not of type RooAbsReal" << std::endl;
1002 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::setRealValue(" <<
GetName() <<
") ERROR no object with name '" <<
name <<
"' found" << std::endl;
1007 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::setRealValue(" <<
GetName() <<
") ERROR object '" <<
name <<
"' is not of type RooAbsRealLValue" << std::endl;
1010 rar->setVal(newVal) ;
1024 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::getCatLabel(" <<
GetName() <<
") ERROR no object with name '" <<
name <<
"' found" << std::endl;
1029 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::getCatLabel(" <<
GetName() <<
") ERROR object '" <<
name <<
"' is not of type RooAbsCategory" << std::endl;
1032 return rac->getCurrentLabel() ;
1045 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::setCatLabel(" <<
GetName() <<
") ERROR no object with name '" <<
name <<
"' found" << std::endl;
1050 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::setCatLabel(" <<
GetName() <<
") ERROR object '" <<
name <<
"' is not of type RooAbsCategory" << std::endl;
1053 rac->setLabel(newVal) ;
1067 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::getCatLabel(" <<
GetName() <<
") ERROR no object with name '" <<
name <<
"' found" << std::endl;
1072 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::getCatLabel(" <<
GetName() <<
") ERROR object '" <<
name <<
"' is not of type RooAbsCategory" << std::endl;
1075 return rac->getCurrentIndex() ;
1088 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::setCatLabel(" <<
GetName() <<
") ERROR no object with name '" <<
name <<
"' found" << std::endl;
1093 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::setCatLabel(" <<
GetName() <<
") ERROR object '" <<
name <<
"' is not of type RooAbsCategory" << std::endl;
1096 rac->setIndex(newVal) ;
1110 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::getStringValue(" <<
GetName() <<
") ERROR no object with name '" <<
name <<
"' found" << std::endl;
1115 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::getStringValue(" <<
GetName() <<
") ERROR object '" <<
name <<
"' is not of type RooStringVar" << std::endl;
1119 return ras->getVal() ;
1132 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::setStringValue(" <<
GetName() <<
") ERROR no object with name '" <<
name <<
"' found" << std::endl;
1137 if (verbose)
coutE(InputArguments) <<
"RooAbsCollection::setStringValue(" <<
GetName() <<
") ERROR object '" <<
name <<
"' is not of type RooStringVar" << std::endl;
1140 ras->setVal(newVal);
1149 std::string retVal ;
1150 for (
auto arg :
_list) {
1151 retVal += arg->GetName();
1155 if (!retVal.empty()) {
1156 retVal.erase(retVal.end()-1);
1202 if (opt &&
TString(opt)==
"I") {
1205 if (opt &&
TString(opt).Contains(
"v")) {
1223 for (
auto arg :
_list) {
1230 os << '\'' << (static_cast<RooStringVar *>(arg))->getVal() <<
'\'';
1232 os << arg->GetName();
1254 Int_t maxNameLen(1) ;
1256 if (nameFieldLengthSaved==0) {
1257 for (
auto next :
_list) {
1258 Int_t len = strlen(next->GetName()) ;
1259 if (
len>maxNameLen) maxNameLen =
len ;
1264 unsigned int idx = 0;
1265 for (
auto next :
_list) {
1266 os <<
indent << std::setw(3) << ++idx <<
") ";
1281 for (
auto arg :
_list) {
1282 std::cout << arg <<
" " << arg->ClassName() <<
"::" << arg->GetName() <<
" (" << arg->GetTitle() <<
")" << std::endl ;
1335 pc.
defineInt(
"dummy",
"FormatArgs",0,0) ;
1346 pc.
process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1351 const char* outFile = pc.
getString(
"outputFile") ;
1352 if (outFile && strlen(outFile)) {
1353 std::ofstream ofs(outFile) ;
1394 sibFormatCmd = *formatCmd ;
1398 static char buf[100] ;
1399 strlcpy(buf,tmp.
Data(),100) ;
1407 for(
auto * col : static_range_cast<RooAbsCollection*>(siblingList)) {
1415 for(
auto * col : static_range_cast<RooAbsCollection*>(listList)) {
1417 for (
auto* arg : *col) {
1422 coutW(InputArguments) <<
"RooAbsCollection::printLatex: can only print RooRealVar in LateX, skipping non-RooRealVar object named "
1423 << arg->
GetName() << std::endl;
1426 coutW(InputArguments) <<
"RooAbsCollection::printLatex: WARNING: naming and/or ordering of sibling list is different" << std::endl;
1429 listListRRV.
Add(list) ;
1430 if (prevList && list->
size() != prevList->
size()) {
1431 coutW(InputArguments) <<
"RooAbsCollection::printLatex: ERROR: sibling list(s) must have same length as self" << std::endl;
1442 for (k=0 ; k<nlist ; k++) subheader +=
"c" ;
1444 TString header =
"\\begin{tabular}{" ;
1445 for (j=0 ; j<ncol ; j++) {
1446 if (j>0) header +=
"|" ;
1447 header += subheader ;
1450 ofs << header << std::endl;
1454 for (i=0 ; i<nrow ; i++) {
1455 for (j=0 ; j<ncol ; j++) {
1456 for (k=0 ; k<nlist ; k++) {
1462 ofs << par->
format((k==0)?*formatCmd:sibFormatCmd);
1465 if (!(j==ncol-1 && k==nlist-1)) {
1470 ofs <<
"\\\\" << std::endl;
1473 ofs <<
"\\end{tabular}" << std::endl;
1486 if (!rangeSpec)
return true ;
1489 std::vector<std::string> cutVec ;
1490 if (rangeSpec && strlen(rangeSpec)>0) {
1491 if (strchr(rangeSpec,
',')==
nullptr) {
1492 cutVec.push_back(rangeSpec) ;
1494 const size_t bufSize = strlen(rangeSpec)+1;
1495 std::vector<char> buf(bufSize);
1496 strlcpy(buf.data(),rangeSpec,bufSize) ;
1497 const char* oneRange = strtok(buf.data(),
",") ;
1499 cutVec.push_back(oneRange) ;
1500 oneRange = strtok(
nullptr,
",") ;
1506 bool selectByRange = true ;
1507 for (
auto arg :
_list) {
1508 bool selectThisArg = false ;
1510 for (icut=0 ; icut<cutVec.size() ; icut++) {
1511 if (arg->inRange(cutVec[icut].c_str())) {
1512 selectThisArg = true ;
1516 if (!selectThisArg) {
1517 selectByRange = false ;
1522 return selectByRange ;
1543 return strcmp(
l->
GetName(),
r->GetName()) > 0;
1546 std::sort(
_list.begin(),
_list.end(), cmpReverse);
1550 return strcmp(
l->
GetName(),
r->GetName()) < 0;
1567 std::unordered_set<TNamed const *> memberNames;
1568 memberNames.reserve(
_list.size());
1569 bool hasDuplicates =
false;
1571 hasDuplicates |= !memberNames.insert(arg->namePtr()).second;
1577 if (hasDuplicates) {
1578 std::unordered_set<TNamed const *> seenArgsLegacy;
1579 for (std::size_t iArg = 0; iArg <
_list.size(); ++iArg) {
1581 bool movedArg =
false;
1583 if (seenArgsLegacy.find(server->namePtr()) == seenArgsLegacy.end()) {
1584 auto found = std::find_if(
_list.begin(),
_list.end(),
1585 [server](
RooAbsArg *elem) { return elem->namePtr() == server->namePtr(); });
1586 if (found !=
_list.end()) {
1598 seenArgsLegacy.insert(arg->
namePtr());
1604 sorted.reserve(
_list.size());
1605 std::unordered_set<TNamed const *> seenArgs;
1606 seenArgs.reserve(
_list.size());
1609 std::unordered_set<TNamed const *> onStack;
1612 std::vector<std::pair<RooAbsArg *, std::size_t>> stack;
1614 if (seenArgs.count(arg->namePtr()))
1616 stack.emplace_back(arg, 0);
1617 onStack.insert(arg->namePtr());
1618 while (!stack.empty()) {
1620 bool descended =
false;
1621 auto const &servers = node->
servers();
1622 while (stack.back().second < servers.size()) {
1623 RooAbsArg *server = servers[stack.back().second++];
1625 if (memberNames.count(serverName) && !seenArgs.count(serverName) && !onStack.count(serverName)) {
1626 stack.emplace_back(server, 0);
1627 onStack.insert(serverName);
1634 if (seenArgs.insert(node->
namePtr()).second) {
1635 sorted.push_back(node);
1637 onStack.erase(node->
namePtr());
1642 _list = std::move(sorted);
1648 _list.push_back(item);
1667#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 33, 00)
1668 if (flag && !
dynamic_cast<RooArgSet const *
>(
this)) {
1670 std::stringstream msg;
1671 msg <<
"RooAbsCollection::useHashMapForFind() ERROR: this collection is not a RooArgSet but a RooArgList, so "
1672 "hash-assisted finding can't be enabled!"
1674 oocoutE(
nullptr, ObjectHandling) << msg.str() << std::endl;
1675 throw std::runtime_error(msg.str());
1691 for (
unsigned int i=0; i < std::min(
_list.size(), other.
size()); ++i) {
1692 if (
_list[i]->namePtr() != other.
_list[i]->namePtr())
1701 std::string typeName = klass->
GetName();
1702 std::stringstream msg;
1703 msg <<
"RooAbsCollection::addTyped<" << typeName <<
">() ERROR: component " << arg->
GetName() <<
" is not of type "
1705 oocoutE(
nullptr, InputArguments) << msg.str() << std::endl;
1706 throw std::invalid_argument(msg.str());
1712 for (
auto const *myarg : static_range_cast<RooRealVar *>(*
this)) {
1713 if (myarg->isConstant())
1714 constSet.
add(*myarg);
static Roo_reg_AGKInteg1D instance
int Int_t
Signed integer 4 bytes (int)
char Text_t
General string (char)
const char Option_t
Option string (const char)
static void indent(ostringstream &buf, int indent_level)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Common abstract base class for objects that represent a value and a "shape" in RooFit.
virtual void copyCache(const RooAbsArg *source, bool valueOnly=false, bool setValDirty=true)=0
const TNamed * namePtr() const
De-duplicated pointer to this object's name.
virtual void syncCache(const RooArgSet *nset=nullptr)=0
const RefCountList_t & servers() const
List of all servers of this object.
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
Abstract base class for objects that represent a discrete value that can be set from the outside,...
A space to attach TBranches.
Abstract container object that can hold multiple RooAbsArg objects.
RooAbsCollection * selectByAttrib(const char *name, bool value) const
Create a subset of the current collection, consisting only of those elements with the specified attri...
bool equals(const RooAbsCollection &otherColl) const
Check if this and other collection have identically-named contents.
double getRealValue(const char *name, double defVal=0.0, bool verbose=false) const
Get value of a RooAbsReal stored in set with given name.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
void deleteList()
Delete contents of the list.
Int_t getCatIndex(const char *name, Int_t defVal=0, bool verbose=false) const
Get index value of a RooAbsCategory stored in set with given name.
std::vector< RooAbsArg * > Storage_t
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
void printLatex(const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Output content of collection as LaTex table.
RooAbsCollection & assignValueOnly(const RooAbsCollection &other, bool forceIfSizeOne=false)
Sets the value of any argument in our set that also appears in the other set.
virtual TObject * create(const char *newname) const =0
Int_t defaultPrintContents(Option_t *opt) const override
Define default RooPrinable print options for given Print() flag string For inline printing only show ...
bool allInRange(const char *rangeSpec) const
Return true if all contained object report to have their value inside the specified range.
void assignFast(const RooAbsCollection &other, bool setValDirty=true) const
Functional equivalent of assign() but assumes this and other collection have same layout.
void sortTopologically()
Sort collection topologically: the servers of any RooAbsArg will be before that RooAbsArg in the coll...
const char * getStringValue(const char *name, const char *defVal="", bool verbose=false) const
Get string value of a RooStringVar stored in set with given name.
virtual bool canBeAdded(const RooAbsArg &arg, bool silent) const =0
Determine whether it's possible to add a given RooAbsArg to the collection or not.
RooAbsCollection * snapshot(bool deepCopy=true) const
Take a snap shot of current collection contents.
RooAbsCollection()
Default constructor.
void printValue(std::ostream &os) const override
Print value of collection, i.e.
~RooAbsCollection() override
Destructor.
bool setStringValue(const char *name, const char *newVal="", bool verbose=false)
Set string value of a RooStringVar stored in set with given name to newVal.
HashAssistedFind * _hashAssistedFind
!
const char * GetName() const override
Returns name of object.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
void setAttribAll(const Text_t *name, bool value=true)
Set given attribute in each element of the collection by calling each elements setAttribute() functio...
void printTitle(std::ostream &os) const override
Return collection title.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in the collection.
bool _allRRV
All contents are RRV.
bool hasSameLayout(const RooAbsCollection &other) const
Check that all entries where the collections overlap have the same name.
void RecursiveRemove(TObject *obj) override
If one of the TObject we have a referenced to is deleted, remove the reference.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
Storage_t::size_type size() const
RooAbsArg * first() const
virtual bool replace(const RooAbsArg &var1, const RooAbsArg &var2)
Replace var1 with var2 and return true for success.
bool setCatIndex(const char *name, Int_t newVal=0, bool verbose=false)
Set index value of a RooAbsCategoryLValue stored in set with given name to newVal.
void clear()
Clear contents. If the collection is owning, it will also delete the contents.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Implement multiline printing of collection, one line for each contained object showing the requested ...
static void throwAddTypedException(TClass *klass, RooAbsArg *arg)
bool setCatLabel(const char *name, const char *newVal="", bool verbose=false)
Set state name of a RooAbsCategoryLValue stored in set with given name to newVal.
void removeConstantParameters()
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
Storage_t _list
Actual object storage.
RooAbsCollection * selectByName(const char *nameList, bool verbose=false) const
Create a subset of the current collection, consisting only of those elements with names matching the ...
bool setRealValue(const char *name, double newVal=0.0, bool verbose=false)
Set value of a RooAbsRealLValue stored in set with given name to newVal No error messages are printed...
bool _ownCont
Flag to identify a list that owns its contents.
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
void printName(std::ostream &os) const override
Return collection name.
void sort(bool reverse=false)
Sort collection using std::sort and name comparison.
std::size_t _sizeThresholdForMapSearch
!
void dump() const
Base contents dumper for debugging purposes.
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
const char * getCatLabel(const char *name, const char *defVal="", bool verbose=false) const
Get state name of a RooAbsCategory stored in set with given name.
void useHashMapForFind(bool flag) const
bool replaceImpl(const RooAbsArg &var1, const RooAbsArg &var2)
std::string contentsString() const
Return comma separated list of contained object names as STL string.
void printClassName(std::ostream &os) const override
Return collection class name.
void setName(const char *name)
RooAbsCollection & operator=(const RooAbsCollection &other)
Assign values from the elements in other to our elements.
void insert(RooAbsArg *)
Insert an element into the owned collections.
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Named container for two doubles, two integers two object points and three string pointers that can be...
void addArg(const RooCmdArg &arg)
Utility function to add nested RooCmdArg to payload of this RooCmdArg.
const char * getString(Int_t idx) const
Return string stored in slot idx.
void setString(Int_t idx, const char *value)
Configurable parser for RooCmdArg named arguments.
void defineMutex(const char *head, Args_t &&... tail)
Define arguments where any pair is mutually exclusive.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
bool hasProcessed(const char *cmdName) const
Return true if RooCmdArg with name 'cmdName' has been processed.
bool ok(bool verbose) const
Return true of parsing was successful.
bool defineObject(const char *name, const char *argName, int setNum, const TObject *obj=nullptr, bool isArray=false)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
const char * getString(const char *name, const char *defaultValue="", bool convEmptyToNull=false) const
Return string property registered with name 'name'.
bool defineString(const char *name, const char *argName, int stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
const RooLinkedList & getObjectList(const char *name) const
Return list of objects registered with name 'name'.
bool defineInt(const char *name, const char *argName, int intNum, int defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
int getInt(const char *name, int defaultValue=0) const
Return integer property registered with name 'name'.
const char * name() const override
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
TObject * At(int index) const
Return object stored in sequential position given by index.
void Delete(Option_t *o=nullptr) override
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
virtual void Add(TObject *arg)
TObject * FindObject(const char *name) const override
Return pointer to object with given name.
Registry for const char* names.
static const TNamed * known(const char *stringPtr)
If the name is already known, return its TNamed pointer. Otherwise return 0 (don't register the name)...
A 'mix-in' base class that define the standard RooFit plotting and printing methods.
static void nameFieldLength(Int_t newLen)
Set length of field reserved from printing name of RooAbsArgs in multi-line collection printing to gi...
Variable that can be changed from the outside.
std::string format(const RooCmdArg &formatArg) const
Format contents of RooRealVar for pretty printing on RooPlot parameter boxes.
void copyCacheFast(const RooRealVar &other, bool setValDirty=true)
A RooAbsArg implementing string values.
TClass instances represent classes, structs and namespaces in the ROOT type system.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual const char * GetTitle() const
Returns title of object.
Regular expression class.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Append(const char *cs)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
RooCmdArg LatexTableStyle(bool flag=true)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
bool snapshotImpl(RooAbsCollection const &input, RooAbsCollection &output, bool deepCopy, RooArgSet const *observables)
Helper for hash-map-assisted finding of elements by name.
RooAbsArg * find(const TNamed *nptr) const
std::unordered_map< const TNamed *, const RooAbsArg *const > nameToItemMap
const std::size_t & currentRooNameRegCounter
void erase(const RooAbsArg *elm)
std::size_t rooNameRegCounterWhereMapWasValid
void replace(const RooAbsArg *out, const RooAbsArg *in)
void insert(const RooAbsArg *elm)
HashAssistedFind(It_t first, It_t last)
Initialise empty hash map for fast finding by name.