Two directories with different number of entries

Dear rooters,
I have 1573 root files, and I wanted to merge them, so I used the hadd tool, to do the job. When I opened the produced root file, I found two directories:
events;1 (Number of Entries: 136965)
events;2 (Number of Entries: 93882)
I have seen this before, but the problem now is that these directories have not the same number of events.
Is this a problem of ROOT or I have to check my code?

Also, is there any way, to have only one directory?

Thank you in advance.

EDIT 1: I write a script which will print the number of events:

void test_entries(TString Filename)
        TFile *inf = new TFile(Filename);
        TTree *t1 = (TTree*)inf->Get("multijets/events");


In line
Tree t1 = (TTree)inf->Get(“multijets/events”);
I tried also “events;1” and next I tried “events;2” and it prints always the same:
So… Could I say that this is the real number of entries?

[url]Aux;1 aux;2 aux3;

Thank you Coyote!

I checked the links and I found out that I have to run this code

   TIter nextkey(f.GetListOfKeys());
   TKey *key;
   while (key = (TKey*)nextkey()) {
      Event *event = (Event*)key->ReadObj();

I am getting these errors:

Error: Symbol Event is not defined in current scope test_entries.C:17: Error: class,struct,union or type Event not defined test_entries.C:17: Warning: Automatic variable Event*event is allocated test_entries.C:17: Error: Undeclared variable Event*event test_entries.C:17: *** Interpreter error recovered ***

I search for Event.h but no results… Any ideas?

You should try something like this: TFile *file = TFile::Open("MyRootFile.root"); file->ls(); TTree *tree; file->GetObject("MyRootTree", tree); if (tree) { tree->Print(); } else { std::cout << "Warning: MyRootTree NOT found!" << std::endl; }

Thank you Pepe and Coyote.
Finally, I solved the problem, doing the follow:
As I said in my first post, I add 1537 histograms, using hadd.
So, I tried to each 400 histograms each time(1537 / 400 ~ 4 files) and finally I added the 4 files.
It seems that the hadd has a limit.


In order version of ROOT hadd was limited to the number of allowed open descriptor (OS limit, usually around 1024). This should be fixed in the lastest version of ROOT.



It could also be the same problem as in Hadd with Trees in Root 5.32 with a large number of files
which has also been solved (in v5.32 patch branch and any later release).