58#if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
104 _allRRV(other._allRRV)
111 for (
auto item : other.
_list) {
138 if (
_list.size() > 1) {
139 std::vector<RooAbsArg*> tmp;
140 tmp.reserve(
_list.size());
143 for (
auto arg :
_list) {
145 if (!arg->dependsOn(*
this, arg)) tmp.push_back(arg);
149 std::sort(tmp.begin(), tmp.end());
151 tmp.erase(std::unique(tmp.begin(), tmp.end()), tmp.end());
153 auto newEnd =
_list.end();
154 for (
auto item : tmp) {
155 newEnd = std::remove(
_list.begin(), newEnd, item);
159 }
while (!tmp.empty() &&
_list.size() > 1);
162 if (
_list.size() > 1) {
164 <<
") WARNING: unable to delete following elements in client-server order " ;
170 for (
auto item :
_list) {
198 snapName.
Append(
"Snapshot of ") ;
233 for (
auto orig :
_list) {
243 for (Storage_t::size_type i = 0; i <
output._list.size(); ++i) {
244 const auto var =
output._list[i];
245 error |=
output.addServerClonesToList(*var);
251 coutE(
ObjectHandling) <<
"RooAbsCollection::snapshot(): Errors occurred in deep clone process, snapshot not created" << endl ;
260 var->redirectServers(
output,deepCopy);
278 for (
const auto server : var.
servers()) {
284 _list.push_back(serverClone) ;
305 if (&other==
this)
return *this ;
307 for (
auto elem :
_list) {
308 auto theirs = other.
find(*elem);
309 if(!theirs)
continue;
311 elem->copyCache(theirs) ;
312 elem->setAttribute(
"Constant",theirs->isConstant()) ;
325 if (&other==
this)
return *this ;
334 for (
auto elem :
_list) {
335 auto theirs = other.
find(*elem);
336 if(!theirs)
continue;
338 elem->copyCache(theirs,
kTRUE) ;
351 if (&other==
this) return ;
354 auto iter2 = other.
_list.begin();
355 for (
auto iter1 =
_list.begin();
356 iter1 !=
_list.end() && iter2 != other.
_list.end();
363 auto theirs =
static_cast<RooRealVar*
>(*iter2);
366 (*iter2)->syncCache() ;
367 (*iter1)->copyCache(*iter2,
kTRUE,setValDirty) ;
391 _list.push_back(&var);
419 if (clone2)
_list.push_back(clone2);
461 for (
auto item : list.
_list) {
462 result |=
add(*item,silent);
479 for (
auto item : list.
_list) {
496 for (
auto item : list.
_list) {
511 coutE(
ObjectHandling) <<
"RooAbsCollection: cannot replace variables in a copied list" << endl;
516 for (
const auto * arg : other.
_list) {
518 auto found =
find(*arg);
519 if (found)
replace(*found,*arg);
536 coutE(
ObjectHandling) <<
"RooAbsCollection: cannot replace variables in a copied list" << endl;
542 auto var1It = std::find(
_list.begin(),
_list.end(), &var1);
544 if (var1It ==
_list.end()) {
546 <<
" and cannot be replaced" << endl;
554 if(other != 0 && other != &var1) {
556 <<
"\" with already existing \"" << var2.
GetName() <<
"\"" << endl;
582 const auto sizeBefore =
_list.size();
586 if (matchByNameOnly) {
589 return elm->GetName() ==
name;
591 std::set<RooAbsArg*> toBeDeleted;
595 if (nameMatch(elm)) {
596 toBeDeleted.insert(elm);
603 for (
auto arg : toBeDeleted)
607 return sizeBefore != _list.size();
619 auto oldSize =
_list.size();
620 for (
auto item : list.
_list) {
621 remove(*item, silent, matchByNameOnly);
624 return oldSize !=
_list.size();
653 for (
auto arg :
_list) {
654 arg->setAttribute(
name, value);
669 selName.
Append(
"_selection") ;
673 for (
auto arg :
_list) {
674 if (arg->getAttribute(
name)==value)
693 selName.
Append(
"_selection") ;
697 for (
auto arg :
_list) {
698 if (refColl.
find(*arg))
716 selName.
Append(
"_selection") ;
719 const size_t bufSize = strlen(nameList) + 1;
720 char* buf =
new char[bufSize] ;
721 strlcpy(buf,nameList,bufSize) ;
722 char* wcExpr = strtok(buf,
",") ;
731 while((arg=iter.
next())) {
739 wcExpr = strtok(0,
",") ;
759 return left->
namePtr() == right->namePtr();
762 return std::is_permutation(
_list.begin(),
_list.end(),
763 otherColl.
_list.begin(),
775 for (
auto arg :
_list) {
776 if (otherColl.
find(*arg)) {
797 if (
_list.size() < 10) {
799 return strcmp(elm->GetName(),
name) == 0;
802 item = std::find_if(
_list.begin(),
_list.end(), findByName);
806 if (!nptr)
return nullptr;
808 auto findByNamePtr = [nptr](
const RooAbsArg* elm) {
809 return nptr == elm->namePtr();
812 item = std::find_if(
_list.begin(),
_list.end(), findByNamePtr);
815 return item !=
_list.end() ? *item :
nullptr;
826 const auto nptr = arg.
namePtr();
827 auto findByNamePtr = [nptr](
const RooAbsArg * listItem) {
828 return nptr == listItem->namePtr();
831 auto item = std::find_if(
_list.begin(),
_list.end(), findByNamePtr);
833 return item !=
_list.end() ? *item :
nullptr;
844 for (
auto arg :
_list) {
845 retVal += arg->GetName();
849 retVal.erase(retVal.end()-1);
881 os << IsA()->GetName() ;
894 if (opt &&
TString(opt)==
"I") {
897 if (opt &&
TString(opt).Contains(
"v")) {
915 for (
auto arg :
_list) {
924 os << arg->GetName();
947 Int_t maxNameLen(1) ;
949 if (nameFieldLengthSaved==0) {
950 for (
auto next :
_list) {
951 Int_t len = strlen(next->GetName()) ;
952 if (len>maxNameLen) maxNameLen = len ;
957 for (
auto next :
_list) {
958 os <<
indent << std::setw(3) << ++index <<
") ";
973 for (
auto arg :
_list) {
974 cout << arg <<
" " << arg->IsA()->GetName() <<
"::" << arg->GetName() <<
" (" << arg->GetTitle() <<
")" << endl ;
1022 pc.defineInt(
"ncol",
"Columns",0,1) ;
1023 pc.defineString(
"outputFile",
"OutputFile",0,
"") ;
1024 pc.defineString(
"format",
"Format",0,
"NEYVU") ;
1025 pc.defineInt(
"sigDigit",
"Format",0,1) ;
1026 pc.defineObject(
"siblings",
"Sibling",0,0,
kTRUE) ;
1027 pc.defineInt(
"dummy",
"FormatArgs",0,0) ;
1028 pc.defineMutex(
"Format",
"FormatArgs") ;
1038 pc.process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1043 const char* outFile =
pc.getString(
"outputFile") ;
1044 if (outFile && strlen(outFile)) {
1045 std::ofstream ofs(outFile) ;
1046 if (
pc.hasProcessed(
"FormatArgs")) {
1049 printLatex(ofs,
pc.getInt(
"ncol"),0,0,
pc.getObjectList(
"siblings"),formatCmd) ;
1051 printLatex(ofs,
pc.getInt(
"ncol"),
pc.getString(
"format"),
pc.getInt(
"sigDigit"),
pc.getObjectList(
"siblings")) ;
1054 if (
pc.hasProcessed(
"FormatArgs")) {
1057 printLatex(cout,
pc.getInt(
"ncol"),0,0,
pc.getObjectList(
"siblings"),formatCmd) ;
1059 printLatex(cout,
pc.getInt(
"ncol"),
pc.getString(
"format"),
pc.getInt(
"sigDigit"),
pc.getObjectList(
"siblings")) ;
1080 sibOption = option ;
1084 sibFormatCmd = *formatCmd ;
1088 static char buf[100] ;
1089 strlcpy(buf,tmp.
Data(),100) ;
1090 sibFormatCmd.
_s[0] = buf ;
1112 while((arg=iter.
next())) {
1118 coutW(
InputArguments) <<
"RooAbsCollection::printLatex: can only print RooRealVar in LateX, skipping non-RooRealVar object named "
1122 coutW(
InputArguments) <<
"RooAbsCollection::printLatex: WARNING: naming and/or ordering of sibling list is different" << endl ;
1125 listListRRV.
Add(list) ;
1127 coutW(
InputArguments) <<
"RooAbsCollection::printLatex: ERROR: sibling list(s) must have same length as self" << endl ;
1138 for (k=0 ; k<nlist ; k++) subheader +=
"c" ;
1140 TString header =
"\\begin{tabular}{" ;
1141 for (j=0 ; j<ncol ; j++) {
1142 if (j>0) header +=
"|" ;
1143 header += subheader ;
1146 ofs << header << endl ;
1150 for (i=0 ; i<nrow ; i++) {
1151 for (j=0 ; j<ncol ; j++) {
1152 for (k=0 ; k<nlist ; k++) {
1160 TString* tmp = par->
format((k==0)?*formatCmd:sibFormatCmd) ;
1165 if (!(j==ncol-1 && k==nlist-1)) {
1170 ofs <<
"\\\\" << endl ;
1173 ofs <<
"\\end{tabular}" << endl ;
1186 if (!rangeSpec)
return kTRUE ;
1189 vector<string> cutVec ;
1190 if (rangeSpec && strlen(rangeSpec)>0) {
1191 if (strchr(rangeSpec,
',')==0) {
1192 cutVec.push_back(rangeSpec) ;
1194 const size_t bufSize = strlen(rangeSpec)+1;
1195 char* buf =
new char[bufSize] ;
1196 strlcpy(buf,rangeSpec,bufSize) ;
1197 const char* oneRange = strtok(buf,
",") ;
1199 cutVec.push_back(oneRange) ;
1200 oneRange = strtok(0,
",") ;
1208 for (
auto arg :
_list) {
1211 for (icut=0 ; icut<cutVec.size() ; icut++) {
1212 if (arg->inRange(cutVec[icut].c_str())) {
1213 selectThisArg =
kTRUE ;
1217 if (!selectThisArg) {
1223 return selectByRange ;
1259 return strcmp(
l->GetName(),
r->
GetName()) > 0;
1262 std::sort(
_list.begin(),
_list.end(), cmpReverse);
1266 return strcmp(
l->GetName(),
r->
GetName()) < 0;
1278 ccoutE(
DataHandling) <<
"The legacy RooFit collection iterators don't support reverse iterations, any more. "
1279 <<
"Use begin() and end()" << endl;
1280 return std::make_unique<LegacyIterator_t>(
_list);
static void indent(ostringstream &buf, int indent_level)
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
const TNamed * namePtr() const
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)=0
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
const RefCountList_t & servers() const
virtual void syncCache(const RooArgSet *nset=0)=0
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooFIter fwdIterator() const R__SUGGEST_ALTERNATIVE("begin()
One-time forward iterator.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
RooAbsCollection * selectCommon(const RooAbsCollection &refColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
virtual TObject * create(const char *newname) const =0
RooAbsCollection()
Default constructor.
RooAbsCollection & assignValueOnly(const RooAbsCollection &other, Bool_t oneSafe=kFALSE)
The assignment operator sets the value of any argument in our set that also appears in the other set.
virtual Bool_t replace(const RooAbsArg &var1, const RooAbsArg &var2)
Replace var1 with var2 and return kTRUE for success.
void printLatex(const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg()) const
Output content of collection as LaTex table.
void sort(Bool_t reverse=false)
Sort collection using std::sort and name comparison.
Bool_t addServerClonesToList(const RooAbsArg &var)
Add clones of servers of given argument to end of list.
virtual void printName(std::ostream &os) const
Return collection name.
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual ~RooAbsCollection()
Destructor.
RooAbsArg * first() const
void assignFast(const RooAbsCollection &other, Bool_t setValDirty=kTRUE)
Functional equivalent of operator=() but assumes this and other collection have same layout.
RooAbsCollection * selectByName(const char *nameList, Bool_t verbose=kFALSE) const
Create a subset of the current collection, consisting only of those elements with names matching the ...
Bool_t overlaps(const RooAbsCollection &otherColl) const
Check if this and other collection have common entries.
Bool_t allInRange(const char *rangeSpec) const
Return true if all contained object report to have their value inside the specified range.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Implement multiline printing of collection, one line for each contained object showing the requested ...
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
std::unique_ptr< LegacyIterator_t > makeLegacyIterator(bool forward=true) const
Factory for legacy iterators.
void setAttribAll(const Text_t *name, Bool_t value=kTRUE)
Set given attribute in each element of the collection by calling each elements setAttribute() functio...
void dump() const
Base contents dumper for debugging purposes.
virtual void printTitle(std::ostream &os) const
Return collection title.
Bool_t equals(const RooAbsCollection &otherColl) const
Check if this and other collection have identically-named contents.
RooAbsCollection * selectByAttrib(const char *name, Bool_t value) const
Create a subset of the current collection, consisting only of those elements with the specified attri...
const char * GetName() const
Returns name of object.
virtual void printClassName(std::ostream &os) const
Return collection class name.
std::string contentsString() const
Return comma separated list of contained object names as STL string.
void setName(const char *name)
RooAbsCollection & operator=(const RooAbsCollection &other)
The assignment operator sets the value of any argument in our set that also appears in the other set.
void safeDeleteList()
Examine client server dependencies in list and delete contents in safe order: any client is deleted b...
virtual void RecursiveRemove(TObject *obj)
If one of the TObject we have a referenced to is deleted, remove the reference.
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
void makeTypedStructureTag()
RooAbsArg * find(const char *name) const
Find object with given name in list.
Storage_t::const_iterator const_iterator
virtual void printValue(std::ostream &os) const
Print value of collection, i.e.
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default RooPrinable print options for given Print() flag string For inline printing only show ...
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.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
void addArg(const RooCmdArg &arg)
Utility function to add nested RooCmdArg to payload of this RooCmdArg.
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
TObject * FindObject(const char *name) const
Return pointer to obejct with given name.
RooFIter fwdIterator() const
Create a one-time-use forward iterator for this list.
TObject * At(Int_t index) const
Return object stored in sequential position given by index.
void Delete(Option_t *o=0)
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
virtual void Add(TObject *arg)
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)...
RooPlotable is 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...
RooRealVar represents a fundamental (non-derived) real valued object.
TString * format(const RooCmdArg &formatArg) const
Format contents of RooRealVar for pretty printing on RooPlot parameter boxes.
void copyCacheFast(const RooRealVar &other, Bool_t setValDirty=kTRUE)
RooStringVar implements a string values RooAbsArg.
static void create(const TObject *obj)
Register creation of object 'obj'.
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetName() const
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_t flag=kTRUE)
static constexpr double pc
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
static void output(int code)