Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooAbsArg.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooAbsArg.h,v 1.93 2007/07/16 21:04:28 wouter Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 #ifndef ROO_ABS_ARG
17 #define ROO_ABS_ARG
18 
19 #include <assert.h>
20 #include "TNamed.h"
21 #include "THashList.h"
22 #include "TRefArray.h"
23 #include "RooPrintable.h"
24 #include "RooSTLRefCountList.h"
25 #include "RooAbsCache.h"
26 #include "RooLinkedListIter.h"
27 #include "RooNameReg.h"
28 #include <map>
29 #include <set>
30 #include <deque>
31 #include <stack>
32 
33 #include <iostream>
34 
35 
36 #include "TClass.h"
37 
38 class TTree ;
39 class RooArgSet ;
40 class RooAbsCollection ;
41 class RooTreeData ;
42 class RooTreeDataStore ;
43 class RooVectorDataStore ;
44 class RooAbsData ;
45 class RooAbsDataStore ;
46 class RooAbsProxy ;
47 class RooArgProxy ;
48 class RooSetProxy ;
49 class RooListProxy ;
50 class RooExpensiveObjectCache ;
51 class RooWorkspace ;
52 
53 class RooRefArray : public TObjArray {
54  public:
55  RooRefArray() : TObjArray() {
56  } ;
57  RooRefArray(const RooRefArray& other) : TObjArray(other) {
58  }
59  RooRefArray& operator=(const RooRefArray& other) = default;
60  virtual ~RooRefArray() {} ;
61  protected:
62  ClassDef(RooRefArray,1) // Helper class for proxy lists
63 } ;
64 
65 class RooAbsArg;
66 /// Print at the prompt
67 namespace cling {
68 std::string printValue(RooAbsArg*);
69 }
70 
71 class RooAbsArg : public TNamed, public RooPrintable {
72 public:
73  using RefCountList_t = RooSTLRefCountList<RooAbsArg>;
74  using RefCountListLegacyIterator_t = TIteratorToSTLInterface<RefCountList_t::Container_t>;
75 
76  // Constructors, cloning and assignment
77  RooAbsArg() ;
78  virtual ~RooAbsArg();
79  RooAbsArg(const char *name, const char *title);
80  RooAbsArg(const RooAbsArg& other, const char* name=0) ;
81  RooAbsArg& operator=(const RooAbsArg& other);
82  virtual TObject* clone(const char* newname=0) const = 0 ;
83  virtual TObject* Clone(const char* newname = 0) const {
84  return clone(newname && newname[0] != '\0' ? newname : nullptr);
85  }
86  virtual RooAbsArg* cloneTree(const char* newname=0) const ;
87 
88  // Accessors to client-server relation information
89 
90  /// Does value or shape of this arg depend on any other arg?
91  virtual Bool_t isDerived() const {
92  return kTRUE ;
93  //std::cout << IsA()->GetName() << "::isDerived(" << GetName() << ") = " << (_serverList.GetSize()>0 || _proxyList.GetSize()>0) << std::endl ;
94  //return (_serverList.GetSize()>0 || _proxyList.GetSize()>0)?kTRUE:kFALSE;
95  }
96  Bool_t isCloneOf(const RooAbsArg& other) const ;
97  Bool_t dependsOnValue(const RooAbsCollection& serverList, const RooAbsArg* ignoreArg=0) const {
98  // Does this arg depend on the value of any of of the values in serverList?
99  return dependsOn(serverList,ignoreArg,kTRUE) ;
100  }
101  Bool_t dependsOnValue(const RooAbsArg& server, const RooAbsArg* ignoreArg=0) const {
102  // Does this arg depend on the value of server?
103  return dependsOn(server,ignoreArg,kTRUE) ;
104  }
105  Bool_t dependsOn(const RooAbsCollection& serverList, const RooAbsArg* ignoreArg=0, Bool_t valueOnly=kFALSE) const ;
106  Bool_t dependsOn(const RooAbsArg& server, const RooAbsArg* ignoreArg=0, Bool_t valueOnly=kFALSE) const ;
107  Bool_t overlaps(const RooAbsArg& testArg, Bool_t valueOnly=kFALSE) const ;
108  Bool_t hasClients() const { return !_clientList.empty(); }
109 
110  ////////////////////////////////////////////////////////////////////////////
111  // Legacy iterators
112  inline TIterator* clientIterator() const
113  R__SUGGEST_ALTERNATIVE("Use clients() and begin(), end() or range-based loops.") {
114  // Return iterator over all client RooAbsArgs
115  return makeLegacyIterator(_clientList);
116  }
117  inline TIterator* valueClientIterator() const
118  R__SUGGEST_ALTERNATIVE("Use valueClients() and begin(), end() or range-based loops.") {
119  // Return iterator over all shape client RooAbsArgs
120  return makeLegacyIterator(_clientListValue);
121  }
122  inline TIterator* shapeClientIterator() const
123  R__SUGGEST_ALTERNATIVE("Use shapeClients() and begin(), end() or range-based loops.") {
124  // Return iterator over all shape client RooAbsArgs
125  return makeLegacyIterator(_clientListShape);
126  }
127  inline TIterator* serverIterator() const
128  R__SUGGEST_ALTERNATIVE("Use servers() and begin(), end() or range-based loops.") {
129  // Return iterator over all server RooAbsArgs
130  return makeLegacyIterator(_serverList);
131  }
132 
133  inline RooFIter valueClientMIterator() const
134  R__SUGGEST_ALTERNATIVE("Use valueClients() and begin(), end() or range-based loops.") {
135  return RooFIter(std::unique_ptr<RefCountListLegacyIterator_t>(makeLegacyIterator(_clientListValue)));
136  }
137  inline RooFIter shapeClientMIterator() const
138  R__SUGGEST_ALTERNATIVE("Use shapeClients() and begin(), end() or range-based loops.") {
139  return RooFIter(std::unique_ptr<RefCountListLegacyIterator_t>(makeLegacyIterator(_clientListShape)));
140  }
141  inline RooFIter serverMIterator() const
142  R__SUGGEST_ALTERNATIVE("Use shapeClients() and begin(), end() or range-based loops.") {
143  return RooFIter(std::unique_ptr<RefCountListLegacyIterator_t>(makeLegacyIterator(_serverList)));
144  }
145 
146  ////////////////////////////////////////////////////////////////////////////
147 
148  /// List of all clients of this object.
149  const RefCountList_t& clients() const {
150  return _clientList;
151  }
152  /// List of all value clients of this object. Value clients receive value updates.
153  const RefCountList_t& valueClients() const {
154  return _clientListValue;
155  }
156  /// List of all shape clients of this object. Shape clients receive property information such as
157  /// changes of a value range.
158  const RefCountList_t& shapeClients() const {
159  return _clientListShape;
160  }
161 
162  /// List of all servers of this object.
163  const RefCountList_t& servers() const {
164  return _serverList;
165  }
166  /// Return server of `this` with name `name`. Returns nullptr if not found.
167  inline RooAbsArg* findServer(const char *name) const {
168  const auto serverIt = _serverList.findByName(name);
169  return serverIt != _serverList.end() ? *serverIt : nullptr;
170  }
171  /// Return server of `this` that has the same name as `arg`. Returns `nullptr` if not found.
172  inline RooAbsArg* findServer(const RooAbsArg& arg) const {
173  const auto serverIt = _serverList.findByNamePointer(&arg);
174  return serverIt != _serverList.end() ? *serverIt : nullptr;
175  }
176  /// Return i-th server from server list.
177  inline RooAbsArg* findServer(Int_t index) const {
178  return _serverList.containedObjects()[index];
179  }
180  /// Check if `this` is serving values to `arg`.
181  inline Bool_t isValueServer(const RooAbsArg& arg) const {
182  return _clientListValue.containsByNamePtr(&arg);
183  }
184  /// Check if `this` is serving values to an object with name `name`.
185  inline Bool_t isValueServer(const char* name) const {
186  return _clientListValue.containsSameName(name);
187  }
188  /// Check if `this` is serving shape to `arg`.
189  inline Bool_t isShapeServer(const RooAbsArg& arg) const {
190  return _clientListShape.containsByNamePtr(&arg);
191  }
192  /// Check if `this` is serving shape to an object with name `name`.
193  inline Bool_t isShapeServer(const char* name) const {
194  return _clientListShape.containsSameName(name);
195  }
196  void leafNodeServerList(RooAbsCollection* list, const RooAbsArg* arg=0, Bool_t recurseNonDerived=kFALSE) const ;
197  void branchNodeServerList(RooAbsCollection* list, const RooAbsArg* arg=0, Bool_t recurseNonDerived=kFALSE) const ;
198  void treeNodeServerList(RooAbsCollection* list, const RooAbsArg* arg=0,
199  Bool_t doBranch=kTRUE, Bool_t doLeaf=kTRUE,
200  Bool_t valueOnly=kFALSE, Bool_t recurseNonDerived=kFALSE) const ;
201 
202 
203  /// Is this object a fundamental type that can be added to a dataset?
204  /// Fundamental-type subclasses override this method to return kTRUE.
205  /// Note that this test is subtlely different from the dynamic isDerived()
206  /// test, e.g. a constant is not derived but is also not fundamental.
207  inline virtual Bool_t isFundamental() const {
208  return kFALSE;
209  }
210 
211  /// Create a fundamental-type object that stores our type of value. The
212  /// created object will have a valid value, but not necessarily the same
213  /// as our value. The caller is responsible for deleting the returned object.
214  virtual RooAbsArg *createFundamental(const char* newname=0) const = 0;
215 
216  /// Is this argument an l-value, i.e., can it appear on the left-hand side
217  /// of an assignment expression? LValues are also special since they can
218  /// potentially be analytically integrated and generated.
219  inline virtual Bool_t isLValue() const {
220  return kFALSE;
221  }
222 
223 
224  // Parameter & observable interpretation of servers
225  friend class RooProdPdf ;
226  friend class RooAddPdf ;
227  friend class RooAddPdfOrig ;
228  RooArgSet* getVariables(Bool_t stripDisconnected=kTRUE) const ;
229  RooArgSet* getParameters(const RooAbsData* data, Bool_t stripDisconnected=kTRUE) const ;
230  /// Return the parameters of this p.d.f when used in conjuction with dataset 'data'
231  RooArgSet* getParameters(const RooAbsData& data, Bool_t stripDisconnected=kTRUE) const {
232  return getParameters(&data,stripDisconnected) ;
233  }
234  /// Return the parameters of the p.d.f given the provided set of observables
235  RooArgSet* getParameters(const RooArgSet& observables, Bool_t stripDisconnected=kTRUE) const {
236  return getParameters(&observables,stripDisconnected);
237  }
238  virtual RooArgSet* getParameters(const RooArgSet* depList, Bool_t stripDisconnected=kTRUE) const ;
239  /// Return the observables of this pdf given a set of observables
240  RooArgSet* getObservables(const RooArgSet& set, Bool_t valueOnly=kTRUE) const {
241  return getObservables(&set,valueOnly) ;
242  }
243  RooArgSet* getObservables(const RooAbsData* data) const ;
244  /// Return the observables of this pdf given the observables defined by `data`.
245  RooArgSet* getObservables(const RooAbsData& data) const {
246  return getObservables(&data) ;
247  }
248  RooArgSet* getObservables(const RooArgSet* depList, Bool_t valueOnly=kTRUE) const ;
249  Bool_t observableOverlaps(const RooAbsData* dset, const RooAbsArg& testArg) const ;
250  Bool_t observableOverlaps(const RooArgSet* depList, const RooAbsArg& testArg) const ;
251  virtual Bool_t checkObservables(const RooArgSet* nset) const ;
252  Bool_t recursiveCheckObservables(const RooArgSet* nset) const ;
253  RooArgSet* getComponents() const ;
254 
255  // --- Obsolete functions for backward compatibility
256  /// \deprecated Use getObservables()
257  inline RooArgSet* getDependents(const RooArgSet& set) const { return getObservables(set) ; }
258  /// \deprecated Use getObservables()
259  inline RooArgSet* getDependents(const RooAbsData* set) const { return getObservables(set) ; }
260  /// \deprecated Use getObservables()
261  inline RooArgSet* getDependents(const RooArgSet* depList) const { return getObservables(depList) ; }
262  /// \deprecated Use observableOverlaps()
263  inline Bool_t dependentOverlaps(const RooAbsData* dset, const RooAbsArg& testArg) const { return observableOverlaps(dset,testArg) ; }
264  /// \deprecated Use observableOverlaps()
265  inline Bool_t dependentOverlaps(const RooArgSet* depList, const RooAbsArg& testArg) const { return observableOverlaps(depList, testArg) ; }
266  /// \deprecated Use checkObservables()
267  inline Bool_t checkDependents(const RooArgSet* nset) const { return checkObservables(nset) ; }
268  /// \deprecated Use recursiveCheckObservables()
269  inline Bool_t recursiveCheckDependents(const RooArgSet* nset) const { return recursiveCheckObservables(nset) ; }
270  // --- End obsolete functions for backward compatibility
271 
272  void attachDataSet(const RooAbsData &set);
273  void attachDataStore(const RooAbsDataStore &set);
274 
275  // I/O streaming interface (machine readable)
276  virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) = 0 ;
277  virtual void writeToStream(std::ostream& os, Bool_t compact) const = 0 ;
278 
279  /// Print the object to the defaultPrintStream().
280  /// \param[in] options **V** print verbose. **T** print a tree structure with all children.
281  virtual void Print(Option_t *options= 0) const {
282  // Printing interface (human readable)
283  printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
284  }
285 
286  virtual void printName(std::ostream& os) const ;
287  virtual void printTitle(std::ostream& os) const ;
288  virtual void printClassName(std::ostream& os) const ;
289  virtual void printAddress(std::ostream& os) const ;
290  virtual void printArgs(std::ostream& os) const ;
291  virtual void printMetaArgs(std::ostream& /*os*/) const {} ;
292  virtual void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const;
293  virtual void printTree(std::ostream& os, TString indent="") const ;
294 
295  virtual Int_t defaultPrintContents(Option_t* opt) const ;
296 
297  // Accessors to attributes
298  void setAttribute(const Text_t* name, Bool_t value=kTRUE) ;
299  Bool_t getAttribute(const Text_t* name) const ;
300  inline const std::set<std::string>& attributes() const {
301  // Returns set of names of boolean attributes defined
302  return _boolAttrib ;
303  }
304 
305  void setStringAttribute(const Text_t* key, const Text_t* value) ;
306  const Text_t* getStringAttribute(const Text_t* key) const ;
307  inline const std::map<std::string,std::string>& stringAttributes() const {
308  // Returns std::map<string,string> with all string attributes defined
309  return _stringAttrib ;
310  }
311 
312  // Accessors to transient attributes
313  void setTransientAttribute(const Text_t* name, Bool_t value=kTRUE) ;
314  Bool_t getTransientAttribute(const Text_t* name) const ;
315  inline const std::set<std::string>& transientAttributes() const {
316  // Return set of transient boolean attributes
317  return _boolAttribTransient ;
318  }
319 
320  inline Bool_t isConstant() const {
321  // Returns true if 'Constant' attribute is set
322  return _isConstant ; //getAttribute("Constant") ;
323  }
324  RooLinkedList getCloningAncestors() const ;
325 
326  // Sorting
327  Int_t Compare(const TObject* other) const ;
328  virtual Bool_t IsSortable() const {
329  // Object is sortable in ROOT container class
330  return kTRUE ;
331  }
332 
333  //Debug hooks
334  static void verboseDirty(Bool_t flag) ;
335  void printDirty(Bool_t depth=kTRUE) const ;
336 
337  static void setDirtyInhibit(Bool_t flag) ;
338 
339  virtual Bool_t operator==(const RooAbsArg& other) = 0 ;
340  virtual Bool_t isIdentical(const RooAbsArg& other, Bool_t assumeSameType=kFALSE) = 0 ;
341 
342  // Range management
343  virtual Bool_t inRange(const char*) const {
344  // Is value in range (dummy interface always returns true)
345  return kTRUE ;
346  }
347  virtual Bool_t hasRange(const char*) const {
348  // Has this argument a defined range (dummy interface always returns flase)
349  return kFALSE ;
350  }
351 
352 
353  enum ConstOpCode { Activate=0, DeActivate=1, ConfigChange=2, ValueChange=3 } ;
354 
355 
356  friend class RooMinuit ;
357 
358  // Cache mode optimization (tracks changes & do lazy evaluation vs evaluate always)
359  virtual void optimizeCacheMode(const RooArgSet& observables) ;
360  virtual void optimizeCacheMode(const RooArgSet& observables, RooArgSet& optNodes, RooLinkedList& processedNodes) ;
361 
362 
363  // Find constant terms in expression
364  Bool_t findConstantNodes(const RooArgSet& observables, RooArgSet& cacheList) ;
365  Bool_t findConstantNodes(const RooArgSet& observables, RooArgSet& cacheList, RooLinkedList& processedNodes) ;
366 
367 
368  // constant term optimization
369  virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE) ;
370  enum CacheMode { Always=0, NotAdvised=1, Never=2 } ;
371  virtual CacheMode canNodeBeCached() const { return Always ; }
372  virtual void setCacheAndTrackHints(RooArgSet& /*trackNodes*/ ) {} ;
373 
374  void graphVizTree(const char* fileName, const char* delimiter="\n", bool useTitle=false, bool useLatex=false) ;
375  void graphVizTree(std::ostream& os, const char* delimiter="\n", bool useTitle=false, bool useLatex=false) ;
376 
377 /* TGraphStruct* graph(Bool_t useFactoryTag=kFALSE, Double_t textSize=0.03) ; */
378 
379  void printComponentTree(const char* indent="",const char* namePat=0, Int_t nLevel=999) ;
380  void printCompactTree(const char* indent="",const char* fileName=0, const char* namePat=0, RooAbsArg* client=0) ;
381  void printCompactTree(std::ostream& os, const char* indent="", const char* namePat=0, RooAbsArg* client=0) ;
382  virtual void printCompactTreeHook(std::ostream& os, const char *ind="") ;
383 
384  // Dirty state accessor
385  inline Bool_t isShapeDirty() const {
386  // Return true is shape has been invalidated by server value change
387  return isDerived()?_shapeDirty:kFALSE ;
388  }
389 
390  inline Bool_t isValueDirty() const {
391  // Returns true of value has been invalidated by server value change
392  if (inhibitDirty()) return kTRUE ;
393  switch(_operMode) {
394  case AClean:
395  return kFALSE ;
396  case ADirty:
397  return kTRUE ;
398  case Auto:
399  if (_valueDirty) return isDerived() ;
400  return kFALSE ;
401  }
402  return kTRUE ; // we should never get here
403  }
404 
405  inline Bool_t isValueDirtyAndClear() const {
406  // Returns true of value has been invalidated by server value change
407  if (inhibitDirty()) return kTRUE ;
408  switch(_operMode) {
409  case AClean:
410  return kFALSE ;
411  case ADirty:
412  return kTRUE ;
413  case Auto:
414  if (_valueDirty) {
415  _valueDirty = kFALSE ;
416  return isDerived();
417  }
418  return kFALSE ;
419  }
420  return kTRUE ; // But we should never get here
421  }
422 
423 
424  inline Bool_t isValueOrShapeDirtyAndClear() const {
425  // Returns true of value has been invalidated by server value change
426 
427  if (inhibitDirty()) return kTRUE ;
428  switch(_operMode) {
429  case AClean:
430  return kFALSE ;
431  case ADirty:
432  return kTRUE ;
433  case Auto:
434  if (_valueDirty || _shapeDirty) {
435  _shapeDirty = kFALSE ;
436  _valueDirty = kFALSE ;
437  return isDerived();
438  }
439  _shapeDirty = kFALSE ;
440  _valueDirty = kFALSE ;
441  return kFALSE ;
442  }
443  return kTRUE ; // But we should never get here
444  }
445 
446  // Cache management
447  void registerCache(RooAbsCache& cache) ;
448  void unRegisterCache(RooAbsCache& cache) ;
449  Int_t numCaches() const ;
450  RooAbsCache* getCache(Int_t index) const ;
451 
452  enum OperMode { Auto=0, AClean=1, ADirty=2 } ;
453  inline OperMode operMode() const { return _operMode ; }
454  void setOperMode(OperMode mode, Bool_t recurseADirty=kTRUE) ;
455 
456  Bool_t addOwnedComponents(const RooArgSet& comps) ;
457  const RooArgSet* ownedComponents() const { return _ownedComponents ; }
458 
459  void setProhibitServerRedirect(Bool_t flag) { _prohibitServerRedirect = flag ; }
460 
461  void setWorkspace(RooWorkspace &ws) { _myws = &ws; }
462 
463 
464  // Dirty state modifiers
465  /// Mark the element dirty. This forces a re-evaluation when a value is requested.
466  void setValueDirty() {
467  if (_operMode == Auto && !inhibitDirty())
468  setValueDirty(nullptr);
469  }
470  /// Notify that a shape-like property (*e.g.* binning) has changed.
471  void setShapeDirty() { setShapeDirty(nullptr); }
472 
473  const char* aggregateCacheUniqueSuffix() const ;
474  virtual const char* cacheUniqueSuffix() const { return 0 ; }
475 
476  void wireAllCaches() ;
477 
478  inline const TNamed* namePtr() const {
479  return _namePtr ;
480  }
481 
482  void SetName(const char* name) ;
483  void SetNameTitle(const char *name, const char *title) ;
484 
485 
486  // Server redirection interface
487  Bool_t redirectServers(const RooAbsCollection& newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t isRecursionStep=kFALSE) ;
488  Bool_t recursiveRedirectServers(const RooAbsCollection& newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE) ;
489  virtual Bool_t redirectServersHook(const RooAbsCollection& /*newServerList*/, Bool_t /*mustReplaceAll*/, Bool_t /*nameChange*/, Bool_t /*isRecursive*/) { return kFALSE ; } ;
490  virtual void serverNameChangeHook(const RooAbsArg* /*oldServer*/, const RooAbsArg* /*newServer*/) { } ;
491 
492  void addServer(RooAbsArg& server, Bool_t valueProp=kTRUE, Bool_t shapeProp=kFALSE, std::size_t refCount = 1);
493  void addServerList(RooAbsCollection& serverList, Bool_t valueProp=kTRUE, Bool_t shapeProp=kFALSE) ;
494  void replaceServer(RooAbsArg& oldServer, RooAbsArg& newServer, Bool_t valueProp, Bool_t shapeProp) ;
495  void changeServer(RooAbsArg& server, Bool_t valueProp, Bool_t shapeProp) ;
496  void removeServer(RooAbsArg& server, Bool_t force=kFALSE) ;
497  RooAbsArg *findNewServer(const RooAbsCollection &newSet, Bool_t nameChange) const;
498 
499  RooExpensiveObjectCache& expensiveObjectCache() const ;
500  virtual void setExpensiveObjectCache(RooExpensiveObjectCache &cache) { _eocache = &cache; }
501 
502  virtual Bool_t importWorkspaceHook(RooWorkspace &ws)
503  {
504  _myws = &ws;
505  return kFALSE;
506  };
507 
508 
509 protected:
510  void graphVizAddConnections(std::set<std::pair<RooAbsArg*,RooAbsArg*> >&) ;
511 
512  virtual void operModeHook() {} ;
513 
514  virtual void optimizeDirtyHook(const RooArgSet* /*obs*/) {} ;
515 
516  virtual Bool_t isValid() const ;
517 
518  virtual void getParametersHook(const RooArgSet* /*nset*/, RooArgSet* /*list*/, Bool_t /*stripDisconnected*/) const {} ;
519  virtual void getObservablesHook(const RooArgSet* /*nset*/, RooArgSet* /*list*/) const {} ;
520 
521  void clearValueAndShapeDirty() const {
522  _valueDirty=kFALSE ;
523  _shapeDirty=kFALSE ;
524  }
525 
526  void clearValueDirty() const {
527  _valueDirty=kFALSE ;
528  }
529  void clearShapeDirty() const {
530  _shapeDirty=kFALSE ;
531  }
532 
533  /// Force element to re-evaluate itself when a value is requested.
534  void setValueDirty(const RooAbsArg* source);
535  /// Notify that a shape-like property (*e.g.* binning) has changed.
536  void setShapeDirty(const RooAbsArg* source);
537 
538  virtual void ioStreamerPass2() ;
539  static void ioStreamerPass2Finalize() ;
540 
541 
542 private:
543  void addParameters(RooArgSet& params, const RooArgSet* nset=0, Bool_t stripDisconnected=kTRUE) const;
544 
545  RefCountListLegacyIterator_t * makeLegacyIterator(const RefCountList_t& list) const;
546 
547 
548  protected:
549 
550  // Client-Server relation and Proxy management
551  friend class RooArgSet ;
552  friend class RooAbsCollection ;
553  friend class RooCustomizer ;
554  friend class RooWorkspace ;
555  friend class RooExtendPdf ;
556  friend class RooRealIntegral ;
557  friend class RooAbsReal ;
558  friend class RooProjectedPdf ;
559  RefCountList_t _serverList ; // list of server objects
560  RefCountList_t _clientList; // list of client objects
561  RefCountList_t _clientListShape; // subset of clients that requested shape dirty flag propagation
562  RefCountList_t _clientListValue; // subset of clients that requested value dirty flag propagation
563 
564  RooRefArray _proxyList ; // list of proxies
565  std::deque<RooAbsCache*> _cacheList ; // list of caches
566 
567 
568  // Proxy management
569  friend class RooAddModel ;
570  friend class RooArgProxy ;
571  friend class RooSetProxy ;
572  friend class RooListProxy ;
573  friend class RooObjectFactory ;
574  friend class RooHistPdf ;
575  friend class RooHistFunc ;
576  friend class RooHistFunc2 ;
577  void registerProxy(RooArgProxy& proxy) ;
578  void registerProxy(RooSetProxy& proxy) ;
579  void registerProxy(RooListProxy& proxy) ;
580  void unRegisterProxy(RooArgProxy& proxy) ;
581  void unRegisterProxy(RooSetProxy& proxy) ;
582  void unRegisterProxy(RooListProxy& proxy) ;
583  RooAbsProxy* getProxy(Int_t index) const ;
584  void setProxyNormSet(const RooArgSet* nset) ;
585  Int_t numProxies() const ;
586 
587  // Attribute list
588  std::set<std::string> _boolAttrib ; // Boolean attributes
589  std::map<std::string,std::string> _stringAttrib ; // String attributes
590  std::set<std::string> _boolAttribTransient ; //! Transient boolean attributes (not copied in ctor)
591 
592  void printAttribList(std::ostream& os) const;
593 
594  // Hooks for RooTreeData interface
595  friend class RooCompositeDataStore ;
596  friend class RooTreeDataStore ;
597  friend class RooVectorDataStore ;
598  friend class RooTreeData ;
599  friend class RooDataSet ;
600  friend class RooRealMPFE ;
601  virtual void syncCache(const RooArgSet* nset=0) = 0 ;
602  virtual void copyCache(const RooAbsArg* source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE) = 0 ;
603 
604  virtual void attachToTree(TTree& t, Int_t bufSize=32000) = 0 ;
605  virtual void attachToVStore(RooVectorDataStore& vstore) = 0 ;
606  /// Attach this argument to the data store such that it reads data from there.
607  void attachToStore(RooAbsDataStore& store) ;
608 
609  virtual void setTreeBranchStatus(TTree& t, Bool_t active) = 0 ;
610  virtual void fillTreeBranch(TTree& t) = 0 ;
611  TString cleanBranchName() const ;
612 
613  // Global
614  friend std::ostream& operator<<(std::ostream& os, const RooAbsArg &arg);
615  friend std::istream& operator>>(std::istream& is, RooAbsArg &arg) ;
616  friend void RooRefArray::Streamer(TBuffer&);
617 
618  // Debug stuff
619  static Bool_t _verboseDirty ; // Static flag controlling verbose messaging for dirty state changes
620  static Bool_t _inhibitDirty ; // Static flag controlling global inhibit of dirty state propagation
621  Bool_t _deleteWatch ; //! Delete watch flag
622 
623  Bool_t inhibitDirty() const ;
624 
625  public:
626  void setLocalNoDirtyInhibit(Bool_t flag) const { _localNoInhibitDirty = flag ; }
627  Bool_t localNoDirtyInhibit() const { return _localNoInhibitDirty ; }
628  protected:
629 
630 
631  mutable Bool_t _valueDirty ; // Flag set if value needs recalculating because input values modified
632  mutable Bool_t _shapeDirty ; // Flag set if value needs recalculating because input shapes modified
633  mutable bool _allBatchesDirty{true}; //! Mark batches as dirty (only meaningful for RooAbsReal).
634 
635  mutable OperMode _operMode ; // Dirty state propagation mode
636  mutable Bool_t _fast ; // Allow fast access mode in getVal() and proxies
637 
638  // Owned components
639  RooArgSet* _ownedComponents ; //! Set of owned component
640 
641  mutable Bool_t _prohibitServerRedirect ; //! Prohibit server redirects -- Debugging tool
642 
643  mutable RooExpensiveObjectCache* _eocache ; // Pointer to global cache manager for any expensive components created by this object
644 
645  mutable TNamed* _namePtr ; //! Do not persist. Pointer to global instance of string that matches object named
646  Bool_t _isConstant ; //! Cached isConstant status
647 
648  mutable Bool_t _localNoInhibitDirty ; //! Prevent 'AlwaysDirty' mode for this node
649 
650 /* RooArgSet _leafNodeCache ; //! Cached leaf nodes */
651 /* RooArgSet _branchNodeCache //! Cached branch nodes */
652 
653  mutable RooWorkspace *_myws; //! In which workspace do I live, if any
654 
655  // Legacy streamers need the following statics:
656  friend class RooFitResult;
657  public:
658  static std::map<RooAbsArg*,TRefArray*> _ioEvoList ; // temporary holding list for proxies needed in schema evolution
659  protected:
660  static std::stack<RooAbsArg*> _ioReadStack ; // reading stack
661 
662  ClassDef(RooAbsArg,7) // Abstract variable
663 };
664 
665 std::ostream& operator<<(std::ostream& os, const RooAbsArg &arg);
666 std::istream& operator>>(std::istream& is, RooAbsArg &arg);
667 
668 
669 #endif