81 :
RooXYChi2Var{
name, title, func, xydata, nullptr, integrate, makeRooAbsTestStatisticCfg()}
105 :
RooXYChi2Var{
name, title, func, xydata, &yvar, integrate, makeRooAbsTestStatisticCfg()}
115 _integrate(integrate),
116 _intConfig(*defaultIntegratorConfig())
118 bool isPdf =
dynamic_cast<RooAbsPdf const *
>(&func) !=
nullptr;
121 auto &extPdf =
static_cast<RooAbsPdf const &
>(func);
122 if (!extPdf.canBeExtended()) {
123 throw std::runtime_error(
124 Form(
"RooXYChi2Var::RooXYChi2Var(%s) ERROR: Input p.d.f. must be extendible",
GetName()));
141 _extended(other._extended),
142 _integrate(other._integrate),
143 _intConfig(other._intConfig)
162 if (
auto* var =
dynamic_cast<RooRealVar*
>(arg)) {
175#ifdef R__HAS_MATHMORE
193 for(
auto *
x : static_range_cast<RooRealVar*>(
_rrvArgs)) {
194 _binList.push_back(&
x->getBinning(
"bin",
false,
true)) ;
212 for(
auto * var : static_range_cast<RooRealVar*>(
_rrvArgs)) {
214 if (var->hasAsymError()) {
217 double cxval = var->getVal() ;
218 double xerrLo = -var->getAsymErrorLo() ;
219 double xerrHi = var->getAsymErrorHi() ;
220 double xerr = (xerrLo+xerrHi)/2 ;
223 var->setVal(cxval - xerr/100) ;
224 double fxmin =
fy() ;
227 var->setVal(cxval + xerr/100) ;
228 double fxmax =
fy() ;
231 double slope = (fxmax-fxmin)/(2*xerr/100.) ;
236 if ((ydata>cxval && fxmax>fxmin) || (ydata<=cxval && fxmax<=fxmin)) {
238 ret += pow(xerrHi*slope,2) ;
241 ret += pow(xerrLo*slope,2) ;
244 }
else if (var->hasError()) {
247 double cxval = var->getVal() ;
248 double xerr = var->getError() ;
251 var->setVal(cxval - xerr/100) ;
252 double fxmin =
fy() ;
255 var->setVal(cxval + xerr/100) ;
256 double fxmax =
fy() ;
259 double slope = (fxmax-fxmin)/(2*xerr/100.) ;
267 ret += pow(xerr*slope,2) ;
298 double xmin =
x->getVal() +
x->getErrorLo() ;
299 double xmax =
x->getVal() +
x->getErrorHi() ;
306 return ret / volume ;
323 double result(0), carry(0);
328 for (
auto i=firstEvent ; i<lastEvent ; i+=stepSize) {
334 double yfunc =
fy() ;
344 ydata = xydata->
weight() ;
349 double eExt = yfunc-ydata ;
352 double eInt = (eExt>0) ? eyhi : eylo ;
361 coutE(Eval) <<
"RooXYChi2Var::RooXYChi2Var(" <<
GetName() <<
") INFINITY ERROR: data point " << i
362 <<
" has zero error, but function is not zero (f=" << yfunc <<
")" << endl ;
367 double term = eExt*eExt/(eInt*eInt+ eIntX2);
368 double y = term - carry;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
const_iterator begin() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
RooAbsReal * _funcClone
Pointer to internal clone of input function.
RooArgSet * _funcObsSet
List of observables in the pdf expression.
RooAbsData * _dataClone
Pointer to internal clone if input data.
Abstract interface for all probability density functions.
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
Abstract base class for objects that represent a real value and implements functionality common to al...
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create an object that represents the integral of the function over one or more observables listed in ...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
double _evalCarry
! carry of Kahan sum in evaluatePartition
GOFOpMode operMode() const
RooArgSet is a container object that can hold multiple RooAbsArg objects.
bool setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
RooDataSet is a container class to hold unbinned data.
const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
void weightError(double &lo, double &hi, ErrorType etype=SumW2) const override
Return the asymmetric errors on the current weight.
double weight() const override
Return event weight of current event.
void setEpsRel(double newEpsRel)
Set relative convergence criteria (convergence if std::abs(Err)/abs(Int)<newEpsRel)
void setEpsAbs(double newEpsAbs)
Set absolute convergence criteria (convergence if std::abs(Err)<newEpsAbs)
RooRealVar represents a variable that can be changed from the outside.
double getErrorLo() const
double getErrorHi() const
RooXYChi2Var implements a simple chi^2 calculation from an unbinned dataset with values x,...
double fy() const
Return function value requested bu present configuration.
std::unique_ptr< RooAbsReal > _funcInt
! Function integral
std::list< RooAbsBinning * > _binList
! Bin ranges
bool _extended
Is the input function and extended p.d.f.
void initIntegrator()
Initialize bin content integrator.
RooRealVar * _yvar
Y variable if so designated.
RooXYChi2Var(const char *name, const char *title, RooAbsReal &func, RooDataSet &data, bool integrate=false)
RooXYChi2Var constructor with function and X-Y values dataset.
RooArgSet requiredExtraObservables() const override
double evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override
Calculate chi^2 in partition from firstEvent to lastEvent using given stepSize.
bool _integrate
Is integration over the bin volume requested.
RooArgSet _rrvArgs
Set of real-valued observables.
double xErrorContribution(double ydata) const
Calculate contribution to internal error due to error on 'x' coordinates at point i.
void initialize()
Common constructor initialization.
RooNumIntConfig _intConfig
Numeric integrator configuration for integration of function over bin.
const char * GetName() const override
Returns name of object.