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) {
199 snapName.
Append(
"Snapshot of ") ;
234 for (
auto orig :
_list) {
244 for (Storage_t::size_type i = 0; i <
output._list.size(); ++i) {
245 const auto var =
output._list[i];
246 error |=
output.addServerClonesToList(*var);
252 coutE(
ObjectHandling) <<
"RooAbsCollection::snapshot(): Errors occurred in deep clone process, snapshot not created" << endl ;
261 var->redirectServers(
output,deepCopy);
279 for (
const auto server : var.
servers()) {
285 _list.push_back(serverClone) ;
306 if (&other==
this)
return *this ;
308 for (
auto elem :
_list) {
309 auto theirs = other.
find(*elem);
310 if(!theirs)
continue;
312 elem->copyCache(theirs) ;
313 elem->setAttribute(
"Constant",theirs->isConstant()) ;
326 if (&other==
this)
return *this ;
335 for (
auto elem :
_list) {
336 auto theirs = other.
find(*elem);
337 if(!theirs)
continue;
339 elem->copyCache(theirs,
kTRUE) ;
352 if (&other==
this) return ;
355 auto iter2 = other.
_list.begin();
356 for (
auto iter1 =
_list.begin();
357 iter1 !=
_list.end() && iter2 != other.
_list.end();
364 auto theirs =
static_cast<RooRealVar*
>(*iter2);
367 (*iter2)->syncCache() ;
368 (*iter1)->copyCache(*iter2,
kTRUE,setValDirty) ;
392 _list.push_back(&var);
420 if (clone2)
_list.push_back(clone2);
462 for (
auto item : list.
_list) {
463 result |=
add(*item,silent);
480 for (
auto item : list.
_list) {
497 for (
auto item : list.
_list) {
512 coutE(
ObjectHandling) <<
"RooAbsCollection: cannot replace variables in a copied list" << endl;
517 for (
const auto * arg : other.
_list) {
519 auto found =
find(*arg);
520 if (found)
replace(*found,*arg);
537 coutE(
ObjectHandling) <<
"RooAbsCollection: cannot replace variables in a copied list" << endl;
543 auto var1It = std::find(
_list.begin(),
_list.end(), &var1);
545 if (var1It ==
_list.end()) {
547 <<
" and cannot be replaced" << endl;
555 if(other != 0 && other != &var1) {
557 <<
"\" with already existing \"" << var2.
GetName() <<
"\"" << endl;
583 const auto sizeBefore =
_list.size();
587 if (matchByNameOnly) {
590 return elm->GetName() ==
name;
592 std::set<RooAbsArg*> toBeDeleted;
596 if (nameMatch(elm)) {
597 toBeDeleted.insert(elm);
604 for (
auto arg : toBeDeleted)
608 return sizeBefore != _list.size();
620 auto oldSize =
_list.size();
621 for (
auto item : list.
_list) {
622 remove(*item, silent, matchByNameOnly);
625 return oldSize !=
_list.size();
654 for (
auto arg :
_list) {
655 arg->setAttribute(
name, value);
670 selName.
Append(
"_selection") ;
674 for (
auto arg :
_list) {
675 if (arg->getAttribute(
name)==value)
694 selName.
Append(
"_selection") ;
698 for (
auto arg :
_list) {
699 if (refColl.
find(*arg))
717 selName.
Append(
"_selection") ;
720 const size_t bufSize = strlen(nameList) + 1;
721 char* buf =
new char[bufSize] ;
722 strlcpy(buf,nameList,bufSize) ;
723 char* wcExpr = strtok(buf,
",") ;
732 while((arg=iter.
next())) {
740 wcExpr = strtok(0,
",") ;
760 return left->
namePtr() == right->namePtr();
763 return std::is_permutation(
_list.begin(),
_list.end(),
764 otherColl.
_list.begin(),
776 for (
auto arg :
_list) {
777 if (otherColl.
find(*arg)) {
798 if (
_list.size() < 10) {
800 return strcmp(elm->GetName(),
name) == 0;
803 item = std::find_if(
_list.begin(),
_list.end(), findByName);
807 if (!nptr)
return nullptr;
809 auto findByNamePtr = [nptr](
const RooAbsArg* elm) {
810 return nptr == elm->namePtr();
813 item = std::find_if(
_list.begin(),
_list.end(), findByNamePtr);
816 return item !=
_list.end() ? *item :
nullptr;
827 const auto nptr = arg.
namePtr();
828 auto findByNamePtr = [nptr](
const RooAbsArg * listItem) {
829 return nptr == listItem->namePtr();
832 auto item = std::find_if(
_list.begin(),
_list.end(), findByNamePtr);
834 return item !=
_list.end() ? *item :
nullptr;
845 for (
auto arg :
_list) {
846 retVal += arg->GetName();
850 retVal.erase(retVal.end()-1);
882 os << IsA()->GetName() ;
895 if (opt &&
TString(opt)==
"I") {
898 if (opt &&
TString(opt).Contains(
"v")) {
916 for (
auto arg :
_list) {
925 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 unsigned int idx = 0;
958 for (
auto next :
_list) {
959 os <<
indent << std::setw(3) << ++idx <<
") ";
974 for (
auto arg :
_list) {
975 cout << arg <<
" " << arg->IsA()->GetName() <<
"::" << arg->GetName() <<
" (" << arg->GetTitle() <<
")" << endl ;
1023 pc.defineInt(
"ncol",
"Columns",0,1) ;
1024 pc.defineString(
"outputFile",
"OutputFile",0,
"") ;
1025 pc.defineString(
"format",
"Format",0,
"NEYVU") ;
1026 pc.defineInt(
"sigDigit",
"Format",0,1) ;
1027 pc.defineObject(
"siblings",
"Sibling",0,0,
kTRUE) ;
1028 pc.defineInt(
"dummy",
"FormatArgs",0,0) ;
1029 pc.defineMutex(
"Format",
"FormatArgs") ;
1039 pc.process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1044 const char* outFile =
pc.getString(
"outputFile") ;
1045 if (outFile && strlen(outFile)) {
1046 std::ofstream ofs(outFile) ;
1047 if (
pc.hasProcessed(
"FormatArgs")) {
1050 printLatex(ofs,
pc.getInt(
"ncol"),0,0,
pc.getObjectList(
"siblings"),formatCmd) ;
1052 printLatex(ofs,
pc.getInt(
"ncol"),
pc.getString(
"format"),
pc.getInt(
"sigDigit"),
pc.getObjectList(
"siblings")) ;
1055 if (
pc.hasProcessed(
"FormatArgs")) {
1058 printLatex(cout,
pc.getInt(
"ncol"),0,0,
pc.getObjectList(
"siblings"),formatCmd) ;
1060 printLatex(cout,
pc.getInt(
"ncol"),
pc.getString(
"format"),
pc.getInt(
"sigDigit"),
pc.getObjectList(
"siblings")) ;
1081 sibOption = option ;
1085 sibFormatCmd = *formatCmd ;
1089 static char buf[100] ;
1090 strlcpy(buf,tmp.
Data(),100) ;
1091 sibFormatCmd.
_s[0] = buf ;
1113 while((arg=iter.
next())) {
1119 coutW(
InputArguments) <<
"RooAbsCollection::printLatex: can only print RooRealVar in LateX, skipping non-RooRealVar object named "
1123 coutW(
InputArguments) <<
"RooAbsCollection::printLatex: WARNING: naming and/or ordering of sibling list is different" << endl ;
1126 listListRRV.
Add(list) ;
1128 coutW(
InputArguments) <<
"RooAbsCollection::printLatex: ERROR: sibling list(s) must have same length as self" << endl ;
1139 for (k=0 ; k<nlist ; k++) subheader +=
"c" ;
1141 TString header =
"\\begin{tabular}{" ;
1142 for (j=0 ; j<ncol ; j++) {
1143 if (j>0) header +=
"|" ;
1144 header += subheader ;
1147 ofs << header << endl ;
1151 for (i=0 ; i<nrow ; i++) {
1152 for (j=0 ; j<ncol ; j++) {
1153 for (k=0 ; k<nlist ; k++) {
1161 TString* tmp = par->
format((k==0)?*formatCmd:sibFormatCmd) ;
1166 if (!(j==ncol-1 && k==nlist-1)) {
1171 ofs <<
"\\\\" << endl ;
1174 ofs <<
"\\end{tabular}" << endl ;
1187 if (!rangeSpec)
return kTRUE ;
1190 vector<string> cutVec ;
1191 if (rangeSpec && strlen(rangeSpec)>0) {
1192 if (strchr(rangeSpec,
',')==0) {
1193 cutVec.push_back(rangeSpec) ;
1195 const size_t bufSize = strlen(rangeSpec)+1;
1196 char* buf =
new char[bufSize] ;
1197 strlcpy(buf,rangeSpec,bufSize) ;
1198 const char* oneRange = strtok(buf,
",") ;
1200 cutVec.push_back(oneRange) ;
1201 oneRange = strtok(0,
",") ;
1209 for (
auto arg :
_list) {
1212 for (icut=0 ; icut<cutVec.size() ; icut++) {
1213 if (arg->inRange(cutVec[icut].c_str())) {
1214 selectThisArg =
kTRUE ;
1218 if (!selectThisArg) {
1224 return selectByRange ;
1260 return strcmp(
l->GetName(),
r->
GetName()) > 0;
1263 std::sort(
_list.begin(),
_list.end(), cmpReverse);
1267 return strcmp(
l->GetName(),
r->
GetName()) < 0;
1279 ccoutE(
DataHandling) <<
"The legacy RooFit collection iterators don't support reverse iterations, any more. "
1280 <<
"Use begin() and end()" << endl;
1281 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
List of all servers of this object.
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.
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 variable that can be changed from the outside.
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)