Scanning TTrees Using TCuts ans GetBranchhere is my problem

Hello everybody,

here is my problem : I have to get all entries from one leaf of a TTree with a condition on other leaves … To do so I use a cut the way described in the user guide, it works if I draw a TH1D but the cut is ignored when I use GetBranch. Here is what I do:

CutData = (TEventList *) gDirectory->Get(“ROOTCutData”);

//Here if I draw an histo it’s well cut

TBranch *branch = Data->GetBranch(MyLeaf);
n = (int) branch->GetEntries();

And then I use branch->GetEntry() to get data … but I get all the branch, the TCut “MyCut” being simply ignored.

Does anybody know a way to do this (I need to use TCuts as the cuts can be quite complex) ?

Thanks for your help


The EventList is only used by the TTree::Draw/Scan and TTree::GetEntryNumber and not by the TBranch.

In order to implement what you want, just do:

for(int i=0; i< CutData->GetN(); i++) { branch->GetEntry(CutData->GetEntry(i)); }


thanks a lot, that s much more simple and it seems to work