Updating ClassDef version of root file

Hi guys.

I am using ROOT version 6.18.04 on macOS. So I am trying to run my code over a root file example_combined_ConstExample_model.root that I generated using HistFactory. Before I did this I modified the entire source code so that the members RooAbsPdf in each of the files in the ROOT source code were replaced with RooAbsPdf1. Now when I try to run my code over this root file I get the following error:

Warning in <TStreamerInfo::BuildCheck>: 
   The StreamerInfo of class RooGaussian read from file /Users/cashcrusaders/Documents/UJ_LimitSetting/Input/example_combined_ConstExample_model.root
   has the same version (=1) as the active class but a different checksum.
   You should update the version to ClassDef(RooGaussian,2).
   Do not try to write objects with the current class definition,
   the files will not be readable.

So now I am confused as to which version of RooGaussian.h I should update. I tried updating the version that is in my projected folder but I get the same error. I also tried using the following:

 ws->addClassDeclImportDir("~/Documents/UJ_LimitSetting/src/inc/");
 ws->addClassImplImportDir("~/Documents/UJ_LimitSetting/src/");
ws->importClassCode("RooGaussian1.cxx");

where RooGaussian1.cxx is the modified version

Hi @Xola,

it sounds like you want to play with fire. :slight_smile:
First, are you sure that no remnants of the “official” ROOT classes are around somewhere? Has ROOT been compiled from scratch and there’s no ROOT installed somewhere in your system that might interfere?

Now a question for @pcanal:
If you replace the base class of some class, do you have to increment the class version? I thought ROOT can handle this, but it looks like this is the problem here.
If Philippe says yes to that question, you will have to increment all the class versions of all classes that inherit from RooAbsPdf1.

Haha yeah I think I was playing with fire. I ended up incrementing the versions of the classes that my compiler was complaining about and re-compiled ROOT. It worked. Guess I should have said that I had already solved it. I dont think I should have even asked this questions because the forum has so many solutions related to this question. My apologies :pensive:

Yes … (the meta-data for the derived classes currently embeds the base class version number)

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