Not sure how to use ROOT's Landau Gaussian convolution Fit

Hi everyone, I’m new to ROOT and I’m trying to fit histogram data using the Landau Gaussian convolution fit found in: https://root.cern.ch/doc/v614/langaus_8C_source.html. My data is in a text file with each row containing the histogram count data with a total of 150 lines. e.g.:
256
8716
13051
8921
6527

23
16
33

How do I allow the ROOT program to read the data inside the text file and then what kind of command should I input inside the ROOT session to successfully output the fit graph? Please explain it step by step, as I’m very new to ROOT. Thanks for the help in advance.

Something like that:

void ascii2hist()
{
   int    i=0;
   FILE   *fp;
   fp = fopen("ascii2hist.dat","r");

   float x;
   auto h = new TH1F("h","h",150,0.,150);
   while (!feof(fp)) {
      fscanf(fp,"%g\n",&x);
      i++;
      h->SetBinContent(i,x);
   }
   h->Fit("...");
}

Hey, thanks for the help. Do I add this line of code in the .C file? Could you tell me what I’m supposed to do? Cheers.

This is a C++ macro. You should create a file ascii2hist.C and put this code inside. Then you execute it in root by typing .x ascii2hist.C. Of course the file name containing your data should be changed to the real name of your file.