I had also tried using TGraph, attaching the macro below :
{
TGraph *graph = new TGraph(“yield176_30.dat”);
auto binEdges = graph->GetX();
auto values = graph->GetY();
auto hist = new TH1F(“hist”, “”, graph->GetN() - 1, binEdges);
//Fill the histogram
for (int i = 0; i < values->size(); i++) {
hist->SetBinContent(binEdges[i], values[i]);
}
hist->Draw("");
}
But it shows the following error when I try to compile it :
