TTree selective filling

Hello everyone,

I got a problem with setting up my TTree, maybe someone can help.

What I want to do is to produce a Tree with Branches that are created from classes that basically look like this:

class Detector{
Int LotsOfData[length]
};

class BunchOfDetectors{
Detector A1;
Detector A2;
Detector A3;
(etc.)
};

Where the Branch is created from BunchofDetectors. This works just fine. The Problem is, that normally most of the Detectors are empty and i don’t want to write lots of 0s for each event.

Therefore, is It possible to:

A: Disable subbranches when filling the tree in any way without loosing the correct event numbering.
(SetBranchStatus does not work)

B: Define LotsOfData as variable length array, that changes its length on a event-to-event basis without getting the “TStreamerInfo::Build: discarding: Int LotsofData, no [dimension]” Error.

Many thanks in advance,

Marc

I found a way around this problem by manually filling only subbranches of the splitted master branch , but now again the correlation between data and the event number is gone…

Tree->SetEntries(nevent);
Subbranch->SetEntries(nevent);

Both don’t help either.