Hi Rene,
On Thu, 2005-01-06 at 08:08 +0100, Rene Brun wrote:
> Christian,
>
> See example in tutorial copytree3.C
This example _copies_ the tree. That's _not_ what I want to do. I want to loop over the entries, and for each iteration read in the current entry, as well as some previous entry:
Int_t delayed = 2;
TTree* tree = static_cast<TTree*>(file->Get("T"));
TTree* delay = new MixTree(tree);
tree->SetBranchAddress("data", &data);
delay->SetBranchAddress("data", &previous);
Int_t n = tree->GetEntries();
for (Int_t i = 0; i < n; i++) {
Int_t read = tree->GetEntry(i);
if (read < 0) {
Error("...", "Error reading from tree");
break;
}
if (read == 0) break;
if (i <= delayed) break;
read = delay->GetEntry(i-delayed);
if (read < 0) {
Error("...", "Error reading old entry");
break;
}
// Do mixed event analysis on the data in `data'
// and `previous'
}
This is not the same as copying the tree, and using TTree::CloneTree is a gross misuse that member function (not to say ineffcient). Please also refer to my previous email, and the attachments in it.
Thank you for your help anyway.
Yours,
--
___ | Christian Holm Christensen
|_| | -------------------------------------------------------------
| | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91
_| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91
_| Denmark Office: (+45) 353 25 404
____| Email: cholm_at_nbi.dk Web: www.nbi.dk/~cholm
| |
Received on Thu Jan 06 2005 - 11:22:26 MET
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET