Hello rooters, I am trying to write a function which selects events in a TTree. I would like to have the selection done the same way the Draw() is implemented. The only way I know how to do it is to use the CopyTree() method but there is an overhead of memory if I have a lot of branches (let's say 50) I don't want to use. The cut can be applied on other branches I am not interested in (for instance on variable "y"). For instance: Float_t Sum_X_Square(TTree* T, TCut cut){ TTree* T_new = T->CopyTree(cut); Float_t x; T_new->SetBranchAdress("x",&x); T_new->SetBranchStatus("*",0); // disable all branches T_new->SetBranchStatus("x",1); // able the "x" branch Float total = 0; Int_t nEntries = T_new->GetEntries(); for (Int_t i = 0; i < nEntries; i++) { T_new->GetEvent(i); total += x * x; } delete T_new; return(total); } Is there a better way to do it, without going through the overhead of the T_new object? The problem I have is that if T is too big, I have a crash because my machine hasn't got enough memory. Regards, Matthieu Guillo Thomas Jefferson National Laboratory Office 71 trailer 16 Phone: 757-269-5551
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET