TChain's SetEventList problem when trees are in a directory

Dear Sir/Madam,

I try to use SetEventList for TChain but in vain, here’s what I use to setup my chain:

{
   TChain *mychain=new TChain("folder/tree");
   mychain->Add("output_*.root");

   mychain->Draw(">>evlist","X>20");//X is some variable

   TEventList *evlist = (TEventList*)gROOT->FindObject("evlist");

   mychain->SetEventList(evlist);

   ...

}

I notice that it works when my trees are not in a directory, i.e. TChain *mychain=new TChain(“tree”);, it works when SetEventList.

Unfortunately, I create those trees and put them in a directory…

Please help…

Thank you in advance.

Regards,

YH

Try gROOT->FindObjectAny(“evlist”);

Hi,

also note that in at least 5.34/03

only adds a single file with the literal name ‘output_*.root’ to the chain
(e.g. the glob isn’t expanded).

Hello, thank you so much for replying!

I am using 5.34/03 and it seems that the syntax “output_*” works for me.

And I tried with the gROOT->FindObjectAny(“evlist”); but also the same problem.

The problem seem to be not from getting the list, because I can access the list like this:

{
   TChain *mychain=new TChain("dir/tree");
   mychain->Add("output_*.root");

   mychain->Draw(">>evlist","X>20");
   TEventList *elist = (TEventList*)gROOT->FindObjectAny("evlist");

    cout<<elist->GetN();
}

And what happens if you try: [code] mychain->Draw(">>elist", “X>20”, “entrylistarray”); //X is some variable

TEntryListArray elist = (TEntryListArray)gROOT->FindObject(“elist”);

mychain->SetEntryList(elist);[/code] or: [code] mychain->Draw(">>elist", “X>20”, “entrylist”); //X is some variable

TEntryList elist = (TEntryList)gROOT->FindObject(“elist”);

mychain->SetEntryList(elist);[/code] If it still doesn’t work, try to use: mychain->SetEntryList(elist, "ne");

It works!

Thank you so much!

Thanks again!

YH