Re: Extracting data out of Histogram

From: Otto.Schaile <Otto.Schaile_at_physik.uni-muenchen.de>
Date: Tue, 28 Jul 2009 17:27:53 +0200


Hello,
here an example:

   TFile f("hsimple.root");
   TH1F * hpx = f.Get("hpx");

   for (Int_t i = 1; i <= hpx->GetNbinsX(); i++) {
      cout << i << " " << hpx->GetBinLowEdge(i)<< " " <<
hpx->GetBinContent(i) << endl;

   }

Cheers
Otto

Ronen Abravanel wrote:
> Hello,
> I have an 1D Histogram (of Float_t) and I want to extract the data
> collected in the histogram:
>
> I want to have a list of bins (Lets say, the lower value of a bin) and
> the count in this bin. (Alternatively,Some map between the bin and the
> value).
>
>
> How can I do it?
>
> Thanks,
> Ronen.
>
>

-- 
Dr. Otto Schaile              Fakultät für Physik, LMU München
Phone: +49 89 289 14070       Am Coulombwall 1 
Mobil: +49 160 1553598        85748 Garching, Germany
FAX:   +49 89 289 14072       email: Otto.Schaile_at_LMU.DE
Received on Tue Jul 28 2009 - 17:28:02 CEST

This archive was generated by hypermail 2.2.0 : Tue Jul 28 2009 - 23:50:01 CEST