RE: Plotting a histogram from text file.

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Thu, 31 Mar 2005 09:55:06 +0200 (MEST)


If you just want to modify the bin content of a histogram, do   hist->SetBinContent(bin,value);

Rene Brun

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

> 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 Thu Mar 31 2005 - 09:55:13 MEST

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