Logo ROOT   6.12/07
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 
733 RooAbsCollection* RooAbsCollection::selectByName(const char* nameList, Bool_t verbose) const
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  if (arg->IsA()->InheritsFrom(RooStringVar::Class())) {
922  os << '\'' << ((RooStringVar *)arg)->getVal() << '\'';
923  } else {
924  os << arg->GetName();
925  }
926  }
927  os << ")" ;
928 }
929 
930 
931 
932 ////////////////////////////////////////////////////////////////////////////////
933 /// Implement multiline printin of collection, one line for each ontained object showing
934 /// the requested content
935 
936 void RooAbsCollection::printMultiline(ostream&os, Int_t contents, Bool_t /*verbose*/, TString indent) const
937 {
938  if (TString(GetName()).Length()>0 && (contents&kCollectionHeader)) {
939  os << indent << ClassName() << "::" << GetName() << ":" << (_ownCont?" (Owning contents)":"") << endl;
940  }
941 
942  RooFIter iterat= fwdIterator();
943  int index= 0;
944  RooAbsArg *next = 0;
945  TString deeper(indent);
946  deeper.Append(" ");
947 
948  // Adjust the with of the name field to fit the largest name, if requesed
949  Int_t maxNameLen(1) ;
950  Int_t nameFieldLengthSaved = RooPrintable::_nameLength ;
951  if (nameFieldLengthSaved==0) {
952  while((next=iterat.next())) {
953  Int_t len = strlen(next->GetName()) ;
954  if (len>maxNameLen) maxNameLen = len ;
955  }
956  iterat = fwdIterator() ;
957  RooPrintable::nameFieldLength(maxNameLen+1) ;
958  }
959 
960  while((0 != (next= iterat.next()))) {
961  os << indent << setw(3) << ++index << ") ";
962  next->printStream(os,contents,kSingleLine,"");
963  }
964 
965  // Reset name field length, if modified
966  RooPrintable::nameFieldLength(nameFieldLengthSaved) ;
967 }
968 
969 
970 
971 ////////////////////////////////////////////////////////////////////////////////
972 /// Base contents dumper for debugging purposes
973 
975 {
976  RooFIter iter = fwdIterator() ;
977  RooAbsArg* arg ;
978  while((arg=iter.next())) {
979  cout << arg << " " << arg->IsA()->GetName() << "::" << arg->GetName() << " (" << arg->GetTitle() << ")" << endl ;
980  }
981 }
982 
983 
984 
985 ////////////////////////////////////////////////////////////////////////////////
986 /// Output content of collection as LaTex table. By default a table with two columns is created: the left
987 /// column contains the name of each variable, the right column the value.
988 ///
989 /// The following optional named arguments can be used to modify the default behavior
990 ///
991 /// Columns(Int_t ncol) -- Fold table into multiple columns, i.e. ncol=3 will result in 3 x 2 = 6 total columns
992 /// Sibling(const RooAbsCollection& other) -- Define sibling list. The sibling list is assumed to have objects with the same
993 /// name in the same order. If this is not the case warnings will be printed. If a single
994 /// sibling list is specified, 3 columns will be output: the (common) name, the value of this
995 /// list and the value in the sibling list. Multiple sibling lists can be specified by
996 /// repeating the Sibling() command.
997 /// Format(const char* str) -- Classic format string, provided for backward compatibility
998 /// Format(...) -- Formatting arguments, details are given below
999 /// OutputFile(const char* fname) -- Send output to file with given name rather than standard output
1000 ///
1001 /// The Format(const char* what,...) has the following structure
1002 ///
1003 /// const char* what -- Controls what is shown. "N" adds name, "E" adds error,
1004 /// "A" shows asymmetric error, "U" shows unit, "H" hides the value
1005 /// FixedPrecision(int n) -- Controls precision, set fixed number of digits
1006 /// AutoPrecision(int n) -- Controls precision. Number of shown digits is calculated from error
1007 /// + n specified additional digits (1 is sensible default)
1008 /// VerbatimName(Bool_t flag) -- Put variable name in a \\verb+ + clause.
1009 ///
1010 /// Example use: list.printLatex(Columns(2), Format("NEU",AutoPrecision(1),VerbatimName()) ) ;
1011 
1012 void RooAbsCollection::printLatex(const RooCmdArg& arg1, const RooCmdArg& arg2,
1013  const RooCmdArg& arg3, const RooCmdArg& arg4,
1014  const RooCmdArg& arg5, const RooCmdArg& arg6,
1015  const RooCmdArg& arg7, const RooCmdArg& arg8) const
1016 {
1017 
1018 
1019  // Define configuration for this method
1020  RooCmdConfig pc("RooAbsCollection::printLatex()") ;
1021  pc.defineInt("ncol","Columns",0,1) ;
1022  pc.defineString("outputFile","OutputFile",0,"") ;
1023  pc.defineString("format","Format",0,"NEYVU") ;
1024  pc.defineInt("sigDigit","Format",0,1) ;
1025  pc.defineObject("siblings","Sibling",0,0,kTRUE) ;
1026  pc.defineInt("dummy","FormatArgs",0,0) ;
1027  pc.defineMutex("Format","FormatArgs") ;
1028 
1029  // Stuff all arguments in a list
1030  RooLinkedList cmdList;
1031  cmdList.Add(const_cast<RooCmdArg*>(&arg1)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg2)) ;
1032  cmdList.Add(const_cast<RooCmdArg*>(&arg3)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg4)) ;
1033  cmdList.Add(const_cast<RooCmdArg*>(&arg5)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg6)) ;
1034  cmdList.Add(const_cast<RooCmdArg*>(&arg7)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg8)) ;
1035 
1036  // Process & check varargs
1037  pc.process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1038  if (!pc.ok(kTRUE)) {
1039  return ;
1040  }
1041 
1042  const char* outFile = pc.getString("outputFile") ;
1043  if (outFile && strlen(outFile)) {
1044  ofstream ofs(outFile) ;
1045  if (pc.hasProcessed("FormatArgs")) {
1046  RooCmdArg* formatCmd = static_cast<RooCmdArg*>(cmdList.FindObject("FormatArgs")) ;
1047  formatCmd->addArg(RooFit::LatexTableStyle()) ;
1048  printLatex(ofs,pc.getInt("ncol"),0,0,pc.getObjectList("siblings"),formatCmd) ;
1049  } else {
1050  printLatex(ofs,pc.getInt("ncol"),pc.getString("format"),pc.getInt("sigDigit"),pc.getObjectList("siblings")) ;
1051  }
1052  } else {
1053  if (pc.hasProcessed("FormatArgs")) {
1054  RooCmdArg* formatCmd = static_cast<RooCmdArg*>(cmdList.FindObject("FormatArgs")) ;
1055  formatCmd->addArg(RooFit::LatexTableStyle()) ;
1056  printLatex(cout,pc.getInt("ncol"),0,0,pc.getObjectList("siblings"),formatCmd) ;
1057  } else {
1058  printLatex(cout,pc.getInt("ncol"),pc.getString("format"),pc.getInt("sigDigit"),pc.getObjectList("siblings")) ;
1059  }
1060  }
1061 }
1062 
1063 
1064 
1065 
1066 ////////////////////////////////////////////////////////////////////////////////
1067 /// Internal implementation function of printLatex
1068 
1069 void RooAbsCollection::printLatex(ostream& ofs, Int_t ncol, const char* option, Int_t sigDigit, const RooLinkedList& siblingList, const RooCmdArg* formatCmd) const
1070 {
1071  // Count number of rows to print
1072  Int_t nrow = (Int_t) (getSize() / ncol + 0.99) ;
1073  Int_t i,j,k ;
1074 
1075  // Sibling list do not need to print their name as it is supposed to be the same
1076  TString sibOption ;
1077  RooCmdArg sibFormatCmd ;
1078  if (option) {
1079  sibOption = option ;
1080  sibOption.ReplaceAll("N","") ;
1081  sibOption.ReplaceAll("n","") ;
1082  } else {
1083  sibFormatCmd = *formatCmd ;
1084  TString tmp = formatCmd->_s[0] ;
1085  tmp.ReplaceAll("N","") ;
1086  tmp.ReplaceAll("n","") ;
1087  static char buf[100] ;
1088  strlcpy(buf,tmp.Data(),100) ;
1089  sibFormatCmd._s[0] = buf ;
1090  }
1091 
1092 
1093  // Make list of lists ;
1094  RooLinkedList listList ;
1095  listList.Add((RooAbsArg*)this) ;
1096  RooFIter sIter = siblingList.fwdIterator() ;
1097  RooAbsCollection* col ;
1098  while((col=(RooAbsCollection*)sIter.next())) {
1099  listList.Add(col) ;
1100  }
1101 
1102  RooLinkedList listListRRV ;
1103 
1104  // Make list of RRV-only components
1105  RooFIter lIter = listList.fwdIterator() ;
1106  RooArgList* prevList = 0 ;
1107  while((col=(RooAbsCollection*)lIter.next())) {
1108  RooArgList* list = new RooArgList ;
1109  RooFIter iter = col->fwdIterator() ;
1110  RooAbsArg* arg ;
1111  while((arg=iter.next())) {
1112 
1113  RooRealVar* rrv = dynamic_cast<RooRealVar*>(arg) ;
1114  if (rrv) {
1115  list->add(*rrv) ;
1116  } else {
1117  coutW(InputArguments) << "RooAbsCollection::printLatex: can only print RooRealVar in LateX, skipping non-RooRealVar object named "
1118  << arg->GetName() << endl ;
1119  }
1120  if (prevList && TString(rrv->GetName()).CompareTo(prevList->at(list->getSize()-1)->GetName())) {
1121  coutW(InputArguments) << "RooAbsCollection::printLatex: WARNING: naming and/or ordering of sibling list is different" << endl ;
1122  }
1123  }
1124  listListRRV.Add(list) ;
1125  if (prevList && list->getSize() != prevList->getSize()) {
1126  coutW(InputArguments) << "RooAbsCollection::printLatex: ERROR: sibling list(s) must have same length as self" << endl ;
1127  delete list ;
1128  listListRRV.Delete() ;
1129  return ;
1130  }
1131  prevList = list ;
1132  }
1133 
1134  // Construct table header
1135  Int_t nlist = listListRRV.GetSize() ;
1136  TString subheader = "l" ;
1137  for (k=0 ; k<nlist ; k++) subheader += "c" ;
1138 
1139  TString header = "\\begin{tabular}{" ;
1140  for (j=0 ; j<ncol ; j++) {
1141  if (j>0) header += "|" ;
1142  header += subheader ;
1143  }
1144  header += "}" ;
1145  ofs << header << endl ;
1146 
1147 
1148  // Print contents, delegating actual printing to RooRealVar::format()
1149  for (i=0 ; i<nrow ; i++) {
1150  for (j=0 ; j<ncol ; j++) {
1151  for (k=0 ; k<nlist ; k++) {
1152  RooRealVar* par = (RooRealVar*) ((RooArgList*)listListRRV.At(k))->at(i+j*nrow) ;
1153  if (par) {
1154  if (option) {
1155  TString* tmp = par->format(sigDigit,(k==0)?option:sibOption.Data()) ;
1156  ofs << *tmp ;
1157  delete tmp ;
1158  } else {
1159  TString* tmp = par->format((k==0)?*formatCmd:sibFormatCmd) ;
1160  ofs << *tmp ;
1161  delete tmp ;
1162  }
1163  }
1164  if (!(j==ncol-1 && k==nlist-1)) {
1165  ofs << " & " ;
1166  }
1167  }
1168  }
1169  ofs << "\\\\" << endl ;
1170  }
1171 
1172  ofs << "\\end{tabular}" << endl ;
1173  listListRRV.Delete() ;
1174 }
1175 
1176 
1177 
1178 
1179 ////////////////////////////////////////////////////////////////////////////////
1180 /// Return true if all contained object report to have their
1181 /// value inside the specified range
1182 
1183 Bool_t RooAbsCollection::allInRange(const char* rangeSpec) const
1184 {
1185  if (!rangeSpec) return kTRUE ;
1186 
1187  // Parse rangeSpec specification
1188  vector<string> cutVec ;
1189  if (rangeSpec && strlen(rangeSpec)>0) {
1190  if (strchr(rangeSpec,',')==0) {
1191  cutVec.push_back(rangeSpec) ;
1192  } else {
1193  const size_t bufSize = strlen(rangeSpec)+1;
1194  char* buf = new char[bufSize] ;
1195  strlcpy(buf,rangeSpec,bufSize) ;
1196  const char* oneRange = strtok(buf,",") ;
1197  while(oneRange) {
1198  cutVec.push_back(oneRange) ;
1199  oneRange = strtok(0,",") ;
1200  }
1201  delete[] buf ;
1202  }
1203  }
1204 
1205 
1206  RooFIter iter = _list.fwdIterator() ;
1207 
1208  // Apply range based selection criteria
1209  Bool_t selectByRange = kTRUE ;
1210  RooAbsArg* arg ;
1211  while((arg=iter.next())) {
1212  Bool_t selectThisArg = kFALSE ;
1213  UInt_t icut ;
1214  for (icut=0 ; icut<cutVec.size() ; icut++) {
1215  if (arg->inRange(cutVec[icut].c_str())) {
1216  selectThisArg = kTRUE ;
1217  break ;
1218  }
1219  }
1220  if (!selectThisArg) {
1221  selectByRange = kFALSE ;
1222  break ;
1223  }
1224  }
1225 
1226  return selectByRange ;
1227 }
1228 
1229 
1230 
1231 ////////////////////////////////////////////////////////////////////////////////
1232 
1234 {
1235 }
1236 
1237 
1238 ////////////////////////////////////////////////////////////////////////////////
1239 
1241 {
1242 }
1243 
1244 ////////////////////////////////////////////////////////////////////////////////
1245 /// If one of the TObject we have a referenced to is deleted, remove the
1246 /// reference.
1247 
1249 {
1250  if (obj && obj->InheritsFrom(RooAbsArg::Class())) remove(*(RooAbsArg*)obj,false,false);
1251 }
1252 
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:243
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:740
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: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:266
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: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: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:925
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