RE: Plotting a histogram from text file.

From: Saleem, Muhammad <saleem_at_slac.stanford.edu>
Date: Tue, 29 Mar 2005 22:51:44 -0800


Hi Rene  

Thanks for the reply. No i do not want scatter plot. Here is what i have:  

I have the histogram(one Dimensional) then i use the command :  

hist->Print("all"); > hist.txt  

so I get the number of enteries and the bins in 2 columns. TH1.Print Name= Xp06NetLCbin5, Entries= 234335, Total sum= 57497

  347   2.1525
  317   2.1575
  382   2.1625
  394   2.1675
  376   2.1725
  378   2.1775
  455   2.1825
  465   2.1875
  443   2.1925
  499   2.1975
  507   2.2025
  540   2.2075
  524   2.2125
  567   2.2175
  595   2.2225
  605   2.2275
  592   2.2325
  668   2.2375
   .          .
   .          .
   .          .

I have to make some changes in the enteries, then i have to plot the histogram (one Dimensional) using this " hist.txt " I know TGraph can be used:
TGraph *graph = new TGraph(30);

   graph->SetPoint(1,347,2.1525);
and so on, but the problem is this will just shoh the graph no the histogram where i can have error bars and then fit this with soem function like Gaussian + poly. etc.;  

regards  

---saleem


From: Rene Brun [mailto:brun_at_pcroot.cern.ch] Sent: Tue 3/29/2005 10:24 PM
To: Saleem, Muhammad
Cc: roottalk_at_pcroot.cern.ch
Subject: Re: [ROOT] Plotting a histogram from text file.

I assume that you want to show a scatter-plot of one ntuple/Tree column versus another column.
If TTree* T is a pointer to your Tree, do

   T->Draw("energy:nentries");

I strongly suggest to read the ROOT Users Guide chapter about Trees and play with the tutorials
  hsimple.C, ntuple.C, tree3.C

Rene Brun

On
Tue, 29 Mar 2005, Saleem, Muhammad wrote:

>
> Hi
>
> I want to plot a histogram from the file which has No. of enteries in one column and bin size in the other column.
>
> Some one can point me out that how do i plot the histogram.
>
> Is there any script for this?
>
> cheers
>
> ---saleem
>
Received on Wed Mar 30 2005 - 09:00:36 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET