Histogram from text files containing velocities

Hi All,
I need to plot an histogram from a text file containing velocities.
For instance, if velocities are between 0 and 100, and I want my histogram to have 100 xbins, I would like to plot the number of occurences of each bin.
Do you know any macros doing this?
Many Thanks,
Hannibal

{
  TTree *t = new TTree("t", "temoporary tree with velocities");
  t->ReadFile("file_with_velocities.txt", "v/D"); // one velocity per line
  TH1D *h = new TH1D("h", "velocities;v[km/h];n", 100, 0.0, 100.00001);
  t->Project("h", "v");
  delete t; // no longer needed
  h->Draw("L");
}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.