> Will tree contain sequentially all the contents of the two vectors
> ampl and time?
yes.
You should replace
tree->Write();
while
f->Write();
// Or tree->GetDirectory()->GetFile()->Write(); // if you TTree is so large that it triggers the creation of additional // file (See TTree::ChangeFile for details)
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch]
On Behalf Of Marco Calviani
Sent: Wednesday, January 10, 2007 10:04 AM
To: Rene Brun; roottalk_at_pcroot.cern.ch
Subject: Re: [ROOT] TNtuple (or TTree?) and vector fill
Thanks Rene,
is it possible to keep the TTree open and do a Fill() for n loops
and then at the end close the TTree?
Something like this:
int leggi()
{
TFile *f = new TFile("test.root","recreate"); TTree *tree = new TTree("tree","example"); tree->Branch("ampl",&l,"ampl"); tree->Branch("time",&time,"time"); for(int i=0; i>n; i++) { Float_t *ampl = new Float_t[]; Float_t *time = new Float_t[]; ....... ....... tree->Fill() }
Will tree contain sequentially all the contents of the two vectors ampl and time?
Regards,
marco
On 1/10/07, Rene Brun <Rene.Brun_at_cern.ch> wrote:
> Marco,
>
>
This archive was generated by hypermail 2.2.0 : Wed Jan 17 2007 - 23:50:00 CET