Logo ROOT   6.14/05
Reference Guide
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 "RooRefCountList.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 #include "TClass.h"
36 
37 class TTree ;
38 class RooArgSet ;
39 class RooAbsCollection ;
40 class RooTreeData ;
41 class RooTreeDataStore ;
42 class RooVectorDataStore ;
43 class RooAbsData ;
44 class RooAbsDataStore ;
45 class RooAbsProxy ;
46 class RooArgProxy ;
47 class RooSetProxy ;
48 class RooListProxy ;
50 class RooWorkspace ;
51 class RooRealProxy ;
52 /* class TGraphStruct ; */
53 
54 class RooRefArray : public TObjArray {
55  public:
57  } ;
58  RooRefArray(const RooRefArray& other) : TObjArray(other) {
59  }
60  virtual ~RooRefArray() {} ;
61  protected:
62  ClassDef(RooRefArray,1) // Helper class for proxy lists
63 } ;
64 
65 
66 class RooAbsArg : public TNamed, public RooPrintable {
67 public:
68 
69  // Constructors, cloning and assignment
70  RooAbsArg() ;
71  virtual ~RooAbsArg();
72  RooAbsArg(const char *name, const char *title);
73  RooAbsArg(const RooAbsArg& other, const char* name=0) ;
74  virtual TObject* clone(const char* newname=0) const = 0 ;
75  virtual TObject* Clone(const char* newname=0) const {
76  return clone(newname) ;
77  }
78  virtual RooAbsArg* cloneTree(const char* newname=0) const ;
79 
80  // Accessors to client-server relation information
81  virtual Bool_t isDerived() const {
82  // Does value or shape of this arg depend on any other arg?
83  return kTRUE ;
84  //std::cout << IsA()->GetName() << "::isDerived(" << GetName() << ") = " << (_serverList.GetSize()>0 || _proxyList.GetSize()>0) << std::endl ;
85  //return (_serverList.GetSize()>0 || _proxyList.GetSize()>0)?kTRUE:kFALSE;
86  }
87  Bool_t isCloneOf(const RooAbsArg& other) const ;
88  Bool_t dependsOnValue(const RooAbsCollection& serverList, const RooAbsArg* ignoreArg=0) const {
89  // Does this arg depend on the value of any of of the values in serverList?
90  return dependsOn(serverList,ignoreArg,kTRUE) ;
91  }
92  Bool_t dependsOnValue(const RooAbsArg& server, const RooAbsArg* ignoreArg=0) const {
93  // Does this arg depend on the value of server?
94  return dependsOn(server,ignoreArg,kTRUE) ;
95  }
96  Bool_t dependsOn(const RooAbsCollection& serverList, const RooAbsArg* ignoreArg=0, Bool_t valueOnly=kFALSE) const ;
97  Bool_t dependsOn(const RooAbsArg& server, const RooAbsArg* ignoreArg=0, Bool_t valueOnly=kFALSE) const ;
98  Bool_t overlaps(const RooAbsArg& testArg, Bool_t valueOnly=kFALSE) const ;
99  Bool_t hasClients() const { return _clientList.GetSize()>0 ? kTRUE : kFALSE ; }
100  inline TIterator* clientIterator() const {
101  // Return iterator over all client RooAbsArgs
102  return _clientList.MakeIterator() ;
103  }
104  inline TIterator* valueClientIterator() const {
105  // Return iterator over all value client RooAbsArgs
106  return _clientListValue.MakeIterator() ;
107  }
108  inline TIterator* shapeClientIterator() const {
109  // Return iterator over all shape client RooAbsArgs
110  return _clientListShape.MakeIterator() ;
111  }
112  inline TIterator* serverIterator() const {
113  // Return iterator over all server RooAbsArgs
114  return _serverList.MakeIterator() ;
115  }
116 
117  inline RooFIter valueClientMIterator() const { return _clientListValue.fwdIterator() ; }
118  inline RooFIter shapeClientMIterator() const { return _clientListShape.fwdIterator() ; }
119  inline RooFIter serverMIterator() const { return _serverList.fwdIterator() ; }
120 
121 
122  inline RooAbsArg* findServer(const char *name) const {
123  // Return server of this arg with given name. Returns null if not found
124  return (RooAbsArg*)_serverList.FindObject(name);
125  }
126  inline RooAbsArg* findServer(const RooAbsArg& arg) const {
127  // Return server of this arg with name of given input arg. Returns null if not found
128  return (RooAbsArg*)_serverList.findArg(&arg);
129  }
130  inline RooAbsArg* findServer(Int_t index) const {
131  // Return i-th server from server list
132  return (RooAbsArg*)_serverList.At(index);
133  }
134  inline Bool_t isValueServer(const RooAbsArg& arg) const {
135  // If true, arg is a value server of self
136  return _clientListValue.findArg(&arg)?kTRUE:kFALSE ;
137  }
138  inline Bool_t isValueServer(const char* name) const {
139  // If true, we have a server with given name
140  return _clientListValue.FindObject(name)?kTRUE:kFALSE ;
141  }
142  inline Bool_t isShapeServer(const RooAbsArg& arg) const {
143  // If true arg is a shape server of self
144  return _clientListShape.findArg(&arg)?kTRUE:kFALSE ;
145  }
146  inline Bool_t isShapeServer(const char* name) const {
147  // If true, we have a shape server with given name
148  return _clientListShape.FindObject(name)?kTRUE:kFALSE ;
149  }
150  void leafNodeServerList(RooAbsCollection* list, const RooAbsArg* arg=0, Bool_t recurseNonDerived=kFALSE) const ;
151  void branchNodeServerList(RooAbsCollection* list, const RooAbsArg* arg=0, Bool_t recurseNonDerived=kFALSE) const ;
152  void treeNodeServerList(RooAbsCollection* list, const RooAbsArg* arg=0,
153  Bool_t doBranch=kTRUE, Bool_t doLeaf=kTRUE,
154  Bool_t valueOnly=kFALSE, Bool_t recurseNonDerived=kFALSE) const ;
155 
156 
157  inline virtual Bool_t isFundamental() const {
158  // Is this object a fundamental type that can be added to a dataset?
159  // Fundamental-type subclasses override this method to return kTRUE.
160  // Note that this test is subtlely different from the dynamic isDerived()
161  // test, e.g. a constant is not derived but is also not fundamental.
162  return kFALSE;
163  }
164 
165  // Create a fundamental-type object that stores our type of value. The
166  // created object will have a valid value, but not necessarily the same
167  // as our value. The caller is responsible for deleting the returned object.
168  virtual RooAbsArg *createFundamental(const char* newname=0) const = 0;
169 
170  inline virtual Bool_t isLValue() const {
171  // Is this argument an l-value, ie, can it appear on the left-hand side
172  // of an assignment expression? LValues are also special since they can
173  // potentially be analytically integrated and generated.
174  return kFALSE;
175  }
176 
177  void addParameters(RooArgSet& params, const RooArgSet* nset=0, Bool_t stripDisconnected=kTRUE) const ;
178 
179  // Parameter & observable interpretation of servers
180  friend class RooProdPdf ;
181  friend class RooAddPdf ;
182  friend class RooAddPdfOrig ;
183  RooArgSet* getVariables(Bool_t stripDisconnected=kTRUE) const ;
184  RooArgSet* getParameters(const RooAbsData* data, Bool_t stripDisconnected=kTRUE) const ;
185  RooArgSet* getParameters(const RooAbsData& data, Bool_t stripDisconnected=kTRUE) const {
186  // Return the parameters of this p.d.f when used in conjuction with dataset 'data'
187  return getParameters(&data,stripDisconnected) ;
188  }
189  RooArgSet* getParameters(const RooArgSet& set, Bool_t stripDisconnected=kTRUE) const {
190  // Return the parameters of the p.d.f given the provided set of observables
191  return getParameters(&set,stripDisconnected) ;
192  }
193  virtual RooArgSet* getParameters(const RooArgSet* depList, Bool_t stripDisconnected=kTRUE) const ;
194  RooArgSet* getObservables(const RooArgSet& set, Bool_t valueOnly=kTRUE) const {
195  // Return the observables of _this_ pdf given a set of observables
196  return getObservables(&set,valueOnly) ;
197  }
198  RooArgSet* getObservables(const RooAbsData* data) const ;
199  RooArgSet* getObservables(const RooAbsData& data) const {
200  // Return the observables of _this_ pdf given the observables defined by 'data'
201  return getObservables(&data) ;
202  }
203  RooArgSet* getObservables(const RooArgSet* depList, Bool_t valueOnly=kTRUE) const ;
204  Bool_t observableOverlaps(const RooAbsData* dset, const RooAbsArg& testArg) const ;
205  Bool_t observableOverlaps(const RooArgSet* depList, const RooAbsArg& testArg) const ;
206  virtual Bool_t checkObservables(const RooArgSet* nset) const ;
207  Bool_t recursiveCheckObservables(const RooArgSet* nset) const ;
208  RooArgSet* getComponents() const ;
209 
210  // --- Obsolete functions for backward compatibility
211  inline RooArgSet* getDependents(const RooArgSet& set) const { return getObservables(set) ; }
212  inline RooArgSet* getDependents(const RooAbsData* set) const { return getObservables(set) ; }
213  inline RooArgSet* getDependents(const RooArgSet* depList) const { return getObservables(depList) ; }
214  inline Bool_t dependentOverlaps(const RooAbsData* dset, const RooAbsArg& testArg) const { return observableOverlaps(dset,testArg) ; }
215  inline Bool_t dependentOverlaps(const RooArgSet* depList, const RooAbsArg& testArg) const { return observableOverlaps(depList, testArg) ; }
216  inline Bool_t checkDependents(const RooArgSet* nset) const { return checkObservables(nset) ; }
217  inline Bool_t recursiveCheckDependents(const RooArgSet* nset) const { return recursiveCheckObservables(nset) ; }
218  // --- End obsolete functions for backward compatibility
219 
220  void attachDataSet(const RooAbsData &set);
221  void attachDataStore(const RooAbsDataStore &set);
222 
223  // I/O streaming interface (machine readable)
224  virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) = 0 ;
225  virtual void writeToStream(std::ostream& os, Bool_t compact) const = 0 ;
226 
227  inline virtual void Print(Option_t *options= 0) const {
228  // Printing interface (human readable)
229  printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
230  }
231 
232  virtual void printName(std::ostream& os) const ;
233  virtual void printTitle(std::ostream& os) const ;
234  virtual void printClassName(std::ostream& os) const ;
235  virtual void printAddress(std::ostream& os) const ;
236  virtual void printArgs(std::ostream& os) const ;
237  virtual void printMetaArgs(std::ostream& /*os*/) const {} ;
238  virtual void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const;
239  virtual void printTree(std::ostream& os, TString indent="") const ;
240 
241  virtual Int_t defaultPrintContents(Option_t* opt) const ;
242 
243  // Accessors to attributes
244  void setAttribute(const Text_t* name, Bool_t value=kTRUE) ;
245  Bool_t getAttribute(const Text_t* name) const ;
246  inline const std::set<std::string>& attributes() const {
247  // Returns set of names of boolean attributes defined
248  return _boolAttrib ;
249  }
250 
251  void setStringAttribute(const Text_t* key, const Text_t* value) ;
252  const Text_t* getStringAttribute(const Text_t* key) const ;
253  inline const std::map<std::string,std::string>& stringAttributes() const {
254  // Returns std::map<string,string> with all string attributes defined
255  return _stringAttrib ;
256  }
257 
258  // Accessors to transient attributes
259  void setTransientAttribute(const Text_t* name, Bool_t value=kTRUE) ;
260  Bool_t getTransientAttribute(const Text_t* name) const ;
261  inline const std::set<std::string>& transientAttributes() const {
262  // Return set of transient boolean attributes
263  return _boolAttribTransient ;
264  }
265 
266  inline Bool_t isConstant() const {
267  // Returns true if 'Constant' attribute is set
268  return _isConstant ; //getAttribute("Constant") ;
269  }
270  RooLinkedList getCloningAncestors() const ;
271 
272  // Sorting
273  Int_t Compare(const TObject* other) const ;
274  virtual Bool_t IsSortable() const {
275  // Object is sortable in ROOT container class
276  return kTRUE ;
277  }
278 
279  //Debug hooks
280  static void verboseDirty(Bool_t flag) ;
281  void printDirty(Bool_t depth=kTRUE) const ;
282 
283  static void setDirtyInhibit(Bool_t flag) ;
284 
285  virtual Bool_t operator==(const RooAbsArg& other) = 0 ;
286  virtual Bool_t isIdentical(const RooAbsArg& other, Bool_t assumeSameType=kFALSE) = 0 ;
287 
288  // Range management
289  virtual Bool_t inRange(const char*) const {
290  // Is value in range (dummy interface always returns true)
291  return kTRUE ;
292  }
293  virtual Bool_t hasRange(const char*) const {
294  // Has this argument a defined range (dummy interface always returns flase)
295  return kFALSE ;
296  }
297 
298 
299  enum ConstOpCode { Activate=0, DeActivate=1, ConfigChange=2, ValueChange=3 } ;
300 
301 
302  friend class RooMinuit ;
303 
304  // Cache mode optimization (tracks changes & do lazy evaluation vs evaluate always)
305  virtual void optimizeCacheMode(const RooArgSet& observables) ;
306  virtual void optimizeCacheMode(const RooArgSet& observables, RooArgSet& optNodes, RooLinkedList& processedNodes) ;
307 
308 
309  // Find constant terms in expression
310  Bool_t findConstantNodes(const RooArgSet& observables, RooArgSet& cacheList) ;
311  Bool_t findConstantNodes(const RooArgSet& observables, RooArgSet& cacheList, RooLinkedList& processedNodes) ;
312 
313 
314  // constant term optimization
315  virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE) ;
316  enum CacheMode { Always=0, NotAdvised=1, Never=2 } ;
317  virtual CacheMode canNodeBeCached() const { return Always ; }
318  virtual void setCacheAndTrackHints(RooArgSet& /*trackNodes*/ ) {} ;
319 
320  void graphVizTree(const char* fileName, const char* delimiter="\n", bool useTitle=false, bool useLatex=false) ;
321  void graphVizTree(std::ostream& os, const char* delimiter="\n", bool useTitle=false, bool useLatex=false) ;
322 
323 /* TGraphStruct* graph(Bool_t useFactoryTag=kFALSE, Double_t textSize=0.03) ; */
324 
325  void printComponentTree(const char* indent="",const char* namePat=0, Int_t nLevel=999) ;
326  void printCompactTree(const char* indent="",const char* fileName=0, const char* namePat=0, RooAbsArg* client=0) ;
327  void printCompactTree(std::ostream& os, const char* indent="", const char* namePat=0, RooAbsArg* client=0) ;
328  virtual void printCompactTreeHook(std::ostream& os, const char *ind="") ;
329 
330  // Dirty state accessor
331  inline Bool_t isShapeDirty() const {
332  // Return true is shape has been invalidated by server value change
333  return isDerived()?_shapeDirty:kFALSE ;
334  }
335 
336  inline Bool_t isValueDirty() const {
337  // Returns true of value has been invalidated by server value change
338  if (inhibitDirty()) return kTRUE ;
339  switch(_operMode) {
340  case AClean:
341  return kFALSE ;
342  case ADirty:
343  return kTRUE ;
344  case Auto:
345  if (_valueDirty) return isDerived() ;
346  return kFALSE ;
347  }
348  return kTRUE ; // we should never get here
349  }
350 
351  inline Bool_t isValueDirtyAndClear() const {
352  // Returns true of value has been invalidated by server value change
353  if (inhibitDirty()) return kTRUE ;
354  switch(_operMode) {
355  case AClean:
356  return kFALSE ;
357  case ADirty:
358  return kTRUE ;
359  case Auto:
360  if (_valueDirty) {
361  _valueDirty = kFALSE ;
362  return isDerived();
363  }
364  return kFALSE ;
365  }
366  return kTRUE ; // But we should never get here
367  }
368 
369 
371  // Returns true of value has been invalidated by server value change
372 
373  if (inhibitDirty()) return kTRUE ;
374  switch(_operMode) {
375  case AClean:
376  return kFALSE ;
377  case ADirty:
378  return kTRUE ;
379  case Auto:
380  if (_valueDirty || _shapeDirty) {
381  _shapeDirty = kFALSE ;
382  _valueDirty = kFALSE ;
383  return isDerived();
384  }
385  _shapeDirty = kFALSE ;
386  _valueDirty = kFALSE ;
387  return kFALSE ;
388  }
389  return kTRUE ; // But we should never get here
390  }
391 
392  // Cache management
393  void registerCache(RooAbsCache& cache) ;
394  void unRegisterCache(RooAbsCache& cache) ;
395  Int_t numCaches() const ;
396  RooAbsCache* getCache(Int_t index) const ;
397 
398  enum OperMode { Auto=0, AClean=1, ADirty=2 } ;
399  inline OperMode operMode() const { return _operMode ; }
400  void setOperMode(OperMode mode, Bool_t recurseADirty=kTRUE) ;
401 
402  static UInt_t crc32(const char* data);
403  static UInt_t crc32(const char* data, ULong_t sz, UInt_t crc = 0);
404 
405  static const UInt_t fnv1a32start = 2166136261u;
406  static UInt_t fnv1a32(const char* data);
407  static UInt_t fnv1a32(const char* data, ULong_t sz, UInt_t hash = fnv1a32start);
408 
409  static const ULong64_t fnv1a64start = (ULong64_t(3421674724u) << 32) | ULong64_t(2216829733u);
410  static ULong64_t fnv1a64(const char* data);
411  static ULong64_t fnv1a64(const char* data, ULong_t sz, ULong64_t hash = fnv1a64start);
412 
413  Bool_t addOwnedComponents(const RooArgSet& comps) ;
414  const RooArgSet* ownedComponents() const { return _ownedComponents ; }
415 
416  void setProhibitServerRedirect(Bool_t flag) { _prohibitServerRedirect = flag ; }
417 
418  void setWorkspace(RooWorkspace &ws) { _myws = &ws; }
419 
420  protected:
421 
422  void graphVizAddConnections(std::set<std::pair<RooAbsArg*,RooAbsArg*> >&) ;
423 
424  friend class RooExtendPdf ;
425  friend class RooRealIntegral ;
426  friend class RooAbsReal ;
427  friend class RooProjectedPdf ;
428  //friend class RooSimCloneTool ;
429 
430  virtual void operModeHook() {} ;
431 
432  virtual void optimizeDirtyHook(const RooArgSet* /*obs*/) {} ;
433 
434  virtual Bool_t isValid() const ;
435 
436  virtual void getParametersHook(const RooArgSet* /*nset*/, RooArgSet* /*list*/, Bool_t /*stripDisconnected*/) const {} ;
437  virtual void getObservablesHook(const RooArgSet* /*nset*/, RooArgSet* /*list*/) const {} ;
438 
439  // Dirty state modifiers
440  public:
441  inline void setValueDirty() const { if (_operMode==Auto && !inhibitDirty()) setValueDirty(0) ; }
442  inline void setShapeDirty() const { setShapeDirty(0) ; }
443 
444  inline void clearValueAndShapeDirty() const {
447  }
448 
449  inline void clearValueDirty() const {
451  }
452  inline void clearShapeDirty() const {
454  }
455 
456  const char* aggregateCacheUniqueSuffix() const ;
457  virtual const char* cacheUniqueSuffix() const { return 0 ; }
458 
459  void wireAllCaches() ;
460 
461  inline const TNamed* namePtr() const {
462  return _namePtr ;
463  }
464 
465  void SetName(const char* name) ;
466  void SetNameTitle(const char *name, const char *title) ;
467 
468  protected:
469 
470  // Client-Server relatation and Proxy management
471  friend class RooArgSet ;
472  friend class RooAbsCollection ;
473  friend class RooCustomizer ;
474  friend class RooWorkspace ;
475  RooRefCountList _serverList ; // list of server objects
476  RooRefCountList _clientList ; // list of client objects
477  RooRefCountList _clientListShape ; // subset of clients that requested shape dirty flag propagation
478  RooRefCountList _clientListValue ; // subset of clients that requested value dirty flag propagation
479  RooRefArray _proxyList ; // list of proxies
480  std::deque<RooAbsCache*> _cacheList ; // list of caches
481  TIterator* _clientShapeIter ; //! Iterator over _clientListShape
482  TIterator* _clientValueIter ; //! Iterator over _clientListValue
483 
484  // Server redirection interface
485  public:
486  Bool_t redirectServers(const RooAbsCollection& newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t isRecursionStep=kFALSE) ;
487  Bool_t recursiveRedirectServers(const RooAbsCollection& newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE) ;
488  virtual Bool_t redirectServersHook(const RooAbsCollection& /*newServerList*/, Bool_t /*mustReplaceAll*/, Bool_t /*nameChange*/, Bool_t /*isRecursive*/) { return kFALSE ; } ;
489  virtual void serverNameChangeHook(const RooAbsArg* /*oldServer*/, const RooAbsArg* /*newServer*/) { } ;
490 
491  void addServer(RooAbsArg& server, Bool_t valueProp=kTRUE, Bool_t shapeProp=kFALSE) ;
492  void addServerList(RooAbsCollection& serverList, Bool_t valueProp=kTRUE, Bool_t shapeProp=kFALSE) ;
493  void replaceServer(RooAbsArg& oldServer, RooAbsArg& newServer, Bool_t valueProp, Bool_t shapeProp) ;
494  void changeServer(RooAbsArg& server, Bool_t valueProp, Bool_t shapeProp) ;
495  void removeServer(RooAbsArg& server, Bool_t force=kFALSE) ;
496  RooAbsArg *findNewServer(const RooAbsCollection &newSet, Bool_t nameChange) const;
497 
499  virtual void setExpensiveObjectCache(RooExpensiveObjectCache &cache) { _eocache = &cache; }
500 
502  {
503  _myws = &ws;
504  return kFALSE;
505  };
506 
507  protected:
508  // Proxy management
509  friend class RooAddModel ;
510  friend class RooArgProxy ;
511  friend class RooSetProxy ;
512  friend class RooListProxy ;
513  friend class RooObjectFactory ;
514  friend class RooHistPdf ;
515  friend class RooHistFunc ;
516  friend class RooHistFunc2 ;
517  void registerProxy(RooArgProxy& proxy) ;
518  void registerProxy(RooSetProxy& proxy) ;
519  void registerProxy(RooListProxy& proxy) ;
520  void unRegisterProxy(RooArgProxy& proxy) ;
521  void unRegisterProxy(RooSetProxy& proxy) ;
522  void unRegisterProxy(RooListProxy& proxy) ;
523  RooAbsProxy* getProxy(Int_t index) const ;
524  void setProxyNormSet(const RooArgSet* nset) ;
525  Int_t numProxies() const ;
526 
527  // Attribute list
528  std::set<std::string> _boolAttrib ; // Boolean attributes
529  std::map<std::string,std::string> _stringAttrib ; // String attributes
530  std::set<std::string> _boolAttribTransient ; //! Transient boolean attributes (not copied in ctor)
531 
532  void printAttribList(std::ostream& os) const;
533 
534  // Hooks for RooTreeData interface
535  friend class RooCompositeDataStore ;
536  friend class RooTreeDataStore ;
537  friend class RooVectorDataStore ;
538  friend class RooTreeData ;
539  friend class RooDataSet ;
540  friend class RooRealMPFE ;
541  virtual void syncCache(const RooArgSet* nset=0) = 0 ;
542  virtual void copyCache(const RooAbsArg* source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE) = 0 ;
543 
544  virtual void attachToTree(TTree& t, Int_t bufSize=32000) = 0 ;
545  virtual void attachToVStore(RooVectorDataStore& vstore) = 0 ;
546  void attachToStore(RooAbsDataStore& store) ;
547 
548  virtual void setTreeBranchStatus(TTree& t, Bool_t active) = 0 ;
549  virtual void fillTreeBranch(TTree& t) = 0 ;
550  TString cleanBranchName() const ;
551 
552  // Global
553  friend std::ostream& operator<<(std::ostream& os, const RooAbsArg &arg);
554  friend std::istream& operator>>(std::istream& is, RooAbsArg &arg) ;
555 
556  // Debug stuff
557  static Bool_t _verboseDirty ; // Static flag controlling verbose messaging for dirty state changes
558  static Bool_t _inhibitDirty ; // Static flag controlling global inhibit of dirty state propagation
559  Bool_t _deleteWatch ; //! Delete watch flag
560 
561  Bool_t inhibitDirty() const ;
562 
563  public:
564  void setLocalNoDirtyInhibit(Bool_t flag) const { _localNoInhibitDirty = flag ; }
566  protected:
567 
568  // Value and Shape dirty state bits
569  void setValueDirty(const RooAbsArg* source) const ;
570  void setShapeDirty(const RooAbsArg* source) const ;
571  mutable Bool_t _valueDirty ; // Flag set if value needs recalculating because input values modified
572  mutable Bool_t _shapeDirty ; // Flag set if value needs recalculating because input shapes modified
573 
574  friend class RooRealProxy ;
575  mutable OperMode _operMode ; // Dirty state propagation mode
576  mutable Bool_t _fast ; // Allow fast access mode in getVal() and proxies
577 
578  // Owned components
579  RooArgSet* _ownedComponents ; //! Set of owned component
580 
581  mutable Bool_t _prohibitServerRedirect ; //! Prohibit server redirects -- Debugging tool
582 
583  mutable RooExpensiveObjectCache* _eocache ; // Pointer to global cache manager for any expensive components created by this object
584 
585  mutable TNamed* _namePtr ; //! Do not persist. Pointer to global instance of string that matches object named
586  Bool_t _isConstant ; //! Cached isConstant status
587 
588  mutable Bool_t _localNoInhibitDirty ; //! Prevent 'AlwaysDirty' mode for this node
589 
590 /* RooArgSet _leafNodeCache ; //! Cached leaf nodes */
591 /* RooArgSet _branchNodeCache //! Cached branch nodes */
592 
593  mutable RooWorkspace *_myws; //! In which workspace do I live, if any
594 
595  public:
596  virtual void ioStreamerPass2() ;
597  static void ioStreamerPass2Finalize() ;
598  static std::map<RooAbsArg*,TRefArray*> _ioEvoList ; // temporary holding list for proxies needed in schema evolution
599  static std::stack<RooAbsArg*> _ioReadStack ; // reading stack
600 
601  ClassDef(RooAbsArg,6) // Abstract variable
602 };
603 
604 std::ostream& operator<<(std::ostream& os, const RooAbsArg &arg);
605 std::istream& operator>>(std::istream& is, RooAbsArg &arg) ;
606 
607 #endif
void clearValueDirty() const
Definition: RooAbsArg.h:449
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddPdf.h:29
An array of TObjects.
Definition: TObjArray.h:37
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
TIterator * _clientShapeIter
Definition: RooAbsArg.h:481
static std::stack< RooAbsArg * > _ioReadStack
Definition: RooAbsArg.h:599
RooExpensiveObjectCache _eocache
Transient ROOT directory representation of workspace.
Definition: RooWorkspace.h:272
Class RooProjectedPdf is a RooAbsPdf implementation that represent a projection of a given input p...
void setProhibitServerRedirect(Bool_t flag)
Definition: RooAbsArg.h:416
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Definition: RooAbsArg.h:194
void ws()
Definition: ws.C:62
RooFIter valueClientMIterator() const
Definition: RooAbsArg.h:117
const char Option_t
Definition: RtypesCore.h:62
RooExpensiveObjectCache is a singleton class that serves as repository for objects that are expensive...
Bool_t dependentOverlaps(const RooAbsData *dset, const RooAbsArg &testArg) const
Definition: RooAbsArg.h:214
RooProdPdf is an efficient implementation of a product of PDFs of the form.
Definition: RooProdPdf.h:31
Int_t Compare(const TObject *obj) const
Compare two TCollection objects.
Bool_t dependsOnValue(const RooAbsArg &server, const RooAbsArg *ignoreArg=0) const
Definition: RooAbsArg.h:92
const RooArgSet * ownedComponents() const
Definition: RooAbsArg.h:414
A RooRefCountList is a RooLinkedList that keeps a reference counter with each added node...
TNamed * _namePtr
Definition: RooAbsArg.h:585
Bool_t isShapeServer(const char *name) const
Definition: RooAbsArg.h:146
std::istream & operator>>(std::istream &is, RooAbsArg &arg)
Istream operator.
Definition: RooAbsArg.cxx:1463
Bool_t isValueOrShapeDirtyAndClear() const
Definition: RooAbsArg.h:370
RooTreeData is the abstract base class for data collection that use a TTree as internal storage mecha...
Definition: RooTreeData.h:25
Basic string class.
Definition: TString.h:131
virtual Bool_t isLValue() const
Definition: RooAbsArg.h:170
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TIterator * valueClientIterator() const
Definition: RooAbsArg.h:104
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
Definition: RooAbsArg.h:75
std::set< std::string > _boolAttrib
Definition: RooAbsArg.h:528
Bool_t inhibitDirty() const
Delete watch flag.
Definition: RooAbsArg.cxx:83
Bool_t isValueDirtyAndClear() const
Definition: RooAbsArg.h:351
RooTreeDataStore is the abstract base class for data collection that use a TTree as internal storage ...
RooAbsCache is the abstract base class for data members of RooAbsArgs that cache other (composite) Ro...
Definition: RooAbsCache.h:27
void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition: RooAbsArg.cxx:2397
Bool_t _fast
Definition: RooAbsArg.h:576
Bool_t _deleteWatch
Definition: RooAbsArg.h:559
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)
Copy the cached value of another RooAbsArg to our cache.
virtual void optimizeDirtyHook(const RooArgSet *)
Definition: RooAbsArg.h:432
Iterator abstract base class.
Definition: TIterator.h:30
virtual void getParametersHook(const RooArgSet *, RooArgSet *, Bool_t) const
Definition: RooAbsArg.h:436
virtual void syncCache(const RooArgSet *set=0)
Definition: RooAbsReal.h:378
RooArgSet * _ownedComponents
Definition: RooAbsArg.h:579
void attachToStore(RooAbsDataStore &store)
Definition: RooAbsArg.cxx:2320
TIterator * shapeClientIterator() const
Definition: RooAbsArg.h:108
virtual Bool_t isValid() const
Check if current value is valid.
Definition: RooAbsReal.cxx:437
RooAbsArg * findServer(const char *name) const
Definition: RooAbsArg.h:122
RooRefCountList _clientListValue
Definition: RooAbsArg.h:478
const std::set< std::string > & transientAttributes() const
Definition: RooAbsArg.h:261
Bool_t _valueDirty
Definition: RooAbsArg.h:571
virtual Bool_t inRange(const char *) const
Definition: RooAbsArg.h:289
void setValueDirty() const
Definition: RooAbsArg.h:441
RooArgSet * getParameters(const RooArgSet &set, Bool_t stripDisconnected=kTRUE) const
Definition: RooAbsArg.h:189
std::deque< RooAbsCache * > _cacheList
Definition: RooAbsArg.h:480
void clearValueAndShapeDirty() const
Definition: RooAbsArg.h:444
RooFIter serverMIterator() const
Definition: RooAbsArg.h:119
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects The class perfor...
RooAbsArg * findServer(Int_t index) const
Definition: RooAbsArg.h:130
RooRealMPFE is the multi-processor front-end for parallel calculation of RooAbsReal objects...
Definition: RooRealMPFE.h:30
#define ClassDef(name, id)
Definition: Rtypes.h:320
RooPlotable is a &#39;mix-in&#39; base class that define the standard RooFit plotting and printing methods...
Definition: RooPrintable.h:25
void setWorkspace(RooWorkspace &ws)
Definition: RooAbsArg.h:418
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
RooHistFunc implements a real-valued function sampled from a multidimensional histogram.
Definition: RooHistFunc.h:29
RooVectorDataStore is the abstract base class for data collection that use a TTree as internal storag...
RooFIter shapeClientMIterator() const
Definition: RooAbsArg.h:118
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooAbsArg.h:227
static Bool_t _verboseDirty
Definition: RooAbsArg.h:557
virtual Bool_t redirectServersHook(const RooAbsCollection &, Bool_t, Bool_t, Bool_t)
Definition: RooAbsArg.h:488
RooArgSet * getObservables(const RooAbsData &data) const
Definition: RooAbsArg.h:199
static Bool_t _inhibitDirty
Definition: RooAbsArg.h:558
const std::map< std::string, std::string > & stringAttributes() const
Definition: RooAbsArg.h:253
virtual Bool_t IsSortable() const
Definition: RooAbsArg.h:274
RooCompositeDataStore is the abstract base class for data collection that use a TTree as internal sto...
void wireAllCaches()
Definition: RooAbsArg.cxx:2363
virtual void setCacheAndTrackHints(RooArgSet &)
Definition: RooAbsArg.h:318
virtual void operModeHook()
Definition: RooAbsArg.h:430
virtual Bool_t isFundamental() const
Definition: RooAbsArg.h:157
RooHistPdf implements a probablity density function sampled from a multidimensional histogram...
Definition: RooHistPdf.h:28
Bool_t dependentOverlaps(const RooArgSet *depList, const RooAbsArg &testArg) const
Definition: RooAbsArg.h:215
virtual Bool_t importWorkspaceHook(RooWorkspace &ws)
Definition: RooAbsArg.h:501
Bool_t checkDependents(const RooArgSet *nset) const
Definition: RooAbsArg.h:216
virtual const char * cacheUniqueSuffix() const
Definition: RooAbsArg.h:457
TString cleanBranchName() const
Construct a mangled name from the actual name that is free of any math symbols that might be interpre...
Definition: RooAbsArg.cxx:1863
virtual void serverNameChangeHook(const RooAbsArg *, const RooAbsArg *)
Definition: RooAbsArg.h:489
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition: TObject.cxx:321
Bool_t recursiveCheckDependents(const RooArgSet *nset) const
Definition: RooAbsArg.h:217
Bool_t _isConstant
Do not persist. Pointer to global instance of string that matches object named.
Definition: RooAbsArg.h:586
RooAbsProxy is the abstact interface for proxy classes.
Definition: RooAbsProxy.h:31
const std::set< std::string > & attributes() const
Definition: RooAbsArg.h:246
RooWorkspace * _myws
Prevent &#39;AlwaysDirty&#39; mode for this node.
Definition: RooAbsArg.h:593
unsigned int UInt_t
Definition: RtypesCore.h:42
RooArgSet * getDependents(const RooArgSet &set) const
Definition: RooAbsArg.h:211
RooRefCountList _clientList
Definition: RooAbsArg.h:476
virtual void printMetaArgs(std::ostream &) const
Definition: RooAbsArg.h:237
OperMode operMode() const
Definition: RooAbsArg.h:399
OperMode _operMode
Definition: RooAbsArg.h:575
virtual ~RooRefArray()
Definition: RooAbsArg.h:60
virtual Bool_t hasRange(const char *) const
Definition: RooAbsArg.h:293
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
RooRefCountList _clientListShape
Definition: RooAbsArg.h:477
void SetName(const char *name)
Definition: TCollection.h:204
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
virtual void attachToTree(TTree &t, Int_t bufSize=32000)
Attach object to a branch of given TTree.
TIterator * serverIterator() const
Definition: RooAbsArg.h:112
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:25
const Bool_t kFALSE
Definition: RtypesCore.h:88
Bool_t isValueServer(const char *name) const
Definition: RooAbsArg.h:138
Bool_t _localNoInhibitDirty
Cached isConstant status.
Definition: RooAbsArg.h:588
RooRefArray _proxyList
Definition: RooAbsArg.h:479
virtual void setExpensiveObjectCache(RooExpensiveObjectCache &cache)
Definition: RooAbsArg.h:499
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
Bool_t hasClients() const
Definition: RooAbsArg.h:99
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
virtual void attachToVStore(RooVectorDataStore &vstore)
std::map< std::string, std::string > _stringAttrib
Definition: RooAbsArg.h:529
unsigned long long ULong64_t
Definition: RtypesCore.h:70
unsigned long ULong_t
Definition: RtypesCore.h:51
RooArgSet * getDependents(const RooAbsData *set) const
Definition: RooAbsArg.h:212
RooRefCountList _serverList
Definition: RooAbsArg.h:475
TIterator * _clientValueIter
Iterator over _clientListShape.
Definition: RooAbsArg.h:482
std::ostream & operator<<(std::ostream &os, const RooAbsArg &arg)
Bool_t _prohibitServerRedirect
Set of owned component.
Definition: RooAbsArg.h:581
Bool_t isValueDirty() const
Definition: RooAbsArg.h:336
RooArgSet * getDependents(const RooArgSet *depList) const
Definition: RooAbsArg.h:213
Bool_t dependsOnValue(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0) const
Definition: RooAbsArg.h:88
Mother of all ROOT objects.
Definition: TObject.h:37
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects...
RooArgProxy is the abstact interface for RooAbsArg proxy classes.
Definition: RooArgProxy.h:24
Bool_t isShapeServer(const RooAbsArg &arg) const
Definition: RooAbsArg.h:142
RooRefArray(const RooRefArray &other)
Definition: RooAbsArg.h:58
Bool_t _shapeDirty
Definition: RooAbsArg.h:572
Bool_t operator==(const TDatime &d1, const TDatime &d2)
Definition: TDatime.h:102
Bool_t isValueServer(const RooAbsArg &arg) const
Definition: RooAbsArg.h:134
virtual Bool_t isDerived() const
Definition: RooAbsArg.h:81
void setShapeDirty() const
Definition: RooAbsArg.h:442
Bool_t localNoDirtyInhibit() const
Definition: RooAbsArg.h:565
RooExpensiveObjectCache & expensiveObjectCache()
Definition: RooWorkspace.h:156
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:24
virtual void setTreeBranchStatus(TTree &t, Bool_t active)
(De)Activate associated tree branch
virtual void getObservablesHook(const RooArgSet *, RooArgSet *) const
Definition: RooAbsArg.h:437
RooRealProxy is the concrete proxy for RooAbsReal objects A RooRealProxy is the general mechanism to ...
Definition: RooRealProxy.h:23
char Text_t
Definition: RtypesCore.h:58
A TTree object has a header with a name and a title.
Definition: TTree.h:70
Bool_t isShapeDirty() const
Definition: RooAbsArg.h:331
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
void setLocalNoDirtyInhibit(Bool_t flag) const
Definition: RooAbsArg.h:564
static std::map< RooAbsArg *, TRefArray * > _ioEvoList
Definition: RooAbsArg.h:598
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
virtual void fillTreeBranch(TTree &t)
Fill the tree branch that associated with this object with its current value.
RooAbsArg * findServer(const RooAbsArg &arg) const
Definition: RooAbsArg.h:126
RooArgSet * getParameters(const RooAbsData &data, Bool_t stripDisconnected=kTRUE) const
Definition: RooAbsArg.h:185
const char * aggregateCacheUniqueSuffix() const
Definition: RooAbsArg.cxx:2345
const Bool_t kTRUE
Definition: RtypesCore.h:87
RooExpensiveObjectCache * _eocache
Prohibit server redirects – Debugging tool.
Definition: RooAbsArg.h:583
char name[80]
Definition: TGX11.cxx:109
std::set< std::string > _boolAttribTransient
Definition: RooAbsArg.h:530
void clearShapeDirty() const
Definition: RooAbsArg.h:452
Bool_t isConstant() const
Definition: RooAbsArg.h:266
const TNamed * namePtr() const
Definition: RooAbsArg.h:461
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
virtual CacheMode canNodeBeCached() const
Definition: RooAbsArg.h:317
RooMinuit is a wrapper class around TFitter/TMinuit that provides a seamless interface between the MI...
Definition: RooMinuit.h:39
TIterator * clientIterator() const
Definition: RooAbsArg.h:100