I’m a root beginner, and I would like to ask for help with the following. I want to open two or several root files where I have stored TGraphs and compare them by drawing them on the same canvas. Could you please give me some advice or a basic code on how to do this? I appreciate the help.
To plot them together it’s better to use a TMultiGraph; something like:
// do similarly for all files/graphs:
TFile *f1 = new TFile("file1.root");
TGraph *g1 = (TGraph*)f1->Get("graph1"); // supposing file1.root contains graph1
// ... (f2, g2, etc.)
// then add all graphs to a multigraph and draw it:
TMultiGraph *mg = new TMultiGraph();
mg->Add(g1);
mg->Add(g2);
// ...
mg->Draw("Al*");