Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooAbsCollection.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAbsCollection.h,v 1.26 2007/08/09 19:55:47 wouter Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_ABS_COLLECTION
17#define ROO_ABS_COLLECTION
18
19#include <RooAbsArg.h>
20#include <RooCmdArg.h>
21#include <RooFit/UniqueId.h>
22#include <RooLinkedListIter.h>
23#include <RooPrintable.h>
24
25// The range casts are not used in this file, but if you want to work with
26// RooFit collections you also want to have static_range_cast and
27// dynamic_range_cast available without including RangeCast.h every time.
28#include <ROOT/RRangeCast.hxx>
29
30#include <ROOT/RSpan.hxx>
31
32#include <TClass.h>
33#include <TObject.h>
34#include <TString.h>
35
36#include <string>
37#include <unordered_map>
38#include <vector>
39#include <type_traits>
40#include <memory>
41
42
43// To make ROOT::RangeStaticCast available under the name static_range_cast.
44template <typename T, typename Range_t>
46{
47 return ROOT::RangeStaticCast<T>(std::forward<Range_t>(coll));
48}
49
50
51// To make ROOT::RangeDynCast available under the dynamic_range_cast.
52template <typename T, typename Range_t>
54{
55 return ROOT::RangeDynCast<T>(std::forward<Range_t>(coll));
56}
57
58
59namespace RooFit {
60namespace Detail {
61struct HashAssistedFind;
62}
63}
64
65class RooAbsCollection : public TObject, public RooPrintable {
66public:
67 using Storage_t = std::vector<RooAbsArg*>;
68 using const_iterator = Storage_t::const_iterator;
69
70
71 // Constructors, assignment etc.
73 RooAbsCollection(const char *name);
74 virtual TObject* clone(const char* newname) const = 0 ;
75 virtual TObject* create(const char* newname) const = 0 ;
76 TObject* Clone(const char* newname=nullptr) const override {
77 return clone(newname?newname:GetName()) ;
78 }
79 ~RooAbsCollection() override;
80
81 // Create a copy of an existing list. New variables cannot be added
82 // to a copied list. The variables in the copied list are independent
83 // of the original variables.
84 RooAbsCollection(const RooAbsCollection& other, const char *name="");
86
87 void assign(const RooAbsCollection& other) const;
88 RooAbsCollection &assignValueOnly(const RooAbsCollection& other, bool forceIfSizeOne=false);
89 void assignFast(const RooAbsCollection& other, bool setValDirty=true) const;
90
91 // Move constructor
93
94 /// Returns a unique ID that is different for every instantiated
95 /// RooAbsCollection. This ID can be used to check whether two collections
96 /// are the same object, which is safer than memory address comparisons that
97 /// might result in false positives when memory is recycled.
99
100 // Copy list and contents (and optionally 'deep' servers)
101 RooAbsCollection *snapshot(bool deepCopy=true) const ;
102 bool snapshot(RooAbsCollection& output, bool deepCopy=true) const ;
103
104 /// Set the size at which the collection will automatically start using an extra
105 /// lookup table instead of performing a linear search.
106 void setHashTableSize(Int_t number) {
108 }
109 /// Query the size at which the collection will automatically start using an extra
110 /// lookup table instead of performing a linear search.
113 }
114
115 /// Const access to the underlying stl container.
116 Storage_t const& get() const { return _list; }
117
118 // List content management
119 virtual bool add(const RooAbsArg& var, bool silent=false) ;
120// The following function is not memory safe, because it takes ownership of var
121// without moving it. It is not publicly available in the memory safe
122// interfaces mode.
123#ifdef ROOFIT_MEMORY_SAFE_INTERFACES
124protected:
125#endif
126 virtual bool addOwned(RooAbsArg& var, bool silent=false);
127#ifdef ROOFIT_MEMORY_SAFE_INTERFACES
128public:
129#endif
130 bool addOwned(std::unique_ptr<RooAbsArg> var, bool silent=false);
131 virtual RooAbsArg *addClone(const RooAbsArg& var, bool silent=false) ;
132 virtual bool replace(const RooAbsArg& var1, const RooAbsArg& var2) ;
133 virtual bool remove(const RooAbsArg& var, bool silent=false, bool matchByNameOnly=false) ;
134 virtual void removeAll() ;
135
136 template<typename Iterator_t,
137 typename value_type = typename std::remove_pointer<typename std::iterator_traits<Iterator_t>::value_type>,
138 typename = std::enable_if<std::is_convertible<const value_type*, const RooAbsArg*>::value> >
139 bool add(Iterator_t beginIt, Iterator_t endIt, bool silent=false) {
140 bool result = false ;
141 _list.reserve(_list.size() + std::distance(beginIt, endIt));
142 for (auto it = beginIt; it != endIt; ++it) {
143 result |= add(**it,silent);
144 }
145 return result;
146 }
147 ////////////////////////////////////////////////////////////////////////////////
148 /// Add a collection of arguments to this collection by calling add()
149 /// for each element in the source collection
150 bool add(const RooAbsCollection& list, bool silent=false) {
151 return add(list._list.begin(), list._list.end(), silent);
152 }
153 /**
154 * \brief Adds elements of a given RooAbsCollection to the container if they match the specified type.
155 *
156 * This function iterates through the elements of the provided RooAbsCollection and checks if each element
157 * matches the specified type. If any element doesn't match the type, it throws an exception.
158 *
159 * \tparam Arg_t The type to match for elements in the collection. Must inherit from RooAbsArg.
160 * \param list The RooAbsCollection containing elements to be added.
161 * \param silent Forwarded to the non-typed add function. If true,
162 * suppresses error messages when adding elements, e.g. when
163 * the collection is a RooArgSet and the element is already in
164 * the set.
165 * \return Returns true if all elements could be added, else false.
166 *
167 * \throws std::invalid_argument if an element in the collection doesn't match the specified type.
168 */
169 template <class Arg_t>
170 bool addTyped(const RooAbsCollection &list, bool silent = false)
171 {
172 for (RooAbsArg *arg : list) {
173 if (!dynamic_cast<Arg_t *>(arg)) {
174 throwAddTypedException(Arg_t::Class(), arg);
175 }
176 }
177 return add(list, silent);
178 }
179 virtual bool addOwned(const RooAbsCollection& list, bool silent=false);
180 bool addOwned(RooAbsCollection&& list, bool silent=false);
181 virtual void addClone(const RooAbsCollection& list, bool silent=false);
182 bool replace(const RooAbsCollection &other);
183 bool remove(const RooAbsCollection& list, bool silent=false, bool matchByNameOnly=false) ;
184 template<class forwardIt>
185 void remove(forwardIt rangeBegin, forwardIt rangeEnd, bool silent = false, bool matchByNameOnly = false) {
186 for (forwardIt it = rangeBegin; it != rangeEnd; ++it) {
187 static_assert(std::is_same<
188 typename std::iterator_traits<forwardIt>::value_type,
189 RooAbsArg*>::value, "Can only remove lists of RooAbsArg*.");
190 auto castedElm = static_cast<RooAbsArg*>(*it);
191 remove(*castedElm, silent, matchByNameOnly);
192 }
193 }
194
195 // Utilities functions when used as configuration object
196 double getRealValue(const char* name, double defVal=0.0, bool verbose=false) const ;
197 const char* getCatLabel(const char* name, const char* defVal="", bool verbose=false) const ;
198 Int_t getCatIndex(const char* name, Int_t defVal=0, bool verbose=false) const ;
199 const char* getStringValue(const char* name, const char* defVal="", bool verbose=false) const ;
200 bool setRealValue(const char* name, double newVal=0.0, bool verbose=false) ;
201 bool setCatLabel(const char* name, const char* newVal="", bool verbose=false) ;
202 bool setCatIndex(const char* name, Int_t newVal=0, bool verbose=false) ;
203 bool setStringValue(const char* name, const char* newVal="", bool verbose=false) ;
204
205 // Group operations on AbsArgs
206 void setAttribAll(const Text_t* name, bool value=true) ;
207
208 // List search methods
209 RooAbsArg *find(const char *name) const ;
210 RooAbsArg *find(const RooAbsArg&) const ;
211
212 /// Find object by name in the collection
213 TObject* FindObject(const char* name) const override { return find(name); }
214
215 /// Find object in the collection, Note: matching by object name, like the find() method
216 TObject* FindObject(const TObject* obj) const override { auto arg = dynamic_cast<const RooAbsArg*>(obj); return (arg) ? find(*arg) : nullptr; }
217
218 /// Check if collection contains an argument with the same name as var.
219 /// To check for a specific instance, use containsInstance().
220 bool contains(const RooAbsArg& var) const {
221 return find(var) != nullptr;
222 }
223 /// Check if this exact instance is in this collection.
224 virtual bool containsInstance(const RooAbsArg& var) const {
225 return std::find(_list.begin(), _list.end(), &var) != _list.end();
226 }
227 RooAbsCollection* selectByAttrib(const char* name, bool value) const ;
228 bool selectCommon(const RooAbsCollection& refColl, RooAbsCollection& outColl) const ;
229 RooAbsCollection* selectCommon(const RooAbsCollection& refColl) const ;
230 RooAbsCollection* selectByName(const char* nameList, bool verbose=false) const ;
231 bool equals(const RooAbsCollection& otherColl) const ;
232 bool hasSameLayout(const RooAbsCollection& other) const;
233
234 template<typename Iterator_t,
235 typename value_type = typename std::remove_pointer<typename std::iterator_traits<Iterator_t>::value_type>,
236 typename = std::enable_if<std::is_convertible<const value_type*, const RooAbsArg*>::value> >
237 bool overlaps(Iterator_t otherCollBegin, Iterator_t otherCollEnd) const {
238 for (auto it = otherCollBegin; it != otherCollEnd; ++it) {
239 if (find(**it)) {
240 return true ;
241 }
242 }
243 return false ;
244 }
245
246 ////////////////////////////////////////////////////////////////////////////////
247 /// Check if this and other collection have common entries
248 bool overlaps(const RooAbsCollection& otherColl) const {
249 return overlaps(otherColl._list.begin(), otherColl._list.end());
250 }
251
252 /// TIterator-style iteration over contained elements.
253 /// \note These iterators are slow. Use begin() and end() or
254 /// range-based for loop instead.
255 inline TIterator* createIterator(bool dir = kIterForward) const
256 R__DEPRECATED(6,34, "begin(), end() and range-based for loops.") {
257 // Create and return an iterator over the elements in this collection
258 return new RooLinkedListIter(makeLegacyIterator(dir));
259 }
260
261 /// TIterator-style iteration over contained elements.
262 /// \note This iterator is slow. Use begin() and end() or range-based for loop instead.
264 R__DEPRECATED(6,34, "begin(), end() and range-based for loops.") {
265 return RooLinkedListIter(makeLegacyIterator(dir));
266 }
267
268 /// One-time forward iterator.
269 /// \note Use begin() and end() or range-based for loop instead.
271 R__DEPRECATED(6,34, "begin(), end() and range-based for loops.") {
272 return RooFIter(makeLegacyIterator());
273 }
274
276 return _list.begin();
277 }
278
280 return _list.end();
281 }
282
283 Storage_t::const_reverse_iterator rbegin() const {
284 return _list.rbegin();
285 }
286
287 Storage_t::const_reverse_iterator rend() const {
288 return _list.rend();
289 }
290
291 Storage_t::size_type size() const {
292 return _list.size();
293 }
294
295 bool empty() const {
296 return _list.empty();
297 }
298
299 void reserve(Storage_t::size_type count) {
300 _list.reserve(count);
301 }
302
303 /// Clear contents. If the collection is owning, it will also delete the contents.
304 void clear() {
305 removeAll();
306 }
307
308 /// Return the number of elements in the collection
309 inline Int_t getSize() const R__SUGGEST_ALTERNATIVE("size() returns true size.") {
310 return _list.size();
311 }
312
313 inline RooAbsArg *first() const {
314 // Return the first element in this collection
315 // calling front on an empty container is undefined
316 return _list.empty() ? nullptr : _list.front();
317 }
318
319 RooAbsArg * operator[](Storage_t::size_type i) const {
320 return _list[i];
321 }
322
323
324 /// Returns index of given arg, or -1 if arg is not in the collection.
325 inline Int_t index(const RooAbsArg* arg) const {
326 auto item = std::find(_list.begin(), _list.end(), arg);
327 return item != _list.end() ? item - _list.begin() : -1;
328 }
329
330 /// Returns index of given arg, or -1 if arg is not in the collection.
331 inline Int_t index(const RooAbsArg& arg) const {
332 return index(&arg);
333 }
334
335 Int_t index(const char* name) const;
336
337 inline void Print(Option_t *options= nullptr) const override {
338 // Printing interface (human readable)
340 }
341 std::string contentsString() const ;
342
343
344 void printName(std::ostream& os) const override ;
345 void printTitle(std::ostream& os) const override ;
346 void printClassName(std::ostream& os) const override ;
347 void printValue(std::ostream& os) const override ;
348 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override ;
349
350 Int_t defaultPrintContents(Option_t* opt) const override ;
351
352 // Latex printing methods
353 void printLatex(const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
354 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
355 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
356 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) const ;
357 void printLatex(std::ostream& ofs, Int_t ncol, const char* option="NEYU", Int_t sigDigit=1,
358 const RooLinkedList& siblingLists=RooLinkedList(), const RooCmdArg* formatCmd=nullptr) const ;
359
360 void setName(const char *name) {
361 // Set name of collection
362 _name= name;
363 }
364 const char* GetName() const override {
365 // Return namer of collection
366 return _name.Data() ;
367 }
368 bool isOwning() const {
369 // Does collection own contents?
370 return _ownCont ;
371 }
372
373 bool allInRange(const char* rangeSpec) const ;
374
375 void dump() const ;
376
377 void releaseOwnership() { _ownCont = false ; }
378 void takeOwnership() { _ownCont = true ; }
379
380 void sort(bool reverse = false);
381 void sortTopologically();
382
383 void RecursiveRemove(TObject *obj) override;
384
385 void useHashMapForFind(bool flag) const;
386
387 // For use in the RooArgList/Set(std::vector<RooAbsArgPtrOrDouble> const&) constructor.
388 // Can be replaced with std::variant when C++17 is the minimum supported standard.
390 RooAbsArgPtrOrDouble(RooAbsArg & arg) : ptr{&arg}, hasPtr{true} {}
391 RooAbsArgPtrOrDouble(double x) : val{x}, hasPtr{false} {}
392
393 RooAbsArg * ptr = nullptr;
394 double val = 0.0;
395 bool hasPtr = false;
396 };
397
398protected:
399 Storage_t _list; ///< Actual object storage
401
402 bool _ownCont = false; ///< Flag to identify a list that owns its contents.
403 TString _name; ///< Our name.
404 bool _allRRV = true; ///< All contents are RRV
405
406 void deleteList() ;
407
408 inline TNamed* structureTag() { if (_structureTag==nullptr) makeStructureTag() ; return _structureTag ; }
410
411 mutable TNamed* _structureTag{nullptr}; ///<! Structure tag
412 mutable TNamed* _typedStructureTag{nullptr}; ///<! Typed structure tag
413
414 inline void clearStructureTags() { _structureTag = nullptr ; _typedStructureTag = nullptr ; }
415
418
419 /// Determine whether it's possible to add a given RooAbsArg to the collection or not.
420 virtual bool canBeAdded(const RooAbsArg& arg, bool silent) const = 0;
421
422 template<class T>
423 static void assert_is_no_temporary(T &&) {
424 static_assert(!std::is_rvalue_reference<T&&>::value,
425 "A reference to a temporary RooAbsArg will be passed to a RooAbsCollection constructor! "
426 "This is not allowed, because the collection will not own the arguments. "
427 "Hence, the collection will contain dangling pointers when the temporary goes out of scope."
428 );
429 }
430
431private:
432
433#if ROOT_VERSION_CODE < ROOT_VERSION(6, 34, 00)
434 // TODO: Remove this friend declaration and function in 6.34, where it's not
435 // needed anymore because the deprecated legacy iterators will be removed.
436 friend class RooWorkspace;
437 std::unique_ptr<LegacyIterator_t> makeLegacyIterator (bool forward = true) const;
438#else
439#error "Please remove this unneeded code."
440#endif
441
443 mutable std::unique_ptr<HashAssistedFind> _hashAssistedFind; ///<!
444 std::size_t _sizeThresholdForMapSearch = 100; ///<!
445
446 void insert(RooAbsArg*);
447
448 static void throwAddTypedException(TClass *klass, RooAbsArg *arg);
449
451
452 ClassDefOverride(RooAbsCollection,3) // Collection of RooAbsArg objects
453};
454
455#endif
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
Definition RConfig.hxx:529
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition RConfig.hxx:521
ROOT::RRangeCast< T, true, Range_t > dynamic_range_cast(Range_t &&coll)
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
char Text_t
Definition RtypesCore.h:62
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
static void indent(ostringstream &buf, int indent_level)
const Bool_t kIterForward
Definition TCollection.h:42
Option_t Option_t option
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 char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
Wraps any collection that can be used in range-based loops and applies static_cast<T> or dynamic_cast...
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
Abstract container object that can hold multiple RooAbsArg objects.
void remove(forwardIt rangeBegin, forwardIt rangeEnd, bool silent=false, bool matchByNameOnly=false)
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.
RooFit::UniqueId< RooAbsCollection > const & uniqueId() const
Returns a unique ID that is different for every instantiated RooAbsCollection.
std::unique_ptr< HashAssistedFind > _hashAssistedFind
!
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
TNamed * _typedStructureTag
! Typed structure tag
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
Storage_t const & get() const
Const access to the underlying stl container.
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.
TNamed * typedStructureTag()
bool contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
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.
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.
Int_t getSize() const
Return the number of elements in the collection.
Storage_t::const_reverse_iterator rend() const
~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.
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...
bool overlaps(const RooAbsCollection &otherColl) const
Check if this and other collection have common entries.
Storage_t::const_reverse_iterator rbegin() const
TObject * FindObject(const TObject *obj) const override
Find object in the collection, Note: matching by object name, like the find() method.
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.
RooFIter fwdIterator() const R__DEPRECATED(6
One-time forward iterator.
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
bool overlaps(Iterator_t otherCollBegin, Iterator_t otherCollEnd) const
bool _allRRV
All contents are RRV.
const_iterator end() const
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...
TString _name
Our name.
Storage_t::size_type size() const
RooAbsArg * operator[](Storage_t::size_type i) const
TIterator begin()
RooAbsArg * first() const
static void assert_is_no_temporary(T &&)
virtual bool replace(const RooAbsArg &var1, const RooAbsArg &var2)
Replace var1 with var2 and return true for success.
bool add(const RooAbsCollection &list, bool silent=false)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
void reserve(Storage_t::size_type count)
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.
bool addTyped(const RooAbsCollection &list, bool silent=false)
Adds elements of a given RooAbsCollection to the container if they match the specified type.
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.
TIterator * createIterator(bool dir=kIterForward) const R__DEPRECATED(6
TIterator-style iteration over contained elements.
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.
Int_t index(const RooAbsArg &arg) const
Returns index of given arg, or -1 if arg is not in the collection.
const_iterator begin() const
void printName(std::ostream &os) const override
Return collection name.
void sort(bool reverse=false)
Sort collection using std::sort and name comparison.
bool add(Iterator_t beginIt, Iterator_t endIt, bool silent=false)
std::size_t _sizeThresholdForMapSearch
!
void dump() const
Base contents dumper for debugging purposes.
const RooFit::UniqueId< RooAbsCollection > _uniqueId
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...
TObject * FindObject(const char *name) const override
Find object by name in the collection.
TNamed * _structureTag
! Structure tag
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.
virtual bool containsInstance(const RooAbsArg &var) const
Check if this exact instance is in this collection.
void useHashMapForFind(bool flag) const
bool isOwning() const
void setHashTableSize(Int_t number)
Set the size at which the collection will automatically start using an extra lookup table instead of ...
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.
Int_t getHashTableSize() const
Query the size at which the collection will automatically start using an extra lookup table instead o...
virtual TObject * clone(const char *newname) const =0
void insert(RooAbsArg *)
Insert an element into the owned collections.
TIterator end() and range-based for loops.")
RooAbsArg * find(const char *name) const
Find object with given name in list.
Storage_t::const_iterator const_iterator
RooLinkedListIter iterator(bool dir=kIterForward) const R__DEPRECATED(6
TIterator-style iteration over contained elements.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
Named container for two doubles, two integers two object points and three string pointers that can be...
Definition RooCmdArg.h:26
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
A wrapper around TIterator derivatives.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
A 'mix-in' base class that define the standard RooFit plotting and printing methods.
virtual StyleOption defaultPrintStyle(Option_t *opt) const
static std::ostream & defaultPrintStream(std::ostream *os=nullptr)
Return a reference to the current default stream to use in Print().
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
Persistable container for RooFit projects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
TIterator and GenericRooFIter front end with STL back end.
Iterator abstract base class.
Definition TIterator.h:30
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
Double_t x[n]
Definition legend1.C:17
for(Int_t i=0;i< n;i++)
Definition legend1.C:18
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26
Helper for hash-map-assisted finding of elements by name.
A UniqueId can be added as a class member to enhance any class with a unique identifier for each inst...
Definition UniqueId.h:39
static void output()