66 _func(0), _data(0), _projDeps(0), _splitRange(0), _simCount(0),
67 _verbose(
kFALSE), _init(
kFALSE), _gofOpMode(Slave), _nEvents(0), _setNum(0),
68 _numSets(0), _extSet(0), _nGof(0), _gofArray(0), _nCPU(1), _mpfeArray(0),
69 _mpinterl(
RooFit::BulkPartition), _doOffset(
kFALSE), _offset(0),
70 _offsetCarry(0), _evalCarry(0)
102 const RooArgSet& projDeps,
const char* rangeName,
const char* addCoefRangeName,
105 _paramSet(
"paramSet",
"Set of parameters",this),
109 _rangeName(rangeName?rangeName:
""),
110 _addCoefRangeName(addCoefRangeName?addCoefRangeName:
""),
111 _splitRange(splitCutRange),
118 _mpinterl(interleave),
163 _paramSet(
"paramSet",
"Set of parameters",this),
166 _projDeps((
RooArgSet*)other._projDeps->Clone()),
167 _rangeName(other._rangeName),
168 _addCoefRangeName(other._addCoefRangeName),
169 _splitRange(other._splitRange),
171 _verbose(other._verbose),
174 _gofSplitMode(other._gofSplitMode),
177 _mpinterl(other._mpinterl),
178 _doOffset(other._doOffset),
179 _offset(other._offset),
180 _offsetCarry(other._offsetCarry),
181 _evalCarry(other._evalCarry)
266 carry = (t -
sum) -
y;
295 carry = (t -
sum) -
y;
328 throw std::logic_error(
"this should never happen");
401 os <<
indent <<
"RooAbsTestStatistic begin GOF contents" << endl ;
405 indent2 +=
Form(
"[%d] ",i);
409 os <<
indent <<
"RooAbsTestStatistic end GOF contents" << endl;
470 RooAbsTestStatistic* gof =
create(
GetName(),
GetTitle(),*real,*data,*projDeps,rangeName,addCoefRangeName,1,
_mpinterl,
_verbose,
_splitRange);
478 ccoutD(Eval) <<
"RooAbsTestStatistic::initMPMode: starting remote server process #" << i << endl;
487 coutI(Eval) <<
"RooAbsTestStatistic::initMPMode: started " <<
_nCPU <<
" remote server process." << endl;
501 const RooArgSet* projDeps,
const char* rangeName,
const char* addCoefRangeName)
509 coutE(Fitting) <<
"RooAbsTestStatistic::initSimMode(" <<
GetName() <<
") ERROR: index category of simultaneous pdf is missing in dataset, aborting" << endl;
510 throw std::runtime_error(
"RooAbsTestStatistic::initSimMode() ERROR, index category of simultaneous pdf is missing in dataset, aborting");
517 for (
const auto& catState : simCat) {
532 for (
const auto& catState : simCat) {
533 const std::string& catName = catState.first;
539 ccoutI(Fitting) <<
"RooAbsTestStatistic::initSimMode: creating slave calculator #" <<
n <<
" for state " << catName
540 <<
" (" << dset->
numEntries() <<
" dataset entries)" << endl;
551 }
else if (pdf->IsA()->
InheritsFrom(RooProdPdf::Class())) {
555 while ((component = iter.
next())) {
570 _gofArray[
n] =
create(catName.c_str(), catName.c_str(),(binnedPdf?*binnedPdf:*pdf),*dset,*projDeps,
573 _gofArray[
n] =
create(catName.c_str(),catName.c_str(),(binnedPdf?*binnedPdf:*pdf),*dset,*projDeps,
599 delete selTargetParams;
607 ccoutD(Fitting) <<
"RooAbsTestStatistic::initSimMode: state " << catName
608 <<
" has no data entries, no slave calculator created" << endl;
613 coutI(Fitting) <<
"RooAbsTestStatistic::initSimMode: created " <<
n <<
" slave calculators." << endl;
654 coutF(DataHandling) <<
"Tried to split '" << indata.
GetName() <<
"' into categories of '" << indexCat.
GetName()
655 <<
"', but splitting failed. Input data:" << std::endl;
657 throw std::runtime_error(
"Error when setting up test statistic: dataset couldn't be split into categories.");
666 coutE(DataHandling) <<
"RooAbsTestStatistic::setData(" <<
GetName() <<
") ERROR: Cannot find component data for state " <<
_gofArray[i]->
GetName() << endl;
673 coutF(DataHandling) <<
"RooAbsTestStatistic::setData(" <<
GetName() <<
") FATAL: setData() is not supported in multi-processor mode" << endl;
674 throw std::runtime_error(
"RooAbsTestStatistic::setData is not supported in MPMaster mode");
static void indent(ostringstream &buf, int indent_level)
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
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...
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.
void SetName(const char *name)
Set the name of the TNamed.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
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...
Storage_t::size_type size() const
RooAbsData is the common abstract base class for binned and unbinned datasets.
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
Return effective number of entries in dataset, i.e., sum all weights.
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
RooAbsData * getSimData(const char *idxstate)
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Bool_t canSplitFast() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual Double_t getValV(const RooArgSet *normalisationSet=nullptr) const
Return value of object.
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.
std::string _addCoefRangeName
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.
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 Double_t evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const =0
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
Calculate 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.
pRooRealMPFE * _mpfeArray
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.
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
RooProdPdf is an efficient implementation of a product of PDFs of the form.
RooRealMPFE is the multi-processor front-end for parallel calculation of RooAbsReal objects.
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)
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...
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.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
static uint64_t sum(uint64_t i)