[quote=“couet”]
{
TProfile *prof1 = new TProfile("prof1", "prof1", 100, -2.5, 2.5);
prof1->Fill(0, 1);
prof1->Fill(0, 1);
prof1->SetFillColor(4);
TProfile *prof2 = new TProfile("prof2", "prof2", 100, -2.5, 2.5);
prof2->Fill(0.1, 0.5);
prof2->Fill(0.1, 0.5);
prof2->SetFillColor(2);
THStack hs("stack", "stack");
hs->Add(prof1);
hs->Add(prof2);
hs->SetMaximum(2);
hs->Draw("HIST");
}
Yes in fact as you can see on this modified version of you macro the 2 histos are not superimposed… but both are drawn[/quote]
I asked Lorenzo (our math expert) who told no that it does not really make sense to stack profile histograms. If you want to make a stack convert them to normal TH1.
It does not make sense to stack profile plots, so we cannot have this functionality automatically. It is the user who needs to do the projection of TProfile in a TH1, according to its needs
[quote=“moneta”]It does not make sense to stack profile plots, so we cannot have this functionality automatically. It is the user who needs to do the projection of TProfile in a TH1, according to its needs
Best Regards
Lorenzo[/quote]
ok, but if it doesn’t make sense the function THStack::Add should not take as argument a TProfile
Yes, you are right, we should probably add an error message since we cannot exclude it at compile time, since
we have unfortunately a TProfile deriving from a TH1.
Thank you for the suggestion