TChain->Add(TChain) and GetEntries()

Hi, rooters,
in a little C+±program, I use some smaller chains to sort some files, and one big chain to use all data. To get the big chain, I simply add the smaller chains:

—snip—

TChain strahlon=new TChain(“T”);
TChain strahloff=new TChain(“T”);
/// —4 more chains–
// …
strahlon->Add("strahl/strahlon
.root",0);
strahloff->Add("strahl/strahloff
.root",0);
// ----filling the other chains–
// …
Int_t allnum=0;

TChain *all=new TChain(“T”);
allnum+=all->Add(strahlon);
allnum+=all->Add(strahloff);

// …

cerr<<"Files total:"<<allnum<<endl;   // !!! This Number is right !!
cerr<<"Events total:"<<all>GetEntries()<<endl; // !!! Completly wrong !!

—snip—

If I use the same code on the same files in a root-script, I get the right number of Events. The number of entries is equal to kBigNumber times the number of files in all, so the compiled program seems to ignore the option of TChain::Add(char *filename). As I use wildcards, I don’t want to use the TChain::AddFile() method. Any other hints what I’m doing wrong?

I’m using root 4.00/08

It is likely that you use the doc of 5.12 to run with the old version 4.
I suggest to upgrade your version to 5.12 or 5.13

Rene

In my tree, I use a user defined class. Can I read my old files with a new root version?

Did you try?
If you tried and it failed, please give more details.

Rene

As I can avoid this problem with just adding the files directly to the chain, I didn’t want to risk spoiling my configuration (and the one of the other users as well). It’s the quick and dirty version, but it’s working…