Access to statistics box in RooPlot

to change the properties like border size and fill color of a statistics box in a RooPlot object I am currently doing

RooDataSet *myset = …
RooPlot *plot = …

TPaveText text = (TPaveText) plot->getAttText();
… etc

This works, but for esthetic reasons I am annoyed by the extra type casting I have to do from TAttText to TPaveText, especially since RooDataSet::statOn creates a TPaveText objecy but RooPlot::getAttText returns a TAttText object.

Is there a reason why there isn’t a RooPlot::getPaveText or equivalent?


Hi Aras,

The getAttText() style accessors are added to be able to conventiently
change the text properties of any object you added to your RooPlot
that inherits from TAttText w/o casting. Similar accessors exist for marker style, color etc. Note that you can get the TObject pointer back with the getObject()

You are of course correct that a TPaveText has additional properties,
but as in principle you any TObject inherited object can be added
to a RooPlot your request would lead to an very large number of possible
accessors of this style, so its is a bit of a balance, but your point
on statOn making TPaveTexts is a good one.

So I’ll add a TPave* accessor to RooPlot, which covers a few
more use cases than TPaveText and does allow you to access the
non-text properties of a TPaveText.