How to get error from Rooformula?

i want to get error from Rooformula, how to do it?

Hi @liuwe,

thanks for the question but you could give us a bit more context of what exactly you would like to do?

Cheers,
Marta

    RooRealVar *frac_R = new RooRealVar(Form("frac_R_b%i",i),"",0.2,0,1.);
    RooRealVar *frac_2 = new RooRealVar(Form("frac_2_b%i",i),"",0.3,0.,1.);
    RooRealVar *f0     = new RooRealVar(Form("f0_b%i",i),"",0.5,0.,1.);
    RooRealVar *sigma1 = new RooRealVar(Form("sigma1_b%i",i),"",0.2,0.,1.);
    RooRealVar *sigma2 = new RooRealVar(Form("sigma2_a%i",i),"",0.005,0.,.1);
    RooRealVar *sigma3 = new RooRealVar(Form("sigma3_b%i",i),"",0.015,0.,.1);
    RooFormulaVar *D = new RooFormulaVar(Form("D_b%i",i),"@1*@2*exp(-@0*@0*@3*@3/2)+@1*(1-@2)*exp(-@0*@0*@4*@4/2)+(1

-@1)exp(-@0@0*@5*@5/2)",RooArgList(*Dms,*frac_R,*frac_2,*sigma1,*sigma2,*sigma3));

    RooFormulaVar *AVERR = new RooFormulaVar(Form("AVERR_b%i",i), "sqrt(-2.*log(@0))/@1",RooArgList(*D,*Dms));

I’ve found that for D I can only use getVal(), but I want to implement something like getError().

Hi @liuwe,

I’m not a roofit expert but maybe this tutorial could give you some hints: ROOT: tutorials/roofit/rf606_nllerrorhandling.C File Reference
and the class documentation is here: ROOT: RooRealVar Class Reference

I will also tag @jonas so that he can give you more insights in case it is needed.

Cheers,
Marta