Hi,
I have a TChain from which I want to select certain entries, copy them
to a new TTree, and write the new TTree to a file.
My problem is that when I copy more than a certain number of entries to the new tree, the original tree also gets written to the file.
My macro:
#include "Analysis_split.C"
void WriteEtMiss(Long64_t nbrEntries)
{
Analysis_split *a = new Analysis_split(0); //made with MakeClass on
the TChain I //I want to copyfrom.
EtMiss->SetName("EtMiss"); EtMiss->SetTitle("EtMissTitle"); EtMiss->Write();
The output from root when scanning 5336 events or less from the original tree:
root [5] WriteEtMiss(5336) root [6] .ls TFile** EtMissCut.root TFile* EtMissCut.root OBJ: TTree EtMiss EtMissTitle : 0 at: 0xcc5ced8 KEY: TTree EtMiss;1 EtMissTitle root [7] EtMiss->GetEntries()
(long long)2291
root [8]
This works as I meant it to. The tree EtMiss gets written to the file. However, if I try to scan more than 5336 entries, the tree/chain that I copy from (t3333) also gets written to the file:
root [1] WriteEtMiss(5337) root [2] .ls TFile** EtMissCut.root TFile* EtMissCut.root OBJ: TTree EtMiss EtMissTitle : 0 at: 0xbb4e260 KEY: TTree t3333;1 Combined Ntuple KEY: TTree EtMiss;1 EtMissTitle root [3] t3333->GetEntries()
(long long)2292
root [4] EtMiss->GetEntries()
(long long)2292
The chain that I run on has 25256 events. Each file in the chain has 400 entries (except for the last). If I run on more events, for instance 20000, t3333;1 is replaced by t3333;4.
If I run on another dataset, the number for entries where this happens
is different.
The phenomenon then occurs at 23384 entries. But the number of entries
copied to EtMiss is now 2107, which is of the same order as in the first
example (the second data sample has fewer entries that satisfies the
selection criteria).
I have never used CopyTree before, so I might be doing something the wrong way here.
I use root version 4.02/00 on SLC3. I downloaded binaries from the root homepage.
Thanks in advance!
cheers,
Ola
Received on Thu Jan 27 2005 - 15:32:49 MET
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET