I have a very peculiar bug, which I could use help figuring out. I make a constrained fit by multiplying my mass shape pdf with a set of Gaussians PDFs that include the variable to be constrained. I removed a Print() statement on the constraint pdf, and suddenly the fits stopped working. They were still fitting, but as if the constraint was not there.
I have managed to find a minimal example where RooProdPdf changes behaviour after a Print() statement:
RooRealVar * m1 = new RooRealVar("m1","m1", 2, 0, 4); RooRealVar * m2 = new RooRealVar("m2","m2", 3, 0, 4); RooRealVar * mu1 = new RooRealVar("mu1","mu1", 2); RooRealVar * mu2 = new RooRealVar("mu2","mu2", 2.2); RooRealVar * s1 = new RooRealVar("s1","s1", 1); RooRealVar * s2 = new RooRealVar("s2","s2", 1.2); RooGaussian * g1 = new RooGaussian("g1","g1", *m1, *mu1, *s1); RooGaussian * g2 = new RooGaussian("g2","g2", *m2, *mu2, *s2); RooProdPdf * p = new RooProdPdf("p","p",RooArgList(*g1, *g2)); // if this Print() is left out ... p->Print(); // .. this evaluate() causes a seg fault ... std::cout << "p evaluated to: " << p->evaluate() << std::endl; // but if Print() is called everything works fine
I am seeing this in both 6.08.02 and 6.06.02.
Is this just a ROOT bug or is there something I am completely missing? I would like to understand this.
(I did not use the evaluate( ) in my original application, the point was just to show an example where RooProdPdf changes behaviour due to a Print( ) call).