TChain - select entries only in a given file name(s)

Hello,

suppose we have:

TChain chain("T"); chain.Add("file1.root"); chain.Add("file2.root"); chain.Add("file3.root");

  1. Is it possible to make a plot just for entries in e.g. “file2.root” (i.e. skipping entries from the other two files)? Something like:

where the TCut would select only the entries from a given file name.

  1. Is it possible to mask (temporary dissable/remove) some files which were added to a TChain such that they would not be taken into acount for looping over “all” entries? I can e.g. find all files added to a TChain and create a new TChain with just some files, but is there any other (recomended) way without creating an extra TChain?

Many thanks in advance.

Regards,
Jiri

Hi,

[quote]1) Is it possible to make a plot just for entries in e.g. “file2.root” (i.e. skipping entries from the other two files)? Something like:[/quote]You can use:chain.Draw("x:y", "This->GetCurrentFile()->GetName() == \"'file2.root\" "))however this is pretty ‘slow’ to get what you want.

[quote]2) Is it possible to mask (temporary dissable/remove) some files which were added to a TChain such that they would not be taken into acount for looping over “all” entries? [/quote]No. On the other hand, a TChain object is a pretty light weight object in itself so creating new TChain object is likely to be your best and simplest solution.

Cheers.
Philippe.

Hi Philippe,

ok, I’ll create new TChain if the first approch will be too slow. Many thanks for your fast reply!

Cheers,
Jiri