RE: NTuples

From: Philippe Canal <>
Date: Thu, 23 Jun 2005 12:59:18 -0500

> How can I make a tree with branches using NTuples This is

You should not. Use a TTree instead of a TNtuple. Re-read carefully the chapter on TTree in the User's Guide.

> and many other repeated names leaves.

As you should since you ask for them twice (once in the constructor once in the call to Branch).


-----Original Message-----
From: [] Sent: Thursday, June 23, 2005 9:03 AM
To: Philipe
Subject: [ROOT] NTuples

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"

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");  


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


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

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




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
Nuclear Physics Department Received on Thu Jun 23 2005 - 20:00:13 MEST

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