81 :
RooXYChi2Var{
name, title, func, xydata, nullptr, integrate, makeRooAbsTestStatisticCfg()}
105 :
RooXYChi2Var{
name, title, func, xydata, &yvar, integrate, makeRooAbsTestStatisticCfg()}
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()));
163 if (
auto* var =
dynamic_cast<RooRealVar*
>(arg)) {
176#ifdef R__HAS_MATHMORE
194 for(
auto *
x : static_range_cast<RooRealVar*>(
_rrvArgs)) {
195 _binList.push_back(&
x->getBinning(
"bin",
false,
true)) ;
213 for(
auto * var : static_range_cast<RooRealVar*>(
_rrvArgs)) {
215 if (var->hasAsymError()) {
218 double cxval = var->getVal() ;
219 double xerrLo = -var->getAsymErrorLo() ;
220 double xerrHi = var->getAsymErrorHi() ;
221 double xerr = (xerrLo+xerrHi)/2 ;
224 var->setVal(cxval - xerr/100) ;
225 double fxmin =
fy() ;
228 var->setVal(cxval + xerr/100) ;
229 double fxmax =
fy() ;
232 double slope = (fxmax-fxmin)/(2*xerr/100.) ;
237 if ((ydata>cxval && fxmax>fxmin) || (ydata<=cxval && fxmax<=fxmin)) {
239 ret += pow(xerrHi*slope,2) ;
242 ret += pow(xerrLo*slope,2) ;
245 }
else if (var->hasError()) {
248 double cxval = var->getVal() ;
249 double xerr = var->getError() ;
252 var->setVal(cxval - xerr/100) ;
253 double fxmin =
fy() ;
256 var->setVal(cxval + xerr/100) ;
257 double fxmax =
fy() ;
260 double slope = (fxmax-fxmin)/(2*xerr/100.) ;
268 ret += pow(xerr*slope,2) ;
299 double xmin =
x->getVal() +
x->getErrorLo() ;
300 double xmax =
x->getVal() +
x->getErrorHi() ;
307 return ret / volume ;
330 for (
auto i=firstEvent ; i<lastEvent ; i+=stepSize) {
336 double yfunc =
fy() ;
347 ydata = xydata->
weight() ;
352 double eExt = yfunc-ydata ;
355 double eInt = (eExt>0) ? eyhi : eylo ;
364 coutE(Eval) <<
"RooXYChi2Var::RooXYChi2Var(" <<
GetName() <<
") INFINITY ERROR: data point " << i
365 <<
" has zero error, but function is not zero (f=" << yfunc <<
")" << endl ;
370 double term = eExt*eExt/(eInt*eInt+ eIntX2);
371 double y = term - carry;
RooAbsData * _dataClone
Pointer to internal clone if input data.
RooRealVar * _yvar
Y variable if so designated.
RooNumIntConfig _intConfig
Numeric integrator configuration for integration of function over bin.
bool _integrate
Is integration over the bin volume requested.
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.
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
Abstract base class for test statistics objects that evaluate a function or PDF at each point of a gi...
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.
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)
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.