void afzaal() { auto f1 = new TFile("aluminium.root"); TH1D *h_first = (TH1D*)f1->Get("h1"); h_first->SetLineWidth(2); h_first->SetLineColor(kBlack); h_first->Draw("hist"); auto f2 = new TFile("glass.root"); TH1D* h_second = (TH1D*)f2->Get("h1"); h_second->SetLineWidth(2); h_second->SetLineColor(kRed); h_second->Draw("hist same"); auto f3 = new TFile("bakelite.root"); TH1D* h_third = (TH1D*)f3->Get("h1"); h_third->SetLineWidth(2); h_third->SetLineColor(kGreen); h_third->SetMarkerColor(kGreen); h_third->SetMarkerStyle(2); h_third->Draw("hist same"); auto legend = new TLegend(0.1,0.7,0.48,0.9); legend->AddEntry(h_first, "aluminium","L"); legend->AddEntry(h_second, "glass", "L"); legend->AddEntry(h_third, "bakelite"); legend->Draw(); }