Tool to compare TTrees in Root Files

Hello,

I am wondering if there is a tool that can take two ROOT files, which contain a TTree each, and compare the contents and highlight any differences. I found some older posts in the forums suggesting such a tool was under development, but could not manage to find any details of such a tool currently.

My use case is that we have a ntuple maker in gitlab and would like to be able to check in the CI ,when we update the code , for any changes in the contents of the ntuple produced compared to a reference.

Thanks,

Mark


Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hello @Mark_C_Hodgkinson,

how detailed do you want to do this comparison?

  • To first order, you could simply create a few histograms and compare statistically
  • If the ntuples are small enough, TTree::Scan could work. See here or here
  • If both of the above are not OK, I think you would really need a tool that runs event loops through both trees, but this doesn’t exist yet.

Let us know what approach seems feasible for the CI.

And yes, there is a post that was mentioning this idea, but so far, this hasn’t manifested …

Thanks!

An ATLAS colleague pointed out I can use this tool to do it on any ROOT file that contains TTrees:

and indeed “acmd diff-root file1.root file2.root -t TreeName --error-mode resilient” does the job for me :slight_smile:

Cheers,

Mark

Hello Mark,

that’s great, and the tool is open source! :slightly_smiling_face:

1 Like

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