47 ClassImp(RooDataWeightedAverage);
57 RooDataWeightedAverage::RooDataWeightedAverage(
const char *name,
const char *title, RooAbsReal& pdf, RooAbsData& indata,
58 const RooArgSet& projdeps, Int_t nCPU, RooFit::MPSplit interleave, Bool_t showProgress, Bool_t verbose) :
59 RooAbsOptTestStatistic(name,title,pdf,indata,projdeps,0,0,nCPU,interleave,verbose,kFALSE),
60 _showProgress(showProgress)
63 coutI(Plotting) <<
"RooDataWeightedAverage::ctor(" << GetName() <<
") constructing data weighted average of function " << pdf.GetName()
64 <<
" over " << indata.numEntries() <<
" data points of " << *(indata.get()) <<
" with a total weight of " << indata.sumEntries() << endl ;
66 _sumWeight = indata.sumEntries() ;
73 RooDataWeightedAverage::RooDataWeightedAverage(
const RooDataWeightedAverage& other,
const char* name) :
74 RooAbsOptTestStatistic(other,name),
75 _sumWeight(other._sumWeight),
76 _showProgress(other._showProgress)
85 RooDataWeightedAverage::~RooDataWeightedAverage()
96 Double_t RooDataWeightedAverage::globalNormalization()
const
106 Double_t RooDataWeightedAverage::evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize)
const
110 _dataClone->store()->recalculateCache( _projDeps, firstEvent, lastEvent, stepSize,kFALSE) ;
112 if (setNum()==0 && _showProgress) {
113 ccoutP(Plotting) <<
"." ;
117 for (
auto i=firstEvent ; i<lastEvent ; i+=stepSize) {
121 if (_dataClone->weight()==0)
continue ;
123 Double_t term = _dataClone->weight() * _funcClone->getVal(_normSet);