I created two graphs from data read with the RDataFrame. The final step in my visualization of the data is the legend. Sadly this fails with the message:
buildroot/include/TLegend.h:36:20: note: candidate function not viable: no known conversion from ‘ROOT::RDF::RResultPtr’ to 'const TObject ’ for 1st argument
TLegendEntry AddEntry(const TObject obj, const char label = “”, Option_t* option = “lpf” );
buildroot/include/TLegend.h:37:20: note: candidate function not viable: no known conversion from ‘ROOT::RDF::RResultPtr’ to ‘const char *’ for 1st argument
TLegendEntry AddEntry(const char name, const char label = “”, Option_t option = “lpf” );
Any clue how I can fix this without creating extra TObjects which I use just for the legend?
8000_values.vacuum.txt (8.2 KB)
ANTS.c (1.8 KB)
Ref_values.vacuum.txt (8.2 KB)
ROOT Version: 6.15
Compiler: Not Provided
I think this is expected.
The return value of the RDF actions is always wrapped in a
RResultPtr. You should get out of the smartpointer the pointer to the histogram with the Get method:
unfortunately this does not solve the problem. Changing g2 to g2.Get() returns the error: ‘Get’ is a private member of ‘ROOT::RDF::RResultPtr’
and changing it to g2->Get() returns the error: no member named ‘Get’ in ‘TGraph’. The Later makes sense since I am addressing the member functions of TGraph.
Why is TLegend not taking the information of the underlying graph when I am giving him a smartpointer which points to the object?
my bad. I meant
The compiler is not happy because this is the behaviour of C++. It sometimes may seem frustrating but I believe it’s a big advantage for correctness
Okay now I understand the situation. Thanks alot.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.