Odd behaviour using DrawOption("F")

Dear all,

I can’t explain what’s happening other than posting an example.

KstJPsEE_L0H_fitAndRes.pdf (32 KB)

I’m trying to draw “stacked” backgrounds with the filled style.
Fist one background and the the sum of the first and second background,
then the sum of first second and third, etc.

The thing works. If I just plot lines everything is fine.
But if I use the fill style it seems RooFit draws a line connecting
the points at the extremes and the colors the difference between
my PDF and that line. What am I doing wrong?

The code line is

model->plotOn(frame, range2, Components(curBkg), DrawOption("F"), FillColor(col), FillStyle(1001), LineWidth(0.), LineStyle(0), LineColor(col), Name(myBkgName), MoveToBack());

Instead the following, using just lines works perfectly

model->plotOn(frame, Components(curBkg), range2, DrawOption("L"), LineColor(colors[counter]), LineStyle(styles[counter]), Name(myBkgName), MoveToBack());


Your two filled graphs (the pink one and the green one) do not have the starting end ending point on the X axis. That’s why you see this effect. I do not know what Roofit does in that case but I guess that’s graphs.


so what do you suggest to do?
Setting a range in some way?

I tried using Range() and NormRange() but nothing changed.


As I said I Does not know what Roofit does.
I would say you should add point in you grab to make the polygon correct