Logo ROOT   6.14/05
Reference Guide
RooAbsCollection.cxx
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * @(#)root/roofitcore:$Id$
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 
17 /**
18 \file RooAbsCollection.cxx
19 \class RooAbsCollection
20 \ingroup Roofitcore
21 
22 RooAbsCollection is an abstract container object that can hold
23 multiple RooAbsArg objects. Collections are ordered and can
24 contain multiple objects of the same name, (but a derived
25 implementation can enforce unique names). The storage of objects in
26 implement through class RooLinkedList, a doubly linked list with an
27 an optional hash-table lookup mechanism for fast indexing of large
28 collections.
29 **/
30 
31 #include "Riostream.h"
32 #include "TClass.h"
33 #include "TStopwatch.h"
34 #include "TRegexp.h"
35 #include "RooAbsCollection.h"
36 #include "RooStreamParser.h"
37 #include "RooFormula.h"
38 #include "RooAbsRealLValue.h"
39 #include "RooAbsCategoryLValue.h"
40 #include "RooStringVar.h"
41 #include "RooTrace.h"
42 #include "RooArgList.h"
43 #include "RooLinkedListIter.h"
44 #include "RooCmdConfig.h"
45 #include "RooRealVar.h"
46 #include "RooGlobalFunc.h"
47 #include "RooMsgService.h"
48 
49 #include <algorithm>
50 #include <iomanip>
51 
52 using namespace std;
53 
54 #if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
55 char* operator+( streampos&, char* );
56 #endif
57 
59  ;
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 /// Default constructor
63 
65  _list(0),
66  _ownCont(kFALSE),
67  _name(),
68  _allRRV(kTRUE)
69 {
70 }
71 
72 
73 
74 ////////////////////////////////////////////////////////////////////////////////
75 /// Empty collection constructor
76 
78  _list(0),
80  _name(name),
81  _allRRV(kTRUE)
82 {
83 }
84 
85 
86 
87 ////////////////////////////////////////////////////////////////////////////////
88 /// Copy constructor. Note that a copy of a collection is always non-owning,
89 /// even the source collection is owning. To create an owning copy of
90 /// a collection (owning or not), use the snaphot() method.
91 
93  TObject(other),
94  RooPrintable(other),
95  _list(other._list.getHashTableSize()) ,
97  _name(name),
98  _allRRV(other._allRRV)
99 {
100  RooTrace::create(this) ;
101  if (!name) setName(other.GetName()) ;
102 
103  // Transfer contents (not owned)
104  RooFIter iterat= other.fwdIterator();
105  RooAbsArg *arg = 0;
106  while((arg= iterat.next())) {
107  add(*arg);
108  }
109 }
110 
111 
112 
113 ////////////////////////////////////////////////////////////////////////////////
114 /// Destructor
115 
117 {
118  // Delete all variables in our list if we own them
119  if(_ownCont){
120  safeDeleteList() ;
121  //_list.Delete();
122  }
123 }
124 
125 
126 
127 ////////////////////////////////////////////////////////////////////////////////
128 
130 {
131  return _list.iterator(dir) ;
132 }
133 
134 ////////////////////////////////////////////////////////////////////////////////
135 /// Examine client server dependencies in list and
136 /// delete contents in safe order: any client
137 /// is deleted before a server is deleted
138 
140 {
141  // Handle trivial case here
142  if (_list.GetSize() > 1) {
143  std::vector<RooAbsArg*> tmp;
144  tmp.reserve(_list.GetSize());
145  do {
146  tmp.clear();
147  {
148  RooFIter it = _list.fwdIterator();
149  RooAbsArg* arg;
150  while ((arg = it.next())) {
151  // Check if arg depends on remainder of list
152  if (!arg->dependsOn(*this, arg)) tmp.push_back(arg);
153  }
154  }
155  // sort and uniquify, in case some elements occur more than once
156  std::sort(tmp.begin(), tmp.end());
157  // okay, can remove and delete what's in tmp
158  for (std::vector<RooAbsArg*>::iterator it = tmp.begin(),
159  end = std::unique(tmp.begin(), tmp.end()); end != it; ++it) {
160  while (_list.Remove(*it)) { };
161  delete *it;
162  }
163  } while (!tmp.empty() && _list.GetSize() > 1);
164 
165  // Check if there are any remaining elements
166  if (_list.GetSize() > 1) {
167  coutW(ObjectHandling) << "RooAbsCollection::safeDeleteList(" << GetName()
168  << ") WARNING: unable to delete following elements in client-server order " ;
169  Print("1") ;
170  }
171  }
172 
173  // Built-in delete remaining elements
174  _list.Delete() ;
175 }
176 
177 
178 
179 ////////////////////////////////////////////////////////////////////////////////
180 /// Take a snap shot of current collection contents:
181 /// An owning collection is returned containing clones of
182 ///
183 /// - Elements in this collection
184 /// - External dependents of all elements
185 /// and recursively any dependents of those dependents
186 /// (if deepCopy flag is set)
187 ///
188 /// If deepCopy is specified, the client-server links between the cloned
189 /// list elements and the cloned external dependents are reconnected to
190 /// each other, making the snapshot a completely self-contained entity.
191 ///
192 ///
193 
195 {
196  // First create empty list
197  TString snapName ;
198  if (TString(GetName()).Length()>0) {
199  snapName.Append("Snapshot of ") ;
200  snapName.Append(GetName()) ;
201  }
202  RooAbsCollection* output = (RooAbsCollection*) create(snapName.Data()) ;
203  if (deepCopy || getSize()>1000) {
204  output->setHashTableSize(1000) ;
205  }
206  Bool_t error = snapshot(*output,deepCopy) ;
207  if (error) {
208  delete output ;
209  return 0 ;
210  }
211  output->setHashTableSize(0) ;
212  return output ;
213 }
214 
215 
216 
217 ////////////////////////////////////////////////////////////////////////////////
218 /// Take a snap shot of current collection contents:
219 /// An owning collection is returned containing clones of
220 ///
221 /// - Elements in this collection
222 /// - External dependents of all elements
223 /// and recursively any dependents of those dependents
224 /// (if deepCopy flag is set)
225 ///
226 /// If deepCopy is specified, the client-server links between the cloned
227 /// list elements and the cloned external dependents are reconnected to
228 /// each other, making the snapshot a completely self-contained entity.
229 ///
230 ///
231 
233 {
234  // Copy contents
235  RooFIter iterat= fwdIterator();
236  RooAbsArg *orig = 0;
237  while((0 != (orig= iterat.next()))) {
238  RooAbsArg *copy= (RooAbsArg*)orig->Clone();
239  output.add(*copy);
240  }
241 
242  RooFIter vIter = output.fwdIterator() ;
243  RooAbsArg* var ;
244 
245  // Add external dependents
246  Bool_t error(kFALSE) ;
247  if (deepCopy) {
248  // Recursively add clones of all servers
249  while ((var=vIter.next())) {
250  error |= output.addServerClonesToList(*var) ;
251  }
252  }
253 
254  // Handle eventual error conditions
255  if (error) {
256  coutE(ObjectHandling) << "RooAbsCollection::snapshot(): Errors occurred in deep clone process, snapshot not created" << endl ;
257  output._ownCont = kTRUE ;
258  return kTRUE ;
259  }
260 
261  // Redirect all server connections to internal list members
262  vIter = output.fwdIterator() ;
263  while ((var=vIter.next())) {
264  var->redirectServers(output,deepCopy) ;
265  }
266 
267 
268  // Transfer ownership of contents to list
269  output._ownCont = kTRUE ;
270  return kFALSE ;
271 }
272 
273 
274 
275 ////////////////////////////////////////////////////////////////////////////////
276 /// Add clones of servers of given argument to list
277 
279 {
280  Bool_t ret(kFALSE) ;
281 
282  RooFIter sIter = var.serverMIterator() ;
283  RooAbsArg* server ;
284  while ((server=sIter.next())) {
285  RooAbsArg* tmp = find(*server) ;
286  if (!tmp) {
287  RooAbsArg* serverClone = (RooAbsArg*)server->Clone() ;
288  serverClone->setAttribute("SnapShot_ExtRefClone") ;
289  _list.Add(serverClone) ;
290  if (_allRRV && dynamic_cast<RooRealVar*>(serverClone)==0) {
291  _allRRV=kFALSE ;
292  }
293  ret |= addServerClonesToList(*server) ;
294  } else {
295  }
296  }
297  return ret ;
298 }
299 
300 
301 
302 ////////////////////////////////////////////////////////////////////////////////
303 /// The assignment operator sets the value of any argument in our set
304 /// that also appears in the other set.
305 
307 {
308  if (&other==this) return *this ;
309 
310  RooAbsArg *elem, *theirs ;
311  RooFIter iter = _list.fwdIterator() ;
312  while((elem=iter.next())) {
313  theirs= other.find(*elem);
314  if(!theirs) continue;
315  theirs->syncCache() ;
316  elem->copyCache(theirs) ;
317  elem->setAttribute("Constant",theirs->isConstant()) ;
318  }
319  return *this;
320 }
321 
322 
323 
324 ////////////////////////////////////////////////////////////////////////////////
325 /// The assignment operator sets the value of any argument in our set
326 /// that also appears in the other set.
327 
329 {
330  if (&other==this) return *this ;
331 
332  // Short cut for 1 element assignment
333  if (getSize()==1 && getSize()==other.getSize() && oneSafe) {
334  other.first()->syncCache() ;
335  first()->copyCache(other.first(),kTRUE) ;
336  return *this ;
337  }
338 
339  RooAbsArg *elem, *theirs ;
340  RooFIter iter = _list.fwdIterator() ;
341  while((elem=iter.next())) {
342  theirs= other.find(*elem);
343  if(!theirs) continue;
344  theirs->syncCache() ;
345  elem->copyCache(theirs,kTRUE) ;
346  }
347  return *this;
348 }
349 
350 
351 
352 ////////////////////////////////////////////////////////////////////////////////
353 /// Functional equivalent of operator=() but assumes this and other collection
354 /// have same layout. Also no attributes are copied
355 
356 void RooAbsCollection::assignFast(const RooAbsCollection& other, Bool_t setValDirty)
357 {
358  if (&other==this) return ;
359 
360  RooFIter iter = _list.fwdIterator(), iter2 = other._list.fwdIterator() ;
361 
362  if (_allRRV) {
363 
364  RooRealVar *elem, *theirs ;
365  // All contents are know to be RooRealVars - fast version of assignment
366  while((elem=(RooRealVar*)iter.next())) {
367  // Identical size of iterators is documented assumption of method
368  // coverity[NULL_RETURNS]
369  theirs= (RooRealVar*)iter2.next() ;
370  elem->copyCacheFast(*theirs,setValDirty) ;
371  }
372 
373 
374  } else {
375 
376  RooAbsArg *elem, *theirs ;
377  while((elem=iter.next())) {
378 
379  // Identical size of iterators is documented assumption of method
380  // coverity[NULL_RETURNS]
381  theirs= iter2.next() ;
382 
383  theirs->syncCache() ;
384  elem->copyCache(theirs,kTRUE,setValDirty) ;
385  }
386 
387  }
388 }
389 
390 
391 
392 ////////////////////////////////////////////////////////////////////////////////
393 /// Add the specified argument to list. Returns kTRUE if successful, or
394 /// else kFALSE if a variable of the same name is already in the list.
395 /// This method can only be called on a list that is flagged as owning
396 /// all of its contents, or else on an empty list (which will force the
397 /// list into that mode).
398 
400 {
401  // check that we own our variables or else are empty
402  if(!_ownCont && (getSize() > 0) && !silent) {
403  coutE(ObjectHandling) << ClassName() << "::" << GetName() << "::addOwned: can only add to an owned list" << endl;
404  return kFALSE;
405  }
406  _ownCont= kTRUE;
407 
408  _list.Add((RooAbsArg*)&var);
409  if (_allRRV && dynamic_cast<RooRealVar*>(&var)==0) {
410  _allRRV=kFALSE ;
411  }
412 
413  return kTRUE;
414 }
415 
416 
417 
418 ////////////////////////////////////////////////////////////////////////////////
419 /// Add a clone of the specified argument to list. Returns a pointer to
420 /// the clone if successful, or else zero if a variable of the same name
421 /// is already in the list or the list does *not* own its variables (in
422 /// this case, try add() instead.) Calling addClone() on an empty list
423 /// forces it to take ownership of all its subsequent variables.
424 
426 {
427  // check that we own our variables or else are empty
428  if(!_ownCont && (getSize() > 0) && !silent) {
429  coutE(ObjectHandling) << ClassName() << "::" << GetName() << "::addClone: can only add to an owned list" << endl;
430  return 0;
431  }
432  _ownCont= kTRUE;
433 
434  // add a pointer to a clone of this variable to our list (we now own it!)
435  RooAbsArg *clone2= (RooAbsArg*)var.Clone();
436  if(0 != clone2) _list.Add((RooAbsArg*)clone2);
437  if (_allRRV && dynamic_cast<const RooRealVar*>(&var)==0) {
438  _allRRV=kFALSE ;
439  }
440 
441  return clone2;
442 }
443 
444 
445 
446 ////////////////////////////////////////////////////////////////////////////////
447 /// Add the specified argument to list. Returns kTRUE if successful, or
448 /// else kFALSE if a variable of the same name is already in the list
449 /// or the list owns its variables (in this case, try addClone() or addOwned() instead).
450 
452 {
453  // check that this isn't a copy of a list
454  if(_ownCont && !silent) {
455  coutE(ObjectHandling) << ClassName() << "::" << GetName() << "::add: cannot add to an owned list" << endl;
456  return kFALSE;
457  }
458 
459  // add a pointer to this variable to our list (we don't own it!)
460  _list.Add((RooAbsArg*)&var);
461  if (_allRRV && dynamic_cast<const RooRealVar*>(&var)==0) {
462  _allRRV=kFALSE ;
463  }
464  return kTRUE;
465 }
466 
467 
468 
469 ////////////////////////////////////////////////////////////////////////////////
470 /// Add a collection of arguments to this collection by calling add()
471 /// for each element in the source collection
472 
474 {
475  Bool_t result(false) ;
476 
477  Int_t n= list.getSize() ;
478  for(Int_t index= 0; index < n; index++) {
479  result |= add((RooAbsArg&)*list._list.At(index),silent) ;
480  }
481 
482  return result;
483 }
484 
485 
486 
487 ////////////////////////////////////////////////////////////////////////////////
488 /// Add a collection of arguments to this collection by calling addOwned()
489 /// for each element in the source collection
490 
492 {
493  Bool_t result(false) ;
494 
495  Int_t n= list.getSize() ;
496  for(Int_t index= 0; index < n; index++) {
497  result |= addOwned((RooAbsArg&)*list._list.At(index),silent) ;
498  }
499 
500  return result;
501 }
502 
503 
504 
505 ////////////////////////////////////////////////////////////////////////////////
506 /// Add a collection of arguments to this collection by calling addOwned()
507 /// for each element in the source collection
508 
510 {
511  Int_t n= list.getSize() ;
512  for(Int_t index= 0; index < n; index++) {
513  addClone((RooAbsArg&)*list._list.At(index),silent) ;
514  }
515 }
516 
517 
518 
519 ////////////////////////////////////////////////////////////////////////////////
520 /// Replace any args in our set with args of the same name from the other set
521 /// and return kTRUE for success. Fails if this list is a copy of another.
522 
524 {
525  // check that this isn't a copy of a list
526  if(_ownCont) {
527  coutE(ObjectHandling) << "RooAbsCollection: cannot replace variables in a copied list" << endl;
528  return kFALSE;
529  }
530 
531  // loop over elements in the other list
532  RooFIter otherArgs= other.fwdIterator();
533  const RooAbsArg *arg = 0;
534  while((arg= (const RooAbsArg*)otherArgs.next())) {
535 
536  // do we have an arg of the same name in our set?
537  RooAbsArg *found= find(*arg);
538  if(found) replace(*found,*arg);
539  }
540  return kTRUE;
541 }
542 
543 
544 
545 ////////////////////////////////////////////////////////////////////////////////
546 /// Replace var1 with var2 and return kTRUE for success. Fails if
547 /// this list is a copy of another, if var1 is not already in this set,
548 /// or if var2 is already in this set. var1 and var2 do not need to have
549 /// the same name.
550 
552 {
553  // check that this isn't a copy of a list
554  if(_ownCont) {
555  coutE(ObjectHandling) << "RooAbsCollection: cannot replace variables in a copied list" << endl;
556  return kFALSE;
557  }
558 
559  // is var1 already in this list?
560  const char *name= var1.GetName();
561 
562  if (!_list.FindObject(&var1)) {
563  coutE(ObjectHandling) << "RooAbsCollection: variable \"" << name << "\" is not in the list"
564  << " and cannot be replaced" << endl;
565  return kFALSE;
566  }
567 
568 
569  // is var2's name already in this list?
570  if (dynamic_cast<RooArgSet*>(this)) {
571  RooAbsArg *other = find(var2);
572  if(other != 0 && other != &var1) {
573  coutE(ObjectHandling) << "RooAbsCollection: cannot replace \"" << name
574  << "\" with already existing \"" << var2.GetName() << "\"" << endl;
575  return kFALSE;
576  }
577  }
578 
579  // replace var1 with var2
580  _list.Replace(&var1,&var2) ;
581 // _list.AddBefore((RooAbsArg*)&var1,(RooAbsArg*)&var2);
582 // _list.Remove((RooAbsArg*)&var1);
583 
584  if (_allRRV && dynamic_cast<const RooRealVar*>(&var2)==0) {
585  _allRRV=kFALSE ;
586  }
587 
588  return kTRUE;
589 }
590 
591 
592 
593 ////////////////////////////////////////////////////////////////////////////////
594 /// Remove the specified argument from our list. Return kFALSE if
595 /// the specified argument is not found in our list. An exact pointer
596 /// match is required, not just a match by name. A variable can be
597 /// removed from a copied list and will be deleted at the same time.
598 
599 Bool_t RooAbsCollection::remove(const RooAbsArg& var, Bool_t , Bool_t matchByNameOnly)
600 {
601  // is var already in this list?
602  TString name(var.GetName()) ;
603  Bool_t anyFound(kFALSE) ;
604 
605  RooAbsArg* arg;
606  while ((arg = (RooAbsArg*) _list.FindObject(&var))) {
607  anyFound = kTRUE;
608  _list.Remove(arg);
609  }
610  if (matchByNameOnly) {
611  while ((arg = (RooAbsArg*) _list.FindObject(name.Data()))) {
612  anyFound = kTRUE;
613  _list.Remove(arg);
614  if (_ownCont) delete arg;
615  }
616  }
617 
618  return anyFound ;
619 }
620 
621 
622 
623 ////////////////////////////////////////////////////////////////////////////////
624 /// Remove each argument in the input list from our list using remove(const RooAbsArg&).
625 /// Return kFALSE in case of problems.
626 
627 Bool_t RooAbsCollection::remove(const RooAbsCollection& list, Bool_t silent, Bool_t matchByNameOnly)
628 {
629  Bool_t result(false) ;
630 
631  Int_t n= list.getSize() ;
632  for(Int_t index= 0; index < n; index++) {
633  result |= remove((RooAbsArg&)*list._list.At(index),silent,matchByNameOnly) ;
634  }
635 
636  return result;
637 }
638 
639 
640 
641 ////////////////////////////////////////////////////////////////////////////////
642 /// Remove all arguments from our set, deleting them if we own them.
643 /// This effectively restores our object to the state it would have
644 /// just after calling the RooAbsCollection(const char*) constructor.
645 
647 {
648  if(_ownCont) {
649  safeDeleteList() ;
650  _ownCont= kFALSE;
651  }
652  else {
653  _list.Clear();
654  }
655 }
656 
657 
658 
659 ////////////////////////////////////////////////////////////////////////////////
660 /// Set given attribute in each element of the collection by
661 /// calling each elements setAttribute() function.
662 
664 {
665  RooFIter iter= fwdIterator() ;
666  RooAbsArg* arg ;
667  while ((arg=iter.next())) {
668  arg->setAttribute(name,value) ;
669  }
670 }
671 
672 
673 
674 
675 ////////////////////////////////////////////////////////////////////////////////
676 /// Create a subset of the current collection, consisting only of those
677 /// elements with the specified attribute set. The caller is responsibe
678 /// for deleting the returned collection
679 
681 {
682  TString selName(GetName()) ;
683  selName.Append("_selection") ;
684  RooAbsCollection *sel = (RooAbsCollection*) create(selName.Data()) ;
685 
686  // Scan set contents for matching attribute
687  RooFIter iter= fwdIterator() ;
688  RooAbsArg* arg ;
689  while ((arg=iter.next())) {
690  if (arg->getAttribute(name)==value)
691  sel->add(*arg) ;
692  }
693 
694  return sel ;
695 }
696 
697 
698 
699 
700 ////////////////////////////////////////////////////////////////////////////////
701 /// Create a subset of the current collection, consisting only of those
702 /// elements that are contained as well in the given reference collection.
703 /// The caller is responsible for deleting the returned collection
704 
706 {
707  // Create output set
708  TString selName(GetName()) ;
709  selName.Append("_selection") ;
710  RooAbsCollection *sel = (RooAbsCollection*) create(selName.Data()) ;
711 
712  // Scan set contents for matching attribute
713  RooFIter iter= fwdIterator() ;
714  RooAbsArg* arg ;
715  while ((arg=iter.next())) {
716  if (refColl.find(*arg))
717  sel->add(*arg) ;
718  }
719 
720  return sel ;
721 }
722 
723 
724 
725 ////////////////////////////////////////////////////////////////////////////////
726 /// Create a subset of the current collection, consisting only of those
727 /// elements with names matching the wildcard expressions in nameList,
728 /// supplied as a comma separated list
729 
730 RooAbsCollection* RooAbsCollection::selectByName(const char* nameList, Bool_t verbose) const
731 {
732  // Create output set
733  TString selName(GetName()) ;
734  selName.Append("_selection") ;
735  RooAbsCollection *sel = (RooAbsCollection*) create(selName.Data()) ;
736 
737  const size_t bufSize = strlen(nameList) + 1;
738  char* buf = new char[bufSize] ;
739  strlcpy(buf,nameList,bufSize) ;
740  char* wcExpr = strtok(buf,",") ;
741  while(wcExpr) {
742  TRegexp rexp(wcExpr,kTRUE) ;
743  if (verbose) {
744  cxcoutD(ObjectHandling) << "RooAbsCollection::selectByName(" << GetName() << ") processing expression '" << wcExpr << "'" << endl ;
745  }
746 
747  RooFIter iter = fwdIterator() ;
748  RooAbsArg* arg ;
749  while((arg=iter.next())) {
750  if (TString(arg->GetName()).Index(rexp)>=0) {
751  if (verbose) {
752  cxcoutD(ObjectHandling) << "RooAbsCollection::selectByName(" << GetName() << ") selected element " << arg->GetName() << endl ;
753  }
754  sel->add(*arg) ;
755  }
756  }
757  wcExpr = strtok(0,",") ;
758  }
759  delete[] buf ;
760 
761  return sel ;
762 }
763 
764 
765 
766 
767 ////////////////////////////////////////////////////////////////////////////////
768 /// Check if this and other collection have identically named contents
769 
771 {
772  // First check equal length
773  if (getSize() != otherColl.getSize()) return kFALSE ;
774 
775  // Then check that each element of our list also occurs in the other list
776  RooFIter iter = fwdIterator() ;
777  RooAbsArg* arg ;
778  while((arg=iter.next())) {
779  if (!otherColl.find(*arg)) {
780  return kFALSE ;
781  }
782  }
783  return kTRUE ;
784 }
785 
786 
787 
788 
789 ////////////////////////////////////////////////////////////////////////////////
790 /// Check if this and other collection have common entries
791 
793 {
794  RooFIter iter = fwdIterator() ;
795  RooAbsArg* arg ;
796  while((arg=iter.next())) {
797  if (otherColl.find(*arg)) {
798  return kTRUE ;
799  }
800  }
801  return kFALSE ;
802 }
803 
804 
805 
806 
807 ////////////////////////////////////////////////////////////////////////////////
808 /// Find object with given name in list. A null pointer
809 /// is returned if no object with the given name is found
810 
812 {
813  return (RooAbsArg*) _list.find(name);
814 }
815 
816 
817 
818 ////////////////////////////////////////////////////////////////////////////////
819 /// Find object with given name in list. A null pointer
820 /// is returned if no object with the given name is found
821 
823 {
824  return (RooAbsArg*) _list.findArg(&arg);
825 }
826 
827 
828 
829 ////////////////////////////////////////////////////////////////////////////////
830 /// Return comma separated list of contained object names as STL string
831 
833 {
834  string retVal ;
835  RooFIter iter = fwdIterator() ;
836  RooAbsArg* arg ;
837  Bool_t isFirst(kTRUE) ;
838  while((arg=iter.next())) {
839  if (isFirst) {
840  isFirst=kFALSE ;
841  } else {
842  retVal += "," ;
843  }
844  retVal += arg->GetName() ;
845  }
846  return retVal ;
847 }
848 
849 
850 
851 ////////////////////////////////////////////////////////////////////////////////
852 /// Return collection name
853 
854 void RooAbsCollection::printName(ostream& os) const
855 {
856  os << GetName() ;
857 }
858 
859 
860 
861 ////////////////////////////////////////////////////////////////////////////////
862 /// Return collection title
863 
864 void RooAbsCollection::printTitle(ostream& os) const
865 {
866  os << GetTitle() ;
867 }
868 
869 
870 
871 ////////////////////////////////////////////////////////////////////////////////
872 /// Return collection class name
873 
874 void RooAbsCollection::printClassName(ostream& os) const
875 {
876  os << IsA()->GetName() ;
877 }
878 
879 
880 
881 ////////////////////////////////////////////////////////////////////////////////
882 /// Define default RooPrinable print options for given Print() flag string
883 /// For inline printing only show value of objects, for default print show
884 /// name,class name value and extras of each object. In verbose mode
885 /// also add object adress, argument and title
886 
888 {
889  if (opt && TString(opt)=="I") {
890  return kValue ;
891  }
892  if (opt && TString(opt).Contains("v")) {
894  }
895  return kName|kClassName|kValue ;
896 }
897 
898 
899 
900 
901 
902 ////////////////////////////////////////////////////////////////////////////////
903 /// Print value of collection, i.e. a comma separated list of contained
904 /// object names
905 
906 void RooAbsCollection::printValue(ostream& os) const
907 {
908  Bool_t first2(kTRUE) ;
909  os << "(" ;
910  RooFIter iter = fwdIterator() ;
911  RooAbsArg* arg ;
912  while((arg=iter.next())) {
913  if (!first2) {
914  os << "," ;
915  } else {
916  first2 = kFALSE ;
917  }
918  if (arg->IsA()->InheritsFrom(RooStringVar::Class())) {
919  os << '\'' << ((RooStringVar *)arg)->getVal() << '\'';
920  } else {
921  os << arg->GetName();
922  }
923  }
924  os << ")" ;
925 }
926 
927 
928 
929 ////////////////////////////////////////////////////////////////////////////////
930 /// Implement multiline printin of collection, one line for each ontained object showing
931 /// the requested content
932 
933 void RooAbsCollection::printMultiline(ostream&os, Int_t contents, Bool_t /*verbose*/, TString indent) const
934 {
935  if (TString(GetName()).Length()>0 && (contents&kCollectionHeader)) {
936  os << indent << ClassName() << "::" << GetName() << ":" << (_ownCont?" (Owning contents)":"") << endl;
937  }
938 
939  RooFIter iterat= fwdIterator();
940  int index= 0;
941  RooAbsArg *next = 0;
942  TString deeper(indent);
943  deeper.Append(" ");
944 
945  // Adjust the with of the name field to fit the largest name, if requesed
946  Int_t maxNameLen(1) ;
947  Int_t nameFieldLengthSaved = RooPrintable::_nameLength ;
948  if (nameFieldLengthSaved==0) {
949  while((next=iterat.next())) {
950  Int_t len = strlen(next->GetName()) ;
951  if (len>maxNameLen) maxNameLen = len ;
952  }
953  iterat = fwdIterator() ;
954  RooPrintable::nameFieldLength(maxNameLen+1) ;
955  }
956 
957  while((0 != (next= iterat.next()))) {
958  os << indent << setw(3) << ++index << ") ";
959  next->printStream(os,contents,kSingleLine,"");
960  }
961 
962  // Reset name field length, if modified
963  RooPrintable::nameFieldLength(nameFieldLengthSaved) ;
964 }
965 
966 
967 
968 ////////////////////////////////////////////////////////////////////////////////
969 /// Base contents dumper for debugging purposes
970 
972 {
973  RooFIter iter = fwdIterator() ;
974  RooAbsArg* arg ;
975  while((arg=iter.next())) {
976  cout << arg << " " << arg->IsA()->GetName() << "::" << arg->GetName() << " (" << arg->GetTitle() << ")" << endl ;
977  }
978 }
979 
980 
981 
982 ////////////////////////////////////////////////////////////////////////////////
983 /// Output content of collection as LaTex table. By default a table with two columns is created: the left
984 /// column contains the name of each variable, the right column the value.
985 ///
986 /// The following optional named arguments can be used to modify the default behavior
987 ///
988 /// Columns(Int_t ncol) -- Fold table into multiple columns, i.e. ncol=3 will result in 3 x 2 = 6 total columns
989 /// Sibling(const RooAbsCollection& other) -- Define sibling list. The sibling list is assumed to have objects with the same
990 /// name in the same order. If this is not the case warnings will be printed. If a single
991 /// sibling list is specified, 3 columns will be output: the (common) name, the value of this
992 /// list and the value in the sibling list. Multiple sibling lists can be specified by
993 /// repeating the Sibling() command.
994 /// Format(const char* str) -- Classic format string, provided for backward compatibility
995 /// Format(...) -- Formatting arguments, details are given below
996 /// OutputFile(const char* fname) -- Send output to file with given name rather than standard output
997 ///
998 /// The Format(const char* what,...) has the following structure
999 ///
1000 /// const char* what -- Controls what is shown. "N" adds name, "E" adds error,
1001 /// "A" shows asymmetric error, "U" shows unit, "H" hides the value
1002 /// FixedPrecision(int n) -- Controls precision, set fixed number of digits
1003 /// AutoPrecision(int n) -- Controls precision. Number of shown digits is calculated from error
1004 /// + n specified additional digits (1 is sensible default)
1005 /// VerbatimName(Bool_t flag) -- Put variable name in a \\verb+ + clause.
1006 ///
1007 /// Example use: list.printLatex(Columns(2), Format("NEU",AutoPrecision(1),VerbatimName()) ) ;
1008 
1009 void RooAbsCollection::printLatex(const RooCmdArg& arg1, const RooCmdArg& arg2,
1010  const RooCmdArg& arg3, const RooCmdArg& arg4,
1011  const RooCmdArg& arg5, const RooCmdArg& arg6,
1012  const RooCmdArg& arg7, const RooCmdArg& arg8) const
1013 {
1014 
1015 
1016  // Define configuration for this method
1017  RooCmdConfig pc("RooAbsCollection::printLatex()") ;
1018  pc.defineInt("ncol","Columns",0,1) ;
1019  pc.defineString("outputFile","OutputFile",0,"") ;
1020  pc.defineString("format","Format",0,"NEYVU") ;
1021  pc.defineInt("sigDigit","Format",0,1) ;
1022  pc.defineObject("siblings","Sibling",0,0,kTRUE) ;
1023  pc.defineInt("dummy","FormatArgs",0,0) ;
1024  pc.defineMutex("Format","FormatArgs") ;
1025 
1026  // Stuff all arguments in a list
1027  RooLinkedList cmdList;
1028  cmdList.Add(const_cast<RooCmdArg*>(&arg1)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg2)) ;
1029  cmdList.Add(const_cast<RooCmdArg*>(&arg3)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg4)) ;
1030  cmdList.Add(const_cast<RooCmdArg*>(&arg5)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg6)) ;
1031  cmdList.Add(const_cast<RooCmdArg*>(&arg7)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg8)) ;
1032 
1033  // Process & check varargs
1034  pc.process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1035  if (!pc.ok(kTRUE)) {
1036  return ;
1037  }
1038 
1039  const char* outFile = pc.getString("outputFile") ;
1040  if (outFile && strlen(outFile)) {
1041  ofstream ofs(outFile) ;
1042  if (pc.hasProcessed("FormatArgs")) {
1043  RooCmdArg* formatCmd = static_cast<RooCmdArg*>(cmdList.FindObject("FormatArgs")) ;
1044  formatCmd->addArg(RooFit::LatexTableStyle()) ;
1045  printLatex(ofs,pc.getInt("ncol"),0,0,pc.getObjectList("siblings"),formatCmd) ;
1046  } else {
1047  printLatex(ofs,pc.getInt("ncol"),pc.getString("format"),pc.getInt("sigDigit"),pc.getObjectList("siblings")) ;
1048  }
1049  } else {
1050  if (pc.hasProcessed("FormatArgs")) {
1051  RooCmdArg* formatCmd = static_cast<RooCmdArg*>(cmdList.FindObject("FormatArgs")) ;
1052  formatCmd->addArg(RooFit::LatexTableStyle()) ;
1053  printLatex(cout,pc.getInt("ncol"),0,0,pc.getObjectList("siblings"),formatCmd) ;
1054  } else {
1055  printLatex(cout,pc.getInt("ncol"),pc.getString("format"),pc.getInt("sigDigit"),pc.getObjectList("siblings")) ;
1056  }
1057  }
1058 }
1059 
1060 
1061 
1062 
1063 ////////////////////////////////////////////////////////////////////////////////
1064 /// Internal implementation function of printLatex
1065 
1066 void RooAbsCollection::printLatex(ostream& ofs, Int_t ncol, const char* option, Int_t sigDigit, const RooLinkedList& siblingList, const RooCmdArg* formatCmd) const
1067 {
1068  // Count number of rows to print
1069  Int_t nrow = (Int_t) (getSize() / ncol + 0.99) ;
1070  Int_t i,j,k ;
1071 
1072  // Sibling list do not need to print their name as it is supposed to be the same
1073  TString sibOption ;
1074  RooCmdArg sibFormatCmd ;
1075  if (option) {
1076  sibOption = option ;
1077  sibOption.ReplaceAll("N","") ;
1078  sibOption.ReplaceAll("n","") ;
1079  } else {
1080  sibFormatCmd = *formatCmd ;
1081  TString tmp = formatCmd->_s[0] ;
1082  tmp.ReplaceAll("N","") ;
1083  tmp.ReplaceAll("n","") ;
1084  static char buf[100] ;
1085  strlcpy(buf,tmp.Data(),100) ;
1086  sibFormatCmd._s[0] = buf ;
1087  }
1088 
1089 
1090  // Make list of lists ;
1091  RooLinkedList listList ;
1092  listList.Add((RooAbsArg*)this) ;
1093  RooFIter sIter = siblingList.fwdIterator() ;
1094  RooAbsCollection* col ;
1095  while((col=(RooAbsCollection*)sIter.next())) {
1096  listList.Add(col) ;
1097  }
1098 
1099  RooLinkedList listListRRV ;
1100 
1101  // Make list of RRV-only components
1102  RooFIter lIter = listList.fwdIterator() ;
1103  RooArgList* prevList = 0 ;
1104  while((col=(RooAbsCollection*)lIter.next())) {
1105  RooArgList* list = new RooArgList ;
1106  RooFIter iter = col->fwdIterator() ;
1107  RooAbsArg* arg ;
1108  while((arg=iter.next())) {
1109 
1110  RooRealVar* rrv = dynamic_cast<RooRealVar*>(arg) ;
1111  if (rrv) {
1112  list->add(*rrv) ;
1113  } else {
1114  coutW(InputArguments) << "RooAbsCollection::printLatex: can only print RooRealVar in LateX, skipping non-RooRealVar object named "
1115  << arg->GetName() << endl ;
1116  }
1117  if (prevList && TString(rrv->GetName()).CompareTo(prevList->at(list->getSize()-1)->GetName())) {
1118  coutW(InputArguments) << "RooAbsCollection::printLatex: WARNING: naming and/or ordering of sibling list is different" << endl ;
1119  }
1120  }
1121  listListRRV.Add(list) ;
1122  if (prevList && list->getSize() != prevList->getSize()) {
1123  coutW(InputArguments) << "RooAbsCollection::printLatex: ERROR: sibling list(s) must have same length as self" << endl ;
1124  delete list ;
1125  listListRRV.Delete() ;
1126  return ;
1127  }
1128  prevList = list ;
1129  }
1130 
1131  // Construct table header
1132  Int_t nlist = listListRRV.GetSize() ;
1133  TString subheader = "l" ;
1134  for (k=0 ; k<nlist ; k++) subheader += "c" ;
1135 
1136  TString header = "\\begin{tabular}{" ;
1137  for (j=0 ; j<ncol ; j++) {
1138  if (j>0) header += "|" ;
1139  header += subheader ;
1140  }
1141  header += "}" ;
1142  ofs << header << endl ;
1143 
1144 
1145  // Print contents, delegating actual printing to RooRealVar::format()
1146  for (i=0 ; i<nrow ; i++) {
1147  for (j=0 ; j<ncol ; j++) {
1148  for (k=0 ; k<nlist ; k++) {
1149  RooRealVar* par = (RooRealVar*) ((RooArgList*)listListRRV.At(k))->at(i+j*nrow) ;
1150  if (par) {
1151  if (option) {
1152  TString* tmp = par->format(sigDigit,(k==0)?option:sibOption.Data()) ;
1153  ofs << *tmp ;
1154  delete tmp ;
1155  } else {
1156  TString* tmp = par->format((k==0)?*formatCmd:sibFormatCmd) ;
1157  ofs << *tmp ;
1158  delete tmp ;
1159  }
1160  }
1161  if (!(j==ncol-1 && k==nlist-1)) {
1162  ofs << " & " ;
1163  }
1164  }
1165  }
1166  ofs << "\\\\" << endl ;
1167  }
1168 
1169  ofs << "\\end{tabular}" << endl ;
1170  listListRRV.Delete() ;
1171 }
1172 
1173 
1174 
1175 
1176 ////////////////////////////////////////////////////////////////////////////////
1177 /// Return true if all contained object report to have their
1178 /// value inside the specified range
1179 
1180 Bool_t RooAbsCollection::allInRange(const char* rangeSpec) const
1181 {
1182  if (!rangeSpec) return kTRUE ;
1183 
1184  // Parse rangeSpec specification
1185  vector<string> cutVec ;
1186  if (rangeSpec && strlen(rangeSpec)>0) {
1187  if (strchr(rangeSpec,',')==0) {
1188  cutVec.push_back(rangeSpec) ;
1189  } else {
1190  const size_t bufSize = strlen(rangeSpec)+1;
1191  char* buf = new char[bufSize] ;
1192  strlcpy(buf,rangeSpec,bufSize) ;
1193  const char* oneRange = strtok(buf,",") ;
1194  while(oneRange) {
1195  cutVec.push_back(oneRange) ;
1196  oneRange = strtok(0,",") ;
1197  }
1198  delete[] buf ;
1199  }
1200  }
1201 
1202 
1203  RooFIter iter = _list.fwdIterator() ;
1204 
1205  // Apply range based selection criteria
1206  Bool_t selectByRange = kTRUE ;
1207  RooAbsArg* arg ;
1208  while((arg=iter.next())) {
1209  Bool_t selectThisArg = kFALSE ;
1210  UInt_t icut ;
1211  for (icut=0 ; icut<cutVec.size() ; icut++) {
1212  if (arg->inRange(cutVec[icut].c_str())) {
1213  selectThisArg = kTRUE ;
1214  break ;
1215  }
1216  }
1217  if (!selectThisArg) {
1218  selectByRange = kFALSE ;
1219  break ;
1220  }
1221  }
1222 
1223  return selectByRange ;
1224 }
1225 
1226 
1227 
1228 ////////////////////////////////////////////////////////////////////////////////
1229 
1231 {
1232 }
1233 
1234 
1235 ////////////////////////////////////////////////////////////////////////////////
1236 
1238 {
1239 }
1240 
1241 ////////////////////////////////////////////////////////////////////////////////
1242 /// If one of the TObject we have a referenced to is deleted, remove the
1243 /// reference.
1244 
1246 {
1247  if (obj && obj->InheritsFrom(RooAbsArg::Class())) remove(*(RooAbsArg*)obj,false,false);
1248 }
1249 
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:240
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
#define coutE(a)
Definition: RooMsgService.h:34
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, which is interpreted as an OR of &#39;enum ContentsOptions&#39; values and in the style given by &#39;enum StyleOption&#39;.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
TObject * FindObject(const char *name) const
Return pointer to obejct with given name.
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.
RooAbsCollection()
Default constructor.
Bool_t dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, Bool_t valueOnly=kFALSE) const
Test whether we depend on (ie, are served by) any object in the specified collection.
Definition: RooAbsArg.cxx:735
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
virtual Bool_t Remove(TObject *arg)
Remove object from collection.
const char Option_t
Definition: RtypesCore.h:62
RooAbsCollection * selectCommon(const RooAbsCollection &refColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
const char * getString(const char *name, const char *defaultValue="", Bool_t convEmptyToNull=kFALSE)
Return string property registered with name &#39;name&#39;.
virtual Bool_t replace(const RooAbsArg &var1, const RooAbsArg &var2)
Replace var1 with var2 and return kTRUE for success.
#define cxcoutD(a)
Definition: RooMsgService.h:79
TObject * find(const char *name) const
Return pointer to object with given name in collection.
virtual void printValue(std::ostream &os) const
Print value of collection, i.e.
static void nameFieldLength(Int_t newLen)
Set length of field reserved from printing name of RooAbsArgs in multi-line collection printing to gi...
Regular expression class.
Definition: TRegexp.h:31
RooFIter fwdIterator() const
static Int_t _nameLength
Definition: RooPrintable.h:57
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual ~RooAbsCollection()
Destructor.
Bool_t equals(const RooAbsCollection &otherColl) const
Check if this and other collection have identically named contents.
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
Definition: RooAbsArg.h:75
STL namespace.
#define coutW(a)
Definition: RooMsgService.h:33
void Clear(Option_t *o=0)
Remove all elements from collection.
Int_t GetSize() const
Definition: RooLinkedList.h:60
Bool_t Replace(const TObject *oldArg, const TObject *newArg)
Replace object &#39;oldArg&#39; in collection with new object &#39;newArg&#39;.
void copyCacheFast(const RooRealVar &other, Bool_t setValDirty=kTRUE)
Definition: RooRealVar.h:121
virtual Bool_t inRange(const char *) const
Definition: RooAbsArg.h:289
virtual void syncCache(const RooArgSet *nset=0)=0
Bool_t process(const RooCmdArg &arg)
Process given RooCmdArg.
void safeDeleteList()
Examine client server dependencies in list and delete contents in safe order: any client is deleted b...
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
RooFIter serverMIterator() const
Definition: RooAbsArg.h:119
RooPlotable is a &#39;mix-in&#39; base class that define the standard RooFit plotting and printing methods...
Definition: RooPrintable.h:25
void Class()
Definition: Class.C:29
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
Bool_t allInRange(const char *rangeSpec) const
Return true if all contained object report to have their value inside the specified range...
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...
Bool_t defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", Bool_t appendMode=kFALSE)
Define Double_t property name &#39;name&#39; mapped to Double_t in slot &#39;stringNum&#39; in RooCmdArg with name ar...
static void create(const TObject *obj)
Register creation of object &#39;obj&#39;.
Definition: RooTrace.cxx:68
void assignFast(const RooAbsCollection &other, Bool_t setValDirty=kTRUE)
Functional equivalent of operator=() but assumes this and other collection have same layout...
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
Definition: TString.cxx:1449
Bool_t defineInt(const char *name, const char *argName, Int_t intNum, Int_t defValue=0)
Define integer property name &#39;name&#39; mapped to integer in slot &#39;intNum&#39; in RooCmdArg with name argName...
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
Bool_t overlaps(const RooAbsCollection &otherColl) const
Check if this and other collection have common entries.
virtual void printName(std::ostream &os) const
Return collection name.
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
Definition: RooAbsArg.cxx:263
virtual void Add(TObject *arg)
Definition: RooLinkedList.h:62
Int_t getSize() const
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default RooPrinable print options for given Print() flag string For inline printing only show ...
void defineMutex(const char *argName1, const char *argName2)
Define arguments named argName1 and argName2 mutually exclusive.
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...
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name &#39;name&#39;.
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
std::string contentsString() const
Return comma separated list of contained object names as STL string.
std::string _s[3]
Definition: RooCmdArg.h:111
RooAbsArg * at(Int_t idx) const
Definition: RooArgList.h:84
RooAbsArg * first() const
virtual void RecursiveRemove(TObject *obj)
If one of the TObject we have a referenced to is deleted, remove the reference.
TObject * At(Int_t index) const
Return object stored in sequential position given by index.
Bool_t ok(Bool_t verbose) const
Return true of parsing was successful.
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)=0
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
unsigned int UInt_t
Definition: RtypesCore.h:42
TString * format(const RooCmdArg &formatArg) const
Format contents of RooRealVar for pretty printing on RooPlot parameter boxes.
Definition: RooRealVar.cxx:779
RooLinkedListIter iterator(Bool_t dir=kTRUE) const
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
Definition: RooCmdConfig.h:27
RooAbsArg * next()
const Bool_t kFALSE
Definition: RtypesCore.h:88
RooCmdArg Index(RooCategory &icat)
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
virtual void printClassName(std::ostream &os) const
Return collection class name.
void Delete(Option_t *o=0)
Remove all elements in collection and delete all elements NB: Collection does not own elements...
#define ClassImp(name)
Definition: Rtypes.h:359
RooAbsArg * find(const char *name) const
Find object with given name in list.
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...
RooFIter fwdIterator() const
void addArg(const RooCmdArg &arg)
Utility function to add nested RooCmdArg to payload of this RooCmdArg.
Definition: RooCmdArg.cxx:188
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Implement multiline printin of collection, one line for each ontained object showing the requested co...
RooLinkedList _list
const RooLinkedList & getObjectList(const char *name)
Return list of objects registered with name &#39;name&#39;.
const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
Definition: TObject.h:37
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects...
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:401
Bool_t hasProcessed(const char *cmdName) const
Return true if RooCmdArg with name &#39;cmdName&#39; has been processed.
virtual void printTitle(std::ostream &os) const
Return collection title.
RooLinkedListIter iterator(Bool_t dir=kIterForward) const
void setName(const char *name)
Bool_t addServerClonesToList(const RooAbsArg &var)
Add clones of servers of given argument to list.
char Text_t
Definition: RtypesCore.h:58
RooAbsArg * findArg(const RooAbsArg *) const
Return pointer to object with given name in collection.
static constexpr double pc
Bool_t defineObject(const char *name, const char *argName, Int_t setNum, const TObject *obj=0, Bool_t isArray=kFALSE)
Define TObject property name &#39;name&#39; mapped to object in slot &#39;setNum&#39; in RooCmdArg with name argName ...
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 ...
RooAbsCollection & operator=(const RooAbsCollection &other)
The assignment operator sets the value of any argument in our set that also appears in the other set...
RooCmdArg LatexTableStyle(Bool_t flag=kTRUE)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
void setHashTableSize(Int_t i)
RooStringVar implements a string values RooAbsArg.
Definition: RooStringVar.h:23
Bool_t redirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t isRecursionStep=kFALSE)
Iterator over _clientListValue.
Definition: RooAbsArg.cxx:920
const Bool_t kTRUE
Definition: RtypesCore.h:87
Int_t getHashTableSize() const
const Int_t n
Definition: legend1.C:16
RooLinkedListIter is the TIterator implementation for RooLinkedList.
char name[80]
Definition: TGX11.cxx:109
Bool_t isConstant() const
Definition: RooAbsArg.h:266
virtual TObject * create(const char *newname) const =0
void dump() const
Base contents dumper for debugging purposes.
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:27