Draw call after GetValue gives error

The following works as expected.

ROOT::RDF::TH2DModel mh2D("h2D", "his2D", 100, 0., 100, 100, 0., 100);
auto h2D = matdf.Histo2D(mh2D, "X", "Y");
h2D->Draw("colz");

However, when I do the following i.e. when I use GetValue() before the Draw()

ROOT::RDF::TH2DModel mh2D("h2D", "his2D", 100, 0., 100, 100, 0., 100);
auto h2D = matdf.Histo2D(mh2D, "X", "Y").GetValue();
h2D->Draw("colz");

I get the following error
error: member reference type 'TH2D' is not a pointer;

Please explain why?

ROOT Version: ROOT 6.24/02
Platform: Linux 5.17.12-100.fc34.x86_64
Compiler: 11.3.1 20220421


Hi,

I think the answer can be found in the documentation ROOT: ROOT::RDF::RResultPtr< T > Class Template Reference .
The return type of GetValue is a reference and not a pointer.

Cheers,
D

Thanks a lot, I should have noted that earlier!

It happens, no worries.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.