Making histogram from multiple text files

Can someone please let me know how can I make a histogram from multiple data files?
For one data file with one column only I am doing this:

void Only_one_file(){

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();

}


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Uncle Google → C++ read multiple files

1 Like