SegFault when importing pdf into RooWorkspace

In my code I build a RooBDecay including a self written class DecRateCoeff_Bd which inherits from RooAbsReal. So to compile the code properly I created a dictionary using rootcint. This compiles fine, and it works as well at runtime.
Additionally now I do not want to give only a RooRealVar to this the DecRateCoeff_Bd class but a RooGLMFunction class which inherits as well from RooAbsReal and depends on several other self written classes. What I did so far is to create a dictionary for this RooGLMFunction in the same way as for the DecRateCoeff_Bd class using rootcint. Again the code seems to compile fine, but at runtime when I try to import the RooBDecay into the workspace I get a segfault with the following backtrace:

===========================================================
#5 0x0000000000000000 in ?? ()
#6 0x00007f8bca0aa9dc in RooAbsArg::addServer(RooAbsArg&, bool, bool) () from /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_79/ROOT/6.04.02/x86_64-slc6-gcc49-opt/lib/libRooFitCore.so
#7 0x00007f8bca0ab161 in RooAbsArg::registerProxy(RooArgProxy&) () from /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_79/ROOT/6.04.02/x86_64-slc6-gcc49-opt/lib/libRooFitCore.so
#8 0x00007f8bc9ffc57e in RooArgProxy::RooArgProxy(char const*, RooAbsArg*, RooArgProxy const&) () from /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_79/ROOT/6.04.02/x86_64-slc6-gcc49-opt/lib/libRooFitCore.so
#9 0x00007f8bca0eddc9 in RooRealProxy::RooRealProxy(char const*, RooAbsArg*, RooRealProxy const&) () from /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_79/ROOT/6.04.02/x86_64-slc6-gcc49-opt/lib/libRooFitCore.so
#10 0x00007f8bc75e015c in CPfitter::DecRateCoeff_Bd::DecRateCoeff_Bd(CPfitter::DecRateCoeff_Bd const&, char const*) () from /home/abirnkraut/build_CPTimeFit/lib/libdecratecoeff_bd.so
#11 0x00007f8bc75edbd1 in CPfitter::DecRateCoeff_Bd::clone(char const*) const () from /home/abirnkraut/build_CPTimeFit/lib/libdecratecoeff_bd.so
#12 0x00007f8bca0971c8 in RooAbsCollection::addServerClonesToList(RooAbsArg const&) () from /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_79/ROOT/6.04.02/x86_64-slc6-gcc49-opt/lib/libRooFitCore.so
#13 0x00007f8bca0972f5 in RooAbsCollection::snapshot(RooAbsCollection&, bool) const () from /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_79/ROOT/6.04.02/x86_64-slc6-gcc49-opt/lib/libRooFitCore.so
#14 0x00007f8bca09752e in RooAbsCollection::snapshot(bool) const () from /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_79/ROOT/6.04.02/x86_64-slc6-gcc49-opt/lib/libRooFitCore.so
#15 0x00007f8bca0c214e in RooWorkspace::import(RooAbsArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&) () from /cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_79/ROOT/6.04.02/x86_64-slc6-gcc49-opt/lib/libRooFitCore.so
#16 0x00000000004c242e in CPTimeFit::build_PDF(bool) ()
#17 0x00000000004b641e in main ()
===========================================================

I did tests like importing all “subobjects” as the RooGLMFunction directly and all four DecRateCoeff_Bd as well without any problem. It’s also possible to print the full pdf, only when trying to import the pdf into the workspace I get problems. I assume I’m still making a mistake when creating the dictionary for the RooGLMFunction but I don’t see what I’m doing wrong.

I posted the code snippet where I try to import the pdf into the workspace and my own RooFit classes below. Let me know if you need something else.
Thanks in advance!

RooRealVar C_f = RooRealVar(“C_f”,“C_f”,0.9995,-5.0,5.0);
RooFormulaVar C_fbar = RooFormulaVar(“C_fbar”, “C_fbar”, “-1.0*@0”, RooArgSet(C_f));
RooRealVar *S_f = new RooRealVar(“S_f”,“S_{f}”,-0.031,-5.0,5.0);
RooRealVar *S_fbar = new RooRealVar(“S_fbar”,“S_{#bar f}”,0.029,-5.0,5.0);
RooRealVar sinh_f = RooRealVar(“sinh_f”,“D_{f}”,0.0,-5.0,5.0);
RooRealVar sinh_fbar = RooRealVar(“sinh_fbar”,“D_{#bar f}”,0.0,-5.0,5.0);
RooRealVar cosh_f = RooRealVar(“cosh_f”,“cosh_f”,1.0,-5.0,5.0);
RooRealVar cosh_fbar = RooRealVar(“cosh_fbar”,“cosh_fbar”,1.0,-5.0,5.0);
RooRealVar production_asym = RooRealVar(“production_asym”,“a_{prod}”,0);
RooRealVar detection_asym = RooRealVar(“detection_asym”,“a_{det}”,0);
RooRealVar tageff_os = RooRealVar(“tageff_os”, “#varepsilon_{tag}^{OS}”, 0.37, 0.0, 1.0);
RooRealVar tageff_asym_os = RooRealVar(“tageff_asym_os”,“tageff_asym_os”,0.0);
RooRealVar tageff_ss = RooRealVar(“tageff_ss”, “#varepsilon_{tag}^{SS}”, 0.71, 0.0, 1.0);
RooRealVar tageff_asym_ss = RooRealVar(“tageff_asym_ss”,“tageff_asym_ss”,0.0);

Espresso::GLMBuilder glm = Espresso::GLMBuilder(“GLMCalibration_for_the_OS”,“OS_GLMCalibration”,*MistagOS,“GLMCalibration_not_used_name”,
“/home/abirnkraut/tank/CPTimeFit_BD2Dpi/GLMCalibrations/OS_Combination_Bu2D0Pi_MC_rlogitLink.xml”);

Espresso::RooGLMFunction omega_b = glm.b_mistag();
Espresso::RooGLMFunction omega_bbar = glm.bbar_mistag();

coeff_c_fit = new CPfitter::DecRateCoeff_Bd(“coef_cos_fit”,“coef_cos_fit”,CPfitter::DecRateCoeff_Bd::kCos,*BacCharge,C_f,C_fbar,*TagDecOS,omega_b,omega_bbar,tageff_os,tageff_asym_os,production_asym,detection_asym);
coeff_s_fit = new CPfitter::DecRateCoeff_Bd(“coef_sin_fit”,“coef_sin_fit”,CPfitter::DecRateCoeff_Bd::kSin,*BacCharge,*S_f,*S_fbar,*TagDecOS,omega_b,omega_bbar,tageff_os,tageff_asym_os,production_asym,detection_asym);
coeff_sh_fit = new CPfitter::DecRateCoeff_Bd(“coef_sinh_fit”,“coef_sinh_fit”,CPfitter::DecRateCoeff_Bd::kSinh,*BacCharge,sinh_f,sinh_fbar,*TagDecOS,omega_b,omega_bbar,tageff_os,tageff_asym_os,production_asym,detection_asym);
coeff_ch_fit = new CPfitter::DecRateCoeff_Bd(“coef_cosh_fit”,“coef_cosh_fit”,CPfitter::DecRateCoeff_Bd::kCosh,*BacCharge,cosh_f,cosh_fbar,*TagDecOS,omega_b,omega_bbar,tageff_os,tageff_asym_os,production_asym,detection_asym);

RooRealVar tau = RooRealVar(“tau”,“#tau”,1.519,1.0,2.0);
RooRealVar dgamma = RooRealVar(“dgamma”,“dgamma”,0.0);
RooRealVar deltaM = RooRealVar(“deltaM”,“#Delta m”,0.51);

RooBDecay pdfSigTime_noExtension_fit = RooBDecay(“pdfSigTime_noExtension_fit”,“pdfSigTime_noExtension_fit”,*BeautyTime,tau,dgamma,*coeff_ch_fit,*coeff_sh_fit,*coeff_c_fit,*coeff_s_fit,deltaM,*resolution,RooBDecay::SingleSided);
ws_.import(pdfSigTime_noExtension_fit, RooFit::RecycleConflictNodes());

DecRateCoeff_Bd.h (7.5 KB)
RooGLMFunction.hh (1.4 KB)

Hi,
The proiblem seems to be not in the Dictionary of the class but in the copy constructor of the CPfitter::DecRateCoeff_Bd class that you have implemented. You should verify and test that it works fine

Best Regards

Lorenzo

Hi @moneta,
Thanks for your answer.
I checked the copy constructor quite detailed and couldn’t find any possible problem. I even used it explicitly, means I copied the CPfitter::DecRateCoeff_Bd objects and imported the copies into the workspace.
What finally seemed to work was after importing all individual objects in the workspace to not use the objects I created before in the RooBDecay, but to take the ones from the workspace, so that the creation of the RooBDecay object now looks as follows:

RooBDecay pdfSigTime_noExtension_fit = RooBDecay(“pdfSigTime_noExtension_fit”,“pdfSigTime_noExtension_fit”,BeautyTime,tau,dgamma,((RooAbsReal*)(ws_.obj(“coef_cosh_fit”))),((RooAbsReal)(ws_.obj(“coef_sinh_fit”))),((RooAbsReal)(ws_.obj(“coef_cos_fit”))),((RooAbsReal)(ws_.obj(“coef_sin_fit”))),deltaM,*resolution,RooBDecay::SingleSided);

So finally I do not understand what is causing the different behaviour, as the copy constructor seems to work in some way when importing the single DecRateCoeff class objects?
However, to make the thing complete I attached the copy constructor of the CPfitter::DecRateCoeff_Bd class.

Alex

DecRateCoeff_Bd::DecRateCoeff_Bd(const DecRateCoeff_Bd& other, const char* name) :
RooAbsReal(other,name),
cp_coeff_(“cp_coeff_”,this,other.cp_coeff_),
cp_coeff_bar_(“cp_coeff_bar_”,this,other.cp_coeff_bar_),
coeff_type_(other.coeff_type_),
finalstate_(“finalstate_”,this,other.finalstate_),
tag_os_(“tag_os_”,this,other.tag_os_),
omegab_os_(“omegab_os_”,this,other.omegab_os_),
omegabbar_os_(“omegabbar_os_”,this,other.omegabbar_os_),
eta_os_(“eta_os_”,this,other.eta_os_),
avg_eta_os_(“avg_eta_os_”,this,other.avg_eta_os_),
p0_os_(“p0_os_”,this,other.p0_os_),
p1_os_(“p1_os_”,this,other.p1_os_),
delta_p0_os_(“delta_p0_os_”,this,other.delta_p0_os_),
delta_p1_os_(“delta_p1_os_”,this,other.delta_p1_os_),
tageff_os_(“tageff_os_”,this,other.tageff_os_),
tageff_asym_os_(“tageff_asym_os_”,this,other.tageff_asym_os_),
tag_ss_(“tag_ss_”,this,other.tag_ss_),
omegab_ss_(“omegab_ss_”,this,other.omegab_ss_),
omegabbar_ss_(“omegabbar_ss_”,this,other.omegabbar_ss_),
eta_ss_(“eta_ss_”,this,other.eta_ss_),
avg_eta_ss_(“avg_eta_ss_”,this,other.avg_eta_ss_),
p0_ss_(“p0_ss_”,this,other.p0_ss_),
p1_ss_(“p1_ss_”,this,other.p1_ss_),
delta_p0_ss_(“delta_p0_ss_”,this,other.delta_p0_ss_),
delta_p1_ss_(“delta_p1_ss_”,this,other.delta_p1_ss_),
tageff_ss_(“tageff_ss_”,this,other.tageff_ss_),
tageff_asym_ss_(“tageff_asym_ss_”,this,other.tageff_asym_ss_),
production_asym_(“production_asym_”,this,other.production_asym_),
detection_asym_(“detection_asym_”,this,other.detection_asym_),
onetagger_(other.onetagger_),
glmmodel_(other.glmmodel_)
{
}

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