multiple fits in roofit create plot inconsistencies

From: Pietro Govoni <Pietro.Govoni_at_mib.infn.it>
Date: Thu, 4 Mar 2010 18:00:16 +0100


Dear Rooters and Roofitters,

I am building an iterative fit similar to the one in the macro below (1), which changes the fit range at each iteration. As you can see if you run the macro, which fully reproduces the problem, the fits loop seems to work fine, while the final drawing of the plot looks awkward and an error appears repeatedly:

[#0] ERROR:InputArguments -- RooArgSet::checkForDup: ERROR argument with name gaussx_Int[x|fit_nll_gaussx_bdata]_Norm[x] is already in this set
[#0] ERROR:InputArguments -- RooArgSet::checkForDup: ERROR argument with name gaussx_Int[x|fit_nll_gaussx_bdata]_Norm[x] is already in this set
[...]

Is it a known problem? Am I missing something in the code? I am running with root 5.26/00 on an Apple MacBook Pro.

Thank you very much,

pietro

(1) fitExample.C

{
  using namespace RooFit ;

  RooRealVar x ("x", "x", -10, 10) ;
  RooRealVar meanx ("meanx", "mean of gaussian x", 5., -10., 10.) ;   RooRealVar sigmax ("sigmax", "width of gaussian x", 2, 0., 5.) ;   RooGaussian gaussx ("gaussx", "gaussian PDF", x, meanx, sigmax) ;   RooDataSet * data = gaussx.generate (RooArgSet (x), 10000) ;   RooDataHist bdata ("bdata","bdata",RooArgList (x), *data) ;   

  gaussx.fitTo (bdata, RooFit::Minos (1), RooFit::SumW2Error (kTRUE), Range ("smaller"), PrintLevel (-1)) ;   char rangeName[20] ;
  for (int i = 0 ; i < 4 ; ++i)
    {

      sprintf (rangeName, "R_%d", i) ;
      x.setRange (rangeName, -5., 5.) ;
      gaussx.fitTo (bdata, RooFit::Minos (1), RooFit::SumW2Error (kTRUE), Range (rangeName), PrintLevel (-1)) ;
    }

  RooPlot *xplot = x.frame () ;
  bdata.plotOn (xplot, MarkerColor (kRed)) ;   gaussx.plotOn (xplot) ;
  TCanvas c1 ;
  xplot->Draw () ;
} Received on Thu Mar 04 2010 - 18:00:26 CET

This archive was generated by hypermail 2.2.0 : Thu Mar 04 2010 - 23:50:01 CET