I have generated a histogram and a smoothed version of it using TGraphSmooth(). I would like to now retrieve interpolated values of this smoothed graph. In other words, I give the graph an x value and I get out the corresponding y value, or I give the graph a ya value and I get out the corresponding x value. I’ve tried using TGraph::Eval() to do this, but I always receive interpreter errors.
Here is my code:
{
TFile *f_in = new TFile("./root_data_files/Remap_0091.root");
TH1F h = (TH1F)f_in->Get(“h_lg44”);
Int_t hbins = h->GetNbinsX();
Int_t hmin = h->GetBinCenter(1);
Int_t hmax = h->GetBinCenter(hbins+1);
Int_t ch_per_bin = (hmax-hmin)/hbins;
Float_t x[hbins];
Float_t y[hbins];
Int_t i;
for(i=0; i<hbins; ++i)
{
x[i] = i*ch_per_bin+hmin;
y[i] = h->GetBinContent(i+1);
}//END of i for loop
TGraph *g_points = new TGraph(hbins,x,y);
g_points->SetMarkerStyle(8);
g_points->SetMarkerSize(0.5);
// TCanvas *canvas = new TCanvas(“canvas”,“Smoothing”,0,0,700,500);
// canvas->ToggleEventStatus();
// g_points->Draw(“AP”);
// h->Draw();
TGraphSmooth *gs = new TGraphSmooth(“normal”);
TGraph g_smooth = new TGraph();
g_smooth = (TGraph)gs->SmoothSuper(g_points,"",0,0);
g_smooth->SetLineColor(4);
g_smooth->SetLineWidth(2);
// g_smooth->Draw(“PC”);
g_smooth->Eval(1000,0,"");
}