Reset root session completely

Hi ROOT support,
I’m trying to modify a validation script that compares the contents of two files (generated with two git branches of a common program). Unfortunately the ROOT files to be compared contain classes, and the class definitions have diverged between the two files. As a result, the class definition headers and libraries needed to read the two files are different.

I would therefore like to:

  1. Load the necessary headers and libraries for the first file
  2. Read the file, fill some histograms etc.
  3. Clear the ROOT session - unload the libraries, unload class definitions, Enums etc.
  4. Load the headers and libraries for the second file (these files have the same name, and the define the same classes, as the first file, but with modified definitions)
  5. Read the second file, fill some histograms, overlay the two.

Unfortunately even using:

for(all classes) {
for step (3), and then trying to reload the library and re-`#include` the headers, I've not been able to read both files - the second always fails. If i switch the order of files to be read, the first always works, so clearly the methodology for reading each file is OK, but there's something retained in the session which is preventing the proper reloading of new class definitions.

Are there any other commands to wipe a ROOT session? Is it possible to spawn independent sub-sessions that could operate on each file? 

Any suggestions appreciated.


That’s fairly fragile, not just because of ROOT - many processes recommend vividly against even unloading a shared library, let alone he loading a “fairly similar” one to replace it.

The best you can do is split this up into separate runs of ROOT, i.e. one process per library version, producing our histograms separately. And the e.g. during the last process / iteration you compare the histograms.

Would that work?


Hi Axel,
Thanks for the input. In the end this is what I did (it just meant a more substantial rewrite of the validation code than I would’ve liked). In the validation script I now write all stats to be compared to a separate ROOT file, then use a bash script to call that validation script on each file, and create/append an entry to the comparison file. And, for the second iteration do the comparison, just like you said.
Perhaps this would’ve been possible without the bash script by creating two separate TApplications, if i wrote a separate application that linked against ROOT, rather than a macro compiled with ACLiC? It feels like that would’ve been neater, but also like it would’ve been more work.

Thanks for the feedback, it’s always good to know what is and isn’t possible.

1 Like

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