Logo ROOT   6.10/09
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 <iomanip>
32 #include <fstream>
33 #include <vector>
34 #include <string>
35 #include <sstream>
36 #include <algorithm>
37 
38 #include "Riostream.h"
39 #include "TClass.h"
40 #include "TStopwatch.h"
41 #include "TRegexp.h"
42 #include "RooAbsCollection.h"
43 #include "RooStreamParser.h"
44 #include "RooFormula.h"
45 #include "RooAbsRealLValue.h"
46 #include "RooAbsCategoryLValue.h"
47 #include "RooStringVar.h"
48 #include "RooTrace.h"
49 #include "RooArgList.h"
50 #include "RooLinkedListIter.h"
51 #include "RooCmdConfig.h"
52 #include "RooRealVar.h"
53 #include "RooGlobalFunc.h"
54 #include "RooMsgService.h"
55 using namespace std ;
56 
57 #if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
58 char* operator+( streampos&, char* );
59 #endif
60 
62  ;
63 
64 ////////////////////////////////////////////////////////////////////////////////
65 /// Default constructor
66 
68  _list(0),
69  _ownCont(kFALSE),
70  _name(),
71  _allRRV(kTRUE)
72 {
73 }
74 
75 
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// Empty collection constructor
79 
81  _list(0),
83  _name(name),
84  _allRRV(kTRUE)
85 {
86 }
87 
88 
89 
90 ////////////////////////////////////////////////////////////////////////////////
91 /// Copy constructor. Note that a copy of a collection is always non-owning,
92 /// even the source collection is owning. To create an owning copy of
93 /// a collection (owning or not), use the snaphot() method.
94 
96  TObject(other),
97  RooPrintable(other),
98  _list(other._list.getHashTableSize()) ,
100  _name(name),
101  _allRRV(other._allRRV)
102 {
103  RooTrace::create(this) ;
104  if (!name) setName(other.GetName()) ;
105 
106  // Transfer contents (not owned)
107  RooFIter iterat= other.fwdIterator();
108  RooAbsArg *arg = 0;
109  while((arg= iterat.next())) {
110  add(*arg);
111  }
112 }
113 
114 
115 
116 ////////////////////////////////////////////////////////////////////////////////
117 /// Destructor
118 
120 {
121  // Delete all variables in our list if we own them
122  if(_ownCont){
123  safeDeleteList() ;
124  //_list.Delete();
125  }
126 }
127 
128 
129 
130 ////////////////////////////////////////////////////////////////////////////////
131 
133 {
134  return _list.iterator(dir) ;
135 }
136 
137 ////////////////////////////////////////////////////////////////////////////////
138 /// Examine client server dependencies in list and
139 /// delete contents in safe order: any client
140 /// is deleted before a server is deleted
141 
143 {
144  // Handle trivial case here
145  if (_list.GetSize() > 1) {
146  std::vector<RooAbsArg*> tmp;
147  tmp.reserve(_list.GetSize());
148  do {
149  tmp.clear();
150  {
151  RooFIter it = _list.fwdIterator();
152  RooAbsArg* arg;
153  while ((arg = it.next())) {
154  // Check if arg depends on remainder of list
155  if (!arg->dependsOn(*this, arg)) tmp.push_back(arg);
156  }
157  }
158  // sort and uniquify, in case some elements occur more than once
159  std::sort(tmp.begin(), tmp.end());
160  // okay, can remove and delete what's in tmp
161  for (std::vector<RooAbsArg*>::iterator it = tmp.begin(),
162  end = std::unique(tmp.begin(), tmp.end()); end != it; ++it) {
163  while (_list.Remove(*it)) { };
164  delete *it;
165  }
166  } while (!tmp.empty() && _list.GetSize() > 1);
167 
168  // Check if there are any remaining elements
169  if (_list.GetSize() > 1) {
170  coutW(ObjectHandling) << "RooAbsCollection::safeDeleteList(" << GetName()
171  << ") WARNING: unable to delete following elements in client-server order " ;
172  Print("1") ;
173  }
174  }
175 
176  // Built-in delete remaining elements
177  _list.Delete() ;
178 }
179 
180 
181 
182 ////////////////////////////////////////////////////////////////////////////////
183 /// Take a snap shot of current collection contents:
184 /// An owning collection is returned containing clones of
185 ///
186 /// - Elements in this collection
187 /// - External dependents of all elements
188 /// and recursively any dependents of those dependents
189 /// (if deepCopy flag is set)
190 ///
191 /// If deepCopy is specified, the client-server links between the cloned
192 /// list elements and the cloned external dependents are reconnected to
193 /// each other, making the snapshot a completely self-contained entity.
194 ///
195 ///
196 
198 {
199  // First create empty list
200  TString snapName ;
201  if (TString(GetName()).Length()>0) {
202  snapName.Append("Snapshot of ") ;
203  snapName.Append(GetName()) ;
204  }
205  RooAbsCollection* output = (RooAbsCollection*) create(snapName.Data()) ;
206  if (deepCopy || getSize()>1000) {
207  output->setHashTableSize(1000) ;
208  }
209  Bool_t error = snapshot(*output,deepCopy) ;
210  if (error) {
211  delete output ;
212  return 0 ;
213  }
214  output->setHashTableSize(0) ;
215  return output ;
216 }
217 
218 
219 
220 ////////////////////////////////////////////////////////////////////////////////
221 /// Take a snap shot of current collection contents:
222 /// An owning collection is returned containing clones of
223 ///
224 /// - Elements in this collection
225 /// - External dependents of all elements
226 /// and recursively any dependents of those dependents
227 /// (if deepCopy flag is set)
228 ///
229 /// If deepCopy is specified, the client-server links between the cloned
230 /// list elements and the cloned external dependents are reconnected to
231 /// each other, making the snapshot a completely self-contained entity.
232 ///
233 ///
234 
236 {
237  // Copy contents
238  RooFIter iterat= fwdIterator();
239  RooAbsArg *orig = 0;
240  while((0 != (orig= iterat.next()))) {
241  RooAbsArg *copy= (RooAbsArg*)orig->Clone();
242  output.add(*copy);
243  }
244 
245  RooFIter vIter = output.fwdIterator() ;
246  RooAbsArg* var ;
247 
248  // Add external dependents
249  Bool_t error(kFALSE) ;
250  if (deepCopy) {
251  // Recursively add clones of all servers
252  while ((var=vIter.next())) {
253  error |= output.addServerClonesToList(*var) ;
254  }
255  }
256 
257  // Handle eventual error conditions
258  if (error) {
259  coutE(ObjectHandling) << "RooAbsCollection::snapshot(): Errors occurred in deep clone process, snapshot not created" << endl ;
260  output._ownCont = kTRUE ;
261  return kTRUE ;
262  }
263 
264  // Redirect all server connections to internal list members
265  vIter = output.fwdIterator() ;
266  while ((var=vIter.next())) {
267  var->redirectServers(output,deepCopy) ;
268  }
269 
270 
271  // Transfer ownership of contents to list
272  output._ownCont = kTRUE ;
273  return kFALSE ;
274 }
275 
276 
277 
278 ////////////////////////////////////////////////////////////////////////////////
279 /// Add clones of servers of given argument to list
280 
282 {
283  Bool_t ret(kFALSE) ;
284 
285  RooFIter sIter = var.serverMIterator() ;
286  RooAbsArg* server ;
287  while ((server=sIter.next())) {
288  RooAbsArg* tmp = find(*server) ;
289  if (!tmp) {
290  RooAbsArg* serverClone = (RooAbsArg*)server->Clone() ;
291  serverClone->setAttribute("SnapShot_ExtRefClone") ;
292  _list.Add(serverClone) ;
293  if (_allRRV && dynamic_cast<RooRealVar*>(serverClone)==0) {
294  _allRRV=kFALSE ;
295  }
296  ret |= addServerClonesToList(*server) ;
297  } else {
298  }
299  }
300  return ret ;
301 }
302 
303 
304 
305 ////////////////////////////////////////////////////////////////////////////////
306 /// The assignment operator sets the value of any argument in our set
307 /// that also appears in the other set.
308 
310 {
311  if (&other==this) return *this ;
312 
313  RooAbsArg *elem, *theirs ;
314  RooFIter iter = _list.fwdIterator() ;
315  while((elem=iter.next())) {
316  theirs= other.find(*elem);
317  if(!theirs) continue;
318  theirs->syncCache() ;
319  elem->copyCache(theirs) ;
320  elem->setAttribute("Constant",theirs->isConstant()) ;
321  }
322  return *this;
323 }
324 
325 
326 
327 ////////////////////////////////////////////////////////////////////////////////
328 /// The assignment operator sets the value of any argument in our set
329 /// that also appears in the other set.
330 
332 {
333  if (&other==this) return *this ;
334 
335  // Short cut for 1 element assignment
336  if (getSize()==1 && getSize()==other.getSize() && oneSafe) {
337  other.first()->syncCache() ;
338  first()->copyCache(other.first(),kTRUE) ;
339  return *this ;
340  }
341 
342  RooAbsArg *elem, *theirs ;
343  RooFIter iter = _list.fwdIterator() ;
344  while((elem=iter.next())) {
345  theirs= other.find(*elem);
346  if(!theirs) continue;
347  theirs->syncCache() ;
348  elem->copyCache(theirs,kTRUE) ;
349  }
350  return *this;
351 }
352 
353 
354 
355 ////////////////////////////////////////////////////////////////////////////////
356 /// Functional equivalent of operator=() but assumes this and other collection
357 /// have same layout. Also no attributes are copied
358 
359 void RooAbsCollection::assignFast(const RooAbsCollection& other, Bool_t setValDirty)
360 {
361  if (&other==this) return ;
362 
363  RooFIter iter = _list.fwdIterator(), iter2 = other._list.fwdIterator() ;
364 
365  if (_allRRV) {
366 
367  RooRealVar *elem, *theirs ;
368  // All contents are know to be RooRealVars - fast version of assignment
369  while((elem=(RooRealVar*)iter.next())) {
370  // Identical size of iterators is documented assumption of method
371  // coverity[NULL_RETURNS]
372  theirs= (RooRealVar*)iter2.next() ;
373  elem->copyCacheFast(*theirs,setValDirty) ;
374  }
375 
376 
377  } else {
378 
379  RooAbsArg *elem, *theirs ;
380  while((elem=iter.next())) {
381 
382  // Identical size of iterators is documented assumption of method
383  // coverity[NULL_RETURNS]
384  theirs= iter2.next() ;
385 
386  theirs->syncCache() ;
387  elem->copyCache(theirs,kTRUE,setValDirty) ;
388  }
389 
390  }
391 }
392 
393 
394 
395 ////////////////////////////////////////////////////////////////////////////////
396 /// Add the specified argument to list. Returns kTRUE if successful, or
397 /// else kFALSE if a variable of the same name is already in the list.
398 /// This method can only be called on a list that is flagged as owning
399 /// all of its contents, or else on an empty list (which will force the
400 /// list into that mode).
401 
403 {
404  // check that we own our variables or else are empty
405  if(!_ownCont && (getSize() > 0) && !silent) {
406  coutE(ObjectHandling) << ClassName() << "::" << GetName() << "::addOwned: can only add to an owned list" << endl;
407  return kFALSE;
408  }
409  _ownCont= kTRUE;
410 
411  _list.Add((RooAbsArg*)&var);
412  if (_allRRV && dynamic_cast<RooRealVar*>(&var)==0) {
413  _allRRV=kFALSE ;
414  }
415 
416  return kTRUE;
417 }
418 
419 
420 
421 ////////////////////////////////////////////////////////////////////////////////
422 /// Add a clone of the specified argument to list. Returns a pointer to
423 /// the clone if successful, or else zero if a variable of the same name
424 /// is already in the list or the list does *not* own its variables (in
425 /// this case, try add() instead.) Calling addClone() on an empty list
426 /// forces it to take ownership of all its subsequent variables.
427 
429 {
430  // check that we own our variables or else are empty
431  if(!_ownCont && (getSize() > 0) && !silent) {
432  coutE(ObjectHandling) << ClassName() << "::" << GetName() << "::addClone: can only add to an owned list" << endl;
433  return 0;
434  }
435  _ownCont= kTRUE;
436 
437  // add a pointer to a clone of this variable to our list (we now own it!)
438  RooAbsArg *clone2= (RooAbsArg*)var.Clone();
439  if(0 != clone2) _list.Add((RooAbsArg*)clone2);
440  if (_allRRV && dynamic_cast<const RooRealVar*>(&var)==0) {
441  _allRRV=kFALSE ;
442  }
443 
444  return clone2;
445 }
446 
447 
448 
449 ////////////////////////////////////////////////////////////////////////////////
450 /// Add the specified argument to list. Returns kTRUE if successful, or
451 /// else kFALSE if a variable of the same name is already in the list
452 /// or the list owns its variables (in this case, try addClone() or addOwned() instead).
453 
455 {
456  // check that this isn't a copy of a list
457  if(_ownCont && !silent) {
458  coutE(ObjectHandling) << ClassName() << "::" << GetName() << "::add: cannot add to an owned list" << endl;
459  return kFALSE;
460  }
461 
462  // add a pointer to this variable to our list (we don't own it!)
463  _list.Add((RooAbsArg*)&var);
464  if (_allRRV && dynamic_cast<const RooRealVar*>(&var)==0) {
465  _allRRV=kFALSE ;
466  }
467  return kTRUE;
468 }
469 
470 
471 
472 ////////////////////////////////////////////////////////////////////////////////
473 /// Add a collection of arguments to this collection by calling add()
474 /// for each element in the source collection
475 
477 {
478  Bool_t result(false) ;
479 
480  Int_t n= list.getSize() ;
481  for(Int_t index= 0; index < n; index++) {
482  result |= add((RooAbsArg&)*list._list.At(index),silent) ;
483  }
484 
485  return result;
486 }
487 
488 
489 
490 ////////////////////////////////////////////////////////////////////////////////
491 /// Add a collection of arguments to this collection by calling addOwned()
492 /// for each element in the source collection
493 
495 {
496  Bool_t result(false) ;
497 
498  Int_t n= list.getSize() ;
499  for(Int_t index= 0; index < n; index++) {
500  result |= addOwned((RooAbsArg&)*list._list.At(index),silent) ;
501  }
502 
503  return result;
504 }
505 
506 
507 
508 ////////////////////////////////////////////////////////////////////////////////
509 /// Add a collection of arguments to this collection by calling addOwned()
510 /// for each element in the source collection
511 
513 {
514  Int_t n= list.getSize() ;
515  for(Int_t index= 0; index < n; index++) {
516  addClone((RooAbsArg&)*list._list.At(index),silent) ;
517  }
518 }
519 
520 
521 
522 ////////////////////////////////////////////////////////////////////////////////
523 /// Replace any args in our set with args of the same name from the other set
524 /// and return kTRUE for success. Fails if this list is a copy of another.
525 
527 {
528  // check that this isn't a copy of a list
529  if(_ownCont) {
530  coutE(ObjectHandling) << "RooAbsCollection: cannot replace variables in a copied list" << endl;
531  return kFALSE;
532  }
533 
534  // loop over elements in the other list
535  RooFIter otherArgs= other.fwdIterator();
536  const RooAbsArg *arg = 0;
537  while((arg= (const RooAbsArg*)otherArgs.next())) {
538 
539  // do we have an arg of the same name in our set?
540  RooAbsArg *found= find(*arg);
541  if(found) replace(*found,*arg);
542  }
543  return kTRUE;
544 }
545 
546 
547 
548 ////////////////////////////////////////////////////////////////////////////////
549 /// Replace var1 with var2 and return kTRUE for success. Fails if
550 /// this list is a copy of another, if var1 is not already in this set,
551 /// or if var2 is already in this set. var1 and var2 do not need to have
552 /// the same name.
553 
555 {
556  // check that this isn't a copy of a list
557  if(_ownCont) {
558  coutE(ObjectHandling) << "RooAbsCollection: cannot replace variables in a copied list" << endl;
559  return kFALSE;
560  }
561 
562  // is var1 already in this list?
563  const char *name= var1.GetName();
564 
565  if (!_list.FindObject(&var1)) {
566  coutE(ObjectHandling) << "RooAbsCollection: variable \"" << name << "\" is not in the list"
567  << " and cannot be replaced" << endl;
568  return kFALSE;
569  }
570 
571 
572  // is var2's name already in this list?
573  if (dynamic_cast<RooArgSet*>(this)) {
574  RooAbsArg *other = find(var2);
575  if(other != 0 && other != &var1) {
576  coutE(ObjectHandling) << "RooAbsCollection: cannot replace \"" << name
577  << "\" with already existing \"" << var2.GetName() << "\"" << endl;
578  return kFALSE;
579  }
580  }
581 
582  // replace var1 with var2
583  _list.Replace(&var1,&var2) ;
584 // _list.AddBefore((RooAbsArg*)&var1,(RooAbsArg*)&var2);
585 // _list.Remove((RooAbsArg*)&var1);
586 
587  if (_allRRV && dynamic_cast<const RooRealVar*>(&var2)==0) {
588  _allRRV=kFALSE ;
589  }
590 
591  return kTRUE;
592 }
593 
594 
595 
596 ////////////////////////////////////////////////////////////////////////////////
597 /// Remove the specified argument from our list. Return kFALSE if
598 /// the specified argument is not found in our list. An exact pointer
599 /// match is required, not just a match by name. A variable can be
600 /// removed from a copied list and will be deleted at the same time.
601 
602 Bool_t RooAbsCollection::remove(const RooAbsArg& var, Bool_t , Bool_t matchByNameOnly)
603 {
604  // is var already in this list?
605  TString name(var.GetName()) ;
606  Bool_t anyFound(kFALSE) ;
607 
608  RooAbsArg* arg;
609  while ((arg = (RooAbsArg*) _list.FindObject(&var))) {
610  anyFound = kTRUE;
611  _list.Remove(arg);
612  }
613  if (matchByNameOnly) {
614  while ((arg = (RooAbsArg*) _list.FindObject(name.Data()))) {
615  anyFound = kTRUE;
616  _list.Remove(arg);
617  if (_ownCont) delete arg;
618  }
619  }
620 
621  return anyFound ;
622 }
623 
624 
625 
626 ////////////////////////////////////////////////////////////////////////////////
627 /// Remove each argument in the input list from our list using remove(const RooAbsArg&).
628 /// Return kFALSE in case of problems.
629 
630 Bool_t RooAbsCollection::remove(const RooAbsCollection& list, Bool_t silent, Bool_t matchByNameOnly)
631 {
632  Bool_t result(false) ;
633 
634  Int_t n= list.getSize() ;
635  for(Int_t index= 0; index < n; index++) {
636  result |= remove((RooAbsArg&)*list._list.At(index),silent,matchByNameOnly) ;
637  }
638 
639  return result;
640 }
641 
642 
643 
644 ////////////////////////////////////////////////////////////////////////////////
645 /// Remove all arguments from our set, deleting them if we own them.
646 /// This effectively restores our object to the state it would have
647 /// just after calling the RooAbsCollection(const char*) constructor.
648 
650 {
651  if(_ownCont) {
652  safeDeleteList() ;
653  _ownCont= kFALSE;
654  }
655  else {
656  _list.Clear();
657  }
658 }
659 
660 
661 
662 ////////////////////////////////////////////////////////////////////////////////
663 /// Set given attribute in each element of the collection by
664 /// calling each elements setAttribute() function.
665 
667 {
668  RooFIter iter= fwdIterator() ;
669  RooAbsArg* arg ;
670  while ((arg=iter.next())) {
671  arg->setAttribute(name,value) ;
672  }
673 }
674 
675 
676 
677 
678 ////////////////////////////////////////////////////////////////////////////////
679 /// Create a subset of the current collection, consisting only of those
680 /// elements with the specified attribute set. The caller is responsibe
681 /// for deleting the returned collection
682 
684 {
685  TString selName(GetName()) ;
686  selName.Append("_selection") ;
687  RooAbsCollection *sel = (RooAbsCollection*) create(selName.Data()) ;
688 
689  // Scan set contents for matching attribute
690  RooFIter iter= fwdIterator() ;
691  RooAbsArg* arg ;
692  while ((arg=iter.next())) {
693  if (arg->getAttribute(name)==value)
694  sel->add(*arg) ;
695  }
696 
697  return sel ;
698 }
699 
700 
701 
702 
703 ////////////////////////////////////////////////////////////////////////////////
704 /// Create a subset of the current collection, consisting only of those
705 /// elements that are contained as well in the given reference collection.
706 /// The caller is responsible for deleting the returned collection
707 
709 {
710  // Create output set
711  TString selName(GetName()) ;
712  selName.Append("_selection") ;
713  RooAbsCollection *sel = (RooAbsCollection*) create(selName.Data()) ;
714 
715  // Scan set contents for matching attribute
716  RooFIter iter= fwdIterator() ;
717  RooAbsArg* arg ;
718  while ((arg=iter.next())) {
719  if (refColl.find(*arg))
720  sel->add(*arg) ;
721  }
722 
723  return sel ;
724 }
725 
726 
727 
728 ////////////////////////////////////////////////////////////////////////////////
729 /// Create a subset of the current collection, consisting only of those
730 /// elements with names matching the wildcard expressions in nameList,
731 /// supplied as a comma separated list
732 
734 {
735  // Create output set
736  TString selName(GetName()) ;
737  selName.Append("_selection") ;
738  RooAbsCollection *sel = (RooAbsCollection*) create(selName.Data()) ;
739 
740  const size_t bufSize = strlen(nameList) + 1;
741  char* buf = new char[bufSize] ;
742  strlcpy(buf,nameList,bufSize) ;
743  char* wcExpr = strtok(buf,",") ;
744  while(wcExpr) {
745  TRegexp rexp(wcExpr,kTRUE) ;
746  if (verbose) {
747  cxcoutD(ObjectHandling) << "RooAbsCollection::selectByName(" << GetName() << ") processing expression '" << wcExpr << "'" << endl ;
748  }
749 
750  RooFIter iter = fwdIterator() ;
751  RooAbsArg* arg ;
752  while((arg=iter.next())) {
753  if (TString(arg->GetName()).Index(rexp)>=0) {
754  if (verbose) {
755  cxcoutD(ObjectHandling) << "RooAbsCollection::selectByName(" << GetName() << ") selected element " << arg->GetName() << endl ;
756  }
757  sel->add(*arg) ;
758  }
759  }
760  wcExpr = strtok(0,",") ;
761  }
762  delete[] buf ;
763 
764  return sel ;
765 }
766 
767 
768 
769 
770 ////////////////////////////////////////////////////////////////////////////////
771 /// Check if this and other collection have identically named contents
772 
774 {
775  // First check equal length
776  if (getSize() != otherColl.getSize()) return kFALSE ;
777 
778  // Then check that each element of our list also occurs in the other list
779  RooFIter iter = fwdIterator() ;
780  RooAbsArg* arg ;
781  while((arg=iter.next())) {
782  if (!otherColl.find(*arg)) {
783  return kFALSE ;
784  }
785  }
786  return kTRUE ;
787 }
788 
789 
790 
791 
792 ////////////////////////////////////////////////////////////////////////////////
793 /// Check if this and other collection have common entries
794 
796 {
797  RooFIter iter = fwdIterator() ;
798  RooAbsArg* arg ;
799  while((arg=iter.next())) {
800  if (otherColl.find(*arg)) {
801  return kTRUE ;
802  }
803  }
804  return kFALSE ;
805 }
806 
807 
808 
809 
810 ////////////////////////////////////////////////////////////////////////////////
811 /// Find object with given name in list. A null pointer
812 /// is returned if no object with the given name is found
813 
815 {
816  return (RooAbsArg*) _list.find(name);
817 }
818 
819 
820 
821 ////////////////////////////////////////////////////////////////////////////////
822 /// Find object with given name in list. A null pointer
823 /// is returned if no object with the given name is found
824 
826 {
827  return (RooAbsArg*) _list.findArg(&arg);
828 }
829 
830 
831 
832 ////////////////////////////////////////////////////////////////////////////////
833 /// Return comma separated list of contained object names as STL string
834 
836 {
837  string retVal ;
838  RooFIter iter = fwdIterator() ;
839  RooAbsArg* arg ;
840  Bool_t isFirst(kTRUE) ;
841  while((arg=iter.next())) {
842  if (isFirst) {
843  isFirst=kFALSE ;
844  } else {
845  retVal += "," ;
846  }
847  retVal += arg->GetName() ;
848  }
849  return retVal ;
850 }
851 
852 
853 
854 ////////////////////////////////////////////////////////////////////////////////
855 /// Return collection name
856 
857 void RooAbsCollection::printName(ostream& os) const
858 {
859  os << GetName() ;
860 }
861 
862 
863 
864 ////////////////////////////////////////////////////////////////////////////////
865 /// Return collection title
866 
867 void RooAbsCollection::printTitle(ostream& os) const
868 {
869  os << GetTitle() ;
870 }
871 
872 
873 
874 ////////////////////////////////////////////////////////////////////////////////
875 /// Return collection class name
876 
877 void RooAbsCollection::printClassName(ostream& os) const
878 {
879  os << IsA()->GetName() ;
880 }
881 
882 
883 
884 ////////////////////////////////////////////////////////////////////////////////
885 /// Define default RooPrinable print options for given Print() flag string
886 /// For inline printing only show value of objects, for default print show
887 /// name,class name value and extras of each object. In verbose mode
888 /// also add object adress, argument and title
889 
891 {
892  if (opt && TString(opt)=="I") {
893  return kValue ;
894  }
895  if (opt && TString(opt).Contains("v")) {
897  }
898  return kName|kClassName|kValue ;
899 }
900 
901 
902 
903 
904 
905 ////////////////////////////////////////////////////////////////////////////////
906 /// Print value of collection, i.e. a comma separated list of contained
907 /// object names
908 
909 void RooAbsCollection::printValue(ostream& os) const
910 {
911  Bool_t first2(kTRUE) ;
912  os << "(" ;
913  RooFIter iter = fwdIterator() ;
914  RooAbsArg* arg ;
915  while((arg=iter.next())) {
916  if (!first2) {
917  os << "," ;
918  } else {
919  first2 = kFALSE ;
920  }
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 
1243 
1244 
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:266
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
double par[1]
Definition: unuranDistr.cxx:38
#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:744
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:135
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
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:1448
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:289
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
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
unsigned int UInt_t
Definition: RtypesCore.h:42
bool verbose
TString * format(const RooCmdArg &formatArg) const
Format contents of RooRealVar for pretty printing on RooPlot parameter boxes.
Definition: RooRealVar.cxx:780
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:92
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:336
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:408
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.
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 ...
double result[121]
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)
Bool_t redirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t isRecursionStep=kFALSE)
Iterator over _clientListValue.
Definition: RooAbsArg.cxx:929
const Bool_t kTRUE
Definition: RtypesCore.h:91
Int_t getHashTableSize() const
const Int_t n
Definition: legend1.C:16
RooLinkedListIter is the TIterator implementation for RooLinkedList.
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