Nea
1
Hello. I want to use roofit. But my code doesn’t work.
Here is Error code.
Error in <TFormula::Eval>: Formula is invalid and not ready to execute
re is unknown.
me is unknown.
section1 is unknown.
section2 is unknown.
And this is my code.
RooRealVar t("t", "t", 1, 4500);
RooRealVar pi("pi", "pi", 3.14159);
RooRealVar hn("hn", "hn", 662000.);//ev
RooRealVar re("re", "re", 0.00000000000000281794);//unknown
RooRealVar me("me", "me", 511000.);//ev //unknown
RooFormulaVar s("s", "t/662000", RooArgList(t));
RooFormulaVar ga("ga", "hn/me", RooArgList(hn,me));
TF1* section1 = new TF1("f", "s*s/ga/ga/(1-s)/(1-s)", 0, 4500); //unknown
TF1* section2 = new TF1("f", "s/(1-s)*(s-2/ga)",0,4500); //unknown
TF1* section = new TF1("f", "pi * re * re * / me / (section1 + section2 + 2)", 0, 4500);
RooAbsPdf* rf = bindPdf(section, x);
rf->fitTo(*hist1);
rf->plotOn(frame, LineColor(kYellow));
Thank you for your help.
Regards.
Nea
In
TF1* section = new TF1("f", "pi * re * re * / me / (section1 + section2 + 2)", 0, 4500);
You seem to have a bad math * /
operation.
Generally speaking i don’t use the bindPdf functions ( see tutorial ROOT: tutorials/roofit/rf105_funcbinding.C Source File )
But the
RooGenericPdf
class , which can be supplied direclty with
RooGenericPdf myPdf("pdf","pdf", "( @0 + @1 / @3 ....)", RooArgList( var0, var1, var2...)
Cheers
Given t
is inside s
RooRealVar t("t", "t", 1, 4500);
RooRealVar pi("pi", "pi", 3.14159);
RooRealVar hn("hn", "hn", 662000.);//ev
RooRealVar re("re", "re", 0.00000000000000281794);//unknown
RooRealVar me("me", "me", 511000.);//ev //unknown
RooFormulaVar s("s", "@0/662000", RooArgList(t));
RooFormulaVar ga("ga", "@0/@1", RooArgList(hn,me));
RooGenericPdf pdf("function", "function", "3.14159 * @0*@0/(@1 *( (@2*@2)/((@3*@3)*(1-@2)*(1-@2)) + (@2*@2-2)/(@3*(1-@2)) + 2))", RooArgList( re, me, s, ga));
with this the pdf is valid, but check out the math
2 Likes
Nea
4
Thank you! My code works.
system
Closed
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.