Re: Arrays in an ntuple

From: Otto Schaile (Otto.Schaile@Physik.uni-muenchen.de)
Date: Mon Nov 08 1999 - 18:09:19 MET


On Mon, 8 Nov 1999, Pascal Perrodo wrote:

Hi Pascal,

I think you should use TTree for that (see Root Howtos and examples in
$ROOTSYS/test).

 Ntuples are:                                                                    
 A simple tree restricted to a list of float variables only.          

Cheers
Otto 

> 
> Hi,
> 
> I would like to know how to declare arrays in ntuples (as in PAW ntuples).
> That is, instead of using px,py,pz, use p[3]. 
> I tried to develop a short example below but it doesn't behave as
> expected.
> 
> In the same spirit, how to declare arrays with more than 1 dimensions:
> e.g. x[3][5][10].
> 
> Many thanks in advance,
> Cheers.
>                              Pascal Perrodo.
> 
> +-------------------------------------------------------------------------+
> | Tel : 04 50 09 16 32 (from France), 00 33 4 50 09 16 32 (from abroad)   | 
> | FAX : 04 50 27 94 95 (from France), 00 33 4 50 27 94 95 (from abroad)   |
> |						    		   	  |
> | LAPP, Chemin de Bellevue, BP 110, F-74941 Annecy-le-Vieux CEDEX         |
> +-------------------------------------------------------------------------+
> 
> //
> // create an ntuple
> //
> {
> 
>   gROOT->Reset();
> 
> 
>   TFile *fout;
> 
>   fout = new TFile("ntuple.root","RECREATE","simple essai");
> 
>   TNtuple *nt = new TNtuple("h99","h99","x[2]:y:i:j");
> 
> 
>   Float_t x[2];
>   Float_t y;
>   Int_t i;
>   Int_t j;
> 
>   for ( Int_t n=0 ; n<1000 ; n++ )
>     {
> 
>       x[0] = (Float_t) n;
>       x[1] = 2.*x[0];
>       y = 3.*x[0];
>       i = 4*n;
>       j = 5*n;
> 
>       nt->Fill(x[0],x[1],y,i,j);
> 
>     }
> 
>   fout->Write();
> 
>   fout->Close();
> 
> } // end
> 
> 

----------------------------------------------------------------------------
Otto Schaile                    Sektion Physik der LMU Muenchen
Phone: (+49 89)289 14070        Am Coulombwall 1, D-85748 Garching, Germany
FAX:   (+49 89)289 14072        EMail: Otto.Schaile@Physik.Uni-Muenchen.DE



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET