Skip to content

Commit 8592d55

Browse files
committed
[RF] Rename RooAbsData::plotOn() implementation to plotOnImpl()
The `protected` implementation should have a different name from the public function name. Otherwise, it will also be considered in the cppyy overload resolution, which will not go well because it uses the internal `RooAbsData::PlotOpt` type for the second argument, which is also protected. This also simplifies the Pythonization a bit, because the user-facing `plotOn()` method only needs to be available in the RooAbsData base class, and not be brought into the derived RooDataHist class via `using` statements because the public interface would be shadowed by the protected internal overload.
1 parent 94fed69 commit 8592d55

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/_roodatahist.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ def __init__(self, *args, **kwargs):
4747
args, kwargs = _kwargs_to_roocmdargs(*args, **kwargs)
4848
self._init(*args, **kwargs)
4949

50-
def plotOn(self, *args, **kwargs):
51-
# Redefinition of `RooDataHist.plotOn` for keyword arguments.
52-
# The keywords must correspond to the CmdArg of the `plotOn` function.
53-
args, kwargs = _kwargs_to_roocmdargs(*args, **kwargs)
54-
return self._plotOn(*args, **kwargs)
55-
5650
@property
5751
def shape(self):
5852
shape = []

roofit/roofitcore/inc/RooAbsData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ class RooAbsData : public TNamed, public RooPrintable {
330330
double scaleFactor);
331331

332332
// PlotOn implementation
333-
virtual RooPlot *plotOn(RooPlot *frame, PlotOpt o) const ;
333+
virtual RooPlot *plotOnImpl(RooPlot *frame, PlotOpt o) const ;
334334
virtual RooPlot *plotAsymOn(RooPlot* frame, const RooAbsCategoryLValue& asymCat, PlotOpt o) const ;
335335
virtual RooPlot *plotEffOn(RooPlot* frame, const RooAbsCategoryLValue& effCat, PlotOpt o) const ;
336336

roofit/roofitcore/inc/RooDataHist.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ class RooDataHist : public RooAbsData, public RooDirItem {
131131
return (lo+hi)/2 ;
132132
}
133133

134-
using RooAbsData::plotOn ;
135-
RooPlot *plotOn(RooPlot *frame, PlotOpt o) const override;
134+
RooPlot *plotOnImpl(RooPlot *frame, PlotOpt o) const override;
136135

137136
void reset() override;
138137

roofit/roofitcore/src/RooAbsData.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ RooPlot* RooAbsData::plotOn(RooPlot* frame, const RooLinkedList& argList) const
18181818

18191819
RooPlot* ret ;
18201820
if (!asymCat && !effCat) {
1821-
ret = plotOn(frame,o) ;
1821+
ret = plotOnImpl(frame,o) ;
18221822
} else if (asymCat) {
18231823
ret = plotAsymOn(frame,*asymCat,o) ;
18241824
} else {
@@ -1861,7 +1861,7 @@ RooPlot* RooAbsData::plotOn(RooPlot* frame, const RooLinkedList& argList) const
18611861
///
18621862
/// The drawOptions are passed to the TH1::Draw() method.
18631863
/// \see RooAbsData::plotOn(RooPlot*,const RooLinkedList&) const
1864-
RooPlot *RooAbsData::plotOn(RooPlot *frame, PlotOpt o) const
1864+
RooPlot *RooAbsData::plotOnImpl(RooPlot *frame, PlotOpt o) const
18651865
{
18661866
if(nullptr == frame) {
18671867
coutE(Plotting) << ClassName() << "::" << GetName() << ":plotOn: frame is null" << std::endl;

roofit/roofitcore/src/RooDataHist.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,11 +1095,11 @@ std::size_t RooDataHist::calcTreeIndex(const RooAbsCollection& coords, bool fast
10951095
/// frame in mode specified by plot options 'o'. The main purpose of
10961096
/// this function is to match the specified binning on 'o' to the
10971097
/// internal binning of the plot observable in this RooDataHist.
1098-
/// \note see RooAbsData::plotOn() for plotting options.
1099-
RooPlot *RooDataHist::plotOn(RooPlot *frame, PlotOpt o) const
1098+
/// \note see RooAbsData::plotOnImpl() for plotting options.
1099+
RooPlot *RooDataHist::plotOnImpl(RooPlot *frame, PlotOpt o) const
11001100
{
11011101
checkInit() ;
1102-
if (o.bins) return RooAbsData::plotOn(frame,o) ;
1102+
if (o.bins) return RooAbsData::plotOnImpl(frame,o) ;
11031103

11041104
if(!frame) {
11051105
coutE(InputArguments) << ClassName() << "::" << GetName() << ":plotOn: frame is null" << std::endl;
@@ -1120,7 +1120,7 @@ RooPlot *RooDataHist::plotOn(RooPlot *frame, PlotOpt o) const
11201120
}
11211121

11221122
o.bins = &dataVar->getBinning() ;
1123-
return RooAbsData::plotOn(frame,o) ;
1123+
return RooAbsData::plotOnImpl(frame,o) ;
11241124
}
11251125

11261126

0 commit comments

Comments
 (0)