Branches with different number of entries

When you fill branches one by one you must also set the number of entries in teh Tree itself via
t->SetEntries(number of entries);
My recommendation: do not try to fill a tree with branches having different number of entries.
In your simple case, always call t->Fill(). The compression algorithm will take care of eliminating entries with teh same values.