Segmentation violation while opening the RooWorkspace object

I have saved RooWorkspace object in a root file it gets saved without any error but while creating a handle to access the object it is giving segmentation violation error(see image)

While running the code to create the RooWorkspace object I am getting following warning message.

[#0] WARNING:ObjectHandling -- RooWorkspace::autoImportClass(wspace.bin11) WARNING Cannot 
access code of class RooBtosllModel because header file SingleBuToKstarMuMuFitter/cpp
/RooBtosllModel.h is not found in current directory nor in $ROOTSYS, nor in the search path 
test/BuToKstarMuMuV2Fitter/SingleBuToKstarMuMuFitter/cpp
To fix this problem add the required directory to the search path using RooWorkspace::addClassDeclDir(const char* dir)""

Any idea about this error if anyone has encountered?

@StephanH will most probably give you some hints

I have never seen this before, but the error and warning messages seem to be quite clear:

The problem is that root has to write the class to disc, but this only works if it can see the header.

Have you tried the proposed fix?

To fix this problem add the required directory to the search path using RooWorkspace::addClassDeclDir(const char* dir)

I did try. Interestingly there is no method named addClassDeclDir under RooWorkspace. It gives me attribute error.

That’s true. It’s called a bit differently. See here:
https://root.cern.ch/doc/master/classRooWorkspace.html#a166084e8d0d78a8d632a233d85c95ddd

@StephanH Thanks a lot. Problem was indeed at importing that path. I had to make some changes to the path.

Rooworkspace::addClassDeclImportDir("correct/header/file/path")

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