Consider this example:
void fitslicesytest() {
TString dir = gROOT->GetTutorialDir();
dir.Append("/hsimple.C");
dir.ReplaceAll("/./","/");
if (!gInterpreter->IsLoaded(dir.Data())) gInterpreter->LoadMacro(dir.Data());
TFile *hsimpleFile = (TFile*)gROOT->ProcessLineFast("hsimple(1)");
if (!hsimpleFile) return;
TH2F *hpxpy = (TH2F*)hsimpleFile->Get("hpxpy");
TAxis * Yaxis = hpxpy -> GetYaxis();
TF1 f1 = TF1("f1", "gaus", Yaxis -> GetXmin(), Yaxis -> GetXmax());
f1.SetParameters(100, (Yaxis -> GetXmax() - Yaxis -> GetXmin())/2.0, 0.01);
TObjArray slices;
hpxpy -> FitSlicesY(& f1, 1, hpxpy -> GetNbinsX(), 0, "QNRLM", &slices);
}
I would like to get TFitResult and see the fitted function drawn on each slice. What to do?
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided