void afzaal() { TFile f1 = TFile::Open("aluminium.root", "READ"); h1->SetLineWidth(2); h1->SetLineColor(kBlack); h1->SetMarkerColor(kBlack); h1->SetMarkerStyle(2); h1->Draw("hist"); TFile f2 = TFile::Open("glass.root", "READ"); h1->SetLineWidth(2); h1->SetLineColor(kRed); h1->SetMarkerColor(kRed); h1->SetMarkerStyle(2); h1->Draw("hist same"); TFile f3 = TFile::Open("bakelite.root", "READ"); h1->SetLineWidth(2); h1->SetLineColor(kGreen); h1->SetMarkerColor(kGreen); h1->SetMarkerStyle(2); h1->Draw("hist same"); TH1 h_first = static_cast(f1->Get("h1")); TH1 h_second = static_cast(f2->Get("h1")); TH1* h_third = static_cast(f3->Get("h1")); auto legend = new TLegend(0.1,0.7,0.48,0.9); legend->AddEntry(h_first, "aluminium"); legend->AddEntry(h_second, "glass"); legend->AddEntry(h_third, "bakelite"); legend->Draw(); Double_t scale=1./h1->Integral(); h1->Scale(1/h1->Integral()); h1->Draw("hist same"); }