Hello All,
I have a plain-text histogram file with x-values and their frequency. I am trying to load that into a root histogram as follows:
[code]float location,b;
int frequency=0,loop=0;
TH1F *h = new TH1F("h","h",1000,1,1);
while (!feof(datafile)){
fscanf(datafile,"%f %i",&location,&frequency);
for (loop=0;loop<frequency;loop++) h->Fill(location);
}[/code]
From the root manual, I have set the lower axis value lessthan or equal to the higher axis value for auto-range. However, the histogram does not have the correct ranges. What am I doing wrong?
Root code, the histogram plain text data and a matlab generated histogram (showing the correct range) are attached.
Thanks,
Karthik.
files.zip (14.3 KB)