How to tell TDF to ignore branches which are not used in any way?

Ah I see, sorry it took me so long to understand the issue correctly.

Have you tried redirecting standard error to a file to avoid slowdown due to console printing? (e.g. ./main.x 2> err.log)

In any case, we should not print such warnings at all. I would open a bug report but I need a reproducer. I tried to re-create your situation by reading two trees, one with branch x and one with branches x and y, and writing out only branch x, but no warnings are printed out:

#include <ROOT/TDataFrame.hxx>
using namespace ROOT::Experimental;

int main()
{
   // write two files with different branch content
   {
      TDataFrame d(10);
      auto dwithx = d.Define("x", "42");
      dwithx.Define("y", "83").Snapshot("t", "file1.root");
      dwithx.Snapshot("t", "file2.root");
   }

   // read the common branch from both files
   TDataFrame d("t", {"file1.root", "file2.root"});
   d.Snapshot("t", "out.root", "x");

   return 0;
}

If you could let me have even just a couple of entries of your files so that I could reproduce the behavior it would be of great help. Or otherwise let me know what I’m missing to reproduce the problem.

Cheers,
Enrico