NTuples

From: <giflores_at_nmsu.edu>
Date: Thu, 23 Jun 2005 08:03:26 -0600

Hi Dr Philippe. How can I make a tree with branches using NTuples This is my program:
{
// example of macro to read data from an ascii file and // create a root file with an histogram and an ntuple. gROOT->Reset();
#include "TFile.h"
#include "TTree.h"
#include "TBrowser.h"
#include "TH2.h"
#include "TRandom.h"
#include "TClassTable.h"
#include "TSystem.h"
#include "Riostream.h"
#include<iterator>

Float_t y;
Float_t x;
Float_t z;
Float_t o;
Float_t q;
Float_t e;
Float_t r;
Float_t s;

Int_t nlines = 0;
TFile *f = new TFile("BasicNT.root","RECREATE");

TNtuple *ntuple = new TNtuple("ntuple", "data from ascii file","x:y:z:o:q:e:r:s");:TTree("ntuple","/title");  

ntuple->Branch("one",&y,"y/F:x:z:o");
ntuple->Branch("two",&q,"q/F:e:r:s");

for(Int_t i = 0; i < 10000; i++){

  gRandom->Rannor(y,x);
  gRandom->Rannor(q,e);

  z = y*y*y - x;
  o = z + y*y*y;

  r = q*q*q - e;
  s = r + q*q*q;

  ntuple->Fill(y,x,z,o,q,e,r,s);   

}
ntuple->Print();

f->Write();
}

And for a some reason I getting the leaves with out the branches and also I getting a "o.o" leave type names and many other repeated names leaves. thank you for any help you can give me. Have grate day Gilberto Flores
NMSU
Nuclear Physics Department Received on Thu Jun 23 2005 - 17:15:53 MEST

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