Hello,
there are a few options:
- Are you using RDataFrame or a plain TChain to analyse the files? In RDataFrame, you can ask for file name and entry number. This is called DefinePerSample.
- In a TChain, you can list the files first, get them in a stable order, and create the chain. Now, by just counting every event before the cuts, you should get a “stable” global event number.
- If you don’t have a stable order, you can ask a TChain for the current file, see e.g. in this post. This can be used to derive a unique ID from the filename and entry number.
There might be more ways, but let’s see if one of the above can work for you.