Adding input files to macro using TChain

Hi all
I have been adding root files to my macro (find attached below) using the following method:

vector<string> filename1 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363140_528/artroot_output.root" };
    vector<string> filename2 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363144_529/artroot_output.root" };
    vector<string> filename3 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363146_530/artroot_output.root" };
    vector<string> filename4 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363148_531/artroot_output.root" };
    vector<string> filename5 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363163_534/artroot_output.root" };
    vector<string> filename6 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363166_535/artroot_output.root" };
    vector<string> filename7 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363168_536/artroot_output.root" };
    vector<string> filename8 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363181_51/artroot_output.root" };
    vector<string> filename9 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363183_538/artroot_output.root" };
    vector<string> filename10 { "/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/19363184_539/artroot_output.root" };

Now I actually need more than 100 root files as input into my macro and it’s very cumbersome using the method above.
Basically there are multiple folders within

/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV

and within those folders I want the artroot_output.root file as the input using the TChain (Wild Card) method or any better method if it exists

I tried to look for the correct way to do this in the root forum but I wasn’t able to do it. Any help is appreciated !

Thanks
nospacecharge.C (63.0 KB)

Hi,
I’m not sure why your are putting single strings inside multiple vectors of strings as opposed to multiple strings inside a single vector of strings.

Anyway, does

chain->Add("/pnfs/uboone/scratch/users/jaz8600/v06_26_01_06/detsyst/CV/*/artroot_output.root ")

do the job?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.