Dear Rooters,
This is my first attempt to write a function for root, so please bear with me if this is actually really simple! =) I have a ROOT file containing some trees although I'm only interested in one of the trees (MyTree). This tree contains two branches (event1 and event2) with like a million entries each that I want to use for some criteria. I want to either (Alt.1) remove some entries (according to the criteria) in that tree and save a new root file containing that tree, or (Alt.2) create a new tree with the same structure and save just the entries I'm interested in. Basically, in pseudo-code, this is what I want to do:
Int_t nentries = (Int_t)(MyTree->GetEntries()); MyTree->SetBranchAddress("event1",&event1); MyTree->SetBranchAddress("event2",&event2);
for (Int_t i=0 ; i<nentries ; i++)
if (event1 != event2)
Alt1: remove this entry from the tree and save root-file Alt2: do nothing else Alt1: do nothing Alt2: save this entry to a new tree with same structure as MyTree,and save tree to a new root-file
end
This archive was generated by hypermail 2.2.0 : Wed May 19 2010 - 17:50:01 CEST