Logo ROOT  
Reference Guide
RooAbsArg.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 /** \class RooAbsArg
19  \ingroup Roofitcore
20 
21 RooAbsArg is the common abstract base class for objects that
22 represent a value and a "shape" in RooFit. Values or shapes usually depend on values
23 or shapes of other RooAbsArg instances. Connecting several RooAbsArg in
24 a computation graph models an expression tree that can be evaluated.
25 
26 ### Building a computation graph of RooFit objects
27 Therefore, RooAbsArg provides functionality to connect objects of type RooAbsArg into
28 a computation graph to pass values between those objects.
29 A value can e.g. be a real-valued number, (instances of RooAbsReal), or an integer, that is,
30 catgory index (instances of RooAbsCategory). The third subclass of RooAbsArg is RooStringVar,
31 but it is rarely used.
32 
33 The "shapes" that a RooAbsArg can possess can e.g. be the definition
34 range of an observable, or how many states a category object has. In computations,
35 values are expected to change often, while shapes remain mostly constant
36 (unless e.g. a new range is set for an observable).
37 
38 Nodes of a computation graph are connected using instances of RooAbsProxy.
39 If Node B declares a member `RooTemplateProxy<TypeOfNodeA>`, Node A will be
40 registered as a server of values to Node B, and Node B will know that it is
41 a client of node A. Using functions like dependsOn(), or getObservables()
42 / getParameters(), the relation of `A --> B` can be queried. Using graphVizTree(),
43 one can create a visualisation of the expression tree.
44 
45 
46 An instance of RooAbsArg can have named attributes. It also has flags
47 to indicate that either its value or its shape were changed (= it is dirty).
48 RooAbsArg provides functionality to manage client/server relations in
49 a computation graph (\ref clientServerInterface), and helps propagating
50 value/shape changes through the graph. RooAbsArg implements interfaces
51 for inspecting client/server relationships (\ref clientServerInterface) and
52 setting/clearing/querying named attributes.
53 
54 ### Caching of values
55 The values of nodes in the computation graph are cached in RooFit. If
56 a value is used in two nodes of a graph, it doesn't need to be recomputed. If
57 a node acquires a new value, it notifies its consumers ("clients") that
58 their cached values are dirty. See the functions in \ref optimisationInterface
59 for details.
60 A node uses its isValueDirty() and isShapeDirty() functions to decide if a
61 computation is necessary. Caching can be vetoed globally by setting a
62 bit using setDirtyInhibit(). This will make computations slower, but all the
63 nodes of the computation graph will be evaluated irrespective of whether their
64 state is clean or dirty. Using setOperMode(), caching can also be enabled/disabled
65 for single nodes.
66 
67 */
68 
69 #include "RooFit.h"
70 
71 #include "TBuffer.h"
72 #include "TClass.h"
73 #include "TVirtualStreamerInfo.h"
74 #include "strlcpy.h"
75 
76 #include "RooSecondMoment.h"
77 #include "RooNameSet.h"
78 #include "RooWorkspace.h"
79 
80 #include "RooMsgService.h"
81 #include "RooAbsArg.h"
82 #include "RooArgSet.h"
83 #include "RooArgProxy.h"
84 #include "RooSetProxy.h"
85 #include "RooListProxy.h"
86 #include "RooAbsData.h"
87 #include "RooAbsCategoryLValue.h"
88 #include "RooAbsRealLValue.h"
89 #include "RooTrace.h"
90 #include "RooRealIntegral.h"
91 #include "RooConstVar.h"
93 #include "RooAbsDataStore.h"
94 #include "RooResolutionModel.h"
95 #include "RooVectorDataStore.h"
96 #include "RooTreeDataStore.h"
97 #include "ROOT/RMakeUnique.hxx"
98 
99 #include <iostream>
100 #include <fstream>
101 #include <sstream>
102 #include <cstring>
103 #include <algorithm>
104 
105 using namespace std;
106 
107 #if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
108 char* operator+( streampos&, char* );
109 #endif
110 
112 ;
113 
116 Bool_t RooAbsArg::inhibitDirty() const { return _inhibitDirty && !_localNoInhibitDirty; }
117 
118 std::map<RooAbsArg*,std::unique_ptr<TRefArray>> RooAbsArg::_ioEvoList;
119 std::stack<RooAbsArg*> RooAbsArg::_ioReadStack ;
120 
121 
122 ////////////////////////////////////////////////////////////////////////////////
123 /// Default constructor
124 
126  : TNamed(), _deleteWatch(kFALSE), _valueDirty(kTRUE), _shapeDirty(kTRUE), _operMode(Auto), _fast(kFALSE), _ownedComponents(nullptr),
127  _prohibitServerRedirect(kFALSE), _namePtr(0), _isConstant(kFALSE), _localNoInhibitDirty(kFALSE),
128  _myws(0)
129 {
131 
132 }
133 
134 ////////////////////////////////////////////////////////////////////////////////
135 /// Create an object with the specified name and descriptive title.
136 /// The newly created object has no clients or servers and has its
137 /// dirty flags set.
138 
139 RooAbsArg::RooAbsArg(const char *name, const char *title)
140  : TNamed(name, title), _deleteWatch(kFALSE), _valueDirty(kTRUE), _shapeDirty(kTRUE), _operMode(Auto), _fast(kFALSE),
141  _ownedComponents(0), _prohibitServerRedirect(kFALSE), _namePtr(0), _isConstant(kFALSE),
142  _localNoInhibitDirty(kFALSE), _myws(0)
143 {
144  if (name == nullptr || strlen(name) == 0) {
145  throw std::logic_error("Each RooFit object needs a name. "
146  "Objects representing the same entity (e.g. an observable 'x') are identified using their name.");
147  }
149 }
150 
151 ////////////////////////////////////////////////////////////////////////////////
152 /// Copy constructor transfers all boolean and string properties of the original
153 /// object. Transient properties and client-server links are not copied
154 
155 RooAbsArg::RooAbsArg(const RooAbsArg &other, const char *name)
156  : TNamed(other.GetName(), other.GetTitle()), RooPrintable(other), _boolAttrib(other._boolAttrib),
157  _stringAttrib(other._stringAttrib), _deleteWatch(other._deleteWatch), _operMode(Auto), _fast(kFALSE),
158  _ownedComponents(0), _prohibitServerRedirect(kFALSE), _namePtr(other._namePtr),
159  _isConstant(other._isConstant), _localNoInhibitDirty(other._localNoInhibitDirty), _myws(0)
160 {
161  // Use name in argument, if supplied
162  if (name) {
165  } else {
166  // Same name, don't recalculate name pointer (expensive)
167  TNamed::SetName(other.GetName()) ;
168  _namePtr = other._namePtr ;
169  }
170 
171  // Copy server list by hand
172  Bool_t valueProp, shapeProp ;
173  for (const auto server : other._serverList) {
174  valueProp = server->_clientListValue.containsByNamePtr(&other);
175  shapeProp = server->_clientListShape.containsByNamePtr(&other);
176  addServer(*server,valueProp,shapeProp) ;
177  }
178 
179  setValueDirty() ;
180  setShapeDirty() ;
181 
182  //setAttribute(Form("CloneOf(%08x)",&other)) ;
183  //cout << "RooAbsArg::cctor(" << this << ") #bools = " << _boolAttrib.size() << " #strings = " << _stringAttrib.size() << endl ;
184 
185 }
186 
187 ////////////////////////////////////////////////////////////////////////////////
188 /// Assign all boolean and string properties of the original
189 /// object. Transient properties and client-server links are not assigned.
191  TNamed::operator=(other);
193  _boolAttrib = other._boolAttrib;
195  _deleteWatch = other._deleteWatch;
196  _operMode = other._operMode;
197  _fast = other._fast;
198  _ownedComponents = nullptr;
200  _namePtr = other._namePtr;
201  _isConstant = other._isConstant;
203  _myws = nullptr;
204 
205  bool valueProp, shapeProp;
206  for (const auto server : other._serverList) {
207  valueProp = server->_clientListValue.containsByNamePtr(&other);
208  shapeProp = server->_clientListShape.containsByNamePtr(&other);
209  addServer(*server,valueProp,shapeProp) ;
210  }
211 
212  setValueDirty();
213  setShapeDirty();
214 
215  return *this;
216 }
217 
218 
219 ////////////////////////////////////////////////////////////////////////////////
220 /// Destructor.
221 
223 {
224  // Notify all servers that they no longer need to serve us
225  while (!_serverList.empty()) {
227  }
228 
229  // Notify all clients that they are in limbo
230  std::vector<RooAbsArg*> clientListTmp(_clientList.begin(), _clientList.end()); // have to copy, as we invalidate iterators
231  Bool_t first(kTRUE) ;
232  for (auto client : clientListTmp) {
233  client->setAttribute("ServerDied") ;
234  TString attr("ServerDied:");
235  attr.Append(GetName());
236  attr.Append(Form("(%lx)",(ULong_t)this)) ;
237  client->setAttribute(attr.Data());
238  client->removeServer(*this,kTRUE);
239 
240  if (_verboseDirty) {
241 
242  if (first) {
243  cxcoutD(Tracing) << "RooAbsArg::dtor(" << GetName() << "," << this << ") DeleteWatch: object is being destroyed" << endl ;
244  first = kFALSE ;
245  }
246 
247  cxcoutD(Tracing) << fName << "::" << ClassName() << ":~RooAbsArg: dependent \""
248  << client->GetName() << "\" should have been deleted first" << endl ;
249  }
250  }
251 
252  if (_ownedComponents) {
253  delete _ownedComponents ;
254  _ownedComponents = 0 ;
255  }
256 
257 }
258 
259 
260 ////////////////////////////////////////////////////////////////////////////////
261 /// Control global dirty inhibit mode. When set to true no value or shape dirty
262 /// flags are propagated and cache is always considered to be dirty.
263 
265 {
266  _inhibitDirty = flag ;
267 }
268 
269 
270 ////////////////////////////////////////////////////////////////////////////////
271 /// Activate verbose messaging related to dirty flag propagation
272 
274 {
275  _verboseDirty = flag ;
276 }
277 
278 ////////////////////////////////////////////////////////////////////////////////
279 /// Check if this object was created as a clone of 'other'
280 
282 {
283  return (getAttribute(Form("CloneOf(%lx)",(ULong_t)&other)) ||
284  other.getAttribute(Form("CloneOf(%lx)",(ULong_t)this))) ;
285 }
286 
287 
288 ////////////////////////////////////////////////////////////////////////////////
289 /// Set (default) or clear a named boolean attribute of this object.
290 
292 {
293  // Preserve backward compatibility - any strong
294  if(string("Constant")==name) {
295  _isConstant = value ;
296  }
297 
298  if (value) {
299  _boolAttrib.insert(name) ;
300  } else {
301  set<string>::iterator iter = _boolAttrib.find(name) ;
302  if (iter != _boolAttrib.end()) {
303  _boolAttrib.erase(iter) ;
304  }
305 
306  }
307 
308 }
309 
310 
311 ////////////////////////////////////////////////////////////////////////////////
312 /// Check if a named attribute is set. By default, all attributes are unset.
313 
315 {
316  return (_boolAttrib.find(name) != _boolAttrib.end()) ;
317 }
318 
319 
320 ////////////////////////////////////////////////////////////////////////////////
321 /// Associate string 'value' to this object under key 'key'
322 
323 void RooAbsArg::setStringAttribute(const Text_t* key, const Text_t* value)
324 {
325  if (value) {
326  _stringAttrib[key] = value ;
327  } else {
328  _stringAttrib.erase(key) ;
329  }
330 }
331 
332 ////////////////////////////////////////////////////////////////////////////////
333 /// Get string attribute mapped under key 'key'. Returns null pointer
334 /// if no attribute exists under that key
335 
337 {
338  map<string,string>::const_iterator iter = _stringAttrib.find(key) ;
339  if (iter!=_stringAttrib.end()) {
340  return iter->second.c_str() ;
341  } else {
342  return 0 ;
343  }
344 }
345 
346 
347 ////////////////////////////////////////////////////////////////////////////////
348 /// Set (default) or clear a named boolean attribute of this object.
349 
351 {
352  if (value) {
353 
354  _boolAttribTransient.insert(name) ;
355 
356  } else {
357 
358  set<string>::iterator iter = _boolAttribTransient.find(name) ;
359  if (iter != _boolAttribTransient.end()) {
360  _boolAttribTransient.erase(iter) ;
361  }
362 
363  }
364 
365 }
366 
367 
368 ////////////////////////////////////////////////////////////////////////////////
369 /// Check if a named attribute is set. By default, all attributes
370 /// are unset.
371 
373 {
374  return (_boolAttribTransient.find(name) != _boolAttribTransient.end()) ;
375 }
376 
377 
378 
379 
380 ////////////////////////////////////////////////////////////////////////////////
381 /// Register another RooAbsArg as a server to us, ie, declare that
382 /// we depend on it.
383 /// \param server The server to be registered.
384 /// \param valueProp In addition to the basic client-server relationship, declare dependence on the server's value.
385 /// \param valueProp In addition to the basic client-server relationship, declare dependence on the server's shape.
386 /// \param refCount Optionally add with higher reference count (if multiple components depend on it)
387 
388 void RooAbsArg::addServer(RooAbsArg& server, Bool_t valueProp, Bool_t shapeProp, std::size_t refCount)
389 {
391  cxcoutF(LinkStateMgmt) << "RooAbsArg::addServer(" << this << "," << GetName()
392  << "): PROHIBITED SERVER ADDITION REQUESTED: adding server " << server.GetName()
393  << "(" << &server << ") for " << (valueProp?"value ":"") << (shapeProp?"shape":"") << endl ;
394  throw std::logic_error("PROHIBITED SERVER ADDITION REQUESTED in RooAbsArg::addServer");
395  }
396 
397  cxcoutD(LinkStateMgmt) << "RooAbsArg::addServer(" << this << "," << GetName() << "): adding server " << server.GetName()
398  << "(" << &server << ") for " << (valueProp?"value ":"") << (shapeProp?"shape":"") << endl ;
399 
400  if (server.operMode()==ADirty && operMode()!=ADirty && valueProp) {
402  }
403 
404 
405  // LM: use hash tables for larger lists
406 // if (_serverList.GetSize() > 999 && _serverList.getHashTableSize() == 0) _serverList.setHashTableSize(1000);
407 // if (server._clientList.GetSize() > 999 && server._clientList.getHashTableSize() == 0) server._clientList.setHashTableSize(1000);
408 // if (server._clientListValue.GetSize() > 999 && server._clientListValue.getHashTableSize() == 0) server._clientListValue.setHashTableSize(1000);
409 
410  // Add server link to given server
411  _serverList.Add(&server, refCount) ;
412 
413  server._clientList.Add(this, refCount);
414  if (valueProp) server._clientListValue.Add(this, refCount);
415  if (shapeProp) server._clientListShape.Add(this, refCount);
416 }
417 
418 
419 
420 ////////////////////////////////////////////////////////////////////////////////
421 /// Register a list of RooAbsArg as servers to us by calling
422 /// addServer() for each arg in the list
423 
424 void RooAbsArg::addServerList(RooAbsCollection& serverList, Bool_t valueProp, Bool_t shapeProp)
425 {
426  _serverList.reserve(_serverList.size() + serverList.size());
427 
428  for (const auto arg : serverList) {
429  addServer(*arg,valueProp,shapeProp) ;
430  }
431 }
432 
433 
434 
435 ////////////////////////////////////////////////////////////////////////////////
436 /// Unregister another RooAbsArg as a server to us, ie, declare that
437 /// we no longer depend on its value and shape.
438 
440 {
442  cxcoutF(LinkStateMgmt) << "RooAbsArg::addServer(" << this << "," << GetName() << "): PROHIBITED SERVER REMOVAL REQUESTED: removing server "
443  << server.GetName() << "(" << &server << ")" << endl ;
444  assert(0) ;
445  }
446 
447  if (_verboseDirty) {
448  cxcoutD(LinkStateMgmt) << "RooAbsArg::removeServer(" << GetName() << "): removing server "
449  << server.GetName() << "(" << &server << ")" << endl ;
450  }
451 
452  // Remove server link to given server
453  _serverList.Remove(&server, force) ;
454 
455  server._clientList.Remove(this, force) ;
456  server._clientListValue.Remove(this, force) ;
457  server._clientListShape.Remove(this, force) ;
458 }
459 
460 
461 ////////////////////////////////////////////////////////////////////////////////
462 /// Replace 'oldServer' with 'newServer'
463 
464 void RooAbsArg::replaceServer(RooAbsArg& oldServer, RooAbsArg& newServer, Bool_t propValue, Bool_t propShape)
465 {
466  Int_t count = _serverList.refCount(&oldServer);
467  removeServer(oldServer, kTRUE);
468  addServer(newServer, propValue, propShape, count);
469 }
470 
471 
472 ////////////////////////////////////////////////////////////////////////////////
473 /// Change dirty flag propagation mask for specified server
474 
475 void RooAbsArg::changeServer(RooAbsArg& server, Bool_t valueProp, Bool_t shapeProp)
476 {
477  if (!_serverList.containsByNamePtr(&server)) {
478  coutE(LinkStateMgmt) << "RooAbsArg::changeServer(" << GetName() << "): Server "
479  << server.GetName() << " not registered" << endl ;
480  return ;
481  }
482 
483  // This condition should not happen, but check anyway
484  if (!server._clientList.containsByNamePtr(this)) {
485  coutE(LinkStateMgmt) << "RooAbsArg::changeServer(" << GetName() << "): Server "
486  << server.GetName() << " doesn't have us registered as client" << endl ;
487  return ;
488  }
489 
490  // Remove all propagation links, then reinstall requested ones ;
491  Int_t vcount = server._clientListValue.refCount(this) ;
492  Int_t scount = server._clientListShape.refCount(this) ;
493  server._clientListValue.RemoveAll(this) ;
494  server._clientListShape.RemoveAll(this) ;
495  if (valueProp) {
496  server._clientListValue.Add(this, vcount) ;
497  }
498  if (shapeProp) {
499  server._clientListShape.Add(this, scount) ;
500  }
501 }
502 
503 
504 
505 ////////////////////////////////////////////////////////////////////////////////
506 /// Fill supplied list with all leaf nodes of the arg tree, starting with
507 /// ourself as top node. A leaf node is node that has no servers declared.
508 
509 void RooAbsArg::leafNodeServerList(RooAbsCollection* list, const RooAbsArg* arg, Bool_t recurseNonDerived) const
510 {
511  treeNodeServerList(list,arg,kFALSE,kTRUE,kFALSE,recurseNonDerived) ;
512 }
513 
514 
515 
516 ////////////////////////////////////////////////////////////////////////////////
517 /// Fill supplied list with all branch nodes of the arg tree starting with
518 /// ourself as top node. A branch node is node that has one or more servers declared.
519 
520 void RooAbsArg::branchNodeServerList(RooAbsCollection* list, const RooAbsArg* arg, Bool_t recurseNonDerived) const
521 {
522  treeNodeServerList(list,arg,kTRUE,kFALSE,kFALSE,recurseNonDerived) ;
523 }
524 
525 
526 ////////////////////////////////////////////////////////////////////////////////
527 /// Fill supplied list with nodes of the arg tree, following all server links,
528 /// starting with ourself as top node.
529 /// \param[in] list Output list
530 /// \param[in] arg Start searching at this element of the tree.
531 /// \param[in] doBranch Add branch nodes to the list.
532 /// \param[in] doLeaf Add leaf nodes to the list.
533 /// \param[in] valueOnly Only check if an element is a value server (no shape server).
534 /// \param[in] recurseFundamental
535 
536 void RooAbsArg::treeNodeServerList(RooAbsCollection* list, const RooAbsArg* arg, Bool_t doBranch, Bool_t doLeaf, Bool_t valueOnly, Bool_t recurseFundamental) const
537 {
538 // if (arg==0) {
539 // cout << "treeNodeServerList(" << GetName() << ") doBranch=" << (doBranch?"T":"F") << " doLeaf = " << (doLeaf?"T":"F") << " valueOnly=" << (valueOnly?"T":"F") << endl ;
540 // }
541 
542  if (!arg) {
543  list->reserve(10);
544  arg=this ;
545  }
546 
547  // Decide if to add current node
548  if ((doBranch&&doLeaf) ||
549  (doBranch&&arg->isDerived()) ||
550  (doLeaf&&arg->isFundamental()&&(!(recurseFundamental&&arg->isDerived()))) ||
551  (doLeaf && !arg->isFundamental() && !arg->isDerived())) {
552 
553  list->add(*arg,kTRUE) ;
554  }
555 
556  // Recurse if current node is derived
557  if (arg->isDerived() && (!arg->isFundamental() || recurseFundamental)) {
558  for (const auto server : arg->_serverList) {
559 
560  // Skip non-value server nodes if requested
561  Bool_t isValueSrv = server->_clientListValue.containsByNamePtr(arg);
562  if (valueOnly && !isValueSrv) {
563  continue ;
564  }
565  treeNodeServerList(list,server,doBranch,doLeaf,valueOnly,recurseFundamental) ;
566  }
567  }
568 }
569 
570 
571 ////////////////////////////////////////////////////////////////////////////////
572 /// Create a list of leaf nodes in the arg tree starting with
573 /// ourself as top node that don't match any of the names of the variable list
574 /// of the supplied data set (the dependents). The caller of this
575 /// function is responsible for deleting the returned argset.
576 /// The complement of this function is getObservables()
577 
578 RooArgSet* RooAbsArg::getParameters(const RooAbsData* set, Bool_t stripDisconnected) const
579 {
580  return getParameters(set?set->get():0,stripDisconnected) ;
581 }
582 
583 
584 ////////////////////////////////////////////////////////////////////////////////
585 /// INTERNAL helper function for getParameters()
586 
587 void RooAbsArg::addParameters(RooArgSet& params, const RooArgSet* nset,Bool_t stripDisconnected) const
588 {
589  // INTERNAL helper function for getParameters()
590 
591  RooArgSet nodeParamServers ;
592  RooArgSet nodeBranchServers ;
593  for (const auto server : _serverList) {
594  if (server->isValueServer(*this)) {
595  if (server->isFundamental()) {
596  if (!nset || !server->dependsOn(*nset)) {
597  nodeParamServers.add(*server) ;
598  }
599  } else {
600  nodeBranchServers.add(*server) ;
601  }
602  }
603  }
604 
605  // Allow pdf to strip parameters from list before adding it
606  getParametersHook(nset,&nodeParamServers,stripDisconnected) ;
607 
608  // Add parameters of this node to the combined list
609  params.add(nodeParamServers,kTRUE) ;
610 
611  // Now recurse into branch servers
612  for (const auto server : nodeBranchServers) {
613  server->addParameters(params,nset) ;
614  }
615 }
616 
617 
618 ////////////////////////////////////////////////////////////////////////////////
619 /// Create a list of leaf nodes in the arg tree starting with
620 /// ourself as top node that don't match any of the names the args in the
621 /// supplied argset. The caller of this function is responsible
622 /// for deleting the returned argset. The complement of this function
623 /// is getObservables()
624 
625 RooArgSet* RooAbsArg::getParameters(const RooArgSet* nset, Bool_t stripDisconnected) const
626 {
627 
628  // Check for cached parameter set
629  if (_myws) {
630  RooNameSet nsetObs(nset ? *nset : RooArgSet());
631  const RooArgSet *paramSet = _myws->set(Form("CACHE_PARAMS_OF_PDF_%s_FOR_OBS_%s", GetName(), nsetObs.content()));
632  if (paramSet) {
633  // cout << " restoring parameter cache from workspace for pdf " << IsA()->GetName() << "::" << GetName() <<
634  // endl ;
635  return new RooArgSet(*paramSet);
636  }
637  }
638 
639  RooArgSet *parList = new RooArgSet("parameters");
640 
641  addParameters(*parList, nset, stripDisconnected);
642 
643  parList->sort();
644 
645  // Cache parameter set
646  if (_myws && parList->getSize() > 10) {
647  RooNameSet nsetObs(nset ? *nset : RooArgSet());
648  _myws->defineSetInternal(Form("CACHE_PARAMS_OF_PDF_%s_FOR_OBS_%s", GetName(), nsetObs.content()), *parList);
649  // cout << " caching parameters in workspace for pdf " << IsA()->GetName() << "::" << GetName() << endl ;
650  }
651 
652  return parList;
653 }
654 
655 
656 
657 ////////////////////////////////////////////////////////////////////////////////
658 /// Create a list of leaf nodes in the arg tree starting with
659 /// ourself as top node that match any of the names of the variable list
660 /// of the supplied data set (the dependents). The caller of this
661 /// function is responsible for deleting the returned argset.
662 /// The complement of this function is getParameters().
663 
665 {
666  if (!set) return new RooArgSet ;
667 
668  return getObservables(set->get()) ;
669 }
670 
671 
672 ////////////////////////////////////////////////////////////////////////////////
673 /// Create a list of leaf nodes in the arg tree starting with
674 /// ourself as top node that match any of the names the args in the
675 /// supplied argset. The caller of this function is responsible
676 /// for deleting the returned argset. The complement of this function
677 /// is getParameters().
678 
679 RooArgSet* RooAbsArg::getObservables(const RooArgSet* dataList, Bool_t valueOnly) const
680 {
681  //cout << "RooAbsArg::getObservables(" << GetName() << ")" << endl ;
682 
683  RooArgSet* depList = new RooArgSet("dependents") ;
684  if (!dataList) return depList ;
685 
686  // Make iterator over tree leaf node list
687  RooArgSet leafList("leafNodeServerList") ;
688  treeNodeServerList(&leafList,0,kFALSE,kTRUE,valueOnly) ;
689 
690  if (valueOnly) {
691  for (const auto arg : leafList) {
692  if (arg->dependsOnValue(*dataList) && arg->isLValue()) {
693  depList->add(*arg) ;
694  }
695  }
696  } else {
697  for (const auto arg : leafList) {
698  if (arg->dependsOn(*dataList) && arg->isLValue()) {
699  depList->add(*arg) ;
700  }
701  }
702  }
703 
704  return depList ;
705 }
706 
707 
708 ////////////////////////////////////////////////////////////////////////////////
709 /// Create a RooArgSet with all components (branch nodes) of the
710 /// expression tree headed by this object.
712 {
713  TString name(GetName()) ;
714  name.Append("_components") ;
715 
716  RooArgSet* set = new RooArgSet(name) ;
717  branchNodeServerList(set) ;
718 
719  return set ;
720 }
721 
722 
723 
724 ////////////////////////////////////////////////////////////////////////////////
725 /// Overloadable function in which derived classes can implement
726 /// consistency checks of the variables. If this function returns
727 /// true, indicating an error, the fitter or generator will abort.
728 
730 {
731  return kFALSE ;
732 }
733 
734 
735 ////////////////////////////////////////////////////////////////////////////////
736 /// Recursively call checkObservables on all nodes in the expression tree
737 
739 {
740  RooArgSet nodeList ;
741  treeNodeServerList(&nodeList) ;
742  RooFIter iter = nodeList.fwdIterator() ;
743 
744  RooAbsArg* arg ;
745  Bool_t ret(kFALSE) ;
746  while((arg=iter.next())) {
747  if (arg->getAttribute("ServerDied")) {
748  coutE(LinkStateMgmt) << "RooAbsArg::recursiveCheckObservables(" << GetName() << "): ERROR: one or more servers of node "
749  << arg->GetName() << " no longer exists!" << endl ;
750  arg->Print("v") ;
751  ret = kTRUE ;
752  }
753  ret |= arg->checkObservables(nset) ;
754  }
755 
756  return ret ;
757 }
758 
759 
760 ////////////////////////////////////////////////////////////////////////////////
761 /// Test whether we depend on (ie, are served by) any object in the
762 /// specified collection. Uses the dependsOn(RooAbsArg&) member function.
763 
764 Bool_t RooAbsArg::dependsOn(const RooAbsCollection& serverList, const RooAbsArg* ignoreArg, Bool_t valueOnly) const
765 {
766  // Test whether we depend on (ie, are served by) any object in the
767  // specified collection. Uses the dependsOn(RooAbsArg&) member function.
768 
769  for (auto server : serverList) {
770  if (dependsOn(*server,ignoreArg,valueOnly)) {
771  return kTRUE;
772  }
773  }
774  return kFALSE;
775 }
776 
777 
778 ////////////////////////////////////////////////////////////////////////////////
779 /// Test whether we depend on (ie, are served by) the specified object.
780 /// Note that RooAbsArg objects are considered equivalent if they have
781 /// the same name.
782 
783 Bool_t RooAbsArg::dependsOn(const RooAbsArg& testArg, const RooAbsArg* ignoreArg, Bool_t valueOnly) const
784 {
785  if (this==ignoreArg) return kFALSE ;
786 
787  // First check if testArg is self
788  //if (!TString(testArg.GetName()).CompareTo(GetName())) return kTRUE ;
789  if (testArg.namePtr()==namePtr()) return kTRUE ;
790 
791 
792  // Next test direct dependence
793  RooAbsArg* foundServer = findServer(testArg) ;
794  if (foundServer) {
795 
796  // Return true if valueOnly is FALSE or if server is value server, otherwise keep looking
797  if ( !valueOnly || foundServer->isValueServer(*this)) {
798  return kTRUE ;
799  }
800  }
801 
802  // If not, recurse
803  for (const auto server : _serverList) {
804  if ( !valueOnly || server->isValueServer(*this)) {
805  if (server->dependsOn(testArg,ignoreArg,valueOnly)) {
806  return kTRUE ;
807  }
808  }
809  }
810 
811  return kFALSE ;
812 }
813 
814 
815 
816 ////////////////////////////////////////////////////////////////////////////////
817 /// Test if any of the nodes of tree are shared with that of the given tree
818 
819 Bool_t RooAbsArg::overlaps(const RooAbsArg& testArg, Bool_t valueOnly) const
820 {
821  RooArgSet list("treeNodeList") ;
822  treeNodeServerList(&list) ;
823 
824  return valueOnly ? testArg.dependsOnValue(list) : testArg.dependsOn(list) ;
825 }
826 
827 
828 
829 ////////////////////////////////////////////////////////////////////////////////
830 /// Test if any of the dependents of the arg tree (as determined by getObservables)
831 /// overlaps with those of the testArg.
832 
833 Bool_t RooAbsArg::observableOverlaps(const RooAbsData* dset, const RooAbsArg& testArg) const
834 {
835  return observableOverlaps(dset->get(),testArg) ;
836 }
837 
838 
839 ////////////////////////////////////////////////////////////////////////////////
840 /// Test if any of the dependents of the arg tree (as determined by getObservables)
841 /// overlaps with those of the testArg.
842 
843 Bool_t RooAbsArg::observableOverlaps(const RooArgSet* nset, const RooAbsArg& testArg) const
844 {
845  RooArgSet* depList = getObservables(nset) ;
846  Bool_t ret = testArg.dependsOn(*depList) ;
847  delete depList ;
848  return ret ;
849 }
850 
851 
852 
853 ////////////////////////////////////////////////////////////////////////////////
854 /// Mark this object as having changed its value, and propagate this status
855 /// change to all of our clients. If the object is not in automatic dirty
856 /// state propagation mode, this call has no effect.
857 
859 {
860  _allBatchesDirty = true;
861 
862  if (_operMode!=Auto || _inhibitDirty) return ;
863 
864  // Handle no-propagation scenarios first
865  if (_clientListValue.size() == 0) {
866  _valueDirty = kTRUE ;
867  return ;
868  }
869 
870  // Cyclical dependency interception
871  if (source==0) {
872  source=this ;
873  } else if (source==this) {
874  // Cyclical dependency, abort
875  coutE(LinkStateMgmt) << "RooAbsArg::setValueDirty(" << GetName()
876  << "): cyclical dependency detected, source = " << source->GetName() << endl ;
877  //assert(0) ;
878  return ;
879  }
880 
881  // Propagate dirty flag to all clients if this is a down->up transition
882  if (_verboseDirty) {
883  cxcoutD(LinkStateMgmt) << "RooAbsArg::setValueDirty(" << (source?source->GetName():"self") << "->" << GetName() << "," << this
884  << "): dirty flag " << (_valueDirty?"already ":"") << "raised" << endl ;
885  }
886 
887  _valueDirty = kTRUE ;
888 
889 
890  for (auto client : _clientListValue) {
891  client->setValueDirty(source) ;
892  }
893 
894 
895 }
896 
897 
898 ////////////////////////////////////////////////////////////////////////////////
899 /// Mark this object as having changed its shape, and propagate this status
900 /// change to all of our clients.
901 
903 {
904  if (_verboseDirty) {
905  cxcoutD(LinkStateMgmt) << "RooAbsArg::setShapeDirty(" << GetName()
906  << "): dirty flag " << (_shapeDirty?"already ":"") << "raised" << endl ;
907  }
908 
909  if (_clientListShape.empty()) {
910  _shapeDirty = kTRUE ;
911  return ;
912  }
913 
914  // Set 'dirty' shape state for this object and propagate flag to all its clients
915  if (source==0) {
916  source=this ;
917  } else if (source==this) {
918  // Cyclical dependency, abort
919  coutE(LinkStateMgmt) << "RooAbsArg::setShapeDirty(" << GetName()
920  << "): cyclical dependency detected" << endl ;
921  return ;
922  }
923 
924  // Propagate dirty flag to all clients if this is a down->up transition
926 
927  for (auto client : _clientListShape) {
928  client->setShapeDirty(source) ;
929  client->setValueDirty(source) ;
930  }
931 
932 }
933 
934 
935 
936 ////////////////////////////////////////////////////////////////////////////////
937 /// Replace all direct servers of this object with the new servers in `newServerList`.
938 /// This substitutes objects that we receive values from with new objects that have the same name.
939 /// \see recursiveRedirectServers() Use recursive version if servers that are only indirectly serving this object should be replaced as well.
940 /// \see redirectServers() If only the direct servers of an object need to be replaced.
941 ///
942 /// Note that changing the types of objects is generally allowed, but can be wrong if the interface of an object changes.
943 /// For example, one can reparametrise a model by substituting a variable with a function:
944 /// \f[
945 /// f(x\, |\, a) = a \cdot x \rightarrow f(x\, |\, b) = (2.1 \cdot b) \cdot x
946 /// \f]
947 /// If an object, however, expects a PDF, and this is substituted with a function that isn't normalised, wrong results might be obtained
948 /// or it might even crash the program. The types of the objects being substituted are not checked.
949 ///
950 /// \param[in] newSetOrig Set of new servers that should be used instead of the current servers.
951 /// \param[in] mustReplaceAll A warning is printed and error status is returned if not all servers could be
952 /// substituted successfully.
953 /// \param[in] nameChange If false, an object named "x" is replaced with an object named "x" in `newSetOrig`.
954 /// If the object in `newSet` is called differently, set `nameChange` to true and use setStringAttribute on the x object:
955 /// ```
956 /// objectToReplaceX.setStringAttribute("ORIGNAME", "x")
957 /// ```
958 /// \param[in] isRecursionStep Internal switch used when called from recursiveRedirectServers().
959 Bool_t RooAbsArg::redirectServers(const RooAbsCollection& newSetOrig, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursionStep)
960 {
961  // Trivial case, no servers
962  if (_serverList.empty()) return kFALSE ;
963  if (newSetOrig.getSize()==0) return kFALSE ;
964 
965  // Strip any non-matching removal nodes from newSetOrig
966  RooAbsCollection* newSet ;
967 
968  if (nameChange) {
969  newSet = new RooArgSet ;
970  for (auto arg : newSetOrig) {
971 
972  if (string("REMOVAL_DUMMY")==arg->GetName()) {
973 
974  if (arg->getAttribute("REMOVE_ALL")) {
975  newSet->add(*arg) ;
976  } else if (arg->getAttribute(Form("REMOVE_FROM_%s",getStringAttribute("ORIGNAME")))) {
977  newSet->add(*arg) ;
978  }
979  } else {
980  newSet->add(*arg) ;
981  }
982  }
983  } else {
984  newSet = (RooAbsCollection*) &newSetOrig ;
985  }
986 
987  // Replace current servers with new servers with the same name from the given list
988  Bool_t ret(kFALSE) ;
989 
990  //Copy original server list to not confuse the iterator while deleting
991  std::vector<RooAbsArg*> origServerList, origServerValue, origServerShape;
992  auto origSize = _serverList.size();
993  origServerList.reserve(origSize);
994  origServerValue.reserve(origSize);
995 
996  for (const auto oldServer : _serverList) {
997  origServerList.push_back(oldServer) ;
998 
999  // Retrieve server side link state information
1000  if (oldServer->_clientListValue.containsByNamePtr(this)) {
1001  origServerValue.push_back(oldServer) ;
1002  }
1003  if (oldServer->_clientListShape.containsByNamePtr(this)) {
1004  origServerShape.push_back(oldServer) ;
1005  }
1006  }
1007 
1008  // Delete all previously registered servers
1009  for (auto oldServer : origServerList) {
1010 
1011  RooAbsArg * newServer= oldServer->findNewServer(*newSet, nameChange);
1012 
1013  if (newServer && _verboseDirty) {
1014  cxcoutD(LinkStateMgmt) << "RooAbsArg::redirectServers(" << (void*)this << "," << GetName() << "): server " << oldServer->GetName()
1015  << " redirected from " << oldServer << " to " << newServer << endl ;
1016  }
1017 
1018  if (!newServer) {
1019  if (mustReplaceAll) {
1020  coutE(LinkStateMgmt) << "RooAbsArg::redirectServers(" << (void*)this << "," << GetName() << "): server " << oldServer->GetName()
1021  << " (" << (void*)oldServer << ") not redirected" << (nameChange?"[nameChange]":"") << endl ;
1022  ret = kTRUE ;
1023  }
1024  continue ;
1025  }
1026 
1027  auto findByNamePtr = [&oldServer](const RooAbsArg * item) {
1028  return oldServer->namePtr() == item->namePtr();
1029  };
1030  bool propValue = std::any_of(origServerValue.begin(), origServerValue.end(), findByNamePtr);
1031  bool propShape = std::any_of(origServerShape.begin(), origServerShape.end(), findByNamePtr);
1032 
1033  if (newServer != this) {
1034  replaceServer(*oldServer,*newServer,propValue,propShape) ;
1035  }
1036  }
1037 
1038 
1039  setValueDirty() ;
1040  setShapeDirty() ;
1041 
1042  // Process the proxies
1043  for (int i=0 ; i<numProxies() ; i++) {
1044  RooAbsProxy* p = getProxy(i) ;
1045  if (!p) continue ;
1046  Bool_t ret2 = p->changePointer(*newSet,nameChange,kFALSE) ;
1047 
1048  if (mustReplaceAll && !ret2) {
1049  auto ap = dynamic_cast<const RooArgProxy*>(p);
1050  coutE(LinkStateMgmt) << "RooAbsArg::redirectServers(" << GetName()
1051  << "): ERROR, proxy '" << p->name()
1052  << "' with arg '" << (ap ? ap->absArg()->GetName() : "<could not cast>") << "' could not be adjusted" << endl;
1053  ret = kTRUE ;
1054  }
1055  }
1056 
1057 
1058  // Optional subclass post-processing
1059  for (Int_t i=0 ;i<numCaches() ; i++) {
1060  ret |= getCache(i)->redirectServersHook(*newSet,mustReplaceAll,nameChange,isRecursionStep) ;
1061  }
1062  ret |= redirectServersHook(*newSet,mustReplaceAll,nameChange,isRecursionStep) ;
1063 
1064  if (nameChange) {
1065  delete newSet ;
1066  }
1067 
1068  return ret ;
1069 }
1070 
1071 ////////////////////////////////////////////////////////////////////////////////
1072 /// Find the new server in the specified set that matches the old server.
1073 /// Allow a name change if nameChange is kTRUE, in which case the new
1074 /// server is selected by searching for a new server with an attribute
1075 /// of "ORIGNAME:<oldName>". Return zero if there is not a unique match.
1076 
1078 {
1079  RooAbsArg *newServer = 0;
1080  if (!nameChange) {
1081  newServer = newSet.find(*this) ;
1082  }
1083  else {
1084  // Name changing server redirect:
1085  // use 'ORIGNAME:<oldName>' attribute instead of name of new server
1086  TString nameAttrib("ORIGNAME:") ;
1087  nameAttrib.Append(GetName()) ;
1088 
1089  RooArgSet* tmp = (RooArgSet*) newSet.selectByAttrib(nameAttrib,kTRUE) ;
1090  if(0 != tmp) {
1091 
1092  // Check if any match was found
1093  if (tmp->getSize()==0) {
1094  delete tmp ;
1095  return 0 ;
1096  }
1097 
1098  // Check if match is unique
1099  if(tmp->getSize()>1) {
1100  coutF(LinkStateMgmt) << "RooAbsArg::redirectServers(" << GetName() << "): FATAL Error, " << tmp->getSize() << " servers with "
1101  << nameAttrib << " attribute" << endl ;
1102  tmp->Print("v") ;
1103  assert(0) ;
1104  }
1105 
1106  // use the unique element in the set
1107  newServer= tmp->first();
1108  delete tmp ;
1109  }
1110  }
1111  return newServer;
1112 }
1113 
1114 
1115 ////////////////////////////////////////////////////////////////////////////////
1116 /// Recursively replace all servers with the new servers in `newSet`.
1117 /// This substitutes objects that we receive values from (also indirectly through other objects) with new objects that have the same name.
1118 ///
1119 /// *Copied from redirectServers:*
1120 ///
1121 /// \copydetails RooAbsArg::redirectServers
1122 Bool_t RooAbsArg::recursiveRedirectServers(const RooAbsCollection& newSet, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t recurseInNewSet)
1123 {
1124  // Cyclic recursion protection
1125  static std::set<const RooAbsArg*> callStack;
1126  {
1127  std::set<const RooAbsArg*>::iterator it = callStack.lower_bound(this);
1128  if (it != callStack.end() && this == *it) {
1129  return kFALSE;
1130  } else {
1131  callStack.insert(it, this);
1132  }
1133  }
1134 
1135  // Do not recurse into newset if not so specified
1136 // if (!recurseInNewSet && newSet.contains(*this)) {
1137 // return kFALSE ;
1138 // }
1139 
1140 
1141  // Apply the redirectServers function recursively on all branch nodes in this argument tree.
1142  Bool_t ret(kFALSE) ;
1143 
1144  cxcoutD(LinkStateMgmt) << "RooAbsArg::recursiveRedirectServers(" << this << "," << GetName() << ") newSet = " << newSet << " mustReplaceAll = "
1145  << (mustReplaceAll?"T":"F") << " nameChange = " << (nameChange?"T":"F") << " recurseInNewSet = " << (recurseInNewSet?"T":"F") << endl ;
1146 
1147  // Do redirect on self (identify operation as recursion step)
1148  ret |= redirectServers(newSet,mustReplaceAll,nameChange,kTRUE) ;
1149 
1150  // Do redirect on servers
1151  for (const auto server : _serverList){
1152  ret |= server->recursiveRedirectServers(newSet,mustReplaceAll,nameChange,recurseInNewSet) ;
1153  }
1154 
1155  callStack.erase(this);
1156  return ret ;
1157 }
1158 
1159 
1160 
1161 ////////////////////////////////////////////////////////////////////////////////
1162 /// Register an RooArgProxy in the proxy list. This function is called by owned
1163 /// proxies upon creation. After registration, this arg wil forward pointer
1164 /// changes from serverRedirects and updates in cached normalization sets
1165 /// to the proxies immediately after they occur. The proxied argument is
1166 /// also added as value and/or shape server
1167 
1169 {
1170  // Every proxy can be registered only once
1171  if (_proxyList.FindObject(&proxy)) {
1172  coutE(LinkStateMgmt) << "RooAbsArg::registerProxy(" << GetName() << "): proxy named "
1173  << proxy.GetName() << " for arg " << proxy.absArg()->GetName()
1174  << " already registered" << endl ;
1175  return ;
1176  }
1177 
1178 // cout << (void*)this << " " << GetName() << ": registering proxy "
1179 // << (void*)&proxy << " with name " << proxy.name() << " in mode "
1180 // << (proxy.isValueServer()?"V":"-") << (proxy.isShapeServer()?"S":"-") << endl ;
1181 
1182  // Register proxied object as server
1183  if (proxy.absArg()) {
1184  addServer(*proxy.absArg(),proxy.isValueServer(),proxy.isShapeServer()) ;
1185  }
1186 
1187  // Register proxy itself
1188  _proxyList.Add(&proxy) ;
1189 }
1190 
1191 
1192 ////////////////////////////////////////////////////////////////////////////////
1193 /// Remove proxy from proxy list. This functions is called by owned proxies
1194 /// upon their destruction.
1195 
1197 {
1198  _proxyList.Remove(&proxy) ;
1199  _proxyList.Compress() ;
1200 }
1201 
1202 
1203 
1204 ////////////////////////////////////////////////////////////////////////////////
1205 /// Register an RooSetProxy in the proxy list. This function is called by owned
1206 /// proxies upon creation. After registration, this arg wil forward pointer
1207 /// changes from serverRedirects and updates in cached normalization sets
1208 /// to the proxies immediately after they occur.
1209 
1211 {
1212  // Every proxy can be registered only once
1213  if (_proxyList.FindObject(&proxy)) {
1214  coutE(LinkStateMgmt) << "RooAbsArg::registerProxy(" << GetName() << "): proxy named "
1215  << proxy.GetName() << " already registered" << endl ;
1216  return ;
1217  }
1218 
1219  // Register proxy itself
1220  _proxyList.Add(&proxy) ;
1221 }
1222 
1223 
1224 
1225 ////////////////////////////////////////////////////////////////////////////////
1226 /// Remove proxy from proxy list. This functions is called by owned proxies
1227 /// upon their destruction.
1228 
1230 {
1231  _proxyList.Remove(&proxy) ;
1232  _proxyList.Compress() ;
1233 }
1234 
1235 
1236 
1237 ////////////////////////////////////////////////////////////////////////////////
1238 /// Register an RooListProxy in the proxy list. This function is called by owned
1239 /// proxies upon creation. After registration, this arg wil forward pointer
1240 /// changes from serverRedirects and updates in cached normalization sets
1241 /// to the proxies immediately after they occur.
1242 
1244 {
1245  // Every proxy can be registered only once
1246  if (_proxyList.FindObject(&proxy)) {
1247  coutE(LinkStateMgmt) << "RooAbsArg::registerProxy(" << GetName() << "): proxy named "
1248  << proxy.GetName() << " already registered" << endl ;
1249  return ;
1250  }
1251 
1252  // Register proxy itself
1253  Int_t nProxyOld = _proxyList.GetEntries() ;
1254  _proxyList.Add(&proxy) ;
1255  if (_proxyList.GetEntries()!=nProxyOld+1) {
1256  cout << "RooAbsArg::registerProxy(" << GetName() << ") proxy registration failure! nold=" << nProxyOld << " nnew=" << _proxyList.GetEntries() << endl ;
1257  }
1258 }
1259 
1260 
1261 
1262 ////////////////////////////////////////////////////////////////////////////////
1263 /// Remove proxy from proxy list. This functions is called by owned proxies
1264 /// upon their destruction.
1265 
1267 {
1268  _proxyList.Remove(&proxy) ;
1269  _proxyList.Compress() ;
1270 }
1271 
1272 
1273 
1274 ////////////////////////////////////////////////////////////////////////////////
1275 /// Return the nth proxy from the proxy list.
1276 
1278 {
1279  // Cross cast: proxy list returns TObject base pointer, we need
1280  // a RooAbsProxy base pointer. C++ standard requires
1281  // a dynamic_cast for this.
1282  return dynamic_cast<RooAbsProxy*> (_proxyList.At(index)) ;
1283 }
1284 
1285 
1286 
1287 ////////////////////////////////////////////////////////////////////////////////
1288 /// Return the number of registered proxies.
1289 
1291 {
1292  return _proxyList.GetEntriesFast();
1293 }
1294 
1295 
1296 
1297 ////////////////////////////////////////////////////////////////////////////////
1298 /// Forward a change in the cached normalization argset
1299 /// to all the registered proxies.
1300 
1302 {
1303  for (int i=0 ; i<numProxies() ; i++) {
1304  RooAbsProxy* p = getProxy(i) ;
1305  if (!p) continue ;
1306  getProxy(i)->changeNormSet(nset) ;
1307  }
1308 }
1309 
1310 
1311 
1312 ////////////////////////////////////////////////////////////////////////////////
1313 /// Overloadable function for derived classes to implement
1314 /// attachment as branch to a TTree
1315 
1317 {
1318  coutE(Contents) << "RooAbsArg::attachToTree(" << GetName()
1319  << "): Cannot be attached to a TTree" << endl ;
1320 }
1321 
1322 
1323 
1324 ////////////////////////////////////////////////////////////////////////////////
1325 /// WVE (08/21/01) Probably obsolete now
1326 
1328 {
1329  return kTRUE ;
1330 }
1331 
1332 
1333 
1334 
1335 ////////////////////////////////////////////////////////////////////////////////
1336 /// Print object name
1337 
1338 void RooAbsArg::printName(ostream& os) const
1339 {
1340  os << GetName() ;
1341 }
1342 
1343 
1344 
1345 ////////////////////////////////////////////////////////////////////////////////
1346 /// Print object title
1347 
1348 void RooAbsArg::printTitle(ostream& os) const
1349 {
1350  os << GetTitle() ;
1351 }
1352 
1353 
1354 
1355 ////////////////////////////////////////////////////////////////////////////////
1356 /// Print object class name
1357 
1358 void RooAbsArg::printClassName(ostream& os) const
1359 {
1360  os << IsA()->GetName() ;
1361 }
1362 
1363 
1364 void RooAbsArg::printAddress(ostream& os) const
1365 {
1366  // Print addrss of this RooAbsArg
1367  os << this ;
1368 }
1369 
1370 
1371 
1372 ////////////////////////////////////////////////////////////////////////////////
1373 /// Print object arguments, ie its proxies
1374 
1375 void RooAbsArg::printArgs(ostream& os) const
1376 {
1377  // Print nothing if there are no dependencies
1378  if (numProxies()==0) return ;
1379 
1380  os << "[ " ;
1381  for (Int_t i=0 ; i<numProxies() ; i++) {
1382  RooAbsProxy* p = getProxy(i) ;
1383  if (p==0) continue ;
1384  if (!TString(p->name()).BeginsWith("!")) {
1385  p->print(os) ;
1386  os << " " ;
1387  }
1388  }
1389  printMetaArgs(os) ;
1390  os << "]" ;
1391 }
1392 
1393 
1394 
1395 ////////////////////////////////////////////////////////////////////////////////
1396 /// Define default contents to print
1397 
1399 {
1400  return kName|kClassName|kValue|kArgs ;
1401 }
1402 
1403 
1404 
1405 ////////////////////////////////////////////////////////////////////////////////
1406 /// Implement multi-line detailed printing
1407 
1408 void RooAbsArg::printMultiline(ostream& os, Int_t /*contents*/, Bool_t /*verbose*/, TString indent) const
1409 {
1410  os << indent << "--- RooAbsArg ---" << endl;
1411  // dirty state flags
1412  os << indent << " Value State: " ;
1413  switch(_operMode) {
1414  case ADirty: os << "FORCED DIRTY" ; break ;
1415  case AClean: os << "FORCED clean" ; break ;
1416  case Auto: os << (isValueDirty() ? "DIRTY":"clean") ; break ;
1417  }
1418  os << endl
1419  << indent << " Shape State: " << (isShapeDirty() ? "DIRTY":"clean") << endl;
1420  // attribute list
1421  os << indent << " Attributes: " ;
1422  printAttribList(os) ;
1423  os << endl ;
1424  // our memory address (for x-referencing with client addresses of other args)
1425  os << indent << " Address: " << (void*)this << endl;
1426  // client list
1427  os << indent << " Clients: " << endl;
1428  for (const auto client : _clientList) {
1429  os << indent << " (" << (void*)client << ","
1430  << (_clientListValue.containsByNamePtr(client)?"V":"-")
1431  << (_clientListShape.containsByNamePtr(client)?"S":"-")
1432  << ") " ;
1433  client->printStream(os,kClassName|kTitle|kName,kSingleLine);
1434  }
1435 
1436  // server list
1437  os << indent << " Servers: " << endl;
1438  for (const auto server : _serverList) {
1439  os << indent << " (" << (void*)server << ","
1440  << (server->_clientListValue.containsByNamePtr(this)?"V":"-")
1441  << (server->_clientListShape.containsByNamePtr(this)?"S":"-")
1442  << ") " ;
1443  server->printStream(os,kClassName|kName|kTitle,kSingleLine);
1444  }
1445 
1446  // proxy list
1447  os << indent << " Proxies: " << endl ;
1448  for (int i=0 ; i<numProxies() ; i++) {
1449  RooAbsProxy* proxy=getProxy(i) ;
1450  if (!proxy) continue ;
1451  if (proxy->IsA()->InheritsFrom(RooArgProxy::Class())) {
1452  os << indent << " " << proxy->name() << " -> " ;
1453  RooAbsArg* parg = ((RooArgProxy*)proxy)->absArg() ;
1454  if (parg) {
1455  parg->printStream(os,kName,kSingleLine) ;
1456  } else {
1457  os << " (empty)" << endl ; ;
1458  }
1459  } else {
1460  os << indent << " " << proxy->name() << " -> " ;
1461  os << endl ;
1462  TString moreIndent(indent) ;
1463  moreIndent.Append(" ") ;
1464  ((RooSetProxy*)proxy)->printStream(os,kName,kStandard,moreIndent.Data()) ;
1465  }
1466  }
1467 }
1468 
1469 
1470 ////////////////////////////////////////////////////////////////////////////////
1471 /// Print object tree structure
1472 
1473 void RooAbsArg::printTree(ostream& os, TString /*indent*/) const
1474 {
1475  const_cast<RooAbsArg*>(this)->printCompactTree(os) ;
1476 }
1477 
1478 
1479 ////////////////////////////////////////////////////////////////////////////////
1480 /// Ostream operator
1481 
1482 ostream& operator<<(ostream& os, RooAbsArg &arg)
1483 {
1484  arg.writeToStream(os,kTRUE) ;
1485  return os ;
1486 }
1487 
1488 ////////////////////////////////////////////////////////////////////////////////
1489 /// Istream operator
1490 
1491 istream& operator>>(istream& is, RooAbsArg &arg)
1492 {
1493  arg.readFromStream(is,kTRUE,kFALSE) ;
1494  return is ;
1495 }
1496 
1497 ////////////////////////////////////////////////////////////////////////////////
1498 /// Print the attribute list
1499 
1500 void RooAbsArg::printAttribList(ostream& os) const
1501 {
1502  set<string>::const_iterator iter = _boolAttrib.begin() ;
1503  Bool_t first(kTRUE) ;
1504  while (iter != _boolAttrib.end()) {
1505  os << (first?" [":",") << *iter ;
1506  first=kFALSE ;
1507  ++iter ;
1508  }
1509  if (!first) os << "] " ;
1510 }
1511 
1512 ////////////////////////////////////////////////////////////////////////////////
1513 /// Replace server nodes with names matching the dataset variable names
1514 /// with those data set variables, making this PDF directly dependent on the dataset.
1515 
1517 {
1518  const RooArgSet* set = data.get() ;
1519  RooArgSet branches ;
1520  branchNodeServerList(&branches,0,kTRUE) ;
1521 
1522  RooFIter iter = branches.fwdIterator() ;
1523  RooAbsArg* branch ;
1524  while((branch=iter.next())) {
1525  branch->redirectServers(*set,kFALSE,kFALSE) ;
1526  }
1527 }
1528 
1529 
1530 
1531 ////////////////////////////////////////////////////////////////////////////////
1532 /// Replace server nodes with names matching the dataset variable names
1533 /// with those data set variables, making this PDF directly dependent on the dataset
1534 
1536 {
1537  const RooArgSet* set = dstore.get() ;
1538  RooArgSet branches ;
1539  branchNodeServerList(&branches,0,kTRUE) ;
1540 
1541  RooFIter iter = branches.fwdIterator() ;
1542  RooAbsArg* branch ;
1543  while((branch=iter.next())) {
1544  branch->redirectServers(*set,kFALSE,kFALSE) ;
1545  }
1546 }
1547 
1548 
1549 
1550 ////////////////////////////////////////////////////////////////////////////////
1551 /// Utility function used by TCollection::Sort to compare contained TObjects
1552 /// We implement comparison by name, resulting in alphabetical sorting by object name.
1553 
1554 Int_t RooAbsArg::Compare(const TObject* other) const
1555 {
1556  return strcmp(GetName(),other->GetName()) ;
1557 }
1558 
1559 
1560 
1561 ////////////////////////////////////////////////////////////////////////////////
1562 /// Print information about current value dirty state information.
1563 /// If depth flag is true, information is recursively printed for
1564 /// all nodes in this arg tree.
1565 
1567 {
1568  if (depth) {
1569 
1570  RooArgSet branchList ;
1571  branchNodeServerList(&branchList) ;
1572  RooFIter bIter = branchList.fwdIterator() ;
1573  RooAbsArg* branch ;
1574  while((branch=bIter.next())) {
1575  branch->printDirty(kFALSE) ;
1576  }
1577 
1578  } else {
1579  cout << GetName() << " : " ;
1580  switch (_operMode) {
1581  case AClean: cout << "FORCED clean" ; break ;
1582  case ADirty: cout << "FORCED DIRTY" ; break ;
1583  case Auto: cout << "Auto " << (isValueDirty()?"DIRTY":"clean") ;
1584  }
1585  cout << endl ;
1586  }
1587 }
1588 
1589 
1590 ////////////////////////////////////////////////////////////////////////////////
1591 /// Activate cache mode optimization with given definition of observables.
1592 /// The cache operation mode of all objects in the expression tree will
1593 /// modified such that all nodes that depend directly or indirectly on
1594 /// any of the listed observables will be set to ADirty, as they are
1595 /// expected to change every time. This save change tracking overhead for
1596 /// nodes that are a priori known to change every time
1597 
1598 void RooAbsArg::optimizeCacheMode(const RooArgSet& observables)
1599 {
1600  RooLinkedList proc;
1601  RooArgSet opt ;
1602  optimizeCacheMode(observables,opt,proc) ;
1603 
1604  coutI(Optimization) << "RooAbsArg::optimizeCacheMode(" << GetName() << ") nodes " << opt << " depend on observables, "
1605  << "changing cache operation mode from change tracking to unconditional evaluation" << endl ;
1606 }
1607 
1608 
1609 ////////////////////////////////////////////////////////////////////////////////
1610 /// Activate cache mode optimization with given definition of observables.
1611 /// The cache operation mode of all objects in the expression tree will
1612 /// modified such that all nodes that depend directly or indirectly on
1613 /// any of the listed observables will be set to ADirty, as they are
1614 /// expected to change every time. This save change tracking overhead for
1615 /// nodes that are a priori known to change every time
1616 
1617 void RooAbsArg::optimizeCacheMode(const RooArgSet& observables, RooArgSet& optimizedNodes, RooLinkedList& processedNodes)
1618 {
1619  // Optimization applies only to branch nodes, not to leaf nodes
1620  if (!isDerived()) {
1621  return ;
1622  }
1623 
1624 
1625  // Terminate call if this node was already processed (tree structure may be cyclical)
1626  if (processedNodes.findArg(this)) {
1627  return ;
1628  } else {
1629  processedNodes.Add(this) ;
1630  }
1631 
1632  // Set cache mode operator to 'AlwaysDirty' if we depend on any of the given observables
1633  if (dependsOnValue(observables)) {
1634 
1635  if (dynamic_cast<RooRealIntegral*>(this)) {
1636  cxcoutI(Integration) << "RooAbsArg::optimizeCacheMode(" << GetName() << ") integral depends on value of one or more observables and will be evaluated for every event" << endl ;
1637  }
1638  optimizedNodes.add(*this,kTRUE) ;
1639  if (operMode()==AClean) {
1640  } else {
1641  setOperMode(ADirty,kTRUE) ; // WVE propagate flag recursively to top of tree
1642  }
1643  } else {
1644  }
1645  // Process any RooAbsArgs contained in any of the caches of this object
1646  for (Int_t i=0 ;i<numCaches() ; i++) {
1647  getCache(i)->optimizeCacheMode(observables,optimizedNodes,processedNodes) ;
1648  }
1649 
1650  // Forward calls to all servers
1651  for (const auto server : _serverList) {
1652  server->optimizeCacheMode(observables,optimizedNodes,processedNodes) ;
1653  }
1654 
1655 }
1656 
1657 ////////////////////////////////////////////////////////////////////////////////
1658 /// Find branch nodes with all-constant parameters, and add them to the list of
1659 /// nodes that can be cached with a dataset in a test statistic calculation
1660 
1662 {
1663  RooLinkedList proc ;
1664  Bool_t ret = findConstantNodes(observables,cacheList,proc) ;
1665 
1666  // If node can be optimized and hasn't been identified yet, add it to the list
1667  coutI(Optimization) << "RooAbsArg::findConstantNodes(" << GetName() << "): components "
1668  << cacheList << " depend exclusively on constant parameters and will be precalculated and cached" << endl ;
1669 
1670  return ret ;
1671 }
1672 
1673 
1674 
1675 ////////////////////////////////////////////////////////////////////////////////
1676 /// Find branch nodes with all-constant parameters, and add them to the list of
1677 /// nodes that can be cached with a dataset in a test statistic calculation
1678 
1679 Bool_t RooAbsArg::findConstantNodes(const RooArgSet& observables, RooArgSet& cacheList, RooLinkedList& processedNodes)
1680 {
1681  // Caching only applies to branch nodes
1682  if (!isDerived()) {
1683  return kFALSE;
1684  }
1685 
1686  // Terminate call if this node was already processed (tree structure may be cyclical)
1687  if (processedNodes.findArg(this)) {
1688  return kFALSE ;
1689  } else {
1690  processedNodes.Add(this) ;
1691  }
1692 
1693  // Check if node depends on any non-constant parameter
1694  Bool_t canOpt(kTRUE) ;
1695  RooArgSet* paramSet = getParameters(observables) ;
1696  RooFIter iter = paramSet->fwdIterator() ;
1697  RooAbsArg* param ;
1698  while((param = iter.next())) {
1699  if (!param->isConstant()) {
1700  canOpt=kFALSE ;
1701  break ;
1702  }
1703  }
1704  delete paramSet ;
1705 
1706 
1707  if (getAttribute("NeverConstant")) {
1708  canOpt = kFALSE ;
1709  }
1710 
1711  if (canOpt) {
1712  setAttribute("ConstantExpression") ;
1713  }
1714 
1715  // If yes, list node eligible for caching, if not test nodes one level down
1716  if (canOpt||getAttribute("CacheAndTrack")) {
1717 
1718  if (!cacheList.find(*this) && dependsOnValue(observables) && !observables.find(*this) ) {
1719 
1720  // Add to cache list
1721  cxcoutD(Optimization) << "RooAbsArg::findConstantNodes(" << GetName() << ") adding self to list of constant nodes" << endl ;
1722 
1723  if (canOpt) setAttribute("ConstantExpressionCached") ;
1724  cacheList.add(*this,kFALSE) ;
1725  }
1726  }
1727 
1728  if (!canOpt) {
1729 
1730  // If not, see if next level down can be cached
1731  for (const auto server : _serverList) {
1732  if (server->isDerived()) {
1733  server->findConstantNodes(observables,cacheList,processedNodes) ;
1734  }
1735  }
1736  }
1737 
1738  // Forward call to all cached contained in current object
1739  for (Int_t i=0 ;i<numCaches() ; i++) {
1740  getCache(i)->findConstantNodes(observables,cacheList,processedNodes) ;
1741  }
1742 
1743  return kFALSE ;
1744 }
1745 
1746 
1747 
1748 
1749 ////////////////////////////////////////////////////////////////////////////////
1750 /// Interface function signaling a request to perform constant term
1751 /// optimization. This default implementation takes no action other than to
1752 /// forward the calls to all servers
1753 
1755 {
1756  for (const auto server : _serverList) {
1757  server->constOptimizeTestStatistic(opcode,doAlsoTrackingOpt) ;
1758  }
1759 }
1760 
1761 
1762 ////////////////////////////////////////////////////////////////////////////////
1763 /// Change cache operation mode to given mode. If recurseAdirty
1764 /// is true, then a mode change to AlwaysDirty will automatically
1765 /// be propagated recursively to all client nodes
1766 
1767 void RooAbsArg::setOperMode(OperMode mode, Bool_t recurseADirty)
1768 {
1769  // Prevent recursion loops
1770  if (mode==_operMode) return ;
1771 
1772  _operMode = mode ;
1773  _fast = ((mode==AClean) || dynamic_cast<RooRealVar*>(this)!=0 || dynamic_cast<RooConstVar*>(this)!=0 ) ;
1774  for (Int_t i=0 ;i<numCaches() ; i++) {
1775  getCache(i)->operModeHook() ;
1776  }
1777  operModeHook() ;
1778 
1779  // Propagate to all clients
1780  if (mode==ADirty && recurseADirty) {
1781  for (auto clientV : _clientListValue) {
1782  clientV->setOperMode(mode) ;
1783  }
1784  }
1785 }
1786 
1787 
1788 ////////////////////////////////////////////////////////////////////////////////
1789 /// Print tree structure of expression tree on stdout, or to file if filename is specified.
1790 /// If namePat is not "*", only nodes with names matching the pattern will be printed.
1791 /// The client argument is used in recursive calls to properly display the value or shape nature
1792 /// of the client-server links. It should be zero in calls initiated by users.
1793 
1794 void RooAbsArg::printCompactTree(const char* indent, const char* filename, const char* namePat, RooAbsArg* client)
1795 {
1796  if (filename) {
1797  ofstream ofs(filename) ;
1798  printCompactTree(ofs,indent,namePat,client) ;
1799  } else {
1800  printCompactTree(cout,indent,namePat,client) ;
1801  }
1802 }
1803 
1804 
1805 ////////////////////////////////////////////////////////////////////////////////
1806 /// Print tree structure of expression tree on given ostream.
1807 /// If namePat is not "*", only nodes with names matching the pattern will be printed.
1808 /// The client argument is used in recursive calls to properly display the value or shape nature
1809 /// of the client-server links. It should be zero in calls initiated by users.
1810 
1811 void RooAbsArg::printCompactTree(ostream& os, const char* indent, const char* namePat, RooAbsArg* client)
1812 {
1813  if ( !namePat || TString(GetName()).Contains(namePat)) {
1814  os << indent << this ;
1815  if (client) {
1816  os << "/" ;
1817  if (isValueServer(*client)) os << "V" ; else os << "-" ;
1818  if (isShapeServer(*client)) os << "S" ; else os << "-" ;
1819  }
1820  os << " " ;
1821 
1822  os << IsA()->GetName() << "::" << GetName() << " = " ;
1823  printValue(os) ;
1824 
1825  if (!_serverList.empty()) {
1826  switch(operMode()) {
1827  case Auto: os << " [Auto," << (isValueDirty()?"Dirty":"Clean") << "] " ; break ;
1828  case AClean: os << " [ACLEAN] " ; break ;
1829  case ADirty: os << " [ADIRTY] " ; break ;
1830  }
1831  }
1832  os << endl ;
1833 
1834  for (Int_t i=0 ;i<numCaches() ; i++) {
1836  }
1838  }
1839 
1840  TString indent2(indent) ;
1841  indent2 += " " ;
1842  for (const auto arg : _serverList) {
1843  arg->printCompactTree(os,indent2,namePat,this) ;
1844  }
1845 }
1846 
1847 
1848 ////////////////////////////////////////////////////////////////////////////////
1849 /// Print tree structure of expression tree on given ostream, only branch nodes are printed.
1850 /// Lead nodes (variables) will not be shown
1851 ///
1852 /// If namePat is not "*", only nodes with names matching the pattern will be printed.
1853 
1854 void RooAbsArg::printComponentTree(const char* indent, const char* namePat, Int_t nLevel)
1855 {
1856  if (nLevel==0) return ;
1857  if (isFundamental()) return ;
1858  RooResolutionModel* rmodel = dynamic_cast<RooResolutionModel*>(this) ;
1859  if (rmodel && rmodel->isConvolved()) return ;
1860  if (InheritsFrom("RooConstVar")) return ;
1861 
1862  if ( !namePat || TString(GetName()).Contains(namePat)) {
1863  cout << indent ;
1864  Print() ;
1865  }
1866 
1867  TString indent2(indent) ;
1868  indent2 += " " ;
1869  for (const auto arg : _serverList) {
1870  arg->printComponentTree(indent2.Data(),namePat,nLevel-1) ;
1871  }
1872 }
1873 
1874 
1875 ////////////////////////////////////////////////////////////////////////////////
1876 /// Construct a mangled name from the actual name that
1877 /// is free of any math symbols that might be interpreted by TTree
1878 
1880 {
1881  // Check for optional alternate name of branch for this argument
1882  TString rawBranchName = GetName() ;
1883  if (getStringAttribute("BranchName")) {
1884  rawBranchName = getStringAttribute("BranchName") ;
1885  }
1886 
1887  TString cleanName(rawBranchName) ;
1888  cleanName.ReplaceAll("/","D") ;
1889  cleanName.ReplaceAll("-","M") ;
1890  cleanName.ReplaceAll("+","P") ;
1891  cleanName.ReplaceAll("*","X") ;
1892  cleanName.ReplaceAll("[","L") ;
1893  cleanName.ReplaceAll("]","R") ;
1894  cleanName.ReplaceAll("(","L") ;
1895  cleanName.ReplaceAll(")","R") ;
1896  cleanName.ReplaceAll("{","L") ;
1897  cleanName.ReplaceAll("}","R") ;
1898 
1899  return cleanName;
1900 }
1901 
1902 
1903 ////////////////////////////////////////////////////////////////////////////////
1904 /// Hook function interface for object to insert additional information
1905 /// when printed in the context of a tree structure. This default
1906 /// implementation prints nothing
1907 
1908 void RooAbsArg::printCompactTreeHook(ostream&, const char *)
1909 {
1910 }
1911 
1912 
1913 ////////////////////////////////////////////////////////////////////////////////
1914 /// Register RooAbsCache with this object. This function is called
1915 /// by RooAbsCache constructors for objects that are a datamember
1916 /// of this RooAbsArg. By registering itself the RooAbsArg is aware
1917 /// of all its cache data members and will forward server change
1918 /// and cache mode change calls to the cache objects, which in turn
1919 /// can forward them their contents
1920 
1922 {
1923  _cacheList.push_back(&cache) ;
1924 }
1925 
1926 
1927 ////////////////////////////////////////////////////////////////////////////////
1928 /// Unregister a RooAbsCache. Called from the RooAbsCache destructor
1929 
1931 {
1932  _cacheList.erase(std::remove(_cacheList.begin(), _cacheList.end(), &cache),
1933  _cacheList.end());
1934 }
1935 
1936 
1937 ////////////////////////////////////////////////////////////////////////////////
1938 /// Return number of registered caches
1939 
1941 {
1942  return _cacheList.size() ;
1943 }
1944 
1945 
1946 ////////////////////////////////////////////////////////////////////////////////
1947 /// Return registered cache object by index
1948 
1950 {
1951  return _cacheList[index] ;
1952 }
1953 
1954 
1955 ////////////////////////////////////////////////////////////////////////////////
1956 /// Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
1957 
1958 RooArgSet* RooAbsArg::getVariables(Bool_t stripDisconnected) const
1959 {
1960  return getParameters(RooArgSet(),stripDisconnected) ;
1961 }
1962 
1963 
1964 ////////////////////////////////////////////////////////////////////////////////
1965 /// Return ancestors in cloning chain of this RooAbsArg. NOTE: Returned pointers
1966 /// are not guaranteed to be 'live', so do not dereference without proper caution
1967 
1969 {
1970  RooLinkedList retVal ;
1971 
1972  set<string>::const_iterator iter= _boolAttrib.begin() ;
1973  while(iter != _boolAttrib.end()) {
1974  if (TString(*iter).BeginsWith("CloneOf(")) {
1975  char buf[128] ;
1976  strlcpy(buf,iter->c_str(),128) ;
1977  strtok(buf,"(") ;
1978  char* ptrToken = strtok(0,")") ;
1979  RooAbsArg* ptr = (RooAbsArg*) strtol(ptrToken,0,16) ;
1980  retVal.Add(ptr) ;
1981  }
1982  }
1983 
1984  return retVal ;
1985 }
1986 
1987 
1988 ////////////////////////////////////////////////////////////////////////////////
1989 /// Create a GraphViz .dot file visualizing the expression tree headed by
1990 /// this RooAbsArg object. Use the GraphViz tool suite to make e.g. a gif
1991 /// or ps file from the .dot file
1992 ///
1993 /// Based on concept developed by Kyle Cranmer
1994 
1995 void RooAbsArg::graphVizTree(const char* fileName, const char* delimiter, bool useTitle, bool useLatex)
1996 {
1997  ofstream ofs(fileName) ;
1998  if (!ofs) {
1999  coutE(InputArguments) << "RooAbsArg::graphVizTree() ERROR: Cannot open graphViz output file with name " << fileName << endl ;
2000  return ;
2001  }
2002  graphVizTree(ofs, delimiter, useTitle, useLatex) ;
2003 }
2004 
2005 ////////////////////////////////////////////////////////////////////////////////
2006 /// Write the GraphViz representation of the expression tree headed by
2007 /// this RooAbsArg object to the given ostream.
2008 ///
2009 /// Based on concept developed by Kyle Cranmer
2010 
2011 void RooAbsArg::graphVizTree(ostream& os, const char* delimiter, bool useTitle, bool useLatex)
2012 {
2013  if (!os) {
2014  coutE(InputArguments) << "RooAbsArg::graphVizTree() ERROR: output stream provided as input argument is in invalid state" << endl ;
2015  }
2016 
2017  // Write header
2018  os << "digraph \"" << GetName() << "\"{" << endl ;
2019 
2020  // First list all the tree nodes
2021  RooArgSet nodeSet ;
2022  treeNodeServerList(&nodeSet) ;
2023  RooFIter iter = nodeSet.fwdIterator() ;
2024  RooAbsArg* node ;
2025 
2026  // iterate over nodes
2027  while((node=iter.next())) {
2028  string nodeName = node->GetName();
2029  string nodeTitle = node->GetTitle();
2030  string nodeLabel = (useTitle && !nodeTitle.empty()) ? nodeTitle : nodeName;
2031 
2032  // if using latex, replace ROOT's # with normal latex backslash
2033  string::size_type position = nodeLabel.find("#") ;
2034  while(useLatex && position!=nodeLabel.npos){
2035  nodeLabel.replace(position, 1, "\\");
2036  }
2037 
2038  string typeFormat = "\\texttt{";
2039  string nodeType = (useLatex) ? typeFormat+node->IsA()->GetName()+"}" : node->IsA()->GetName();
2040 
2041  os << "\"" << nodeName << "\" [ color=" << (node->isFundamental()?"blue":"red")
2042  << ", label=\"" << nodeType << delimiter << nodeLabel << "\"];" << endl ;
2043 
2044  }
2045 
2046  // Get set of all server links
2047  set<pair<RooAbsArg*,RooAbsArg*> > links ;
2048  graphVizAddConnections(links) ;
2049 
2050  // And write them out
2051  for(auto const& link : links) {
2052  os << "\"" << link.first->GetName() << "\" -> \"" << link.second->GetName() << "\";" << endl ;
2053  }
2054 
2055  // Write trailer
2056  os << "}" << endl ;
2057 
2058 }
2059 
2060 ////////////////////////////////////////////////////////////////////////////////
2061 /// Utility function that inserts all point-to-point client-server connections
2062 /// between any two RooAbsArgs in the expression tree headed by this object
2063 /// in the linkSet argument.
2064 
2065 void RooAbsArg::graphVizAddConnections(set<pair<RooAbsArg*,RooAbsArg*> >& linkSet)
2066 {
2067  for (const auto server : _serverList) {
2068  linkSet.insert(make_pair(this,server)) ;
2069  server->graphVizAddConnections(linkSet) ;
2070  }
2071 }
2072 
2073 
2074 
2075 // //_____________________________________________________________________________
2076 // TGraphStruct* RooAbsArg::graph(Bool_t useFactoryTag, Double_t textSize)
2077 // {
2078 // // Return a TGraphStruct object filled with the tree structure of the pdf object
2079 
2080 // TGraphStruct* theGraph = new TGraphStruct() ;
2081 
2082 // // First list all the tree nodes
2083 // RooArgSet nodeSet ;
2084 // treeNodeServerList(&nodeSet) ;
2085 // TIterator* iter = nodeSet.createIterator() ;
2086 // RooAbsArg* node ;
2087 
2088 
2089 // // iterate over nodes
2090 // while((node=(RooAbsArg*)iter->Next())) {
2091 
2092 // // Skip node that represent numeric constants
2093 // if (node->IsA()->InheritsFrom(RooConstVar::Class())) continue ;
2094 
2095 // string nodeName ;
2096 // if (useFactoryTag && node->getStringAttribute("factory_tag")) {
2097 // nodeName = node->getStringAttribute("factory_tag") ;
2098 // } else {
2099 // if (node->isFundamental()) {
2100 // nodeName = node->GetName();
2101 // } else {
2102 // ostringstream oss ;
2103 // node->printStream(oss,(node->defaultPrintContents(0)&(~kValue)),node->defaultPrintStyle(0)) ;
2104 // nodeName= oss.str() ;
2105 // // nodeName = Form("%s::%s",node->IsA()->GetName(),node->GetName());
2106 
2107 // }
2108 // }
2109 // if (strncmp(nodeName.c_str(),"Roo",3)==0) {
2110 // nodeName = string(nodeName.c_str()+3) ;
2111 // }
2112 // node->setStringAttribute("graph_name",nodeName.c_str()) ;
2113 
2114 // TGraphNode* gnode = theGraph->AddNode(nodeName.c_str(),nodeName.c_str()) ;
2115 // gnode->SetLineWidth(2) ;
2116 // gnode->SetTextColor(node->isFundamental()?kBlue:kRed) ;
2117 // gnode->SetTextSize(textSize) ;
2118 // }
2119 // delete iter ;
2120 
2121 // // Get set of all server links
2122 // set<pair<RooAbsArg*,RooAbsArg*> > links ;
2123 // graphVizAddConnections(links) ;
2124 
2125 // // And insert them into the graph
2126 // set<pair<RooAbsArg*,RooAbsArg*> >::iterator liter = links.begin() ;
2127 // for( ; liter != links.end() ; ++liter ) {
2128 
2129 // TGraphNode* n1 = (TGraphNode*)theGraph->GetListOfNodes()->FindObject(liter->first->getStringAttribute("graph_name")) ;
2130 // TGraphNode* n2 = (TGraphNode*)theGraph->GetListOfNodes()->FindObject(liter->second->getStringAttribute("graph_name")) ;
2131 // if (n1 && n2) {
2132 // TGraphEdge* edge = theGraph->AddEdge(n1,n2) ;
2133 // edge->SetLineWidth(2) ;
2134 // }
2135 // }
2136 
2137 // return theGraph ;
2138 // }
2139 
2140 
2141 
2142 // //_____________________________________________________________________________
2143 // Bool_t RooAbsArg::inhibitDirty()
2144 // {
2145 // // Return current status of the inhibitDirty global flag. If true
2146 // // no dirty state change tracking occurs and all caches are considered
2147 // // to be always dirty.
2148 // return _inhibitDirty ;
2149 // }
2150 
2151 
2152 ////////////////////////////////////////////////////////////////////////////////
2153 /// Take ownership of the contents of 'comps'
2154 
2156 {
2157  if (!_ownedComponents) {
2158  _ownedComponents = new RooArgSet("owned components") ;
2159  }
2160  return _ownedComponents->addOwned(comps) ;
2161 }
2162 
2163 
2164 
2165 ////////////////////////////////////////////////////////////////////////////////
2166 /// Clone tree expression of objects. All tree nodes will be owned by
2167 /// the head node return by cloneTree()
2168 
2169 RooAbsArg* RooAbsArg::cloneTree(const char* newname) const
2170 {
2171  // Clone tree using snapshot
2172  RooArgSet* clonedNodes = (RooArgSet*) RooArgSet(*this).snapshot(kTRUE) ;
2173 
2174  // Find the head node in the cloneSet
2175  RooAbsArg* head = clonedNodes->find(*this) ;
2176  assert(head);
2177 
2178  // Remove the head node from the cloneSet
2179  // To release it from the set ownership
2180  clonedNodes->remove(*head) ;
2181 
2182  // Add the set as owned component of the head
2183  head->addOwnedComponents(*clonedNodes) ;
2184 
2185  // Delete intermediate container
2186  clonedNodes->releaseOwnership() ;
2187  delete clonedNodes ;
2188 
2189  // Adjust name of head node if requested
2190  if (newname) {
2191  head->TNamed::SetName(newname) ;
2192  head->_namePtr = (TNamed*) RooNameReg::instance().constPtr(newname) ;
2193  }
2194 
2195  // Return the head
2196  return head ;
2197 }
2198 
2199 
2200 
2201 ////////////////////////////////////////////////////////////////////////////////
2202 
2204 {
2205  if (dynamic_cast<RooTreeDataStore*>(&store)) {
2206  attachToTree(((RooTreeDataStore&)store).tree()) ;
2207  } else if (dynamic_cast<RooVectorDataStore*>(&store)) {
2209  }
2210 }
2211 
2212 
2213 
2214 ////////////////////////////////////////////////////////////////////////////////
2215 
2217 {
2218  if (_eocache) {
2219  return *_eocache ;
2220  } else {
2222  }
2223 }
2224 
2225 
2226 ////////////////////////////////////////////////////////////////////////////////
2227 
2229 {
2230  string suffix ;
2231 
2232  RooArgSet branches ;
2233  branchNodeServerList(&branches) ;
2234  RooFIter iter = branches.fwdIterator();
2235  RooAbsArg* arg ;
2236  while((arg=iter.next())) {
2237  const char* tmp = arg->cacheUniqueSuffix() ;
2238  if (tmp) suffix += tmp ;
2239  }
2240  return Form("%s",suffix.c_str()) ;
2241 }
2242 
2243 
2244 ////////////////////////////////////////////////////////////////////////////////
2245 
2247 {
2248  RooArgSet branches ;
2249  branchNodeServerList(&branches) ;
2250  RooFIter iter = branches.fwdIterator() ;
2251  RooAbsArg* arg ;
2252  while((arg=iter.next())) {
2253 // cout << "wiring caches on node " << arg->GetName() << endl ;
2254  for (deque<RooAbsCache*>::iterator iter2 = arg->_cacheList.begin() ; iter2 != arg->_cacheList.end() ; ++iter2) {
2255  (*iter2)->wireCache() ;
2256  }
2257  }
2258 }
2259 
2260 
2261 
2262 ////////////////////////////////////////////////////////////////////////////////
2263 
2264 void RooAbsArg::SetName(const char* name)
2265 {
2267  TNamed* newPtr = (TNamed*) RooNameReg::instance().constPtr(GetName()) ;
2268  if (newPtr != _namePtr) {
2269  //cout << "Rename '" << _namePtr->GetName() << "' to '" << name << "' (set flag in new name)" << endl;
2270  _namePtr = newPtr;
2272  }
2273 }
2274 
2275 
2276 
2277 
2278 ////////////////////////////////////////////////////////////////////////////////
2279 
2280 void RooAbsArg::SetNameTitle(const char *name, const char *title)
2281 {
2282  TNamed::SetNameTitle(name,title) ;
2283  TNamed* newPtr = (TNamed*) RooNameReg::instance().constPtr(GetName()) ;
2284  if (newPtr != _namePtr) {
2285  //cout << "Rename '" << _namePtr->GetName() << "' to '" << name << "' (set flag in new name)" << endl;
2286  _namePtr = newPtr;
2288  }
2289 }
2290 
2291 
2292 ////////////////////////////////////////////////////////////////////////////////
2293 /// Stream an object of class RooAbsArg.
2294 
2295 void RooAbsArg::Streamer(TBuffer &R__b)
2296 {
2297  if (R__b.IsReading()) {
2298  _ioReadStack.push(this) ;
2299  R__b.ReadClassBuffer(RooAbsArg::Class(),this);
2300  _ioReadStack.pop() ;
2302  _isConstant = getAttribute("Constant") ;
2303  } else {
2304  R__b.WriteClassBuffer(RooAbsArg::Class(),this);
2305  }
2306 }
2307 
2308 ////////////////////////////////////////////////////////////////////////////////
2309 /// Method called by workspace container to finalize schema evolution issues
2310 /// that cannot be handled in a single ioStreamer pass.
2311 ///
2312 /// A second pass is typically needed when evolving data member of RooAbsArg-derived
2313 /// classes that are container classes with references to other members, which may
2314 /// not yet be 'live' in the first ioStreamer() evolution pass.
2315 ///
2316 /// Classes may overload this function, but must call the base method in the
2317 /// overloaded call to ensure base evolution is handled properly
2318 
2320 {
2321  // Handling of v5-v6 migration (TRefArray _proxyList --> RooRefArray _proxyList)
2322  auto iter = _ioEvoList.find(this);
2323  if (iter != _ioEvoList.end()) {
2324 
2325  // Transfer contents of saved TRefArray to RooRefArray now
2326  if (!_proxyList.GetEntriesFast())
2327  _proxyList.Expand(iter->second->GetEntriesFast());
2328  for (int i = 0; i < iter->second->GetEntriesFast(); i++) {
2329  _proxyList.Add(iter->second->At(i));
2330  }
2331  // Delete TRefArray and remove from list
2332  _ioEvoList.erase(iter);
2333  }
2334 }
2335 
2336 
2337 
2338 
2339 ////////////////////////////////////////////////////////////////////////////////
2340 /// Method called by workspace container to finalize schema evolution issues
2341 /// that cannot be handled in a single ioStreamer pass. This static finalize method
2342 /// is called after ioStreamerPass2() is called on each directly listed object
2343 /// in the workspace. It's purpose is to complete schema evolution of any
2344 /// objects in the workspace that are not directly listed as content elements
2345 /// (e.g. analytical convolution tokens )
2346 
2348 {
2349  // Handling of v5-v6 migration (TRefArray _proxyList --> RooRefArray _proxyList)
2350  for (const auto& iter : _ioEvoList) {
2351 
2352  // Transfer contents of saved TRefArray to RooRefArray now
2353  if (!iter.first->_proxyList.GetEntriesFast())
2354  iter.first->_proxyList.Expand(iter.second->GetEntriesFast());
2355  for (int i = 0; i < iter.second->GetEntriesFast(); i++) {
2356  iter.first->_proxyList.Add(iter.second->At(i));
2357  }
2358  }
2359 
2360  _ioEvoList.clear();
2361 }
2362 
2363 
2367 }
2368 
2369 ////////////////////////////////////////////////////////////////////////////////
2370 /// Stream an object of class RooRefArray.
2371 
2372 void RooRefArray::Streamer(TBuffer &R__b)
2373 {
2374  UInt_t R__s, R__c;
2375  if (R__b.IsReading()) {
2376 
2377  Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
2378 
2379  // Make temporary refArray and read that from the streamer
2380  auto refArray = std::make_unique<TRefArray>();
2381  refArray->Streamer(R__b) ;
2382  R__b.CheckByteCount(R__s, R__c, refArray->IsA());
2383 
2384  // Schedule deferred processing of TRefArray into proxy list
2385  RooAbsArg::_ioEvoList[RooAbsArg::_ioReadStack.top()] = std::move(refArray);
2386 
2387  } else {
2388 
2389  R__c = R__b.WriteVersion(RooRefArray::IsA(), kTRUE);
2390 
2391  // Make a temporary refArray and write that to the streamer
2392  TRefArray refArray(GetEntriesFast());
2393  TIterator* iter = MakeIterator() ;
2394  TObject* tmpObj ; while ((tmpObj = iter->Next())) {
2395  refArray.Add(tmpObj) ;
2396  }
2397  delete iter ;
2398 
2399  refArray.Streamer(R__b) ;
2400  R__b.SetByteCount(R__c, kTRUE) ;
2401 
2402  }
2403 }
2404 
2405 /// Print at the prompt
2406 namespace cling {
2407 std::string printValue(RooAbsArg *raa)
2408 {
2409  std::stringstream s;
2410  if (0 == *raa->GetName() && 0 == *raa->GetTitle()) {
2411  s << "An instance of " << raa->ClassName() << ".";
2412  return s.str();
2413  }
2414  raa->printStream(s, raa->defaultPrintContents(""), raa->defaultPrintStyle(""));
2415  return s.str();
2416 }
2417 } // namespace cling
2418 
RooSTLRefCountList::containsByNamePtr
bool containsByNamePtr(const T *obj) const
Check if list contains an item using findByNamePointer().
Definition: RooSTLRefCountList.h:162
RooAbsProxy::print
virtual void print(std::ostream &os, Bool_t addContents=kFALSE) const
Print proxy name.
Definition: RooAbsProxy.cxx:74
RooAbsArg::getCache
RooAbsCache * getCache(Int_t index) const
Return registered cache object by index.
Definition: RooAbsArg.cxx:1949
RooAbsArg::numProxies
Int_t numProxies() const
Return the number of registered proxies.
Definition: RooAbsArg.cxx:1290
RooAbsArg::ADirty
@ ADirty
Definition: RooAbsArg.h:388
RooAbsArg::isValueServer
Bool_t isValueServer(const RooAbsArg &arg) const
Check if this is serving values to arg.
Definition: RooAbsArg.h:217
RooWorkspace.h
RooArgSet::addOwned
Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to an owning set.
Definition: RooArgSet.cxx:274
first
Definition: first.py:1
RooNameReg::instance
static RooNameReg & instance()
Return reference to singleton instance.
Definition: RooNameReg.cxx:51
RooAbsArg::_inhibitDirty
static Bool_t _inhibitDirty
Definition: RooAbsArg.h:652
RooAbsArg::operMode
OperMode operMode() const
Query the operation mode of this node.
Definition: RooAbsArg.h:482
cxcoutF
#define cxcoutF(a)
Definition: RooMsgService.h:101
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
Version_t
short Version_t
Definition: RtypesCore.h:65
RooAbsArg::printTitle
virtual void printTitle(std::ostream &os) const
Print object title.
Definition: RooAbsArg.cxx:1348
RooMsgService.h
RooAbsArg::_boolAttribTransient
std::set< std::string > _boolAttribTransient
Definition: RooAbsArg.h:623
TNamed::SetNameTitle
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition: TNamed.cxx:154
RooAbsCollection::first
RooAbsArg * first() const
Definition: RooAbsCollection.h:177
RooSTLRefCountList::size
std::size_t size() const
Number of contained objects (neglecting the ref count).
Definition: RooSTLRefCountList.h:101
RooAbsArg::_localNoInhibitDirty
Bool_t _localNoInhibitDirty
Cached isConstant status.
Definition: RooAbsArg.h:680
TNamed::SetName
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
Option_t
const char Option_t
Definition: RtypesCore.h:66
RooAbsData
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:49
RooAbsArg::_boolAttrib
std::set< std::string > _boolAttrib
Definition: RooAbsArg.h:621
RooFit.h
RooAbsArg::printArgs
virtual void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
Definition: RooAbsArg.cxx:1375
RooFit::InputArguments
@ InputArguments
Definition: RooGlobalFunc.h:68
RooAbsArg::recursiveCheckObservables
Bool_t recursiveCheckObservables(const RooArgSet *nset) const
Recursively call checkObservables on all nodes in the expression tree.
Definition: RooAbsArg.cxx:738
TBuffer::WriteVersion
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
RooAbsArg::getComponents
RooArgSet * getComponents() const
Create a RooArgSet with all components (branch nodes) of the expression tree headed by this object.
Definition: RooAbsArg.cxx:711
TBuffer::SetByteCount
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
RooArgSet.h
TString::Data
const char * Data() const
Definition: TString.h:369
RooAbsArg::Auto
@ Auto
Definition: RooAbsArg.h:388
TNamed::operator=
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:51
RooPrintable::kStandard
@ kStandard
Definition: RooPrintable.h:34
RooAbsArg::_isConstant
Bool_t _isConstant
Do not persist. Pointer to global instance of string that matches object named.
Definition: RooAbsArg.h:678
RooAbsArg::unRegisterCache
void unRegisterCache(RooAbsCache &cache)
Unregister a RooAbsCache. Called from the RooAbsCache destructor.
Definition: RooAbsArg.cxx:1930
tree
Definition: tree.py:1
RooAbsCache::operModeHook
virtual void operModeHook()
Interface for operation mode changes.
Definition: RooAbsCache.cxx:99
operator<<
ostream & operator<<(ostream &os, RooAbsArg &arg)
Ostream operator.
Definition: RooAbsArg.cxx:1482
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
Form
char * Form(const char *fmt,...)
TObjArray::Remove
virtual TObject * Remove(TObject *obj)
Remove object from array.
Definition: TObjArray.cxx:719
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
RooAbsArg::ioStreamerPass2Finalize
static void ioStreamerPass2Finalize()
Method called by workspace container to finalize schema evolution issues that cannot be handled in a ...
Definition: RooAbsArg.cxx:2347
RooAbsArg::redirectServersHook
virtual Bool_t redirectServersHook(const RooAbsCollection &, Bool_t, Bool_t, Bool_t)
Definition: RooAbsArg.h:263
RooAbsArg::dependsOnValue
Bool_t dependsOnValue(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0) const
Check whether this object depends on values from an element in the serverList.
Definition: RooAbsArg.h:102
RooAbsArg::cleanBranchName
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:1879
RooAbsArg::~RooAbsArg
virtual ~RooAbsArg()
Destructor.
Definition: RooAbsArg.cxx:222
RooSetProxy
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:23
RooAbsArg::Print
virtual void Print(Option_t *options=0) const
Print the object to the defaultPrintStream().
Definition: RooAbsArg.h:320
RooAbsArg::graphVizTree
void graphVizTree(const char *fileName, const char *delimiter="\n", bool useTitle=false, bool useLatex=false)
Create a GraphViz .dot file visualizing the expression tree headed by this RooAbsArg object.
Definition: RooAbsArg.cxx:1995
TBuffer::ReadClassBuffer
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
RooAbsArg::printAttribList
void printAttribList(std::ostream &os) const
Transient boolean attributes (not copied in ctor)
Definition: RooAbsArg.cxx:1500
RooAbsCollection::fwdIterator
RooFIter fwdIterator() const
One-time forward iterator.
Definition: RooAbsCollection.h:134
RooAbsArg::_serverList
RefCountList_t _serverList
Definition: RooAbsArg.h:594
coutE
#define coutE(a)
Definition: RooMsgService.h:33
RooAbsArg::namePtr
const TNamed * namePtr() const
Definition: RooAbsArg.h:530
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
RooAbsArg::writeToStream
virtual void writeToStream(std::ostream &os, Bool_t compact) const =0
RooResolutionModel.h
RooFit::Optimization
@ Optimization
Definition: RooGlobalFunc.h:68
operator=
Binding & operator=(OUT(*fun)(void))
Definition: TRInterface_Binding.h:15
RooAbsArg::SetName
void SetName(const char *name)
Set the name of the TNamed.
Definition: RooAbsArg.cxx:2264
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
RooAbsProxy::name
virtual const char * name() const
Definition: RooAbsProxy.h:40
RooAbsArg.h
RooAbsArg::RefCountListLegacyIterator_t
TIteratorToSTLInterface< RefCountList_t::Container_t > RefCountListLegacyIterator_t
Definition: RooAbsArg.h:75
RooAbsArg::ioStreamerPass2
virtual void ioStreamerPass2()
Method called by workspace container to finalize schema evolution issues that cannot be handled in a ...
Definition: RooAbsArg.cxx:2319
RooAbsArg::checkObservables
virtual Bool_t checkObservables(const RooArgSet *nset) const
Overloadable function in which derived classes can implement consistency checks of the variables.
Definition: RooAbsArg.cxx:729
RooSTLRefCountList::refCount
std::size_t refCount(typename Container_t::const_iterator item) const
Return ref count of item that iterator points to.
Definition: RooSTLRefCountList.h:65
RooAbsArg::getTransientAttribute
Bool_t getTransientAttribute(const Text_t *name) const
Check if a named attribute is set.
Definition: RooAbsArg.cxx:372
RooAbsCollection::remove
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
Definition: RooAbsCollection.cxx:584
RooAbsArg::printMultiline
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Implement multi-line detailed printing.
Definition: RooAbsArg.cxx:1408
RooAbsArg::defaultPrintContents
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default contents to print.
Definition: RooAbsArg.cxx:1398
TNamed::fName
TString fName
Definition: TNamed.h:32
RooAbsArg::isShapeServer
Bool_t isShapeServer(const RooAbsArg &arg) const
Check if this is serving shape to arg.
Definition: RooAbsArg.h:225
RooAbsCollection::find
RooAbsArg * find(const char *name) const
Find object with given name in list.
Definition: RooAbsCollection.cxx:813
TString::Contains
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
RooAbsArg::setOperMode
void setOperMode(OperMode mode, Bool_t recurseADirty=kTRUE)
Set the operation mode of this node.
Definition: RooAbsArg.cxx:1767
TObjArray::GetEntries
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:523
RooAbsArg::treeNodeServerList
void treeNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=0, Bool_t doBranch=kTRUE, Bool_t doLeaf=kTRUE, Bool_t valueOnly=kFALSE, Bool_t recurseNonDerived=kFALSE) const
Fill supplied list with nodes of the arg tree, following all server links, starting with ourself as t...
Definition: RooAbsArg.cxx:536
coutI
#define coutI(a)
Definition: RooMsgService.h:30
RooAbsArg::_clientListShape
RefCountList_t _clientListShape
Definition: RooAbsArg.h:596
TClass.h
RooAbsArg::changeServer
void changeServer(RooAbsArg &server, Bool_t valueProp, Bool_t shapeProp)
Change dirty flag propagation mask for specified server.
Definition: RooAbsArg.cxx:475
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooAbsArg::Compare
Int_t Compare(const TObject *other) const
Utility function used by TCollection::Sort to compare contained TObjects We implement comparison by n...
Definition: RooAbsArg.cxx:1554
RooNameSet.h
RooAbsArg::printCompactTree
void printCompactTree(const char *indent="", const char *fileName=0, const char *namePat=0, RooAbsArg *client=0)
Print tree structure of expression tree on stdout, or to file if filename is specified.
Definition: RooAbsArg.cxx:1794
RooArgProxy::isShapeServer
Bool_t isShapeServer() const
Definition: RooArgProxy.h:65
TRefArray
An array of references to TObjects.
Definition: TRefArray.h:39
RooAbsArg::getProxy
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
Definition: RooAbsArg.cxx:1277
RooAbsArg::inhibitDirty
Bool_t inhibitDirty() const
Delete watch flag.
Definition: RooAbsArg.cxx:116
TBuffer
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
RooConstVar
RooConstVar represent a constant real-valued object.
Definition: RooConstVar.h:26
RooAbsArg::isCloneOf
Bool_t isCloneOf(const RooAbsArg &other) const
Check if this object was created as a clone of 'other'.
Definition: RooAbsArg.cxx:281
TObjArray::At
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
RooAbsProxy::changePointer
virtual Bool_t changePointer(const RooAbsCollection &newServerSet, Bool_t nameChange=kFALSE, Bool_t factoryInitMode=kFALSE)=0
RooAbsArg::attachToVStore
virtual void attachToVStore(RooVectorDataStore &vstore)=0
RooSetProxy.h
RooAbsArg::recursiveRedirectServers
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
Recursively replace all servers with the new servers in newSet.
Definition: RooAbsArg.cxx:1122
TBuffer::CheckByteCount
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
TString
Basic string class.
Definition: TString.h:136
RooAbsCollection::GetName
const char * GetName() const
Returns name of object.
Definition: RooAbsCollection.h:227
RooAbsArg::expensiveObjectCache
RooExpensiveObjectCache & expensiveObjectCache() const
Definition: RooAbsArg.cxx:2216
RooPrintable
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
Definition: RooPrintable.h:25
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
RooWorkspace::set
const RooArgSet * set(const char *name)
Return pointer to previously defined named set with given nmame If no such set is found a null pointe...
Definition: RooWorkspace.cxx:977
RooAbsArg::_fast
Bool_t _fast
Definition: RooAbsArg.h:668
RooAbsArg::makeLegacyIterator
RefCountListLegacyIterator_t * makeLegacyIterator(const RefCountList_t &list) const
Definition: RooAbsArg.cxx:2365
RooSTLRefCountList::empty
bool empty() const
Check if empty.
Definition: RooSTLRefCountList.h:114
TObject::InheritsFrom
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
RooTreeDataStore.h
RooAbsArg::branchNodeServerList
void branchNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=0, Bool_t recurseNonDerived=kFALSE) const
Fill supplied list with all branch nodes of the arg tree starting with ourself as top node.
Definition: RooAbsArg.cxx:520
RooAbsCache::redirectServersHook
virtual Bool_t redirectServersHook(const RooAbsCollection &, Bool_t, Bool_t, Bool_t)
Interface for server redirect calls.
Definition: RooAbsCache.cxx:89
RooExpensiveObjectCache
RooExpensiveObjectCache is a singleton class that serves as repository for objects that are expensive...
Definition: RooExpensiveObjectCache.h:24
bool
TIterator
Iterator abstract base class.
Definition: TIterator.h:30
operator+
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
Definition: TString.cxx:1494
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
RooAbsArg::registerProxy
void registerProxy(RooArgProxy &proxy)
Register an RooArgProxy in the proxy list.
Definition: RooAbsArg.cxx:1168
TObjArray::Add
void Add(TObject *obj)
Definition: TObjArray.h:74
RooAbsArg::graphVizAddConnections
void graphVizAddConnections(std::set< std::pair< RooAbsArg *, RooAbsArg * > > &)
Utility function that inserts all point-to-point client-server connections between any two RooAbsArgs...
Definition: RooAbsArg.cxx:2065
RooRealIntegral
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects.
Definition: RooRealIntegral.h:34
RooSTLRefCountList::end
Container_t::const_iterator end() const
End of contained objects.
Definition: RooSTLRefCountList.h:84
RooAbsArg::findNewServer
RooAbsArg * findNewServer(const RooAbsCollection &newSet, Bool_t nameChange) const
Find the new server in the specified set that matches the old server.
Definition: RooAbsArg.cxx:1077
RooLinkedList::findArg
RooAbsArg * findArg(const RooAbsArg *) const
Return pointer to object with given name in collection.
Definition: RooLinkedList.cxx:675
RooAbsArg::_namePtr
TNamed * _namePtr
Definition: RooAbsArg.h:677
RooSTLRefCountList::begin
Container_t::const_iterator begin() const
Iterator over contained objects.
Definition: RooSTLRefCountList.h:79
RooAbsArg::getParameters
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Definition: RooAbsArg.cxx:578
RooAbsArg::isDerived
virtual Bool_t isDerived() const
Does value or shape of this arg depend on any other arg?
Definition: RooAbsArg.h:92
RooFit::LinkStateMgmt
@ LinkStateMgmt
Definition: RooGlobalFunc.h:67
TObject::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:359
RooTrace.h
RooAbsArg::getCloningAncestors
RooLinkedList getCloningAncestors() const
Return ancestors in cloning chain of this RooAbsArg.
Definition: RooAbsArg.cxx:1968
RooAbsArg::addParameters
void addParameters(RooArgSet &params, const RooArgSet *nset=0, Bool_t stripDisconnected=kTRUE) const
INTERNAL helper function for getParameters()
Definition: RooAbsArg.cxx:587
RooAbsArg::setStringAttribute
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
Definition: RooAbsArg.cxx:323
RooAbsArg::_eocache
RooExpensiveObjectCache * _eocache
Prohibit server redirects – Debugging tool.
Definition: RooAbsArg.h:675
RooPrintable::kName
@ kName
Definition: RooPrintable.h:33
RooAbsArg::_prohibitServerRedirect
Bool_t _prohibitServerRedirect
Set of owned component.
Definition: RooAbsArg.h:673
RooResolutionModel
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
Definition: RooResolutionModel.h:26
TBuffer.h
RooSTLRefCountList::Add
void Add(T *obj, std::size_t initialCount=1)
Add an object or increase refCount if it is already present.
Definition: RooSTLRefCountList.h:51
RooAbsArg::replaceServer
void replaceServer(RooAbsArg &oldServer, RooAbsArg &newServer, Bool_t valueProp, Bool_t shapeProp)
Replace 'oldServer' with 'newServer'.
Definition: RooAbsArg.cxx:464
RooAbsArg::SetNameTitle
void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition: RooAbsArg.cxx:2280
RooAbsArg::operator=
RooAbsArg & operator=(const RooAbsArg &other)
Assign all boolean and string properties of the original object.
Definition: RooAbsArg.cxx:190
RooNameReg::constPtr
const TNamed * constPtr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
Definition: RooNameReg.cxx:61
RooArgProxy
RooArgProxy is the abstract interface for RooAbsArg proxy classes.
Definition: RooArgProxy.h:24
RooSTLRefCountList::reserve
void reserve(std::size_t amount)
Definition: RooSTLRefCountList.h:107
RooAbsArg::isValid
virtual Bool_t isValid() const
WVE (08/21/01) Probably obsolete now.
Definition: RooAbsArg.cxx:1327
RooAbsArg::printComponentTree
void printComponentTree(const char *indent="", const char *namePat=0, Int_t nLevel=999)
Print tree structure of expression tree on given ostream, only branch nodes are printed.
Definition: RooAbsArg.cxx:1854
TObject::SetBit
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
RooAbsArg::_valueDirty
Bool_t _valueDirty
Definition: RooAbsArg.h:663
RooAbsArg::removeServer
void removeServer(RooAbsArg &server, Bool_t force=kFALSE)
Unregister another RooAbsArg as a server to us, ie, declare that we no longer depend on its value and...
Definition: RooAbsArg.cxx:439
RooAbsArg::printAddress
virtual void printAddress(std::ostream &os) const
Print class name of object.
Definition: RooAbsArg.cxx:1364
RooAbsArg::isValueDirty
Bool_t isValueDirty() const
Definition: RooAbsArg.h:419
TObjArray::GetEntriesFast
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
RooAbsArg::registerCache
void registerCache(RooAbsCache &cache)
Register RooAbsCache with this object.
Definition: RooAbsArg.cxx:1921
RooAbsArg::_operMode
OperMode _operMode
Mark batches as dirty (only meaningful for RooAbsReal).
Definition: RooAbsArg.h:667
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
RooAbsCache::printCompactTreeHook
virtual void printCompactTreeHook(std::ostream &, const char *)
Interface for printing of cache guts in tree mode printing.
Definition: RooAbsCache.cxx:117
RooFIter
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
Definition: RooLinkedListIter.h:40
TBuffer::WriteClassBuffer
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
RooArgProxy::absArg
RooAbsArg * absArg() const
Definition: RooArgProxy.h:37
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TString::Append
TString & Append(const char *cs)
Definition: TString.h:564
RooAbsData::get
virtual const RooArgSet * get() const
Definition: RooAbsData.h:92
RooArgSet::add
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
Definition: RooArgSet.cxx:261
RooLinkedList
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
RooSTLRefCountList::RemoveAll
void RemoveAll(const T *obj)
Remove from list irrespective of ref count.
Definition: RooSTLRefCountList.h:193
RooWorkspace::defineSetInternal
Bool_t defineSetInternal(const char *name, const RooArgSet &aset)
Definition: RooWorkspace.cxx:891
RooFIter::next
RooAbsArg * next()
Return next element or nullptr if at end.
Definition: RooLinkedListIter.h:49
RooPrintable::kArgs
@ kArgs
Definition: RooPrintable.h:33
RooAbsArg::attachDataStore
void attachDataStore(const RooAbsDataStore &set)
Replace server nodes with names matching the dataset variable names with those data set variables,...
Definition: RooAbsArg.cxx:1535
RooAbsArg::_clientList
RefCountList_t _clientList
Definition: RooAbsArg.h:595
RooAbsCollection
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
Definition: RooAbsCollection.h:31
RooAbsArg::verboseDirty
static void verboseDirty(Bool_t flag)
Activate verbose messaging related to dirty flag propagation.
Definition: RooAbsArg.cxx:273
RooAbsArg::AClean
@ AClean
Definition: RooAbsArg.h:388
RooAbsArg::RooArgSet
friend class RooArgSet
Definition: RooAbsArg.h:586
RooAbsArg::setProxyNormSet
void setProxyNormSet(const RooArgSet *nset)
Forward a change in the cached normalization argset to all the registered proxies.
Definition: RooAbsArg.cxx:1301
RooAbsCollection::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:437
RooAbsArg::getStringAttribute
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
Definition: RooAbsArg.cxx:336
RooAbsArg::optimizeCacheMode
virtual void optimizeCacheMode(const RooArgSet &observables)
Activate cache mode optimization with given definition of observables.
Definition: RooAbsArg.cxx:1598
TString::BeginsWith
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:615
RooAbsCollection::size
Storage_t::size_type size() const
Definition: RooAbsCollection.h:155
RooSTLRefCountList< RooAbsArg >
RooExpensiveObjectCache::instance
static RooExpensiveObjectCache & instance()
Return reference to singleton instance.
Definition: RooExpensiveObjectCache.cxx:80
RooSTLRefCountList::containedObjects
const Container_t & containedObjects() const
Direct reference to container of objects held by this list.
Definition: RooSTLRefCountList.h:95
RooLinkedList::Add
virtual void Add(TObject *arg)
Definition: RooLinkedList.h:62
RooPrintable::kValue
@ kValue
Definition: RooPrintable.h:33
RooAbsArg::_clientListValue
RefCountList_t _clientListValue
Definition: RooAbsArg.h:597
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
RooAbsArg::printDirty
void printDirty(Bool_t depth=kTRUE) const
Print information about current value dirty state information.
Definition: RooAbsArg.cxx:1566
RooNameReg::kRenamedArg
@ kRenamedArg
Definition: RooNameReg.h:37
RooAbsArg::constOptimizeTestStatistic
virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Interface function signaling a request to perform constant term optimization.
Definition: RooAbsArg.cxx:1754
RooAbsArg::attachDataSet
void attachDataSet(const RooAbsData &set)
Replace server nodes with names matching the dataset variable names with those data set variables,...
Definition: RooAbsArg.cxx:1516
RooListProxy
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:24
RooAbsDataStore::get
virtual const RooArgSet * get(Int_t index) const =0
TBuffer::ReadVersion
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
RooAbsArg::overlaps
Bool_t overlaps(const RooAbsArg &testArg, Bool_t valueOnly=kFALSE) const
Test if any of the nodes of tree are shared with that of the given tree.
Definition: RooAbsArg.cxx:819
RooAbsProxy::changeNormSet
virtual void changeNormSet(const RooArgSet *newNormSet)
Destructor.
Definition: RooAbsProxy.cxx:64
RooSecondMoment.h
RooAbsCollection::releaseOwnership
void releaseOwnership()
Definition: RooAbsCollection.h:240
RooArgProxy::isValueServer
Bool_t isValueServer() const
Definition: RooArgProxy.h:61
RooTreeDataStore
RooTreeDataStore is a TTree-backed data storage.
Definition: RooTreeDataStore.h:32
RooAbsDataStore.h
TIterator::Next
virtual TObject * Next()=0
unsigned int
RooExpensiveObjectCache.h
RooConstVar.h
RooAbsArg::isFundamental
virtual Bool_t isFundamental() const
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
Definition: RooAbsArg.h:243
RooAbsArg::printTree
virtual void printTree(std::ostream &os, TString indent="") const
Print object tree structure.
Definition: RooAbsArg.cxx:1473
TVirtualStreamerInfo.h
RooAbsArg::_shapeDirty
Bool_t _shapeDirty
Definition: RooAbsArg.h:664
RooAbsArg::addServer
void addServer(RooAbsArg &server, Bool_t valueProp=kTRUE, Bool_t shapeProp=kFALSE, std::size_t refCount=1)
Register another RooAbsArg as a server to us, ie, declare that we depend on it.
Definition: RooAbsArg.cxx:388
RooFit::Tracing
@ Tracing
Definition: RooGlobalFunc.h:68
RooAbsArg::isShapeDirty
Bool_t isShapeDirty() const
Definition: RooAbsArg.h:414
TBuffer::IsReading
Bool_t IsReading() const
Definition: TBuffer.h:86
RooNameSet
RooNameSet is a utility class that stores the names the objects in a RooArget.
Definition: RooNameSet.h:24
RooAbsArg::cacheUniqueSuffix
virtual const char * cacheUniqueSuffix() const
Definition: RooAbsArg.h:496
RooAbsArg::OperMode
OperMode
Definition: RooAbsArg.h:388
RooListProxy.h
RooAbsArg::readFromStream
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)=0
RooAbsArg::aggregateCacheUniqueSuffix
const char * aggregateCacheUniqueSuffix() const
Definition: RooAbsArg.cxx:2228
RooPrintable::kClassName
@ kClassName
Definition: RooPrintable.h:33
RooAbsData.h
RooAbsArg::setShapeDirty
void setShapeDirty()
Notify that a shape-like property (e.g. binning) has changed.
Definition: RooAbsArg.h:493
RooAbsArg::getObservables
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Return the observables of this pdf given a set of observables.
Definition: RooAbsArg.h:294
RooAbsArg::getParametersHook
virtual void getParametersHook(const RooArgSet *, RooArgSet *, Bool_t) const
Definition: RooAbsArg.h:553
RooAbsArg::addOwnedComponents
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
Definition: RooAbsArg.cxx:2155
RooAbsArg::_proxyList
RooRefArray _proxyList
Definition: RooAbsArg.h:599
RooAbsArg::leafNodeServerList
void leafNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=0, Bool_t recurseNonDerived=kFALSE) const
Fill supplied list with all leaf nodes of the arg tree, starting with ourself as top node.
Definition: RooAbsArg.cxx:509
RooAbsArg::setTransientAttribute
void setTransientAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:350
TObjArray::MakeIterator
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Returns an array iterator.
Definition: TObjArray.cxx:649
TObjArray::FindObject
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:415
RooAbsCategoryLValue.h
RooAbsCache
RooAbsCache is the abstract base class for data members of RooAbsArgs that cache other (composite) Ro...
Definition: RooAbsCache.h:27
TObjArray::Expand
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
Definition: TObjArray.cxx:387
RooVectorDataStore
RooVectorDataStore uses std::vectors to store data columns.
Definition: RooVectorDataStore.h:37
RooAbsArg::_stringAttrib
std::map< std::string, std::string > _stringAttrib
Definition: RooAbsArg.h:622
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
coutF
#define coutF(a)
Definition: RooMsgService.h:34
RooAbsArg::setAttribute
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:291
RooNameSet::content
const char * content() const
Definition: RooNameSet.h:50
RooAbsArg::cloneTree
virtual RooAbsArg * cloneTree(const char *newname=0) const
Clone tree expression of objects.
Definition: RooAbsArg.cxx:2169
name
char name[80]
Definition: TGX11.cxx:110
RooAbsArg::redirectServers
Bool_t redirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t isRecursionStep=kFALSE)
Replace all direct servers of this object with the new servers in newServerList.
Definition: RooAbsArg.cxx:959
RooAbsArg::dependsOn
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:764
RooPrintable::kTitle
@ kTitle
Definition: RooPrintable.h:33
RooPrintable::printStream
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,...
Definition: RooPrintable.cxx:75
RooAbsArg::wireAllCaches
void wireAllCaches()
Definition: RooAbsArg.cxx:2246
RooPrintable::kSingleLine
@ kSingleLine
Definition: RooPrintable.h:34
TObjArray::Compress
virtual void Compress()
Remove empty slots from array.
Definition: TObjArray.cxx:334
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooAbsArg::setValueDirty
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
Definition: RooAbsArg.h:488
RMakeUnique.hxx
RooRealIntegral.h
RooAbsProxy
RooAbsProxy is the abstact interface for proxy classes.
Definition: RooAbsProxy.h:30
RooAbsCollection::Print
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
Definition: RooAbsCollection.h:200
RooAbsArg::printClassName
virtual void printClassName(std::ostream &os) const
Print object class name.
Definition: RooAbsArg.cxx:1358
RooAbsArg::setDirtyInhibit
static void setDirtyInhibit(Bool_t flag)
Control global dirty inhibit mode.
Definition: RooAbsArg.cxx:264
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
RooAbsCache::findConstantNodes
virtual void findConstantNodes(const RooArgSet &, RooArgSet &, RooLinkedList &)
Interface for constant term node finding calls.
Definition: RooAbsCache.cxx:108
RooAbsArg::_deleteWatch
Bool_t _deleteWatch
Definition: RooAbsArg.h:653
RooAbsArg::getVariables
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
Definition: RooAbsArg.cxx:1958
RooVectorDataStore.h
RooAbsArg::_cacheList
std::deque< RooAbsCache * > _cacheList
Definition: RooAbsArg.h:600
RooAbsCache::optimizeCacheMode
virtual void optimizeCacheMode(const RooArgSet &, RooArgSet &, RooLinkedList &)
Interface for processing of cache mode optimization calls.
Definition: RooAbsCache.cxx:80
RooAbsArg::findServer
RooAbsArg * findServer(const char *name) const
Return server of this with name name. Returns nullptr if not found.
Definition: RooAbsArg.h:203
RooAbsDataStore
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
Definition: RooAbsDataStore.h:34
RooAbsArg::ConstOpCode
ConstOpCode
Definition: RooAbsArg.h:386
Text_t
char Text_t
Definition: RtypesCore.h:62
RooAbsArg::_myws
RooWorkspace * _myws
Prevent 'AlwaysDirty' mode for this node.
Definition: RooAbsArg.h:685
RooAbsArg::operModeHook
virtual void operModeHook()
Definition: RooAbsArg.h:547
RooAbsArg::_ownedComponents
RooArgSet * _ownedComponents
Definition: RooAbsArg.h:671
RooPrintable::defaultPrintStyle
virtual StyleOption defaultPrintStyle(Option_t *opt) const
Definition: RooPrintable.cxx:241
Class
void Class()
Definition: Class.C:29
RooFit::Integration
@ Integration
Definition: RooGlobalFunc.h:67
RooAbsArg::_allBatchesDirty
bool _allBatchesDirty
Definition: RooAbsArg.h:665
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooAbsArg::numCaches
Int_t numCaches() const
Return number of registered caches.
Definition: RooAbsArg.cxx:1940
RooAbsArg::_verboseDirty
static Bool_t _verboseDirty
Definition: RooAbsArg.h:651
RooAbsArg::unRegisterProxy
void unRegisterProxy(RooArgProxy &proxy)
Remove proxy from proxy list.
Definition: RooAbsArg.cxx:1196
RooFit::Contents
@ Contents
Definition: RooGlobalFunc.h:69
TObject::ClassName
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:130
RooAbsArg::observableOverlaps
Bool_t observableOverlaps(const RooAbsData *dset, const RooAbsArg &testArg) const
Test if any of the dependents of the arg tree (as determined by getObservables) overlaps with those o...
Definition: RooAbsArg.cxx:833
RooAbsArg::addServerList
void addServerList(RooAbsCollection &serverList, Bool_t valueProp=kTRUE, Bool_t shapeProp=kFALSE)
Register a list of RooAbsArg as servers to us by calling addServer() for each arg in the list.
Definition: RooAbsArg.cxx:424
cxcoutI
#define cxcoutI(a)
Definition: RooMsgService.h:85
RooAbsRealLValue.h
RooAbsArg::attachToStore
void attachToStore(RooAbsDataStore &store)
Attach this argument to the data store such that it reads data from there.
Definition: RooAbsArg.cxx:2203
RooAbsCollection::selectByAttrib
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...
Definition: RooAbsCollection.cxx:677
RooAbsArg::printCompactTreeHook
virtual void printCompactTreeHook(std::ostream &os, const char *ind="")
Hook function interface for object to insert additional information when printed in the context of a ...
Definition: RooAbsArg.cxx:1908
RooAbsArg::printName
virtual void printName(std::ostream &os) const
Print object name.
Definition: RooAbsArg.cxx:1338
RooAbsArg::findConstantNodes
Bool_t findConstantNodes(const RooArgSet &observables, RooArgSet &cacheList)
Find branch nodes with all-constant parameters, and add them to the list of nodes that can be cached ...
Definition: RooAbsArg.cxx:1661
TIteratorToSTLInterface
TIterator and GenericRooFIter front end with STL back end.
Definition: RooLinkedListIter.h:98
RooAbsArg::isConstant
Bool_t isConstant() const
Check if the "Constant" attribute is set.
Definition: RooAbsArg.h:360
RooAbsCollection::reserve
void reserve(Storage_t::size_type count)
Definition: RooAbsCollection.h:163
RooAbsCollection::sort
void sort(Bool_t reverse=false)
Sort collection using std::sort and name comparison.
Definition: RooAbsCollection.cxx:1266
RooArgProxy.h
RooResolutionModel::isConvolved
Bool_t isConvolved()
Definition: RooResolutionModel.h:53
RooAbsCollection::getSize
Int_t getSize() const
Definition: RooAbsCollection.h:172
operator>>
istream & operator>>(istream &is, RooAbsArg &arg)
Istream operator.
Definition: RooAbsArg.cxx:1491
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
RooSTLRefCountList::Remove
void Remove(const T *obj, bool force=false)
Decrease ref count of given object.
Definition: RooSTLRefCountList.h:176
cxcoutD
#define cxcoutD(a)
Definition: RooMsgService.h:81
RooAbsArg::RooAbsArg
RooAbsArg()
Default constructor.
Definition: RooAbsArg.cxx:125
int
RooAbsArg::getAttribute
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
Definition: RooAbsArg.cxx:314
RooAbsArg::attachToTree
virtual void attachToTree(TTree &t, Int_t bufSize=32000)=0
Overloadable function for derived classes to implement attachment as branch to a TTree.
Definition: RooAbsArg.cxx:1316
RooAbsArg::printMetaArgs
virtual void printMetaArgs(std::ostream &) const
Definition: RooAbsArg.h:330
RooPrintable::printValue
virtual void printValue(std::ostream &os) const
Interface to print value of object.
Definition: RooPrintable.cxx:155