Arrays in an ntuple

From: Pascal Perrodo (perrodo@lapp.in2p3.fr)
Date: Mon Nov 08 1999 - 17:11:39 MET


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



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