Reading the result of a fit from a file

TFile *f = new TFile(“test.root”, “READ”);
f->ls();

TH1F *h;

f->GetObject(“ZNChg-tow0”, h);
if (h) h->GetListOfFunctions()->Print();
if (h && (h->GetFunction(“gaus”))) h->GetFunction(“gaus”)->Print();
if (h && (h->GetFunction(“gaus”))) std::cout << h->GetFunction(“gaus”)->GetParameter(1) << std::endl;

f->GetObject(“ZPChg-tow0”, h);
if (h && (h->GetFunction(“gaus”))) std::cout << h->GetFunction(“gaus”)->GetParameter(1) << std::endl;

// …

f->GetObject(“hPMRefAlg”, h);
if (h && (h->GetFunction(“gaus”))) std::cout << h->GetFunction(“gaus”)->GetParameter(1) << std::endl;