Ploting two histograms on same axis


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Respected sir/ma’am
i am new to root. i have stored data in tree and i can access it by writing programs. In a root file i have 3 trees and their respective branches. i can plot a histogram but when it comes to two branches in same axis i am not able to plot. i have tried many programs.

please help me

You should plot the 2nd histogram (tree) with option SAME.

t1->Draw("x");
t2->Draw("y","","SAME");

I have four trees T, PC, FE ,GS.
And here is the rough program

{
TFile f("charm02.root");
T->Draw("abs(phi1 - phi2)");
FE->Draw("abs(fphi1 - fphi2)"," ","SAME");
}

But the error comes

Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
Error in <TTreeFormula::Compile>:  Empty String
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {abs(fphi1 - fphi2), }

where phi1, phi2, fphi1, fphi2 are branches.

What you are doing seems correct.
We will need some reproducer to help you further.

its done thank you
actually

FE->Draw("abs(fphi1 - fphi2)"," ","SAME");

there should be no gap between the (" ").
@couet This seems to be a bug in ROOT.

Ah yes the selection should be empty of course.

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