Hello everyone.
I am trying to generate a histogram from my data file but the data files contains a lot colums and I want to read data one by one.
For example:
2 4 5
5 7 0
6 1
And I want to read data and fill the histogram start 2,4,5,5,7 and so on…
I am trying this:
void Plotting(){
TH1F *h = new TH1F(“h”, “histogram”,1000,5.,9.);
ifstream inp; double x;
inp.open(“data.dat”);
for (int i=1; i<=1000; i++) {
inp >> x;
h->SetBinContent(i,x);
}
h->Draw();
}
I am afraid that I am only reading the first column. Can someone help me how I can read all values one by one?