Ideomatic way to compare contents of two root files

For checking backwards compatibility between different versions of TMVA I have number of files (weights for classifiers) from which I generate a set of root files. I now want to ensure that the contents of the generated files is identical to a set of reference root files.

I’d prefer to be able to use e.g. md5 to check for equality, but there are a number of fields in the root file that vary irrespective of content (e.g. ROOT-file version, UUID). Is there some convenient way of doing this in ROOT?

The files will consist only of histograms and TDirectories.

Hi,

a way that I can think of is to explore recursively the ROOT files descending into the directories and comparing the content of the histograms, bin by bin. This is a very general problem which becomes particularly interesting when you don’t need to check identity but rather compatibility of histograms wrt a particular statistic, say, a chi2.
Experiments solved this in various ways. Perhaps you can be inspired by CMS:
https://twiki.cern.ch/twiki/bin/view/CMSPublic/RelMon

Cheers,
D

Thanks for the insight Danilo! In the end I decided to use the GetQuartile function of TH1 since in this case I’ll only be dealing with this type of histogram.

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