ROOT 6.13/03 | Built for linuxx8664gcc heads/master@v6-13-02-120-g3c7fa4a, Mar 27 2018, 09:56:12
Hi, I’m trying to use the THStack Class Reference to created one
TCanvas with multi histograms. I’m using the TDataFrame.
In my code:
auto hs = new THStack("hs","Histograms");
auto hist1 = TDF.Histo1D({"hist1", "hist1", 100, -20, 20},"Eta");
hs->Add(hist1);
auto hist2 = TDF.Histo1D({"hist2", "hist2", 100, -20, 20},"Eta");
hs->Add(hist2);
auto hist3 = TDF.Histo1D({"hist3", "hist3", 100, -20, 20},"Eta");
hs->Add(hist3);
auto hist4 = TDF.Histo1D({"hist4", "hist4", 100, -20, 20},"Eta");
hs->Add(hist4);
auto c1 = new TCanvas("c1", "c1", 10, 10, 700, 700);
c1->Divide(2,2);
// The histograms:
c1->cd(1);hs->Draw();
c1->cd(1)->SetLogy(1);
c1->cd(2);hs->Draw("nostack");
c1->cd(2)->SetLogy(1);
c1->cd(3);hs->Draw("nostack");
c1->cd(3)->SetLogy(1);
c1->cd(4);hs->Draw("nostack");
c1->cd(4)->SetLogy(1);
Error:
no viable conversion from 'ROOT::Experimental::TDF::TResultProxy<TH1D>' to 'TH1 *'
hs->Add(hist1);
...
The same error for hist2, hist3 and hist4
.
and
/opt/root6/include/THStack.h:55:30: note: passing argument to parameter 'h' here
virtual void Add(TH1 *h, Option_t *option="");
I think that TDataFrame can’t call the class THStack
or I’m put the
syntax wrong.
Someone have some tips or some place where I can find
more explanation, I’ve been trying to fix this for a while.
Cheers, Andre