{ ////////////////////////////////////////////////////////// // This file has been automatically generated // (Thu Mar 29 09:25:30 2001 by ROOT version3.00/06) // from TTree ntuple/Demo ntuple // found on file: hsimple.root ////////////////////////////////////////////////////////// //Reset ROOT and connect tree file gROOT->Reset(); TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("hsimple.root"); if (!f) { f = new TFile("hsimple.root"); } TTree *ntuple = (TTree*)gDirectory->Get("ntuple"); //Declaration of leaves types Float_t px; Float_t py; Float_t pz; Float_t random; Float_t i; //Set branch addresses ntuple->SetBranchAddress("px",&px); ntuple->SetBranchAddress("py",&py); ntuple->SetBranchAddress("pz",&pz); ntuple->SetBranchAddress("random",&random); ntuple->SetBranchAddress("i",&i); // This is the loop skeleton // To read only selected branches, Insert statements like: // ntuple->SetBranchStatus("*",0); // disable all branches // TTreePlayer->SetBranchStatus("branchname",1); // activate branchname Int_t nentries = ntuple->GetEntries(); Int_t nbytes = 0; for (Int_t j=0; jGetEntry(j); printf("j:%i, px:%f, py:%f, pz:%f, random:%f, i:%f\n", j, px, py, pz, random, i); } }