//============================================
I have the above lines in a root script which, when I run it interactively, writes the rooworkspace to a file. When I restart root I have no problem loading the workspace and I have no problem manipulating the roorealvars but when I try to do something like:
w->(pdf(“fermi”))->getVal();
I get a segmentation violation. Am I doing this correctly? I should say that I have loaded the .so file for my pdf via my rootlogon.C file with the following:
Should do the trick for you!
Just make sure you have the include directories that the RooWorkspace will read from configured properly using RooWorkspace::addClassDeclImportDir(const char*).
Once you have the class imported you should no longer need to load the library with the ProcessLine() interface.
After doing that, there is another warning message
[#0] WARNING:ObjectHandling – RooWorkspace::autoImportClass(w) WARNING Cannot access code of class RooAbsPdf because implementation file /build/bellenot/SPI/x86_64-slc5-gcc43-dbg/root/roofit/roofitcore/src/RooAbsPdf.cxx is not found in current directory nor in $ROOTSYS, nor in the search path . To fix this problem add the required directory to the search path using RooWorkspace::addClassImplDir(const char* dir)
RooWorkspace *w = new RooWorkspace("w","w");
w->addClassDeclImportDir("/afs/cern.ch/sw/lcg/app/releases/ROOT/5.28.00b/x86_64-slc5-gcc43-dbg/root");
w->addClassImplImportDir("/afs/cern.ch/sw/lcg/app/releases/ROOT/5.28.00b/src/root/roofit/roofitcore/src/");
w->addClassImplImportDir("/afs/cern.ch/sw/lcg/app/releases/ROOT/5.28.00b/src/root/roofit/roofitcore/");
w->import(fermi);
w->importClassCode(RooFermi::Class(),kTRUE);
and it still gives
[color=#FF0000][#0] WARNING:ObjectHandling – RooWorkspace::autoImportClass(w) WARNING Cannot access code of class RooAbsPdf because implementation file /build/bellenot/SPI/x86_64-slc5-gcc43-dbg/root/roofit/roofitcore/src/RooAbsPdf.cxx is not found in current directory nor in $ROOTSYS, nor in the search path /afs/cern.ch/sw/lcg/app/releases/ROOT/5.28.00b/src/root/roofit/roofitcore/src/,/afs/cern.ch/sw/lcg/app/releases/ROOT/5.28.00b/src/root/roofit/roofitcore/. To fix this problem add the required directory to the search path using RooWorkspace::addClassImplDir(const char* dir)
I like to resurrect this topic. I am attempting to implement the samething as the OP. I am trying to use the suggestion of w->importClassCode(Fermi::Class(),kTRUE); for my own PDF class.
The follow codes compiles and loads RooSignalPDF just fine, but it is unable to import the ClassCode.
PLRun3.cxx:66:22: error: ‘RooSignalPDF’ has not been declared
w->importClassCode(RooSignalPDF::Class(),kTRUE)
Normally I would just
w->importClassCode(“RooSignalPDF”,kTRUE). But I am having trouble getting the class to run with PROOF. I was hoping importing the actual class itself might help.