Logo ROOT   6.16/01
Reference Guide
RooAbsTestStatistic.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 RooAbsTestStatistic.cxx
19\class RooAbsTestStatistic
20\ingroup Roofitcore
21
22RooAbsTestStatistic is the abstract base class for all test
23statistics. Test statistics that evaluate the PDF at each data
24point should inherit from the RooAbsOptTestStatistic class which
25implements several generic optimizations that can be done for such
26quantities.
27
28This test statistic base class organizes calculation of test
29statistic values for RooSimultaneous PDF as a combination of test
30statistic values for the PDF components of the simultaneous PDF and
31organizes multi-processor parallel calculation of test statistic
32values. For the latter, the test statistic value is calculated in
33partitions in parallel executing processes and a posteriori
34combined in the main thread.
35**/
36
37
38#include "RooFit.h"
39#include "Riostream.h"
40
41#include "RooAbsTestStatistic.h"
42#include "RooAbsPdf.h"
43#include "RooSimultaneous.h"
44#include "RooAbsData.h"
45#include "RooArgSet.h"
46#include "RooRealVar.h"
47#include "RooNLLVar.h"
48#include "RooRealMPFE.h"
49#include "RooErrorHandler.h"
50#include "RooMsgService.h"
51#include "TTimeStamp.h"
52#include "RooProdPdf.h"
53#include "RooRealSumPdf.h"
54#include <string>
55
56using namespace std;
57
59
60////////////////////////////////////////////////////////////////////////////////
61/// Default constructor
62
64 _func(0), _data(0), _projDeps(0), _splitRange(0), _simCount(0),
65 _verbose(kFALSE), _init(kFALSE), _gofOpMode(Slave), _nEvents(0), _setNum(0),
66 _numSets(0), _extSet(0), _nGof(0), _gofArray(0), _nCPU(1), _mpfeArray(0),
67 _mpinterl(RooFit::BulkPartition), _doOffset(kFALSE), _offset(0),
68 _offsetCarry(0), _evalCarry(0)
69{
70}
71
72
73
74////////////////////////////////////////////////////////////////////////////////
75/// Constructor taking function (real), a dataset (data), a set of projected observables (projSet). If
76/// rangeName is not null, only events in the dataset inside the range will be used in the test
77/// statistic calculation. If addCoefRangeName is not null, all RooAddPdf component of 'real' will be
78/// instructed to fix their fraction definitions to the given named range. If nCPU is greater than
79/// 1 the test statistic calculation will be paralellized over multiple processes. By default the data
80/// is split with 'bulk' partitioning (each process calculates a contigious block of fraction 1/nCPU
81/// of the data). For binned data this approach may be suboptimal as the number of bins with >0 entries
82/// in each processing block many vary greatly thereby distributing the workload rather unevenly.
83/// If interleave is set to true, the interleave partitioning strategy is used where each partition
84/// i takes all bins for which (ibin % ncpu == i) which is more likely to result in an even workload.
85/// If splitCutRange is true, a different rangeName constructed as rangeName_{catName} will be used
86/// as range definition for each index state of a RooSimultaneous
87
89 const RooArgSet& projDeps, const char* rangeName, const char* addCoefRangeName,
90 Int_t nCPU, RooFit::MPSplit interleave, Bool_t verbose, Bool_t splitCutRange) :
91 RooAbsReal(name,title),
92 _paramSet("paramSet","Set of parameters",this),
93 _func(&real),
94 _data(&data),
95 _projDeps((RooArgSet*)projDeps.Clone()),
96 _rangeName(rangeName?rangeName:""),
97 _addCoefRangeName(addCoefRangeName?addCoefRangeName:""),
98 _splitRange(splitCutRange),
99 _simCount(1),
100 _verbose(verbose),
101 _nGof(0),
102 _gofArray(0),
103 _nCPU(nCPU),
104 _mpfeArray(0),
105 _mpinterl(interleave),
106 _doOffset(kFALSE),
107 _offset(0),
108 _offsetCarry(0),
109 _evalCarry(0)
110{
111 // Register all parameters as servers
112 RooArgSet* params = real.getParameters(&data) ;
113 _paramSet.add(*params) ;
114 delete params ;
115
116 if (_nCPU>1 || _nCPU==-1) {
117
118 if (_nCPU==-1) {
119 _nCPU=1 ;
120 }
121
123
124 } else {
125
126 // Determine if RooAbsReal is a RooSimultaneous
127 Bool_t simMode = dynamic_cast<RooSimultaneous*>(&real)?kTRUE:kFALSE ;
128
129 if (simMode) {
131 } else {
132 _gofOpMode = Slave ;
133 }
134 }
135
136 _setNum = 0 ;
137 _extSet = 0 ;
138 _numSets = 1 ;
139 _init = kFALSE ;
140 _nEvents = data.numEntries() ;
141}
142
143
144
145////////////////////////////////////////////////////////////////////////////////
146/// Copy constructor
147
149 RooAbsReal(other,name),
150 _paramSet("paramSet","Set of parameters",this),
151 _func(other._func),
152 _data(other._data),
153 _projDeps((RooArgSet*)other._projDeps->Clone()),
154 _rangeName(other._rangeName),
155 _addCoefRangeName(other._addCoefRangeName),
156 _splitRange(other._splitRange),
157 _simCount(1),
158 _verbose(other._verbose),
159 _nGof(0),
160 _gofArray(0),
161 _gofSplitMode(other._gofSplitMode),
162 _nCPU(other._nCPU),
163 _mpfeArray(0),
164 _mpinterl(other._mpinterl),
165 _doOffset(other._doOffset),
166 _offset(other._offset),
167 _offsetCarry(other._offsetCarry),
168 _evalCarry(other._evalCarry)
169{
170 // Our parameters are those of original
171 _paramSet.add(other._paramSet) ;
172
173 if (_nCPU>1 || _nCPU==-1) {
174
175 if (_nCPU==-1) {
176 _nCPU=1 ;
177 }
178
180
181 } else {
182
183 // Determine if RooAbsReal is a RooSimultaneous
184 Bool_t simMode = dynamic_cast<RooSimultaneous*>(_func)?kTRUE:kFALSE ;
185
186 if (simMode) {
188 } else {
189 _gofOpMode = Slave ;
190 }
191 }
192
193 _setNum = 0 ;
194 _extSet = 0 ;
195 _numSets = 1 ;
196 _init = kFALSE ;
198
199
200}
201
202
203
204////////////////////////////////////////////////////////////////////////////////
205/// Destructor
206
208{
209 if (MPMaster == _gofOpMode && _init) {
210 for (Int_t i = 0; i < _nCPU; ++i) delete _mpfeArray[i];
211 delete[] _mpfeArray ;
212 }
213
214 if (SimMaster == _gofOpMode && _init) {
215 for (Int_t i = 0; i < _nGof; ++i) delete _gofArray[i];
216 delete[] _gofArray ;
217 }
218
219 delete _projDeps ;
220
221}
222
223
224
225////////////////////////////////////////////////////////////////////////////////
226/// Calculates and return value of test statistic. If the test statistic
227/// is calculated from on a RooSimultaneous, the test statistic calculation
228/// is performed separately on each simultaneous p.d.f component and associated
229/// data and then combined. If the test statistic calculation is parallelized
230/// partitions are calculated in nCPU processes and a posteriori combined.
231
233{
234 // One-time Initialization
235 if (!_init) {
236 const_cast<RooAbsTestStatistic*>(this)->initialize() ;
237 }
238
239 if (SimMaster == _gofOpMode) {
240 // Evaluate array of owned GOF objects
241 Double_t ret = 0.;
242
245 } else {
246 Double_t sum = 0., carry = 0.;
247 for (Int_t i = 0 ; i < _nGof; ++i) {
249 Double_t y = _gofArray[i]->getValV();
250 carry += _gofArray[i]->getCarry();
251 y -= carry;
252 const Double_t t = sum + y;
253 carry = (t - sum) - y;
254 sum = t;
255 }
256 }
257 ret = sum ;
258 _evalCarry = carry;
259 }
260
261 // Only apply global normalization if SimMaster doesn't have MP master
262 if (numSets()==1) {
263 const Double_t norm = globalNormalization();
264 ret /= norm;
265 _evalCarry /= norm;
266 }
267
268 return ret ;
269
270 } else if (MPMaster == _gofOpMode) {
271
272 // Start calculations in parallel
273 for (Int_t i = 0; i < _nCPU; ++i) _mpfeArray[i]->calculate();
274
275
276 Double_t sum(0), carry = 0.;
277 for (Int_t i = 0; i < _nCPU; ++i) {
279 carry += _mpfeArray[i]->getCarry();
280 y -= carry;
281 const Double_t t = sum + y;
282 carry = (t - sum) - y;
283 sum = t;
284 }
285
286 Double_t ret = sum ;
287 _evalCarry = carry;
288 return ret ;
289
290 } else {
291
292 // Evaluate as straight FUNC
293 Int_t nFirst(0), nLast(_nEvents), nStep(1) ;
294
295 switch (_mpinterl) {
297 nFirst = _nEvents * _setNum / _numSets ;
298 nLast = _nEvents * (_setNum+1) / _numSets ;
299 nStep = 1 ;
300 break;
301
303 nFirst = _setNum ;
304 nLast = _nEvents ;
305 nStep = _numSets ;
306 break ;
307
309 nFirst = 0 ;
310 nLast = _nEvents ;
311 nStep = 1 ;
312 break ;
313
314 case RooFit::Hybrid:
315 throw(std::string("this should never happen")) ;
316 break ;
317 }
318
319 Double_t ret = evaluatePartition(nFirst,nLast,nStep);
320
321 if (numSets()==1) {
322 const Double_t norm = globalNormalization();
323 ret /= norm;
324 _evalCarry /= norm;
325 }
326
327 return ret ;
328
329 }
330}
331
332
333
334////////////////////////////////////////////////////////////////////////////////
335/// One-time initialization of the test statistic. Setup
336/// infrastructure for simultaneous p.d.f processing and/or
337/// parallelized processing if requested
338
340{
341 if (_init) return kFALSE;
342
343 if (MPMaster == _gofOpMode) {
345 } else if (SimMaster == _gofOpMode) {
347 }
348 _init = kTRUE;
349 return kFALSE;
350}
351
352
353
354////////////////////////////////////////////////////////////////////////////////
355/// Forward server redirect calls to component test statistics
356
357Bool_t RooAbsTestStatistic::redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t)
358{
359 if (SimMaster == _gofOpMode && _gofArray) {
360 // Forward to slaves
361 for (Int_t i = 0; i < _nGof; ++i) {
362 if (_gofArray[i]) {
363 _gofArray[i]->recursiveRedirectServers(newServerList,mustReplaceAll,nameChange);
364 }
365 }
366 } else if (MPMaster == _gofOpMode&& _mpfeArray) {
367 // Forward to slaves
368 for (Int_t i = 0; i < _nCPU; ++i) {
369 if (_mpfeArray[i]) {
370 _mpfeArray[i]->recursiveRedirectServers(newServerList,mustReplaceAll,nameChange);
371// cout << "redirecting servers on " << _mpfeArray[i]->GetName() << endl;
372 }
373 }
374 }
375 return kFALSE;
376}
377
378
379
380////////////////////////////////////////////////////////////////////////////////
381/// Add extra information on component test statistics when printing
382/// itself as part of a tree structure
383
384void RooAbsTestStatistic::printCompactTreeHook(ostream& os, const char* indent)
385{
386 if (SimMaster == _gofOpMode) {
387 // Forward to slaves
388 os << indent << "RooAbsTestStatistic begin GOF contents" << endl ;
389 for (Int_t i = 0; i < _nGof; ++i) {
390 if (_gofArray[i]) {
391 TString indent2(indent);
392 indent2 += Form("[%d] ",i);
393 _gofArray[i]->printCompactTreeHook(os,indent2);
394 }
395 }
396 os << indent << "RooAbsTestStatistic end GOF contents" << endl;
397 } else if (MPMaster == _gofOpMode) {
398 // WVE implement this
399 }
400}
401
402
403
404////////////////////////////////////////////////////////////////////////////////
405/// Forward constant term optimization management calls to component
406/// test statistics
407
409{
410 initialize();
411 if (SimMaster == _gofOpMode) {
412 // Forward to slaves
413 for (Int_t i = 0; i < _nGof; ++i) {
414 // In SimComponents Splitting strategy only constOptimize the terms that are actually used
416 if ( (i % _numSets == _setNum) || (effSplit != RooFit::SimComponents) ) {
417 if (_gofArray[i]) _gofArray[i]->constOptimizeTestStatistic(opcode,doAlsoTrackingOpt);
418 }
419 }
420 } else if (MPMaster == _gofOpMode) {
421 for (Int_t i = 0; i < _nCPU; ++i) {
422 _mpfeArray[i]->constOptimizeTestStatistic(opcode,doAlsoTrackingOpt);
423 }
424 }
425}
426
427
428
429////////////////////////////////////////////////////////////////////////////////
430/// Set MultiProcessor set number identification of this instance
431
433{
434 _setNum = inSetNum; _numSets = inNumSets;
436
437 if (SimMaster == _gofOpMode) {
438 // Forward to slaves
439 initialize();
440 for (Int_t i = 0; i < _nGof; ++i) {
441 if (_gofArray[i]) _gofArray[i]->setMPSet(inSetNum,inNumSets);
442 }
443 }
444}
445
446
447
448////////////////////////////////////////////////////////////////////////////////
449/// Initialize multi-processor calculation mode. Create component test statistics in separate
450/// processed that are connected to this process through a RooAbsRealMPFE front-end class.
451
452void RooAbsTestStatistic::initMPMode(RooAbsReal* real, RooAbsData* data, const RooArgSet* projDeps, const char* rangeName, const char* addCoefRangeName)
453{
455
456 // Create proto-goodness-of-fit
457 RooAbsTestStatistic* gof = create(GetName(),GetTitle(),*real,*data,*projDeps,rangeName,addCoefRangeName,1,_mpinterl,_verbose,_splitRange);
459
460 for (Int_t i = 0; i < _nCPU; ++i) {
461 gof->setMPSet(i,_nCPU);
462 gof->SetName(Form("%s_GOF%d",GetName(),i));
463 gof->SetTitle(Form("%s_GOF%d",GetTitle(),i));
464
465 ccoutD(Eval) << "RooAbsTestStatistic::initMPMode: starting remote server process #" << i << endl;
466 _mpfeArray[i] = new RooRealMPFE(Form("%s_%lx_MPFE%d",GetName(),(ULong_t)this,i),Form("%s_%lx_MPFE%d",GetTitle(),(ULong_t)this,i),*gof,false);
467 //_mpfeArray[i]->setVerbose(kTRUE,kTRUE);
469 if (i > 0) {
471 }
472 }
474 coutI(Eval) << "RooAbsTestStatistic::initMPMode: started " << _nCPU << " remote server process." << endl;
475 //cout << "initMPMode --- done" << endl ;
476 return ;
477}
478
479
480
481////////////////////////////////////////////////////////////////////////////////
482/// Initialize simultaneous p.d.f processing mode. Strip simultaneous
483/// p.d.f into individual components, split dataset in subset
484/// matching each component and create component test statistics for
485/// each of them.
486
488 const RooArgSet* projDeps, const char* rangeName, const char* addCoefRangeName)
489{
490
492
493 TString simCatName(simCat.GetName());
494 TList* dsetList = const_cast<RooAbsData*>(data)->split(simCat,processEmptyDataSets());
495 if (!dsetList) {
496 coutE(Fitting) << "RooAbsTestStatistic::initSimMode(" << GetName() << ") ERROR: index category of simultaneous pdf is missing in dataset, aborting" << endl;
497 throw std::string("RooAbsTestStatistic::initSimMode() ERROR, index category of simultaneous pdf is missing in dataset, aborting");
498 //RooErrorHandler::softAbort() ;
499 }
500
501 // Count number of used states
502 Int_t n = 0;
503 _nGof = 0;
505 TIterator* catIter = simCat.typeIterator();
506 while ((type = (RooCatType*) catIter->Next())) {
507 // Retrieve the PDF for this simCat state
508 RooAbsPdf* pdf = simpdf->getPdf(type->GetName());
509 RooAbsData* dset = (RooAbsData*) dsetList->FindObject(type->GetName());
510
511 if (pdf && dset && (0. != dset->sumEntries() || processEmptyDataSets())) {
512 ++_nGof;
513 }
514 }
515
516 // Allocate arrays
518 _gofSplitMode.resize(_nGof);
519
520 // Create array of regular fit contexts, containing subset of data and single fitCat PDF
521 catIter->Reset();
522 while ((type = (RooCatType*) catIter->Next())) {
523 // Retrieve the PDF for this simCat state
524 RooAbsPdf* pdf = simpdf->getPdf(type->GetName());
525 RooAbsData* dset = (RooAbsData*) dsetList->FindObject(type->GetName());
526
527 if (pdf && dset && (0. != dset->sumEntries() || processEmptyDataSets())) {
528 ccoutI(Fitting) << "RooAbsTestStatistic::initSimMode: creating slave calculator #" << n << " for state " << type->GetName()
529 << " (" << dset->numEntries() << " dataset entries)" << endl;
530
531
532 // *** START HERE
533 // WVE HACK determine if we have a RooRealSumPdf and then treat it like a binned likelihood
534 RooAbsPdf* binnedPdf = 0 ;
535 Bool_t binnedL = kFALSE ;
536 if (pdf->getAttribute("BinnedLikelihood") && pdf->IsA()->InheritsFrom(RooRealSumPdf::Class())) {
537 // Simplest case: top-level of component is a RRSP
538 binnedPdf = pdf ;
539 binnedL = kTRUE ;
540 } else if (pdf->IsA()->InheritsFrom(RooProdPdf::Class())) {
541 // Default case: top-level pdf is a product of RRSP and other pdfs
542 RooFIter iter = ((RooProdPdf*)pdf)->pdfList().fwdIterator() ;
543 RooAbsArg* component ;
544 while ((component = iter.next())) {
545 if (component->getAttribute("BinnedLikelihood") && component->IsA()->InheritsFrom(RooRealSumPdf::Class())) {
546 binnedPdf = (RooAbsPdf*) component ;
547 binnedL = kTRUE ;
548 }
549 if (component->getAttribute("MAIN_MEASUREMENT")) {
550 // not really a binned pdf, but this prevents a (potentially) long list of subsidiary measurements to be passed to the slave calculator
551 binnedPdf = (RooAbsPdf*) component ;
552 }
553 }
554 }
555 // WVE END HACK
556 // Below here directly pass binnedPdf instead of PROD(binnedPdf,constraints) as constraints are evaluated elsewhere anyway
557 // and omitting them reduces model complexity and associated handling/cloning times
558 if (_splitRange && rangeName) {
559 _gofArray[n] = create(type->GetName(),type->GetName(),(binnedPdf?*binnedPdf:*pdf),*dset,*projDeps,
560 Form("%s_%s",rangeName,type->GetName()),addCoefRangeName,_nCPU*(_mpinterl?-1:1),_mpinterl,_verbose,_splitRange,binnedL);
561 } else {
562 _gofArray[n] = create(type->GetName(),type->GetName(),(binnedPdf?*binnedPdf:*pdf),*dset,*projDeps,
563 rangeName,addCoefRangeName,_nCPU,_mpinterl,_verbose,_splitRange,binnedL);
564 }
566 // *** END HERE
567
568 // Fill per-component split mode with Bulk Partition for now so that Auto will map to bulk-splitting of all components
570 if (dset->numEntries()<10) {
571 //cout << "RAT::initSim("<< GetName() << ") MP mode is auto, setting split mode for component "<< n << " to SimComponents"<< endl ;
574 } else {
575 //cout << "RAT::initSim("<< GetName() << ") MP mode is auto, setting split mode for component "<< n << " to BulkPartition"<< endl ;
578 }
579 }
580
581 // Servers may have been redirected between instantiation and (deferred) initialization
582
583 RooArgSet *actualParams = binnedPdf ? binnedPdf->getParameters(dset) : pdf->getParameters(dset);
584 RooArgSet* selTargetParams = (RooArgSet*) _paramSet.selectCommon(*actualParams);
585
586 _gofArray[n]->recursiveRedirectServers(*selTargetParams);
587
588 delete selTargetParams;
589 delete actualParams;
590
591 ++n;
592
593 } else {
594 if ((!dset || (0. != dset->sumEntries() && !processEmptyDataSets())) && pdf) {
595 if (_verbose) {
596 ccoutD(Fitting) << "RooAbsTestStatistic::initSimMode: state " << type->GetName()
597 << " has no data entries, no slave calculator created" << endl;
598 }
599 }
600 }
601 }
602 coutI(Fitting) << "RooAbsTestStatistic::initSimMode: created " << n << " slave calculators." << endl;
603
604 dsetList->Delete(); // delete the content.
605 delete dsetList;
606 delete catIter;
607}
608
609
610////////////////////////////////////////////////////////////////////////////////
611/// Change dataset that is used to given one. If cloneData is kTRUE, a clone of
612/// in the input dataset is made. If the test statistic was constructed with
613/// a range specification on the data, the cloneData argument is ignore and
614/// the data is always cloned.
615
617{
618 // Trigger refresh of likelihood offsets
619 if (isOffsetting()) {
622 }
623
624 switch(operMode()) {
625 case Slave:
626 // Delegate to implementation
627 return setDataSlave(indata, cloneData);
628 case SimMaster:
629 // Forward to slaves
630 // cout << "RATS::setData(" << GetName() << ") SimMaster, calling setDataSlave() on slave nodes" << endl;
631 if (indata.canSplitFast()) {
632 for (Int_t i = 0; i < _nGof; ++i) {
633 RooAbsData* compData = indata.getSimData(_gofArray[i]->GetName());
634 _gofArray[i]->setDataSlave(*compData, cloneData);
635 }
636 } else if (0 == indata.numEntries()) {
637 // For an unsplit empty dataset, simply assign empty dataset to each component
638 for (Int_t i = 0; i < _nGof; ++i) {
639 _gofArray[i]->setDataSlave(indata, cloneData);
640 }
641 } else {
642// cout << "NONEMPTY DATASET WITHOUT FAST SPLIT SUPPORT! "<< indata.GetName() << endl;
643 const RooAbsCategoryLValue* indexCat = & ((RooSimultaneous*)_func)->indexCat();
644 TList* dlist = indata.split(*indexCat, kTRUE);
645 for (Int_t i = 0; i < _nGof; ++i) {
646 RooAbsData* compData = (RooAbsData*) dlist->FindObject(_gofArray[i]->GetName());
647 // cout << "component data for index " << _gofArray[i]->GetName() << " is " << compData << endl;
648 if (compData) {
649 _gofArray[i]->setDataSlave(*compData,kFALSE,kTRUE);
650 } else {
651 coutE(DataHandling) << "RooAbsTestStatistic::setData(" << GetName() << ") ERROR: Cannot find component data for state " << _gofArray[i]->GetName() << endl;
652 }
653 }
654 }
655 break;
656 case MPMaster:
657 // Not supported
658 coutF(DataHandling) << "RooAbsTestStatistic::setData(" << GetName() << ") FATAL: setData() is not supported in multi-processor mode" << endl;
659 throw string("RooAbsTestStatistic::setData is not supported in MPMaster mode");
660 break;
661 }
662
663 return kTRUE;
664}
665
666
667
669{
670 // Apply internal value offsetting to control numeric precision
671 if (!_init) {
672 const_cast<RooAbsTestStatistic*>(this)->initialize() ;
673 }
674
675 switch(operMode()) {
676 case Slave:
677 _doOffset = flag ;
678 // Clear offset if feature is disabled to that it is recalculated next time it is enabled
679 if (!_doOffset) {
680 _offset = 0 ;
681 _offsetCarry = 0;
682 }
683 setValueDirty() ;
684 break ;
685 case SimMaster:
686 _doOffset = flag;
687 for (Int_t i = 0; i < _nGof; ++i) {
688 _gofArray[i]->enableOffsetting(flag);
689 }
690 break ;
691 case MPMaster:
692 _doOffset = flag;
693 for (Int_t i = 0; i < _nCPU; ++i) {
695 }
696 break;
697 }
698}
699
700
702{ return _evalCarry; }
void Class()
Definition: Class.C:29
#define coutI(a)
Definition: RooMsgService.h:31
#define coutF(a)
Definition: RooMsgService.h:35
#define coutE(a)
Definition: RooMsgService.h:34
#define ccoutI(a)
Definition: RooMsgService.h:38
#define ccoutD(a)
Definition: RooMsgService.h:37
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
unsigned long ULong_t
Definition: RtypesCore.h:51
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:363
int type
Definition: TGX11.cxx:120
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
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:533
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
Definition: RooAbsArg.cxx:2274
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
Definition: RooAbsArg.cxx:264
void setValueDirty() const
Definition: RooAbsArg.h:441
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
Definition: RooAbsArg.cxx:1080
void SetName(const char *name)
Set the name of the TNamed.
Definition: RooAbsArg.cxx:2382
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
TIterator * typeIterator() const
Return iterator over all defined states.
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooAbsCollection * selectCommon(const RooAbsCollection &refColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
virtual TList * split(const RooAbsCategory &splitCat, Bool_t createEmptyDataSets=kFALSE) const
Split dataset into subsets based on states of given splitCat in this dataset.
virtual Double_t sumEntries() const =0
RooAbsData * getSimData(const char *idxstate)
virtual Int_t numEntries() const
Definition: RooAbsData.cxx:285
Bool_t canSplitFast() const
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
virtual Double_t getValV(const RooArgSet *set=0) const
Return value of object.
Definition: RooAbsReal.cxx:248
RooAbsTestStatistic is the abstract base class for all test statistics.
virtual Bool_t processEmptyDataSets() const
Int_t _nGof
Number of designated set to calculated extended term.
GOFOpMode operMode() const
void initSimMode(RooSimultaneous *pdf, RooAbsData *data, const RooArgSet *projDeps, const char *rangeName, const char *addCoefRangeName)
Initialize simultaneous p.d.f processing mode.
Int_t _nCPU
GOF MP Split mode specified by component (when Auto is active)
virtual RooAbsTestStatistic * create(const char *name, const char *title, RooAbsReal &real, RooAbsData &data, const RooArgSet &projDeps, const char *rangeName=0, const char *addCoefRangeName=0, Int_t nCPU=1, RooFit::MPSplit interleave=RooFit::BulkPartition, Bool_t verbose=kTRUE, Bool_t splitCutRange=kFALSE, Bool_t binnedL=kFALSE)=0
RooFit::MPSplit _mpinterl
Array of parallel execution frond ends.
virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Forward constant term optimization management calls to component test statistics.
pRooAbsTestStatistic * _gofArray
virtual Double_t globalNormalization() const
Bool_t setData(RooAbsData &data, Bool_t cloneData=kTRUE)
Change dataset that is used to given one.
void enableOffsetting(Bool_t flag)
GOFOpMode _gofOpMode
Is object initialized
RooAbsTestStatistic()
Default constructor.
virtual Double_t evaluatePartition(Int_t firstEvent, Int_t lastEvent, Int_t stepSize) const =0
void setSimCount(Int_t simCount)
virtual Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
Forward server redirect calls to component test statistics.
virtual Double_t getCarry() const
virtual Bool_t setDataSlave(RooAbsData &, Bool_t=kTRUE, Bool_t=kFALSE)
virtual ~RooAbsTestStatistic()
Destructor.
const RooArgSet * _projDeps
virtual Double_t combinedValue(RooAbsReal **gofArray, Int_t nVal) const =0
virtual Double_t evaluate() const
Calculates and return value of test statistic.
Bool_t isOffsetting() const
Double_t _evalCarry
avoids loss of precision
void initMPMode(RooAbsReal *real, RooAbsData *data, const RooArgSet *projDeps, const char *rangeName, const char *addCoefRangeName)
Initialize multi-processor calculation mode.
std::vector< RooFit::MPSplit > _gofSplitMode
Array of sub-contexts representing part of the combined test statistic.
Double_t _offsetCarry
Offset.
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.
void setMPSet(Int_t setNum, Int_t numSets)
Set MultiProcessor set number identification of this instance.
Bool_t initialize()
One-time initialization of the test statistic.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state.
Definition: RooCatType.h:22
RooAbsArg * next()
RooProdPdf is an efficient implementation of a product of PDFs of the form.
Definition: RooProdPdf.h:31
RooRealMPFE is the multi-processor front-end for parallel calculation of RooAbsReal objects.
Definition: RooRealMPFE.h:30
virtual Double_t getCarry() const
void initialize()
Initialize the remote process and message passing pipes between current process and remote process.
void enableOffsetting(Bool_t flag)
Control verbose messaging related to inter process communication on both client and server side.
virtual Double_t getValV(const RooArgSet *nset=0) const
If value needs recalculation and calculation has not beed started with a call to calculate() start it...
virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTracking=kTRUE)
Intercept call to optimize constant term in test statistics and forward it to object on server side.
void followAsSlave(RooRealMPFE &master)
Definition: RooRealMPFE.h:48
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Overloaded RooArgSet::add() method inserts 'var' into set and registers 'var' as server to owner with...
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
const RooAbsCategoryLValue & indexCat() const
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
Iterator abstract base class.
Definition: TIterator.h:30
virtual void Reset()=0
virtual TObject * Next()=0
A doubly linked list.
Definition: TList.h:44
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Definition: TList.cxx:574
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:467
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
Double_t y[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
@ SimComponents
Definition: RooGlobalFunc.h:60
@ Interleave
Definition: RooGlobalFunc.h:60
@ BulkPartition
Definition: RooGlobalFunc.h:60
@ DataHandling
Definition: RooGlobalFunc.h:59
STL namespace.
static long int sum(long int i)
Definition: Factory.cxx:2258