Remove entry from the tree?

Hi All,

I want to remove an entry from the tree based on entry/event number, i.e. every 10th entry. Is it possible to do without going into the details of the tree structure?

I’m trying to do something like this:

TChain chain("TREE"); chain.Add("Data0.root"); chain.Add("Data1.root"); TFile *f=new TFile("testf.root","recreate"); TTree *nt=new TTree("T","tdsdfsd"); TObjArray *bl=chain.GetListOfBranches(); for(int i=0;i<bl->GetEntriesFast();i++){ nt->Branch(bl[i].GetTitle(),bl[i].GetObjectRef()); }; for(int i=0;i<chain.GetEntriesFast();i++){ if(!i%10) continue; chain.GetEntry(i,1); nt->Fill(); } nt->Write(); f->Close();
but breaks on nt->Branch(bl[i].GetTitle(),bl[i].GetObjectRef());

Hi,

Use chain.CloneTree(0) to create the output tree. See $ROOTSYS/tutorials/tree/copytree* for other examples.

Cheers,
Philippe.

but how can I remove the entry/event from the cloned tree? Shouldn’t I iterate trough the entries? Mainly my question is how to remove entire entry from all the branches of the tree.

[quote]but how can I remove the entry/event from the cloned tree? Shouldn’t I iterate trough the entries? [/quote]Yes, that part of your code example was fine/appropriate.

Cheers,
Philippe.