Re: [ROOT] ntuple to histogram

From: Kurt Rinnert (rinnert@ekp.physik.uni-karlsruhe.de)
Date: Wed Jul 02 2003 - 17:19:00 MEST


Hi Andreas,

you can use TTree::Project() for this purpose (note that TNtuple
is a TTree by inheritance):

TH2F* xy = new TH2F("xy_histo","density",nBinsX,xmin,xmax,nBinsY,ymin,ymax);
ntuple->Project("xy_histo","y:x");

This asumes that yo have declared and intialised nBinsX etc. 
to sensible values.

cheers,
	Kurt

On Wed, Jul 02, 2003 at 04:34:21PM +0200, Andreas Adelmann wrote:
> Hi rooter suppose I have data filled in an 
> ntuple of the following form:
> 
> TNtuple* ntuple = new
> TNtuple("ntuple","NTUPLE","x:px:y:py:z:pz:id:node");
> 
> and I would like to make a density plot in the x and y
> plane.
> 
> How do I fill a histogram from the ntuple? 
> 
> Thanks, Andreas 
> 
> -- 
> Andreas (Andy) Adelmann
> Paul Scherrer Institut 
> CH-5232 Villigen PSI
> Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91
> Phone Home: xx41 62 891 91 44

-- 
Kurt Rinnert, University of Karlsruhe (TH) - Faculty for Physics



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET