Inconsistent results using TChain.Draw and TEventList

Dear Experts,

I have been having an issue when using Root v5.26.00

When I run an interactive session,

I do

TChain ch("treename");
ch->Add("list.root");
TString f = "EventNumber==199817";
ch->Draw("(">>eList",f);
eList->Print();

and joyfully receive:

EventList:eList/EventNumber == 199817, number of entries =1, size=1000

as expected.

If I try to do the same with compiled ROOT code (in a macro that was otherwise working perfectly well), I see:

TEventList eList;
TString f = "EventNumber==199817";
class->fChain->Draw(">>eList",f);
eList->Print();
EventList:eList/EventNumber == 199817, number of entries =0, size=100

Is this to be expected or is this a bug?

The purpose is to find the entry number of an entry with EventNumber==X.

The only other note-worthy point is that I access the TChain in the macro as part of the MakeClass skeleton but as I said, I’m fairly sure the Chain was accessing the files correctly from before.

Does anyone know why this might be happening? I have also tried TEntryList.

Many Thanks,
Chris

Hi,

When you compiled with ROOT the TEventList object that you access is not the one populated by TTree::Draw because the one created by:TEventList eList;is unnamed while the one access by TTree::Draw:class->fChain->Draw(">>eList",f);must be ‘named’ ‘eList’ (note that the ‘name’ of the object is independent from the name of the variable used to point to refer to it; in the CINT case the two happen to be the same, in the compile code they are not). Thus the following will work:[code]TString f = “EventNumber==199817”;
class->fChain->Draw(">>eList",f);
TEventList eList = (TEventList)gDirectory->FindObject(“eList”);
eList->Print();[code]

Cheers,
Philippe.