I am using roofit and roostats to perform some analyses.
I am using ROOT 5.27/01 (trunk@32073, Jan 25 2010, 21:29:56 on linux)
I would like to make a plot of a RooFormulaVar. How does one do this?
I define some variables:
RooRealVar x("x", "my x var", 50.0, 1.0, 100); RooRealVar y("y", "my y var", 25.0, 1.0, 100);
Then I set up my model and import my data, then perform a fit:
result = model->fitTo(*data, Extended(kTRUE),SumW2Error(kTRUE), PrintLevel(1), Range("cutrange"), Save());
Now I want to make a plot of the ratio x/y.
RooFormulaVar ratio_func("ratio","@0/@1",RooArgList(*x,*y)); RooRealVar* ratio = (RooRealVar*) data->addColumn(ratio_func) ; // line 184 RooPlot* ratio_frame = ratio->frame(Bins(10), Title("My Ratio")) ; ratio->plotOn(ratio_frame, LineColor(kBlue)); ratio_frame->Draw() ;
The code above doesn’t work. Any ideas why?
Here’s what happens:
[code] *** Break *** segmentation violation
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
#10 0x0340b5cd in std::ostream::sentry::sentry () from /usr/lib/libstdc++.so.6
#11 0x0340e00a in std::ostream::operator<< () from /usr/lib/libstdc++.so.6
#12 0x0171844e in RooDataHist::printValue () from /home/palladino/root_dev/lib/libRooFitCore.so
#13 0x0807258f in getML (ws=0x9428ec8) at getlikelihood.C:184
Note: I can NOT redefine
RooRealVar x("x", "my x var", 50.0, 1.0, 100); RooRealVar xOvery("xOvery","my ratio", 50.0); RooFormulaVar y("y","my y var", "@0/@1", RooArgList(x,xOvery)) ;
because x and y are highly correlated.
Eventually I would like to get a profile likelihood, with both x and y as parameters of interest,
I can plot the 2-D 1,2,3 sigma contours of the nll fine, but I’d really like to plot x/y of the pll.
Many thanks in advance.[/code]