RooWorkspace custom class persistency

I’m trying to persist a custom RooFit class inside a RooWorkspace between multiple RootCore compiled executables, using cvmfs and root 5.34.18-x86_64-slc6-gcc4.7. I do this of course to separate responsibilities (first executable adds signal model to workspace, a different executable adds the background, …)

In my main(), I do

  RooWorkspace* ws = new RooWorkspace("intermediateWorkspace",true);

where the first two paths should catch my custom class (which is a public RooAbsPdf, AsymBreitWignerXGausSum.h, and .cxx), and the second path should catch the RooAbsPdf header.

I get back (at execution time) the error:

[#0] WARNING:ObjectHandling -- RooWorkspace::autoImportClass(intermediateWorkspace) WARNING Cannot access code of class RooAbsPdf because header file include/RooAbsPdf.h is not found in current directory nor in $ROOTSYS, nor in the search path $ROOTCOREBIN/../MassFit/MassFit/,$ROOTSYS/. To fix this problem add the required directory to the search path using RooWorkspace::addClassDeclDir(const char* dir)

but I can see that the file is right there:

 $ ls $ROOTSYS/include/RooAbsPdf.h

Is there something obvious I’m missing about how to get this working?

In case it’s related, at run time when I write my RooWorkspace to a file, I see the error

Warning in <TBufferFile::WriteObjectAny>: since RooAbsPdf has no public constructor which can be called without argument, objects of this class can not be read with the current library. You will need to add a default constructor before attempting to read it.

For anyone stumbling across this with the same problem, here was the (relatively simple) solution:

-The class must have its ClassDef(AsymBreitWignerXGausSum,1) and ClassImp(AsymBreitWignerXGausSum) in the header and source respectively.

-Need to name your class for CINT in the LinkDef.h:
#pragma link C++ class AsymBreitWignerXGausSum+;

Then everything was working fine for me, the workspace will store the class code (and any dependencies) and be portable from there.