Hi Stephen, You can find an example below Rene Brun { TFile *f = new TFile("peter.root","recreate"); Int_t nPhot; Float_t E[500]; Float_t Px[500]; Float_t Py[500]; Float_t Pz[500]; Float_t Arm[500]; Float_t PhotProb[500]; TTree* nEmcPhotons = new TTree("nEmcPhotons","EMC Photons"); nEmcPhotons->Branch("nPhot",&nPhot,"nPhot/I"); nEmcPhotons->Branch("E",E,"E[nPhot]/F"); nEmcPhotons->Branch("Px",Px,"Px[nPhot]/F"); nEmcPhotons->Branch("Py",Py,"Py[nPhot]/F"); nEmcPhotons->Branch("Pz",Pz,"Pz[nPhot]/F"); nEmcPhotons->Branch("Arm", Arm,"Arm[nPhot]/F"); nEmcPhotons->Branch("PhotProb", PhotProb,"PhotProb[nPhot]/F"); for (Int_t i=0;i<1000;i++) { nPhot = 500*gRandom->Rndm(); for (Int_t j=0;j<nPhot;j++) { E[j] = j; Px[j] = j+1; Py[j] = j+2; Pz[j] = j+3; Arm[j] = j+4; PhotProb[j] = j+5; } nEmcPhotons->Fill(); } nEmcPhotons->Print(); nEmcPhotons->Write(); f->Close(); delete f; } On Sun, 29 Oct 2000, Stephen Adler wrote: > I'm trying to build a root tree with variable length arrays. In the > old days of paw/ntuples, using column wise ntuples, one was able to > define an array with a length as in > > alen[0:250],tracks[1:alen] > > or something like that. I can't remember the paw/ntuple columb-wise > syntax becuase I haven't used it in years. In anycase, I want to do > the same with a root tree. Do I define a branch inside a branch or > something like that? > > Cheers. Steve. >
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET