Analysing multiple files at once

Dear ROOTers,

I have a function which takes an input (and an output too, but that shouldn’t be relevant at the moment) I have 3-4 input files on average and they are named Analysis_numberhere_s000_p001.root, and the second one is Analysis_numberhere_s001_p001.root and so on.
What I’ve done is

unfortunately, the files are analysed in the wrong order, and it appears to me, that the order is s001, s002 and lastly s000.

Has this happened to anyone else in the past?


are you using a TChain behind the scenes or expanding the glob yourself?


1 Like

No, I’m not doing any of that. (unfortunately, I haven’t even heard of them).
Would a TChain help with a “general” code? As I have hundreds of files to analyse.


TChain will definitively help. It behaves like a TTree but it spans
multiple files (hundreds is not a problem):

TChain mychain("nameOfTheTreeInTheFiles");
mychain.Add("myfilesglob_00*.root"); // * is expanded

TChain::Add can be called multople times.


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