Generating pdf Segmentation fault (core dumped)

Hey Rooters
I have a problem, while generating points of a pdf. Here is the code, its straight forward, 3 Gauss are created and added together with an exponantial. But then when I try to generate points the Seg fault appears:

    // Observable
  RooRealVar x("x","x",-20,20) ;

  // Model (intentional strong correlations)
  RooRealVar mean_g1("mean1","mean of g2",-4.0,-15.0,15.0) ;
  RooRealVar sigma_g1("sigma1","width of g1",0.1,0.0,15) ;
  RooGaussian g1("g1","g1",x,mean_g1,sigma_g1) ;

  RooRealVar mean_g2("mean2","mean of g1",-0.5,-15.0,15.0) ;
  RooRealVar sigma_g2("sigma2","width of g2",3.0,0.0,15.0) ;
  RooGaussian g2("g2","g2",x,mean_g2,sigma_g2) ;

  RooRealVar mean_g3("mean3","mean of g3",3.0,-15.0,15.0) ;
  RooRealVar sigma_g3("sigma3","width of g3",1.0,0.0,15.0) ;
  RooGaussian g3("g3","g3",x,mean_g3,sigma_g3) ;

  RooRealVar expo1("expo1","exponent of exp1",0.5,0.0,10.0);
  RooExponential exp1("exp1","exp1",x,exp1);

  RooRealVar frac("frac","frac",0.5,0.0,1.0) ;

  RooRealVar c1("c1","c1",0.5,0.0,1.0);
  RooRealVar c2("c2","c2",0.75,0.0,1.0);
  RooRealVar c3("c3","c3",0.4,0.0,1.0);
  RooRealVar c4("c4","c4",0.9,0.0,1.0);
  RooAddPdf modelmcmc("modelmcmc","modelmcmc",RooArgList(g1,g2,g3,exp1),RooArgList(c1,c2,c3,c4)) ;
  RooAddPdf modelmin("modelmin","modelmin",RooArgList(g1,g2,g3,exp1),RooArgList(c1,c2,c3,c4)) ;

  std::cout << "/* last line before Seg fault */" << '\n';

  // Generate 1000 events
  RooDataSet* datamcmc = modelmcmc.generate(x,1000) ;
  RooDataSet* datamin = modelmin.generate(x,1000) ;

Command line output / Error Message:

RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby 
                Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
                All rights reserved, please read

/* last line before Seg fault */
Segmentation fault (core dumped)

Hi, could you please paste the error message here too? Thanks.

Added it to the end. It really just says seg fault core dumped

Ah, I see. ROOT usually gives a stack trace, which would be valuable. I wonder why you don’t see it.
In any case, thank you. I will have a look into this.

1 Like

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