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, RooAbsData& indata,
118  const RooArgSet& projDeps, const char* rangeName, const char* addCoefRangeName,
119  Int_t nCPU, RooFit::MPSplit interleave, Bool_t verbose, Bool_t splitCutRange, Bool_t /*cloneInputData*/,
120  double integrateOverBinsPrecision) :
121  RooAbsTestStatistic(name,title,real,indata,projDeps,rangeName, addCoefRangeName, nCPU, interleave, verbose, splitCutRange),
122  _projDeps(0),
123  _sealed(kFALSE),
124  _optimized(kFALSE),
125  _integrateBinsPrecision(integrateOverBinsPrecision)
126 {
127  // Don't do a thing in master mode
128 
129  if (operMode()!=Slave) {
130  _funcObsSet = 0 ;
131  _funcCloneSet = 0 ;
132  _funcClone = 0 ;
133  _normSet = 0 ;
134  _projDeps = 0 ;
135  _origFunc = 0 ;
136  _origData = 0 ;
137  _ownData = kFALSE ;
138  _sealed = kFALSE ;
139  return ;
140  }
141 
142  _origFunc = 0 ; //other._origFunc ;
143  _origData = 0 ; // other._origData ;
144 
145  initSlave(real,indata,projDeps,rangeName,addCoefRangeName) ;
146 }
147 
148 ////////////////////////////////////////////////////////////////////////////////
149 /// Copy constructor
150 
152  RooAbsTestStatistic(other,name), _sealed(other._sealed), _sealNotice(other._sealNotice), _optimized(kFALSE),
153  _integrateBinsPrecision(other._integrateBinsPrecision)
154 {
155  // Don't do a thing in master mode
156  if (operMode()!=Slave) {
157 
158  _funcObsSet = 0 ;
159  _funcCloneSet = 0 ;
160  _funcClone = 0 ;
161  _normSet = other._normSet ? ((RooArgSet*) other._normSet->snapshot()) : 0 ;
162  _projDeps = 0 ;
163  _origFunc = 0 ;
164  _origData = 0 ;
165  _ownData = kFALSE ;
166  return ;
167  }
168 
169  _origFunc = 0 ; //other._origFunc ;
170  _origData = 0 ; // other._origData ;
171  _projDeps = 0 ;
172 
173  initSlave(*other._funcClone,*other._dataClone,other._projDeps?*other._projDeps:RooArgSet(),other._rangeName.c_str(),other._addCoefRangeName.c_str()) ;
174 }
175 
176 
177 
178 ////////////////////////////////////////////////////////////////////////////////
179 
180 void RooAbsOptTestStatistic::initSlave(RooAbsReal& real, RooAbsData& indata, const RooArgSet& projDeps, const char* rangeName,
181  const char* addCoefRangeName) {
182  // ******************************************************************
183  // *** PART 1 *** Clone incoming pdf, attach to each other *
184  // ******************************************************************
185 
186  // Clone FUNC
187  _funcClone = static_cast<RooAbsReal*>(real.cloneTree());
188  _funcCloneSet = 0 ;
189 
190  // Attach FUNC to data set
192 
193  if (_funcClone->getAttribute("BinnedLikelihood")) {
194  _funcClone->setAttribute("BinnedLikelihoodActive") ;
195  }
196 
197  // Reattach FUNC to original parameters
198  RooArgSet* origParams = (RooArgSet*) real.getParameters(indata) ;
199  _funcClone->recursiveRedirectServers(*origParams) ;
200 
201  // Mark all projected dependents as such
202  if (projDeps.getSize()>0) {
203  RooArgSet *projDataDeps = (RooArgSet*) _funcObsSet->selectCommon(projDeps) ;
204  projDataDeps->setAttribAll("projectedDependent") ;
205  delete projDataDeps ;
206  }
207 
208  // If PDF is a RooProdPdf (with possible constraint terms)
209  // analyze pdf for actual parameters (i.e those in unconnected constraint terms should be
210  // ignored as here so that the test statistic will not be recalculated if those
211  // are changed
212  RooProdPdf* pdfWithCons = dynamic_cast<RooProdPdf*>(_funcClone) ;
213  if (pdfWithCons) {
214 
215  RooArgSet* connPars = pdfWithCons->getConnectedParameters(*indata.get()) ;
216  // Add connected parameters as servers
217  _paramSet.removeAll() ;
218  _paramSet.add(*connPars) ;
219  delete connPars ;
220 
221  } else {
222  // Add parameters as servers
223  _paramSet.add(*origParams) ;
224  }
225 
226 
227  delete origParams ;
228 
229  // Store normalization set
230  _normSet = (RooArgSet*) indata.get()->snapshot(kFALSE) ;
231 
232  // Expand list of observables with any observables used in parameterized ranges.
233  // This NEEDS to be a counting loop since we are inserting during the loop.
234  for (std::size_t i = 0; i < _funcObsSet->size(); ++i) {
235  auto realDepRLV = dynamic_cast<const RooAbsRealLValue*>((*_funcObsSet)[i]);
236  if (realDepRLV && realDepRLV->isDerived()) {
237  RooArgSet tmp2;
238  realDepRLV->leafNodeServerList(&tmp2, 0, kTRUE);
239  _funcObsSet->add(tmp2,kTRUE);
240  }
241  }
242 
243 
244 
245  // ******************************************************************
246  // *** PART 2 *** Clone and adjust incoming data, attach to PDF *
247  // ******************************************************************
248 
249  // Check if the fit ranges of the dependents in the data and in the FUNC are consistent
250  const RooArgSet* dataDepSet = indata.get() ;
251  for (const auto arg : *_funcObsSet) {
252 
253  // Check that both dataset and function argument are of type RooRealVar
254  RooRealVar* realReal = dynamic_cast<RooRealVar*>(arg) ;
255  if (!realReal) continue ;
256  RooRealVar* datReal = dynamic_cast<RooRealVar*>(dataDepSet->find(realReal->GetName())) ;
257  if (!datReal) continue ;
258 
259  // Check that range of observables in pdf is equal or contained in range of observables in data
260 
261  if (!realReal->getBinning().lowBoundFunc() && realReal->getMin()<(datReal->getMin()-1e-6)) {
262  coutE(InputArguments) << "RooAbsOptTestStatistic: ERROR minimum of FUNC observable " << arg->GetName()
263  << "(" << realReal->getMin() << ") is smaller than that of "
264  << arg->GetName() << " in the dataset (" << datReal->getMin() << ")" << endl ;
266  return ;
267  }
268 
269  if (!realReal->getBinning().highBoundFunc() && realReal->getMax()>(datReal->getMax()+1e-6)) {
270  coutE(InputArguments) << "RooAbsOptTestStatistic: ERROR maximum of FUNC observable " << arg->GetName()
271  << " is larger than that of " << arg->GetName() << " in the dataset" << endl ;
273  return ;
274  }
275  }
276 
277  // Copy data and strip entries lost by adjusted fit range, _dataClone ranges will be copied from realDepSet ranges
278  if (rangeName && strlen(rangeName)) {
280  // cout << "RooAbsOptTestStatistic: reducing dataset to fit in range named " << rangeName << " resulting dataset has " << _dataClone->sumEntries() << " events" << endl ;
281  } else {
282  _dataClone = (RooAbsData*) indata.Clone() ;
283  }
284  _ownData = kTRUE ;
285 
286 
287  // ******************************************************************
288  // *** PART 3 *** Make adjustments for fit ranges, if specified *
289  // ******************************************************************
290 
291  std::unique_ptr<RooArgSet> origObsSet( real.getObservables(indata) );
292  RooArgSet* dataObsSet = (RooArgSet*) _dataClone->get() ;
293  if (rangeName && strlen(rangeName)) {
294  cxcoutI(Fitting) << "RooAbsOptTestStatistic::ctor(" << GetName() << ") constructing test statistic for sub-range named " << rangeName << endl ;
295 
296  bool observablesKnowRange = false;
297  // Adjust FUNC normalization ranges to requested fitRange, store original ranges for RooAddPdf coefficient interpretation
298  for (const auto arg : *_funcObsSet) {
299 
300  RooRealVar* realObs = dynamic_cast<RooRealVar*>(arg) ;
301  if (realObs) {
302 
303  observablesKnowRange |= realObs->hasRange(rangeName);
304 
305  // If no explicit range is given for RooAddPdf coefficients, create explicit named range equivalent to original observables range
306  if (!(addCoefRangeName && strlen(addCoefRangeName))) {
307  realObs->setRange(Form("NormalizationRangeFor%s",rangeName),realObs->getMin(),realObs->getMax()) ;
308  }
309 
310  // Adjust range of function observable to those of given named range
311  realObs->setRange(realObs->getMin(rangeName),realObs->getMax(rangeName)) ;
312 
313  // Adjust range of data observable to those of given named range
314  RooRealVar* dataObs = (RooRealVar*) dataObsSet->find(realObs->GetName()) ;
315  dataObs->setRange(realObs->getMin(rangeName),realObs->getMax(rangeName)) ;
316 
317  // Keep track of list of fit ranges in string attribute fit range of original p.d.f.
318  if (!_splitRange) {
319  const std::string fitRangeName = std::string("fit_") + GetName();
320  const char* origAttrib = real.getStringAttribute("fitrange") ;
321  std::string newAttr = origAttrib ? origAttrib : "";
322 
323  if (newAttr.find(fitRangeName) == std::string::npos) {
324  newAttr += (newAttr.empty() ? "" : ",") + fitRangeName;
325  }
326  real.setStringAttribute("fitrange", newAttr.c_str());
327  RooRealVar* origObs = (RooRealVar*) origObsSet->find(arg->GetName()) ;
328  if (origObs) {
329  origObs->setRange(fitRangeName.c_str(), realObs->getMin(rangeName), realObs->getMax(rangeName));
330  }
331  }
332  }
333  }
334 
335  if (!observablesKnowRange)
336  coutW(Fitting) << "None of the fit observables seem to know the range '" << rangeName << "'. This means that the full range will be used." << std::endl;
337  }
338 
339 
340  // ******************************************************************
341  // *** PART 3.2 *** Binned fits *
342  // ******************************************************************
343 
344  // If dataset is binned, activate caching of bins that are invalid because the're outside the
345  // updated range definition (WVE need to add virtual interface here)
346  RooDataHist* tmph = dynamic_cast<RooDataHist*>(_dataClone) ;
347  if (tmph) {
348  tmph->cacheValidEntries() ;
349  }
350 
352 
353 
354  // Fix RooAddPdf coefficients to original normalization range
355  if (rangeName && strlen(rangeName)) {
356 
357  // WVE Remove projected dependents from normalization
359 
360  if (addCoefRangeName && strlen(addCoefRangeName)) {
361  cxcoutI(Fitting) << "RooAbsOptTestStatistic::ctor(" << GetName()
362  << ") fixing interpretation of coefficients of any RooAddPdf component to range " << addCoefRangeName << endl ;
363  _funcClone->fixAddCoefRange(addCoefRangeName,kFALSE) ;
364  } else {
365  cxcoutI(Fitting) << "RooAbsOptTestStatistic::ctor(" << GetName()
366  << ") fixing interpretation of coefficients of any RooAddPdf to full domain of observables " << endl ;
367  _funcClone->fixAddCoefRange(Form("NormalizationRangeFor%s",rangeName),kFALSE) ;
368  }
369  }
370 
371 
372  // This is deferred from part 2 - but must happen after part 3 - otherwise invalid bins cannot be properly marked in cacheValidEntries
375 
376 
377 
378 
379  // *********************************************************************
380  // *** PART 4 *** Adjust normalization range for projected observables *
381  // *********************************************************************
382 
383  // Remove projected dependents from normalization set
384  if (projDeps.getSize()>0) {
385 
386  _projDeps = (RooArgSet*) projDeps.snapshot(kFALSE) ;
387 
388  //RooArgSet* tobedel = (RooArgSet*) _normSet->selectCommon(*_projDeps) ;
390 
391  // Mark all projected dependents as such
392  RooArgSet *projDataDeps = (RooArgSet*) _funcObsSet->selectCommon(*_projDeps) ;
393  projDataDeps->setAttribAll("projectedDependent") ;
394  delete projDataDeps ;
395  }
396 
397 
398  coutI(Optimization) << "RooAbsOptTestStatistic::ctor(" << GetName() << ") optimizing internal clone of p.d.f for likelihood evaluation."
399  << "Lazy evaluation and associated change tracking will disabled for all nodes that depend on observables" << endl ;
400 
401 
402  // *********************************************************************
403  // *** PART 4 *** Finalization and activation of optimization *
404  // *********************************************************************
405 
406  // Redirect pointers of base class to clone
407  _func = _funcClone ;
408  _data = _dataClone ;
409 
411 
412  optimizeCaching() ;
413 
414 }
415 
416 
417 ////////////////////////////////////////////////////////////////////////////////
418 /// Destructor
419 
421 {
422  if (operMode()==Slave) {
423  delete _funcClone ;
424  delete _funcObsSet ;
425  if (_projDeps) {
426  delete _projDeps ;
427  }
428  if (_ownData) {
429  delete _dataClone ;
430  }
431  }
432  delete _normSet ;
433 }
434 
435 
436 
437 ////////////////////////////////////////////////////////////////////////////////
438 /// Method to combined test statistic results calculated into partitions into
439 /// the global result. This default implementation adds the partition return
440 /// values
441 
443 {
444  // Default implementation returns sum of components
445  Double_t sum(0), carry(0);
446  for (Int_t i = 0; i < n; ++i) {
447  Double_t y = array[i]->getValV();
448  carry += reinterpret_cast<RooAbsOptTestStatistic*>(array[i])->getCarry();
449  y -= carry;
450  const Double_t t = sum + y;
451  carry = (t - sum) - y;
452  sum = t;
453  }
454  _evalCarry = carry;
455  return sum ;
456 }
457 
458 
459 
460 ////////////////////////////////////////////////////////////////////////////////
461 /// Catch server redirect calls and forward to internal clone of function
462 
463 Bool_t RooAbsOptTestStatistic::redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
464 {
465  RooAbsTestStatistic::redirectServersHook(newServerList,mustReplaceAll,nameChange,isRecursive) ;
466  if (operMode()!=Slave) return kFALSE ;
467  Bool_t ret = _funcClone->recursiveRedirectServers(newServerList,kFALSE,nameChange) ;
468  return ret ;
469 }
470 
471 
472 
473 ////////////////////////////////////////////////////////////////////////////////
474 /// Catch print hook function and forward to function clone
475 
477 {
479  if (operMode()!=Slave) return ;
480  TString indent2(indent) ;
481  indent2 += "opt >>" ;
482  _funcClone->printCompactTree(os,indent2.Data()) ;
483  os << indent2 << " dataset clone = " << _dataClone << " first obs = " << _dataClone->get()->first() << endl ;
484 }
485 
486 
487 
488 ////////////////////////////////////////////////////////////////////////////////
489 /// Driver function to propagate constant term optimizations in test statistic.
490 /// If code Activate is sent, constant term optimization will be executed.
491 /// If code Deactivate is sent, any existing constant term optimizations will
492 /// be abandoned. If codes ConfigChange or ValueChange are sent, any existing
493 /// constant term optimizations will be redone.
494 
496 {
497  // cout << "ROATS::constOpt(" << GetName() << ") funcClone structure dump BEFORE const-opt" << endl ;
498  // _funcClone->Print("t") ;
499 
500  RooAbsTestStatistic::constOptimizeTestStatistic(opcode,doAlsoTrackingOpt);
501  if (operMode()!=Slave) return ;
502 
503  if (_dataClone->hasFilledCache() && _dataClone->store()->cacheOwner()!=this) {
504  if (opcode==Activate) {
505  cxcoutW(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
506  << ") dataset cache is owned by another object, no constant term optimization can be applied" << endl ;
507  }
508  return ;
509  }
510 
511  if (!allowFunctionCache()) {
512  if (opcode==Activate) {
513  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
514  << ") function caching prohibited by test statistic, no constant term optimization is applied" << endl ;
515  }
516  return ;
517  }
518 
519  if (_dataClone->hasFilledCache() && opcode==Activate) {
520  opcode=ValueChange ;
521  }
522 
523  switch(opcode) {
524  case Activate:
525  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
526  << ") optimizing evaluation of test statistic by finding all nodes in p.d.f that depend exclusively"
527  << " on observables and constant parameters and precalculating their values" << endl ;
528  optimizeConstantTerms(kTRUE,doAlsoTrackingOpt) ;
529  break ;
530 
531  case DeActivate:
532  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
533  << ") deactivating optimization of constant terms in test statistic" << endl ;
535  break ;
536 
537  case ConfigChange:
538  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
539  << ") one ore more parameter were changed from constant to floating or vice versa, "
540  << "re-evaluating constant term optimization" << endl ;
542  optimizeConstantTerms(kTRUE,doAlsoTrackingOpt) ;
543  break ;
544 
545  case ValueChange:
546  cxcoutI(Optimization) << "RooAbsOptTestStatistic::constOptimize(" << GetName()
547  << ") the value of one ore more constant parameter were changed re-evaluating constant term optimization" << endl ;
548  // Request a forcible cache update of all cached nodes
550 
551  break ;
552  }
553 
554 // cout << "ROATS::constOpt(" << GetName() << ") funcClone structure dump AFTER const-opt" << endl ;
555 // _funcClone->Print("t") ;
556 }
557 
558 
559 
560 ////////////////////////////////////////////////////////////////////////////////
561 /// This method changes the value caching logic for all nodes that depends on any of the observables
562 /// as defined by the given dataset. When evaluating a test statistic constructed from the RooAbsReal
563 /// with a dataset the observables are guaranteed to change with every call, thus there is no point
564 /// in tracking these changes which result in a net overhead. Thus for observable-dependent nodes,
565 /// the evaluation mechanism is changed from being dependent on a 'valueDirty' flag to guaranteed evaluation.
566 /// On the dataset side, the observables objects are modified to no longer send valueDirty messages
567 /// to their client
568 
570 {
571 // cout << "RooAbsOptTestStatistic::optimizeCaching(" << GetName() << "," << this << ")" << endl ;
572 
573  // Trigger create of all object caches now in nodes that have deferred object creation
574  // so that cache contents can be processed immediately
576 
577  // Set value caching mode for all nodes that depend on any of the observables to ADirty
579 
580  // Disable propagation of dirty state flags for observables
582 
583  // Disable reading of observables that are not used
585 }
586 
587 
588 
589 ////////////////////////////////////////////////////////////////////////////////
590 /// Driver function to activate global constant term optimization.
591 /// If activated, constant terms are found and cached with the dataset.
592 /// The operation mode of cached nodes is set to AClean meaning that
593 /// their getVal() call will never result in an evaluate call.
594 /// Finally the branches in the dataset that correspond to observables
595 /// that are exclusively used in constant terms are disabled as
596 /// they serve no more purpose
597 
599 {
600  if(activate) {
601 
602  if (_optimized) {
603  return ;
604  }
605 
606  // Trigger create of all object caches now in nodes that have deferred object creation
607  // so that cache contents can be processed immediately
609 
610  // Apply tracking optimization here. Default strategy is to track components
611  // of RooAddPdfs and RooRealSumPdfs. If these components are a RooProdPdf
612  // or a RooProduct respectively, track the components of these products instead
613  // of the product term
614  RooArgSet trackNodes ;
615 
616 
617  // Add safety check here - applyTrackingOpt will only be applied if present
618  // dataset is constructed in terms of a RooVectorDataStore
619  if (applyTrackingOpt) {
620  if (!dynamic_cast<RooVectorDataStore*>(_dataClone->store())) {
621  coutW(Optimization) << "RooAbsOptTestStatistic::optimizeConstantTerms(" << GetName()
622  << ") WARNING Cache-and-track optimization (Optimize level 2) is only available for datasets"
623  << " implement in terms of RooVectorDataStore - ignoring this option for current dataset" << endl ;
624  applyTrackingOpt = kFALSE ;
625  }
626  }
627 
628  if (applyTrackingOpt) {
629  RooArgSet branches ;
630  _funcClone->branchNodeServerList(&branches) ;
631  for (auto arg : branches) {
632  arg->setCacheAndTrackHints(trackNodes);
633  }
634  // Do not set CacheAndTrack on constant expressions
635  RooArgSet* constNodes = (RooArgSet*) trackNodes.selectByAttrib("Constant",kTRUE) ;
636  trackNodes.remove(*constNodes) ;
637  delete constNodes ;
638 
639  // Set CacheAndTrack flag on all remaining nodes
640  trackNodes.setAttribAll("CacheAndTrack",kTRUE) ;
641  }
642 
643  // Find all nodes that depend exclusively on constant parameters
645 
647 
648  // Cache constant nodes with dataset - also cache entries corresponding to zero-weights in data when using BinnedLikelihood
649  _dataClone->cacheArgs(this,_cachedNodes,_normSet,!_funcClone->getAttribute("BinnedLikelihood")) ;
650 
651  // Put all cached nodes in AClean value caching mode so that their evaluate() is never called
652  for (auto cacheArg : _cachedNodes) {
653  cacheArg->setOperMode(RooAbsArg::AClean) ;
654  }
655 
656  RooArgSet* constNodes = (RooArgSet*) _cachedNodes.selectByAttrib("ConstantExpressionCached",kTRUE) ;
657  RooArgSet actualTrackNodes(_cachedNodes) ;
658  actualTrackNodes.remove(*constNodes) ;
659  if (constNodes->getSize()>0) {
660  if (constNodes->getSize()<20) {
661  coutI(Minimization) << " The following expressions have been identified as constant and will be precalculated and cached: " << *constNodes << endl ;
662  } else {
663  coutI(Minimization) << " A total of " << constNodes->getSize() << " expressions have been identified as constant and will be precalculated and cached." << endl ;
664  }
665  }
666  if (actualTrackNodes.getSize()>0) {
667  if (actualTrackNodes.getSize()<20) {
668  coutI(Minimization) << " The following expressions will be evaluated in cache-and-track mode: " << actualTrackNodes << endl ;
669  } else {
670  coutI(Minimization) << " A total of " << constNodes->getSize() << " expressions will be evaluated in cache-and-track-mode." << endl ;
671  }
672  }
673  delete constNodes ;
674 
675  // Disable reading of observables that are no longer used
677 
678  _optimized = kTRUE ;
679 
680  } else {
681 
682  // Delete the cache
684 
685  // Reactivate all tree branches
687 
688  // Reset all nodes to ADirty
689  optimizeCaching() ;
690 
691  // Disable propagation of dirty state flags for observables
693 
695 
696 
697  _optimized = kFALSE ;
698  }
699 }
700 
701 
702 
703 ////////////////////////////////////////////////////////////////////////////////
704 /// Change dataset that is used to given one. If cloneData is kTRUE, a clone of
705 /// in the input dataset is made. If the test statistic was constructed with
706 /// a range specification on the data, the cloneData argument is ignored and
707 /// the data is always cloned.
709 {
710 
711  if (operMode()==SimMaster) {
712  //cout << "ROATS::setDataSlave() ERROR this is SimMaster _funcClone = " << _funcClone << endl ;
713  return kFALSE ;
714  }
715 
716  //cout << "ROATS::setDataSlave() new dataset size = " << indata.numEntries() << endl ;
717  //indata.Print("v") ;
718 
719 
720  // Delete previous dataset now, if it was owned
721  if (_ownData) {
722  delete _dataClone ;
723  _dataClone = 0 ;
724  }
725 
726  if (!cloneData && _rangeName.size()>0) {
727  coutW(InputArguments) << "RooAbsOptTestStatistic::setData(" << GetName() << ") WARNING: test statistic was constructed with range selection on data, "
728  << "ignoring request to _not_ clone the input dataset" << endl ;
729  cloneData = kTRUE ;
730  }
731 
732  if (cloneData) {
733  // Cloning input dataset
734  if (_rangeName.size()==0) {
735  _dataClone = (RooAbsData*) indata.reduce(*indata.get()) ;
736  } else {
737  _dataClone = ((RooAbsData&)indata).reduce(RooFit::SelectVars(*indata.get()),RooFit::CutRange(_rangeName.c_str())) ;
738  }
739  _ownData = kTRUE ;
740 
741  } else {
742 
743  // Taking input dataset
744  _dataClone = &indata ;
745  _ownData = ownNewData ;
746 
747  }
748 
749  // Attach function clone to dataset
752  _data = _dataClone ;
753 
754  // ReCache constant nodes with dataset
755  if (_cachedNodes.getSize()>0) {
757  }
758 
759  // Adjust internal event count
760  setEventCount(indata.numEntries()) ;
761 
762  setValueDirty() ;
763 
764 // cout << "RAOTS::setDataSlave(" << this << ") END" << endl ;
765 
766  return kTRUE ;
767 }
768 
769 
770 
771 
772 ////////////////////////////////////////////////////////////////////////////////
773 
775 {
776  if (_sealed) {
777  Bool_t notice = (sealNotice() && strlen(sealNotice())) ;
778  coutW(ObjectHandling) << "RooAbsOptTestStatistic::data(" << GetName()
779  << ") WARNING: object sealed by creator - access to data is not permitted: "
780  << (notice?sealNotice():"<no user notice>") << endl ;
781  static RooDataSet dummy ("dummy","dummy",RooArgSet()) ;
782  return dummy ;
783  }
784  return *_dataClone ;
785 }
786 
787 
788 ////////////////////////////////////////////////////////////////////////////////
789 
791 {
792  if (_sealed) {
793  Bool_t notice = (sealNotice() && strlen(sealNotice())) ;
794  coutW(ObjectHandling) << "RooAbsOptTestStatistic::data(" << GetName()
795  << ") WARNING: object sealed by creator - access to data is not permitted: "
796  << (notice?sealNotice():"<no user notice>") << endl ;
797  static RooDataSet dummy ("dummy","dummy",RooArgSet()) ;
798  return dummy ;
799  }
800  return *_dataClone ;
801 }
802 
803 
804 ////////////////////////////////////////////////////////////////////////////////
805 /// Inspect PDF to find out if we are doing a binned fit to a 1-dimensional unbinned PDF.
806 /// If this is the case, enable finer sampling of bins by wrapping PDF into a RooBinSamplingPdf.
807 /// The member _integrateBinsPrecision decides how we act:
808 /// - < 0: Don't do anything.
809 /// - = 0: Only enable feature if fitting unbinned PDF to RooDataHist.
810 /// - > 0: Enable as requested.
812  if (_integrateBinsPrecision < 0.)
813  return;
814 
815  std::unique_ptr<RooArgSet> funcObservables( _funcClone->getObservables(*_dataClone) );
816  const bool oneDimAndBinned = (1 == std::count_if(funcObservables->begin(), funcObservables->end(), [](const RooAbsArg* arg) {
817  auto var = dynamic_cast<const RooRealVar*>(arg);
818  return var && var->numBins() > 1;
819  }));
820 
821  if (!oneDimAndBinned) {
822  if (_integrateBinsPrecision > 0.) {
823  coutE(Fitting) << "Integration over bins was requested, but this is currently only implemented for 1-D fits." << std::endl;
824  }
825  return;
826  }
827 
828  // Find the real-valued observable. We don't care about categories.
829  auto theObs = std::find_if(funcObservables->begin(), funcObservables->end(), [](const RooAbsArg* arg){
830  return dynamic_cast<const RooAbsRealLValue*>(arg);
831  });
832  assert(theObs != funcObservables->end());
833 
834  RooBinSamplingPdf* newPdf = nullptr;
835 
836  if (_integrateBinsPrecision > 0.) {
837  // User forced integration. Let just apply it.
838  newPdf = new RooBinSamplingPdf((std::string(_funcClone->GetName()) + "_binSampling").c_str(),
839  _funcClone->GetTitle(),
840  *static_cast<RooAbsRealLValue*>(*theObs),
841  *static_cast<RooAbsPdf*>(_funcClone),
843  } else if (dynamic_cast<RooDataHist*>(_dataClone) != nullptr
844  && _integrateBinsPrecision == 0.
846  // User didn't forbid integration, and it seems appropriate with a RooDataHist.
847  coutW(Fitting) << "The PDF '" << _funcClone->GetName() << "' is continuous, but fit to binned data. In contrast to ROOT < v6.24,\n"
848  << "RooFit will integrate it in each bin to correct a bias due to poor sampling of the PDF.\n"
849  << "This can be disabled by fitting with \"IntegrateBins(-1.)\"." << std::endl;
850  newPdf = new RooBinSamplingPdf((std::string(_funcClone->GetName()) + "_binSampling").c_str(),
851  _funcClone->GetTitle(),
852  *static_cast<RooAbsRealLValue*>(*theObs),
853  *static_cast<RooAbsPdf*>(_funcClone));
854  }
855 
856  if (newPdf) {
857  newPdf->addOwnedComponents(*_funcClone);
858  _funcClone = newPdf;
859  }
860 }
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:811
RooFit::Minimization
@ Minimization
Definition: RooGlobalFunc.h:67
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
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:442
e
#define e(i)
Definition: RSha256.hxx:103
RooAbsArg::ValueChange
@ ValueChange
Definition: RooAbsArg.h:386
RooAbsArg::DeActivate
@ DeActivate
Definition: RooAbsArg.h:386
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:463
RooAbsTestStatistic::operMode
GOFOpMode operMode() const
Definition: RooAbsTestStatistic.h:100
RooMsgService.h
RooAbsTestStatistic::setEventCount
void setEventCount(Int_t nEvents)
Definition: RooAbsTestStatistic.h:83
RooAbsCollection::first
RooAbsArg * first() const
Definition: RooAbsCollection.h:177
RooAbsTestStatistic::_data
RooAbsData * _data
Definition: RooAbsTestStatistic.h:107
RooAbsArg::ConfigChange
@ ConfigChange
Definition: RooAbsArg.h:386
RooAbsOptTestStatistic::_funcCloneSet
RooArgSet * _funcCloneSet
Definition: RooAbsOptTestStatistic.h:79
RooAbsData
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:47
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:330
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:68
RooAbsBinning::lowBoundFunc
virtual RooAbsReal * lowBoundFunc() const
Return pointer to RooAbsReal parameterized lower bound, if any.
Definition: RooAbsBinning.h:84
RooArgSet.h
RooAbsReal::isBinnedDistribution
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Definition: RooAbsReal.h:315
TString::Data
const char * Data() const
Definition: TString.h:369
RooFit::SelectVars
RooCmdArg SelectVars(const RooArgSet &vars)
Definition: RooGlobalFunc.cxx:182
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:277
RooAbsOptTestStatistic::_funcClone
RooAbsReal * _funcClone
Definition: RooAbsOptTestStatistic.h:81
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:92
RooFit::Optimization
@ Optimization
Definition: RooGlobalFunc.h:68
RooProdPdf::getConnectedParameters
RooArgSet * getConnectedParameters(const RooArgSet &observables) const
Return all parameter constraint p.d.f.s on parameters listed in constrainedParams.
Definition: RooProdPdf.cxx:2138
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:421
RooFit::MPSplit
MPSplit
Definition: RooGlobalFunc.h:70
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
RooAbsCollection::find
RooAbsArg * find(const char *name) const
Find object with given name in list.
Definition: RooAbsCollection.cxx:813
RooAbsData::store
RooAbsDataStore * store()
Definition: RooAbsData.h:66
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:1779
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:62
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:397
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)
Definition: RooAbsArg.cxx:1098
RooAbsTestStatistic::_evalCarry
Double_t _evalCarry
avoids loss of precision
Definition: RooAbsTestStatistic.h:147
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:514
RooAbsOptTestStatistic::data
RooAbsData & data()
Definition: RooAbsOptTestStatistic.cxx:774
RooAbsOptTestStatistic::constOptimizeTestStatistic
void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Driver function to propagate constant term optimizations in test statistic.
Definition: RooAbsOptTestStatistic.cxx:495
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:3924
RooAbsTestStatistic::getCarry
virtual Double_t getCarry() const
Definition: RooAbsTestStatistic.cxx:716
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:89
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:598
RooAbsTestStatistic::_rangeName
std::string _rangeName
Definition: RooAbsTestStatistic.h:109
RooAbsTestStatistic::_splitRange
Bool_t _splitRange
Definition: RooAbsTestStatistic.h:111
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:569
RooAbsOptTestStatistic::initSlave
void initSlave(RooAbsReal &real, RooAbsData &indata, const RooArgSet &projDeps, const char *rangeName, const char *addCoefRangeName)
Definition: RooAbsOptTestStatistic.cxx:180
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
RooArgSet::snapshot
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition: RooArgSet.h:126
RooAbsTestStatistic
RooAbsTestStatistic is the abstract base class for all test statistics.
Definition: RooAbsTestStatistic.h:37
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:708
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:39
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:476
RooAbsPdf.h
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:2189
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:362
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooDataHist.h
RooFit::Fitting
@ Fitting
Definition: RooGlobalFunc.h:67
RooAbsData::get
virtual const RooArgSet * get() const
Definition: RooAbsData.h:90
RooArgSet::add
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
Definition: RooArgSet.cxx:261
TNamed::Clone
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TNamed.cxx:74
RooAbsCollection::selectCommon
RooAbsCollection * selectCommon(const RooAbsCollection &refColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
Definition: RooAbsCollection.cxx:700
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:31
RooAbsArg::AClean
@ AClean
Definition: RooAbsArg.h:388
RooAbsArg::RooArgSet
friend class RooArgSet
Definition: RooAbsArg.h:586
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:1583
RooAbsDataStore::forceCacheUpdate
virtual void forceCacheUpdate()
Definition: RooAbsDataStore.h:126
RooAbsCollection::size
Storage_t::size_type size() const
Definition: RooAbsCollection.h:155
RooAbsData::numEntries
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Definition: RooAbsData.cxx:307
RooCategory.h
y
Double_t y[n]
Definition: legend1.C:17
RooAbsTestStatistic::Slave
@ Slave
Definition: RooAbsTestStatistic.h:99
RooDataHist::cacheValidEntries
void cacheValidEntries()
Cache the datahist entries with bin centers that are inside/outside the current observable definitio.
Definition: RooDataHist.cxx:1921
RooFit::ObjectHandling
@ ObjectHandling
Definition: RooGlobalFunc.h:68
RooRealVar.h
RooAbsOptTestStatistic::sealNotice
const char * sealNotice() const
Definition: RooAbsOptTestStatistic.h:56
RooProduct.h
RooAbsDataStore.h
RooAbsOptTestStatistic::_cachedNodes
RooArgSet _cachedNodes
Definition: RooAbsOptTestStatistic.h:87
RooAbsData::hasFilledCache
Bool_t hasFilledCache() const
Definition: RooAbsData.cxx:2346
RooAbsOptTestStatistic::requiredExtraObservables
virtual RooArgSet requiredExtraObservables() const
Definition: RooAbsOptTestStatistic.h:74
cxcoutW
#define cxcoutW(a)
Definition: RooMsgService.h:93
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:386
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:306
sum
static long int sum(long int i)
Definition: Factory.cxx:2272
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
Double_t
double Double_t
Definition: RtypesCore.h:59
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::addOwnedComponents
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
Definition: RooAbsArg.cxx:2141
RooAbsTestStatistic::_addCoefRangeName
std::string _addCoefRangeName
Definition: RooAbsTestStatistic.h:110
RooAbsTestStatistic::SimMaster
@ SimMaster
Definition: RooAbsTestStatistic.h:99
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:382
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:36
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:2155
RooAbsData::resetCache
virtual void resetCache()
Internal method – Remove cached function values.
Definition: RooAbsData.cxx:338
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:370
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
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
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:488
RooAbsData::attachBuffers
void attachBuffers(const RooArgSet &extObs)
Definition: RooAbsData.cxx:2273
RooAbsPdf
Definition: RooAbsPdf.h:43
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:3954
RooAbsTestStatistic::_func
RooAbsReal * _func
Definition: RooAbsTestStatistic.h:106
RooVectorDataStore.h
RooAbsOptTestStatistic::_normSet
RooArgSet * _normSet
Definition: RooAbsOptTestStatistic.h:78
RooAbsArg::ConstOpCode
ConstOpCode
Definition: RooAbsArg.h:386
RooRealSumPdf.h
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:37
RooAbsCollection::removeAll
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
Definition: RooAbsCollection.cxx:643
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:677
RooAbsOptTestStatistic::~RooAbsOptTestStatistic
virtual ~RooAbsOptTestStatistic()
Destructor.
Definition: RooAbsOptTestStatistic.cxx:420
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:1646
RooAbsDataStore::cacheOwner
virtual const RooAbsArg * cacheOwner()=0
RooAbsCollection::getSize
Int_t getSize() const
Definition: RooAbsCollection.h:172
RooAbsTestStatistic::_paramSet
RooSetProxy _paramSet
Definition: RooAbsTestStatistic.h:97
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:29
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:662
int
RooAbsData::setArgStatus
virtual void setArgStatus(const RooArgSet &set, Bool_t active)
Definition: RooAbsData.cxx:354
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