Logo ROOT  
Reference Guide
RooAbsOptTestStatistic.cxx
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * @(#)root/roofitcore:$Id$
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 
17 /**
18 \file RooAbsOptTestStatistic.cxx
19 \class RooAbsOptTestStatistic
20 \ingroup Roofitcore
21 
22 RooAbsOptTestStatistic is the abstract base class for test
23 statistics objects that evaluate a function or PDF at each point of a given
24 dataset. This class provides generic optimizations, such as
25 caching and precalculation of constant terms that can be made for
26 all such quantities.
27 
28 Implementations should define evaluatePartition(), which calculates the
29 value of a (sub)range of the dataset and optionally combinedValue(),
30 which combines the values calculated for each partition. If combinedValue()
31 is not overloaded, the default implementation will add the partition results
32 to obtain the combined result.
33 
34 Support for calculation in partitions is needed to allow multi-core
35 parallelized calculation of test statistics.
36 **/
37 
38 #include "RooFit.h"
39 
40 #include "Riostream.h"
41 #include <string.h>
42 
43 
44 #include "RooAbsOptTestStatistic.h"
45 #include "RooMsgService.h"
46 #include "RooAbsPdf.h"
47 #include "RooAbsData.h"
48 #include "RooDataHist.h"
49 #include "RooArgSet.h"
50 #include "RooRealVar.h"
51 #include "RooErrorHandler.h"
52 #include "RooGlobalFunc.h"
53 #include "RooBinning.h"
54 #include "RooAbsDataStore.h"
55 #include "RooCategory.h"
56 #include "RooDataSet.h"
57 #include "RooProdPdf.h"
58 #include "RooAddPdf.h"
59 #include "RooProduct.h"
60 #include "RooRealSumPdf.h"
61 #include "RooTrace.h"
62 #include "RooVectorDataStore.h"
63 #include "RooBinSamplingPdf.h"
64 
65 using namespace std;
66 
68 ;
69 
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Default Constructor
73 
75 {
76  // Initialize all non-persisted data members
77 
78  _funcObsSet = 0 ;
79  _funcCloneSet = 0 ;
80  _funcClone = 0 ;
81 
82  _normSet = 0 ;
83  _projDeps = 0 ;
84 
85  _origFunc = 0 ;
86  _origData = 0 ;
87 
88  _ownData = kTRUE ;
89  _sealed = kFALSE ;
90  _optimized = kFALSE ;
91 }
92 
93 
94 
95 ////////////////////////////////////////////////////////////////////////////////
96 /// Create a test statistic, and optimise its calculation.
97 /// \param[in] name Name of the instance.
98 /// \param[in] title Title (for e.g. plotting).
99 /// \param[in] real Function to evaluate.
100 /// \param[in] indata Dataset for which to compute test statistic.
101 /// \param[in] projDeps A set of projected observables.
102 /// \param[in] rangeName If not null, only events in the dataset inside the range will be used in the test
103 /// statistic calculation.
104 /// \param[in] addCoefRangeName If not null, all RooAddPdf components of `real` will be
105 /// instructed to fix their fraction definitions to the given named range.
106 /// \param[in] nCPU If > 1, the test statistic calculation will be parallelised over multiple processes. By default, the data
107 /// is split with 'bulk' partitioning (each process calculates a contiguous block of fraction 1/nCPU
108 /// of the data). For binned data, this approach may be suboptimal as the number of bins with >0 entries
109 /// in each processing block may vary greatly; thereby distributing the workload rather unevenly.
110 /// \param[in] interleave Strategy how to distribute events among workers. If an interleave partitioning strategy is used where each partition
111 /// i takes all bins for which (ibin % ncpu == i), an even distribution of work is more likely.
112 /// \param[in] splitCutRange If true, a different rangeName constructed as `rangeName_{catName}` will be used
113 /// as range definition for each index state of a RooSimultaneous.
114 /// \param[in] cloneInputData Not used. Data is always cloned.
115 /// \param[in] integrateOverBinsPrecision If > 0, PDF in binned fits are integrated over the bins. This sets the precision. If = 0,
116 /// only unbinned PDFs fit to RooDataHist are integrated. If < 0, PDFs are never integrated.
117 RooAbsOptTestStatistic::RooAbsOptTestStatistic(const char *name, const char *title, RooAbsReal& real,
118  RooAbsData& indata, const RooArgSet& projDeps,
120  RooAbsTestStatistic(name,title,real,indata,projDeps,cfg),
121  _projDeps(0),
122  _sealed(kFALSE),
123  _optimized(kFALSE),
124  _integrateBinsPrecision(cfg.integrateOverBinsPrecision)
125 {
126  // Don't do a thing in master mode
127 
128  if (operMode()!=Slave) {
129  _funcObsSet = 0 ;
130  _funcCloneSet = 0 ;
131  _funcClone = 0 ;
132  _normSet = 0 ;
133  _projDeps = 0 ;
134  _origFunc = 0 ;
135  _origData = 0 ;
136  _ownData = kFALSE ;
137  _sealed = kFALSE ;
138  return ;
139  }
140 
141  _origFunc = 0 ; //other._origFunc ;
142  _origData = 0 ; // other._origData ;
143 
144  initSlave(real, indata, projDeps, _rangeName.c_str(), _addCoefRangeName.c_str()) ;
145 }
146 
147 ////////////////////////////////////////////////////////////////////////////////
148 /// Copy constructor
149 
151  RooAbsTestStatistic(other,name), _sealed(other._sealed), _sealNotice(other._sealNotice), _optimized(kFALSE),
152  _integrateBinsPrecision(other._integrateBinsPrecision)
153 {
154  // Don't do a thing in master mode
155  if (operMode()!=Slave) {
156 
157  _funcObsSet = 0 ;
158  _funcCloneSet = 0 ;
159  _funcClone = 0 ;
160  _normSet = other._normSet ? ((RooArgSet*) other._normSet->snapshot()) : 0 ;
161  _projDeps = 0 ;
162  _origFunc = 0 ;
163  _origData = 0 ;
164  _ownData = kFALSE ;
165  return ;
166  }
167 
168  _origFunc = 0 ; //other._origFunc ;
169  _origData = 0 ; // other._origData ;
170  _projDeps = 0 ;
171 
172  initSlave(*other._funcClone,*other._dataClone,other._projDeps?*other._projDeps:RooArgSet(),other._rangeName.c_str(),other._addCoefRangeName.c_str()) ;
173 }
174 
175 
176 
177 ////////////////////////////////////////////////////////////////////////////////
178 
179 void RooAbsOptTestStatistic::initSlave(RooAbsReal& real, RooAbsData& indata, const RooArgSet& projDeps, const char* rangeName,
180  const char* addCoefRangeName) {
181  // ******************************************************************
182  // *** PART 1 *** Clone incoming pdf, attach to each other *
183  // ******************************************************************
184 
185  // Clone FUNC
186  _funcClone = static_cast<RooAbsReal*>(real.cloneTree());
187  _funcCloneSet = 0 ;
188 
189  // Attach FUNC to data set
191 
192  if (_funcClone->getAttribute("BinnedLikelihood")) {
193  _funcClone->setAttribute("BinnedLikelihoodActive") ;
194  }
195 
196  // Reattach FUNC to original parameters
197  RooArgSet* origParams = (RooArgSet*) real.getParameters(indata) ;
198  _funcClone->recursiveRedirectServers(*origParams) ;
199 
200  // Mark all projected dependents as such
201  if (projDeps.getSize()>0) {
202  RooArgSet *projDataDeps = (RooArgSet*) _funcObsSet->selectCommon(projDeps) ;
203  projDataDeps->setAttribAll("projectedDependent") ;
204  delete projDataDeps ;
205  }
206 
207  // If PDF is a RooProdPdf (with possible constraint terms)
208  // analyze pdf for actual parameters (i.e those in unconnected constraint terms should be
209  // ignored as here so that the test statistic will not be recalculated if those
210  // are changed
211  RooProdPdf* pdfWithCons = dynamic_cast<RooProdPdf*>(_funcClone) ;
212  if (pdfWithCons) {
213 
214  RooArgSet* connPars = pdfWithCons->getConnectedParameters(*indata.get()) ;
215  // Add connected parameters as servers
216  _paramSet.removeAll() ;
217  _paramSet.add(*connPars) ;
218  delete connPars ;
219 
220  } else {
221  // Add parameters as servers
222  _paramSet.add(*origParams) ;
223  }
224 
225 
226  delete origParams ;
227 
228  // Store normalization set
229  _normSet = (RooArgSet*) indata.get()->snapshot(kFALSE) ;
230 
231  // Expand list of observables with any observables used in parameterized ranges.
232  // This NEEDS to be a counting loop since we are inserting during the loop.
233  for (std::size_t i = 0; i < _funcObsSet->size(); ++i) {
234  auto realDepRLV = dynamic_cast<const RooAbsRealLValue*>((*_funcObsSet)[i]);
235  if (realDepRLV && realDepRLV->isDerived()) {
236  RooArgSet tmp2;
237  realDepRLV->leafNodeServerList(&tmp2, 0, kTRUE);
238  _funcObsSet->add(tmp2,kTRUE);
239  }
240  }
241 
242 
243 
244  // ******************************************************************
245  // *** PART 2 *** Clone and adjust incoming data, attach to PDF *
246  // ******************************************************************
247 
248  // Check if the fit ranges of the dependents in the data and in the FUNC are consistent
249  const RooArgSet* dataDepSet = indata.get() ;
250  for (const auto arg : *_funcObsSet) {
251 
252  // Check that both dataset and function argument are of type RooRealVar
253  RooRealVar* realReal = dynamic_cast<RooRealVar*>(arg) ;
254  if (!realReal) continue ;
255  RooRealVar* datReal = dynamic_cast<RooRealVar*>(dataDepSet->find(realReal->GetName())) ;
256  if (!datReal) continue ;
257 
258  // Check that range of observables in pdf is equal or contained in range of observables in data
259 
260  if (!realReal->getBinning().lowBoundFunc() && realReal->getMin()<(datReal->getMin()-1e-6)) {
261  coutE(InputArguments) << "RooAbsOptTestStatistic: ERROR minimum of FUNC observable " << arg->GetName()
262  << "(" << realReal->getMin() << ") is smaller than that of "
263  << arg->GetName() << " in the dataset (" << datReal->getMin() << ")" << endl ;
265  return ;
266  }
267 
268  if (!realReal->getBinning().highBoundFunc() && realReal->getMax()>(datReal->getMax()+1e-6)) {
269  coutE(InputArguments) << "RooAbsOptTestStatistic: ERROR maximum of FUNC observable " << arg->GetName()
270  << " is larger than that of " << arg->GetName() << " in the dataset" << endl ;
272  return ;
273  }
274  }
275 
276  // Copy data and strip entries lost by adjusted fit range, _dataClone ranges will be copied from realDepSet ranges
277  if (rangeName && strlen(rangeName)) {
279  // cout << "RooAbsOptTestStatistic: reducing dataset to fit in range named " << rangeName << " resulting dataset has " << _dataClone->sumEntries() << " events" << endl ;
280  } else {
281  _dataClone = (RooAbsData*) indata.Clone() ;
282  }
283  _ownData = kTRUE ;
284 
285 
286  // ******************************************************************
287  // *** PART 3 *** Make adjustments for fit ranges, if specified *
288  // ******************************************************************
289 
290  std::unique_ptr<RooArgSet> origObsSet( real.getObservables(indata) );
291  RooArgSet* dataObsSet = (RooArgSet*) _dataClone->get() ;
292  if (rangeName && strlen(rangeName)) {
293  cxcoutI(Fitting) << "RooAbsOptTestStatistic::ctor(" << GetName() << ") constructing test statistic for sub-range named " << rangeName << endl ;
294 
295  bool observablesKnowRange = false;
296  // Adjust FUNC normalization ranges to requested fitRange, store original ranges for RooAddPdf coefficient interpretation
297  for (const auto arg : *_funcObsSet) {
298 
299  RooRealVar* realObs = dynamic_cast<RooRealVar*>(arg) ;
300  if (realObs) {
301 
302  observablesKnowRange |= realObs->hasRange(rangeName);
303 
304  // If no explicit range is given for RooAddPdf coefficients, create explicit named range equivalent to original observables range
305  if (!(addCoefRangeName && strlen(addCoefRangeName))) {
306  realObs->setRange(Form("NormalizationRangeFor%s",rangeName),realObs->getMin(),realObs->getMax()) ;
307  }
308 
309  // Adjust range of function observable to those of given named range
310  realObs->setRange(realObs->getMin(rangeName),realObs->getMax(rangeName)) ;
311 
312  // Adjust range of data observable to those of given named range
313  RooRealVar* dataObs = (RooRealVar*) dataObsSet->find(realObs->GetName()) ;
314  dataObs->setRange(realObs->getMin(rangeName),realObs->getMax(rangeName)) ;
315 
316  // Keep track of list of fit ranges in string attribute fit range of original p.d.f.
317  if (!_splitRange) {
318  const std::string fitRangeName = std::string("fit_") + GetName();
319  const char* origAttrib = real.getStringAttribute("fitrange") ;
320  std::string newAttr = origAttrib ? origAttrib : "";
321 
322  if (newAttr.find(fitRangeName) == std::string::npos) {
323  newAttr += (newAttr.empty() ? "" : ",") + fitRangeName;
324  }
325  real.setStringAttribute("fitrange", newAttr.c_str());
326  RooRealVar* origObs = (RooRealVar*) origObsSet->find(arg->GetName()) ;
327  if (origObs) {
328  origObs->setRange(fitRangeName.c_str(), realObs->getMin(rangeName), realObs->getMax(rangeName));
329  }
330  }
331  }
332  }
333 
334  if (!observablesKnowRange)
335  coutW(Fitting) << "None of the fit observables seem to know the range '" << rangeName << "'. This means that the full range will be used." << std::endl;
336  }
337 
338 
339  // ******************************************************************
340  // *** PART 3.2 *** Binned fits *
341  // ******************************************************************
342 
343  // If dataset is binned, activate caching of bins that are invalid because the're outside the
344  // updated range definition (WVE need to add virtual interface here)
345  RooDataHist* tmph = dynamic_cast<RooDataHist*>(_dataClone) ;
346  if (tmph) {
347  tmph->cacheValidEntries() ;
348  }
349 
351 
352 
353  // Fix RooAddPdf coefficients to original normalization range
354  if (rangeName && strlen(rangeName)) {
355 
356  // WVE Remove projected dependents from normalization
358 
359  if (addCoefRangeName && strlen(addCoefRangeName)) {
360  cxcoutI(Fitting) << "RooAbsOptTestStatistic::ctor(" << GetName()
361  << ") fixing interpretation of coefficients of any RooAddPdf component to range " << addCoefRangeName << endl ;
362  _funcClone->fixAddCoefRange(addCoefRangeName,kFALSE) ;
363  } else {
364  cxcoutI(Fitting) << "RooAbsOptTestStatistic::ctor(" << GetName()
365  << ") fixing interpretation of coefficients of any RooAddPdf to full domain of observables " << endl ;
366  _funcClone->fixAddCoefRange(Form("NormalizationRangeFor%s",rangeName),kFALSE) ;
367  }
368  }
369 
370 
371  // This is deferred from part 2 - but must happen after part 3 - otherwise invalid bins cannot be properly marked in cacheValidEntries
374 
375 
376 
377 
378  // *********************************************************************
379  // *** PART 4 *** Adjust normalization range for projected observables *
380  // *********************************************************************
381 
382  // Remove projected dependents from normalization set
383  if (projDeps.getSize()>0) {
384 
385  _projDeps = (RooArgSet*) projDeps.snapshot(kFALSE) ;
386 
387  //RooArgSet* tobedel = (RooArgSet*) _normSet->selectCommon(*_projDeps) ;
389 
390  // Mark all projected dependents as such
391  RooArgSet *projDataDeps = (RooArgSet*) _funcObsSet->selectCommon(*_projDeps) ;
392  projDataDeps->setAttribAll("projectedDependent") ;
393  delete projDataDeps ;
394  }
395 
396 
397  coutI(Optimization) << "RooAbsOptTestStatistic::ctor(" << GetName() << ") optimizing internal clone of p.d.f for likelihood evaluation."
398  << "Lazy evaluation and associated change tracking will disabled for all nodes that depend on observables" << endl ;
399 
400 
401  // *********************************************************************
402  // *** PART 4 *** Finalization and activation of optimization *
403  // *********************************************************************
404 
405  // Redirect pointers of base class to clone
406  _func = _funcClone ;
407  _data = _dataClone ;
408 
410 
411  optimizeCaching() ;
412 
413 }
414 
415 
416 ////////////////////////////////////////////////////////////////////////////////
417 /// Destructor
418 
420 {
421  if (operMode()==Slave) {
422  delete _funcClone ;
423  delete _funcObsSet ;
424  if (_projDeps) {
425  delete _projDeps ;
426  }
427  if (_ownData) {
428  delete _dataClone ;
429  }
430  }
431  delete _normSet ;
432 }
433 
434 
435 
436 ////////////////////////////////////////////////////////////////////////////////
437 /// Method to combined test statistic results calculated into partitions into
438 /// the global result. This default implementation adds the partition return
439 /// values
440 
442 {
443  // Default implementation returns sum of components
444  Double_t sum(0), carry(0);
445  for (Int_t i = 0; i < n; ++i) {
446  Double_t y = array[i]->getValV();
447  carry += reinterpret_cast<RooAbsOptTestStatistic*>(array[i])->getCarry();
448  y -= carry;
449  const Double_t t = sum + y;
450  carry = (t - sum) - y;
451  sum = t;
452  }
453  _evalCarry = carry;
454  return sum ;
455 }
456 
457 
458 
459 ////////////////////////////////////////////////////////////////////////////////
460 /// Catch server redirect calls and forward to internal clone of function
461 
462 Bool_t RooAbsOptTestStatistic::redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
463 {
464  RooAbsTestStatistic::redirectServersHook(newServerList,mustReplaceAll,nameChange,isRecursive) ;
465  if (operMode()!=Slave) return kFALSE ;
466  Bool_t ret = _funcClone->recursiveRedirectServers(newServerList,kFALSE,nameChange) ;
467  return ret ;
468 }
469 
470 
471 
472 ////////////////////////////////////////////////////////////////////////////////
473 /// Catch print hook function and forward to function clone
474 
476 {
478  if (operMode()!=Slave) return ;
479  TString indent2(indent) ;
480  indent2 += "opt >>" ;
481  _funcClone->printCompactTree(os,indent2.Data()) ;
482  os << indent2 << " dataset clone = " << _dataClone << " first obs = " << _dataClone->get()->first() << endl ;
483 }
484 
485 
486 
487 ////////////////////////////////////////////////////////////////////////////////
488 /// Driver function to propagate constant term optimizations in test statistic.
489 /// If code Activate is sent, constant term optimization will be executed.
490 /// If code Deactivate is sent, any existing constant term optimizations will
491 /// be abandoned. If codes ConfigChange or ValueChange are sent, any existing
492 /// constant term optimizations will be redone.
493 
495 {
496  // cout << "ROATS::constOpt(" << GetName() << ") funcClone structure dump BEFORE const-opt" << endl ;
497  // _funcClone->Print("t") ;
498 
499  RooAbsTestStatistic::constOptimizeTestStatistic(opcode,doAlsoTrackingOpt);
500  if (operMode()!=Slave) return ;
501 
502  if (_dataClone->hasFilledCache() && _dataClone->store()->cacheOwner()!=this) {
503  if (opcode==Activate) {
504  cxcoutW(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
505  << ") dataset cache is owned by another object, no constant term optimization can be applied" << endl ;
506  }
507  return ;
508  }
509 
510  if (!allowFunctionCache()) {
511  if (opcode==Activate) {
512  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
513  << ") function caching prohibited by test statistic, no constant term optimization is applied" << endl ;
514  }
515  return ;
516  }
517 
518  if (_dataClone->hasFilledCache() && opcode==Activate) {
519  opcode=ValueChange ;
520  }
521 
522  switch(opcode) {
523  case Activate:
524  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
525  << ") optimizing evaluation of test statistic by finding all nodes in p.d.f that depend exclusively"
526  << " on observables and constant parameters and precalculating their values" << endl ;
527  optimizeConstantTerms(kTRUE,doAlsoTrackingOpt) ;
528  break ;
529 
530  case DeActivate:
531  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
532  << ") deactivating optimization of constant terms in test statistic" << endl ;
534  break ;
535 
536  case ConfigChange:
537  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
538  << ") one ore more parameter were changed from constant to floating or vice versa, "
539  << "re-evaluating constant term optimization" << endl ;
541  optimizeConstantTerms(kTRUE,doAlsoTrackingOpt) ;
542  break ;
543 
544  case ValueChange:
545  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
546  << ") the value of one ore more constant parameter were changed re-evaluating constant term optimization" << endl ;
547  // Request a forcible cache update of all cached nodes
549 
550  break ;
551  }
552 
553 // cout << "ROATS::constOpt(" << GetName() << ") funcClone structure dump AFTER const-opt" << endl ;
554 // _funcClone->Print("t") ;
555 }
556 
557 
558 
559 ////////////////////////////////////////////////////////////////////////////////
560 /// This method changes the value caching logic for all nodes that depends on any of the observables
561 /// as defined by the given dataset. When evaluating a test statistic constructed from the RooAbsReal
562 /// with a dataset the observables are guaranteed to change with every call, thus there is no point
563 /// in tracking these changes which result in a net overhead. Thus for observable-dependent nodes,
564 /// the evaluation mechanism is changed from being dependent on a 'valueDirty' flag to guaranteed evaluation.
565 /// On the dataset side, the observables objects are modified to no longer send valueDirty messages
566 /// to their client
567 
569 {
570 // cout << "RooAbsOptTestStatistic::optimizeCaching(" << GetName() << "," << this << ")" << endl ;
571 
572  // Trigger create of all object caches now in nodes that have deferred object creation
573  // so that cache contents can be processed immediately
575 
576  // Set value caching mode for all nodes that depend on any of the observables to ADirty
578 
579  // Disable propagation of dirty state flags for observables
581 
582  // Disable reading of observables that are not used
584 }
585 
586 
587 
588 ////////////////////////////////////////////////////////////////////////////////
589 /// Driver function to activate global constant term optimization.
590 /// If activated, constant terms are found and cached with the dataset.
591 /// The operation mode of cached nodes is set to AClean meaning that
592 /// their getVal() call will never result in an evaluate call.
593 /// Finally the branches in the dataset that correspond to observables
594 /// that are exclusively used in constant terms are disabled as
595 /// they serve no more purpose
596 
598 {
599  if(activate) {
600 
601  if (_optimized) {
602  return ;
603  }
604 
605  // Trigger create of all object caches now in nodes that have deferred object creation
606  // so that cache contents can be processed immediately
608 
609  // Apply tracking optimization here. Default strategy is to track components
610  // of RooAddPdfs and RooRealSumPdfs. If these components are a RooProdPdf
611  // or a RooProduct respectively, track the components of these products instead
612  // of the product term
613  RooArgSet trackNodes ;
614 
615 
616  // Add safety check here - applyTrackingOpt will only be applied if present
617  // dataset is constructed in terms of a RooVectorDataStore
618  if (applyTrackingOpt) {
619  if (!dynamic_cast<RooVectorDataStore*>(_dataClone->store())) {
620  coutW(Optimization) << "RooAbsOptTestStatistic::optimizeConstantTerms(" << GetName()
621  << ") WARNING Cache-and-track optimization (Optimize level 2) is only available for datasets"
622  << " implement in terms of RooVectorDataStore - ignoring this option for current dataset" << endl ;
623  applyTrackingOpt = kFALSE ;
624  }
625  }
626 
627  if (applyTrackingOpt) {
628  RooArgSet branches ;
629  _funcClone->branchNodeServerList(&branches) ;
630  for (auto arg : branches) {
631  arg->setCacheAndTrackHints(trackNodes);
632  }
633  // Do not set CacheAndTrack on constant expressions
634  RooArgSet* constNodes = (RooArgSet*) trackNodes.selectByAttrib("Constant",kTRUE) ;
635  trackNodes.remove(*constNodes) ;
636  delete constNodes ;
637 
638  // Set CacheAndTrack flag on all remaining nodes
639  trackNodes.setAttribAll("CacheAndTrack",kTRUE) ;
640  }
641 
642  // Find all nodes that depend exclusively on constant parameters
644 
646 
647  // Cache constant nodes with dataset - also cache entries corresponding to zero-weights in data when using BinnedLikelihood
648  _dataClone->cacheArgs(this,_cachedNodes,_normSet,!_funcClone->getAttribute("BinnedLikelihood")) ;
649 
650  // Put all cached nodes in AClean value caching mode so that their evaluate() is never called
651  for (auto cacheArg : _cachedNodes) {
652  cacheArg->setOperMode(RooAbsArg::AClean) ;
653  }
654 
655  RooArgSet* constNodes = (RooArgSet*) _cachedNodes.selectByAttrib("ConstantExpressionCached",kTRUE) ;
656  RooArgSet actualTrackNodes(_cachedNodes) ;
657  actualTrackNodes.remove(*constNodes) ;
658  if (constNodes->getSize()>0) {
659  if (constNodes->getSize()<20) {
660  coutI(Minimization) << " The following expressions have been identified as constant and will be precalculated and cached: " << *constNodes << endl ;
661  } else {
662  coutI(Minimization) << " A total of " << constNodes->getSize() << " expressions have been identified as constant and will be precalculated and cached." << endl ;
663  }
664  }
665  if (actualTrackNodes.getSize()>0) {
666  if (actualTrackNodes.getSize()<20) {
667  coutI(Minimization) << " The following expressions will be evaluated in cache-and-track mode: " << actualTrackNodes << endl ;
668  } else {
669  coutI(Minimization) << " A total of " << constNodes->getSize() << " expressions will be evaluated in cache-and-track-mode." << endl ;
670  }
671  }
672  delete constNodes ;
673 
674  // Disable reading of observables that are no longer used
676 
677  _optimized = kTRUE ;
678 
679  } else {
680 
681  // Delete the cache
683 
684  // Reactivate all tree branches
686 
687  // Reset all nodes to ADirty
688  optimizeCaching() ;
689 
690  // Disable propagation of dirty state flags for observables
692 
694 
695 
696  _optimized = kFALSE ;
697  }
698 }
699 
700 
701 
702 ////////////////////////////////////////////////////////////////////////////////
703 /// Change dataset that is used to given one. If cloneData is kTRUE, a clone of
704 /// in the input dataset is made. If the test statistic was constructed with
705 /// a range specification on the data, the cloneData argument is ignored and
706 /// the data is always cloned.
708 {
709 
710  if (operMode()==SimMaster) {
711  //cout << "ROATS::setDataSlave() ERROR this is SimMaster _funcClone = " << _funcClone << endl ;
712  return kFALSE ;
713  }
714 
715  //cout << "ROATS::setDataSlave() new dataset size = " << indata.numEntries() << endl ;
716  //indata.Print("v") ;
717 
718 
719  // Delete previous dataset now, if it was owned
720  if (_ownData) {
721  delete _dataClone ;
722  _dataClone = 0 ;
723  }
724 
725  if (!cloneData && _rangeName.size()>0) {
726  coutW(InputArguments) << "RooAbsOptTestStatistic::setData(" << GetName() << ") WARNING: test statistic was constructed with range selection on data, "
727  << "ignoring request to _not_ clone the input dataset" << endl ;
728  cloneData = kTRUE ;
729  }
730 
731  if (cloneData) {
732  // Cloning input dataset
733  if (_rangeName.size()==0) {
734  _dataClone = (RooAbsData*) indata.reduce(*indata.get()) ;
735  } else {
736  _dataClone = ((RooAbsData&)indata).reduce(RooFit::SelectVars(*indata.get()),RooFit::CutRange(_rangeName.c_str())) ;
737  }
738  _ownData = kTRUE ;
739 
740  } else {
741 
742  // Taking input dataset
743  _dataClone = &indata ;
744  _ownData = ownNewData ;
745 
746  }
747 
748  // Attach function clone to dataset
751  _data = _dataClone ;
752 
753  // ReCache constant nodes with dataset
754  if (_cachedNodes.getSize()>0) {
756  }
757 
758  // Adjust internal event count
759  setEventCount(indata.numEntries()) ;
760 
761  setValueDirty() ;
762 
763 // cout << "RAOTS::setDataSlave(" << this << ") END" << endl ;
764 
765  return kTRUE ;
766 }
767 
768 
769 
770 
771 ////////////////////////////////////////////////////////////////////////////////
772 
774 {
775  if (_sealed) {
776  Bool_t notice = (sealNotice() && strlen(sealNotice())) ;
777  coutW(ObjectHandling) << "RooAbsOptTestStatistic::data(" << GetName()
778  << ") WARNING: object sealed by creator - access to data is not permitted: "
779  << (notice?sealNotice():"<no user notice>") << endl ;
780  static RooDataSet dummy ("dummy","dummy",RooArgSet()) ;
781  return dummy ;
782  }
783  return *_dataClone ;
784 }
785 
786 
787 ////////////////////////////////////////////////////////////////////////////////
788 
790 {
791  if (_sealed) {
792  Bool_t notice = (sealNotice() && strlen(sealNotice())) ;
793  coutW(ObjectHandling) << "RooAbsOptTestStatistic::data(" << GetName()
794  << ") WARNING: object sealed by creator - access to data is not permitted: "
795  << (notice?sealNotice():"<no user notice>") << endl ;
796  static RooDataSet dummy ("dummy","dummy",RooArgSet()) ;
797  return dummy ;
798  }
799  return *_dataClone ;
800 }
801 
802 
803 ////////////////////////////////////////////////////////////////////////////////
804 /// Inspect PDF to find out if we are doing a binned fit to a 1-dimensional unbinned PDF.
805 /// If this is the case, enable finer sampling of bins by wrapping PDF into a RooBinSamplingPdf.
806 /// The member _integrateBinsPrecision decides how we act:
807 /// - < 0: Don't do anything.
808 /// - = 0: Only enable feature if fitting unbinned PDF to RooDataHist.
809 /// - > 0: Enable as requested.
811  if (_integrateBinsPrecision < 0.)
812  return;
813 
814  std::unique_ptr<RooArgSet> funcObservables( _funcClone->getObservables(*_dataClone) );
815  const bool oneDimAndBinned = (1 == std::count_if(funcObservables->begin(), funcObservables->end(), [](const RooAbsArg* arg) {
816  auto var = dynamic_cast<const RooRealVar*>(arg);
817  return var && var->numBins() > 1;
818  }));
819 
820  if (!oneDimAndBinned) {
821  if (_integrateBinsPrecision > 0.) {
822  coutE(Fitting) << "Integration over bins was requested, but this is currently only implemented for 1-D fits." << std::endl;
823  }
824  return;
825  }
826 
827  // Find the real-valued observable. We don't care about categories.
828  auto theObs = std::find_if(funcObservables->begin(), funcObservables->end(), [](const RooAbsArg* arg){
829  return dynamic_cast<const RooAbsRealLValue*>(arg);
830  });
831  assert(theObs != funcObservables->end());
832 
833  RooBinSamplingPdf* newPdf = nullptr;
834 
835  if (_integrateBinsPrecision > 0.) {
836  // User forced integration. Let just apply it.
837  newPdf = new RooBinSamplingPdf((std::string(_funcClone->GetName()) + "_binSampling").c_str(),
838  _funcClone->GetTitle(),
839  *static_cast<RooAbsRealLValue*>(*theObs),
840  *static_cast<RooAbsPdf*>(_funcClone),
842  } else if (dynamic_cast<RooDataHist*>(_dataClone) != nullptr
843  && _integrateBinsPrecision == 0.
845  // User didn't forbid integration, and it seems appropriate with a RooDataHist.
846  coutI(Fitting) << "The PDF '" << _funcClone->GetName() << "' is continuous, but fit to binned data.\n"
847  << "RooFit will integrate it in each bin using the RooBinSamplingPdf." << std::endl;
848  newPdf = new RooBinSamplingPdf((std::string(_funcClone->GetName()) + "_binSampling").c_str(),
849  _funcClone->GetTitle(),
850  *static_cast<RooAbsRealLValue*>(*theObs),
851  *static_cast<RooAbsPdf*>(_funcClone));
852  }
853 
854  if (newPdf) {
855  newPdf->addOwnedComponents(*_funcClone);
856  _funcClone = newPdf;
857  }
858 }
RooErrorHandler::softAbort
static void softAbort()
Definition: RooErrorHandler.h:30
RooAbsOptTestStatistic::_funcObsSet
RooArgSet * _funcObsSet
Definition: RooAbsOptTestStatistic.h:86
n
const Int_t n
Definition: legend1.C:16
RooAbsOptTestStatistic::setUpBinSampling
void setUpBinSampling()
Inspect PDF to find out if we are doing a binned fit to a 1-dimensional unbinned PDF.
Definition: RooAbsOptTestStatistic.cxx:810
RooFit::Minimization
@ Minimization
Definition: RooGlobalFunc.h:60
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
RooAbsOptTestStatistic::combinedValue
virtual Double_t combinedValue(RooAbsReal **gofArray, Int_t nVal) const
Method to combined test statistic results calculated into partitions into the global result.
Definition: RooAbsOptTestStatistic.cxx:441
e
#define e(i)
Definition: RSha256.hxx:103
RooAbsArg::ValueChange
@ ValueChange
Definition: RooAbsArg.h:388
RooAbsArg::DeActivate
@ DeActivate
Definition: RooAbsArg.h:388
RooAbsOptTestStatistic::redirectServersHook
virtual Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
Catch server redirect calls and forward to internal clone of function.
Definition: RooAbsOptTestStatistic.cxx:462
RooAbsTestStatistic::operMode
GOFOpMode operMode() const
Definition: RooAbsTestStatistic.h:113
RooMsgService.h
RooAbsTestStatistic::setEventCount
void setEventCount(Int_t nEvents)
Definition: RooAbsTestStatistic.h:96
RooAbsCollection::first
RooAbsArg * first() const
Definition: RooAbsCollection.h:236
RooAbsTestStatistic::_data
RooAbsData * _data
Definition: RooAbsTestStatistic.h:120
RooAbsArg::ConfigChange
@ ConfigChange
Definition: RooAbsArg.h:388
RooAbsOptTestStatistic::_funcCloneSet
RooArgSet * _funcCloneSet
Definition: RooAbsOptTestStatistic.h:79
RooAbsData
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:49
RooAbsData::cacheArgs
virtual void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=0, Bool_t skipZeroWeights=kFALSE)
Internal method – Cache given set of functions with data.
Definition: RooAbsData.cxx:327
RooAbsBinning::highBoundFunc
virtual RooAbsReal * highBoundFunc() const
Return pointer to RooAbsReal parameterized upper bound, if any.
Definition: RooAbsBinning.h:88
RooAbsRealLValue::getMax
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
Definition: RooAbsRealLValue.h:89
RooFit.h
RooFit::InputArguments
@ InputArguments
Definition: RooGlobalFunc.h:61
RooAbsBinning::lowBoundFunc
virtual RooAbsReal * lowBoundFunc() const
Return pointer to RooAbsReal parameterized lower bound, if any.
Definition: RooAbsBinning.h:84
RooAbsArg::getParameters
RooArgSet * getParameters(const RooAbsData *data, bool stripDisconnected=true) 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
RooArgSet.h
RooAbsReal::isBinnedDistribution
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
Definition: RooAbsReal.h:341
TString::Data
const char * Data() const
Definition: TString.h:369
RooFit::SelectVars
RooCmdArg SelectVars(const RooArgSet &vars)
Definition: RooGlobalFunc.cxx:202
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
Form
char * Form(const char *fmt,...)
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
RooAbsReal::getValV
virtual Double_t getValV(const RooArgSet *normalisationSet=nullptr) const
Return value of object.
Definition: RooAbsReal.cxx:276
RooAbsOptTestStatistic::_funcClone
RooAbsReal * _funcClone
Definition: RooAbsOptTestStatistic.h:81
sum
static uint64_t sum(uint64_t i)
Definition: Factory.cxx:2345
coutE
#define coutE(a)
Definition: RooMsgService.h:33
RooAbsOptTestStatistic::RooAbsOptTestStatistic
RooAbsOptTestStatistic()
Default Constructor.
Definition: RooAbsOptTestStatistic.cxx:74
coutW
#define coutW(a)
Definition: RooMsgService.h:32
RooAbsOptTestStatistic.h
RooAbsReal::getVal
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition: RooAbsReal.h:91
RooFit::Optimization
@ Optimization
Definition: RooGlobalFunc.h:61
RooProdPdf::getConnectedParameters
RooArgSet * getConnectedParameters(const RooArgSet &observables) const
Return all parameter constraint p.d.f.s on parameters listed in constrainedParams.
Definition: RooProdPdf.cxx:2114
RooAbsOptTestStatistic::allowFunctionCache
virtual Bool_t allowFunctionCache()
Definition: RooAbsOptTestStatistic.h:69
RooAbsTestStatistic::constOptimizeTestStatistic
virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Forward constant term optimization management calls to component test statistics.
Definition: RooAbsTestStatistic.cxx:359
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:585
RooAbsCollection::find
RooAbsArg * find(const char *name) const
Find object with given name in list.
Definition: RooAbsCollection.cxx:810
RooAbsData::store
RooAbsDataStore * store()
Definition: RooAbsData.h:68
coutI
#define coutI(a)
Definition: RooMsgService.h:30
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooAddPdf.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:1844
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooAbsTestStatistic::printCompactTreeHook
virtual void printCompactTreeHook(std::ostream &os, const char *indent="")
Add extra information on component test statistics when printing itself as part of a tree structure.
Definition: RooAbsTestStatistic.cxx:335
RooAbsOptTestStatistic::_dataClone
RooAbsData * _dataClone
Definition: RooAbsOptTestStatistic.h:80
RooBinSamplingPdf.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:1159
RooAbsTestStatistic::_evalCarry
Double_t _evalCarry
Offset as KahanSum to avoid loss of precision.
Definition: RooAbsTestStatistic.h:159
TString
Basic string class.
Definition: TString.h:136
RooRealVar::setRange
void setRange(const char *name, Double_t min, Double_t max)
Set a fit or plotting range.
Definition: RooRealVar.cxx:526
RooAbsOptTestStatistic::data
RooAbsData & data()
Definition: RooAbsOptTestStatistic.cxx:773
RooAbsOptTestStatistic::constOptimizeTestStatistic
void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Driver function to propagate constant term optimizations in test statistic.
Definition: RooAbsOptTestStatistic.cxx:494
RooDataSet.h
RooAbsReal::fixAddCoefNormalization
virtual void fixAddCoefNormalization(const RooArgSet &addNormSet=RooArgSet(), Bool_t force=kTRUE)
Fix the interpretation of the coefficient of any RooAddPdf component in the expression tree headed by...
Definition: RooAbsReal.cxx:3903
RooAbsTestStatistic::getCarry
virtual Double_t getCarry() const
Definition: RooAbsTestStatistic.cxx:681
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
RooFit::CutRange
RooCmdArg CutRange(const char *rangeName)
Definition: RooGlobalFunc.cxx:131
bool
RooAbsRealLValue::getMin
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
Definition: RooAbsRealLValue.h:86
RooAbsOptTestStatistic::optimizeConstantTerms
void optimizeConstantTerms(Bool_t, Bool_t=kTRUE)
Driver function to activate global constant term optimization.
Definition: RooAbsOptTestStatistic.cxx:597
RooAbsTestStatistic::_rangeName
std::string _rangeName
Definition: RooAbsTestStatistic.h:122
RooAbsTestStatistic::_splitRange
Bool_t _splitRange
Definition: RooAbsTestStatistic.h:124
RooAbsOptTestStatistic::optimizeCaching
void optimizeCaching()
This method changes the value caching logic for all nodes that depends on any of the observables as d...
Definition: RooAbsOptTestStatistic.cxx:568
RooAbsOptTestStatistic::initSlave
void initSlave(RooAbsReal &real, RooAbsData &indata, const RooArgSet &projDeps, const char *rangeName, const char *addCoefRangeName)
Definition: RooAbsOptTestStatistic.cxx:179
RooArgSet::snapshot
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition: RooArgSet.h:115
RooAbsTestStatistic
RooAbsTestStatistic is the abstract base class for all test statistics.
Definition: RooAbsTestStatistic.h:39
RooTrace.h
RooAbsOptTestStatistic::setDataSlave
Bool_t setDataSlave(RooAbsData &data, Bool_t cloneData=kTRUE, Bool_t ownNewDataAnyway=kFALSE)
Change dataset that is used to given one.
Definition: RooAbsOptTestStatistic.cxx:707
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
RooDataHist
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:37
RooAbsOptTestStatistic::_integrateBinsPrecision
double _integrateBinsPrecision
Definition: RooAbsOptTestStatistic.h:92
RooProdPdf.h
RooAbsOptTestStatistic::printCompactTreeHook
virtual void printCompactTreeHook(std::ostream &os, const char *indent="")
Catch print hook function and forward to function clone.
Definition: RooAbsOptTestStatistic.cxx:475
RooAbsPdf.h
Double_t
RooAbsData::optimizeReadingWithCaching
virtual void optimizeReadingWithCaching(RooAbsArg &arg, const RooArgSet &cacheList, const RooArgSet &keepObsList)
Prepare dataset for use with cached constant terms listed in 'cacheList' of expression 'arg'.
Definition: RooAbsData.cxx:2159
RooAbsOptTestStatistic::_projDeps
RooArgSet * _projDeps
Definition: RooAbsOptTestStatistic.h:82
RooAbsData::setDirtyProp
void setDirtyProp(Bool_t flag)
Control propagation of dirty flags from observables in dataset.
Definition: RooAbsData.cxx:359
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
RooDataHist.h
RooFit::Fitting
@ Fitting
Definition: RooGlobalFunc.h:60
RooAbsData::get
virtual const RooArgSet * get() const
Definition: RooAbsData.h:92
TNamed::Clone
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TNamed.cxx:74
RooAbsOptTestStatistic::_ownData
Bool_t _ownData
Definition: RooAbsOptTestStatistic.h:83
RooAbsCollection
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
Definition: RooAbsCollection.h:33
RooAbsArg::AClean
@ AClean
Definition: RooAbsArg.h:390
RooAbsArg::RooArgSet
friend class RooArgSet
Definition: RooAbsArg.h:599
RooAbsCollection::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:455
RooAbsTestStatistic::Configuration
Definition: RooAbsTestStatistic.h:43
RooAbsOptTestStatistic::_optimized
Bool_t _optimized
Definition: RooAbsOptTestStatistic.h:91
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:1635
RooAbsDataStore::forceCacheUpdate
virtual void forceCacheUpdate()
Definition: RooAbsDataStore.h:126
RooAbsCollection::size
Storage_t::size_type size() const
Definition: RooAbsCollection.h:214
RooAbsData::numEntries
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Definition: RooAbsData.cxx:304
RooCategory.h
y
Double_t y[n]
Definition: legend1.C:17
RooAbsTestStatistic::Slave
@ Slave
Definition: RooAbsTestStatistic.h:112
RooDataHist::cacheValidEntries
void cacheValidEntries()
Compute which bins of the dataset are part of the currently set fit range.
Definition: RooDataHist.cxx:1999
RooFit::ObjectHandling
@ ObjectHandling
Definition: RooGlobalFunc.h:61
RooRealVar.h
RooAbsOptTestStatistic::sealNotice
const char * sealNotice() const
Definition: RooAbsOptTestStatistic.h:55
RooProduct.h
RooAbsDataStore.h
RooAbsOptTestStatistic::_cachedNodes
RooArgSet _cachedNodes
Definition: RooAbsOptTestStatistic.h:87
RooAbsData::hasFilledCache
Bool_t hasFilledCache() const
Definition: RooAbsData.cxx:2316
RooAbsOptTestStatistic::requiredExtraObservables
virtual RooArgSet requiredExtraObservables() const
Definition: RooAbsOptTestStatistic.h:74
cxcoutW
#define cxcoutW(a)
Definition: RooMsgService.h:93
RooAbsCollection::selectCommon
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
Definition: RooAbsCollection.cxx:702
RooGlobalFunc.h
RooSetProxy::removeAll
virtual void removeAll() override
Remove all argument inset using remove(const RooAbsArg&).
Definition: RooSetProxy.cxx:229
RooAbsArg::Activate
@ Activate
Definition: RooAbsArg.h:388
RooRealVar::getBinning
const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const
Return binning definition with name.
Definition: RooRealVar.cxx:318
RooAbsRealLValue::hasRange
virtual Bool_t hasRange(const char *name) const
Check if variable has a binning with given name.
Definition: RooAbsRealLValue.h:102
RooAbsData.h
RooAbsArg::getObservables
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Given a set of possible observables, return the observables that this PDF depends on.
Definition: RooAbsArg.h:295
RooAbsArg::addOwnedComponents
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
Definition: RooAbsArg.cxx:2216
RooAbsTestStatistic::_addCoefRangeName
std::string _addCoefRangeName
Definition: RooAbsTestStatistic.h:123
RooAbsTestStatistic::SimMaster
@ SimMaster
Definition: RooAbsTestStatistic.h:112
RooAbsOptTestStatistic::_sealed
Bool_t _sealed
Definition: RooAbsOptTestStatistic.h:84
RooAbsData::reduce
RooAbsData * reduce(const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg())
Create a reduced copy of this dataset.
Definition: RooAbsData.cxx:379
RooAbsOptTestStatistic
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
Definition: RooAbsOptTestStatistic.h:28
RooVectorDataStore
RooVectorDataStore uses std::vectors to store data columns.
Definition: RooVectorDataStore.h:37
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
RooAbsArg::cloneTree
virtual RooAbsArg * cloneTree(const char *newname=0) const
Clone tree expression of objects.
Definition: RooAbsArg.cxx:2230
RooAbsData::resetCache
virtual void resetCache()
Internal method – Remove cached function values.
Definition: RooAbsData.cxx:335
RooAbsTestStatistic::redirectServersHook
virtual Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
Forward server redirect calls to component test statistics.
Definition: RooAbsTestStatistic.cxx:308
name
char name[80]
Definition: TGX11.cxx:110
RooBinSamplingPdf
The RooBinSamplingPdf is supposed to be used as an adapter between a continuous PDF and a binned dist...
Definition: RooBinSamplingPdf.h:28
RooErrorHandler.h
RooBinning.h
RooDataSet
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:33
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:490
RooAbsData::attachBuffers
void attachBuffers(const RooArgSet &extObs)
Definition: RooAbsData.cxx:2243
RooAbsPdf
Definition: RooAbsPdf.h:41
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
RooAbsReal::fixAddCoefRange
virtual void fixAddCoefRange(const char *rangeName=0, Bool_t force=kTRUE)
Fix the interpretation of the coefficient of any RooAddPdf component in the expression tree headed by...
Definition: RooAbsReal.cxx:3933
RooAbsTestStatistic::_func
RooAbsReal * _func
Definition: RooAbsTestStatistic.h:119
RooVectorDataStore.h
RooAbsOptTestStatistic::_normSet
RooArgSet * _normSet
Definition: RooAbsOptTestStatistic.h:78
RooAbsArg::ConstOpCode
ConstOpCode
Definition: RooAbsArg.h:388
RooRealSumPdf.h
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooAbsCollection::removeAll
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
Definition: RooAbsCollection.cxx:644
Riostream.h
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
RooProdPdf
RooProdPdf is an efficient implementation of a product of PDFs of the form.
Definition: RooProdPdf.h:37
RooAbsOptTestStatistic::_origData
RooAbsData * _origData
Definition: RooAbsOptTestStatistic.h:90
cxcoutI
#define cxcoutI(a)
Definition: RooMsgService.h:85
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:678
RooAbsOptTestStatistic::~RooAbsOptTestStatistic
virtual ~RooAbsOptTestStatistic()
Destructor.
Definition: RooAbsOptTestStatistic.cxx:419
RooAbsOptTestStatistic::_origFunc
RooAbsReal * _origFunc
List of nodes that are cached as constant expressions.
Definition: RooAbsOptTestStatistic.h:89
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:1711
RooAbsDataStore::cacheOwner
virtual const RooAbsArg * cacheOwner()=0
RooAbsCollection::getSize
Int_t getSize() const
Definition: RooAbsCollection.h:231
RooAbsTestStatistic::_paramSet
RooSetProxy _paramSet
Definition: RooAbsTestStatistic.h:110
RooSetProxy::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Overloaded RooArgSet::add() method inserts 'var' into set and registers 'var' as server to owner with...
Definition: RooSetProxy.cxx:165
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:33
RooAbsCollection::setAttribAll
void setAttribAll(const Text_t *name, Bool_t value=kTRUE)
Set given attribute in each element of the collection by calling each elements setAttribute() functio...
Definition: RooAbsCollection.cxx:663
int
RooAbsData::setArgStatus
virtual void setArgStatus(const RooArgSet &set, Bool_t active)
Definition: RooAbsData.cxx:351
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