Combine TMultiGraphs

Hi all,

I have a problem with plotting several TMultiGraphs on one canvas (combining them). I have 5 TMultiGraphs in 5 different files. In a macro, I try to call them and plot them together on one canvas, but I get a *** Break *** segmentation violation. So, I assume this cannot be done for TMultiGraphs as for TGraphs. Also, I am calling them into the macro as TGraphs, but they are not TGraphs. I apologize for this beginner’s questions. I appreciate the help.

Here is an example of my code:

void mean()
{
   auto c1 = new TCanvas();

  TFile *f1 = new TFile("0.7.root");
  TGraph *gr1 = (TGraph*)f1->Get("ca2");
  gr1->SetName("gr1");

  TFile *f2 = new TFile("0.8.root");
  TGraph *gr2 = (TGraph*)f2->Get("ca1");
  gr2->SetName("gr2");

  TFile *f3 = new TFile("0.9.root");
  TGraph *gr3 = (TGraph*)f3->Get("ca4");
  gr3->SetName("gr3");

  TFile *f4 = new TFile("0.65.root");
  TGraph *gr4 = (TGraph*)f4->Get("ca5");
  gr4->SetName("gr4");

  TFile *f5 = new TFile("0.85.root");
  TGraph *gr5 = (TGraph*)f5->Get("ca3");
  gr5->SetName("gr5");


   gr1->SetMarkerStyle(20); gr1->SetMarkerColor(kRed);        gr1->SetMarkerSize(1.3);
   gr2->SetMarkerStyle(21); gr2->SetMarkerColor(kBlue);       gr2->SetMarkerSize(1.3);
   gr3->SetMarkerStyle(22); gr3->SetMarkerColor(kBlack);      gr3->SetMarkerSize(1.3);
   gr4->SetMarkerStyle(23); gr4->SetMarkerColor(kOrange);     gr4->SetMarkerSize(1.3);
   gr5->SetMarkerStyle(33); gr5->SetMarkerColor(kGreen);      gr5->SetMarkerSize(1.3);

  TMultiGraph *mg = new TMultiGraph();
  mg->Add(gr1);
  mg->Add(gr2);
  mg->Add(gr3);
  mg->Add(gr4);
  mg->Add(gr5);
  mg->Draw("AP");
}

Attach the output of:
rootls -l 0.7.root 0.8.root 0.9.root 0.65.root 0.85.root