RooFFTConvPdf not working when doing a simultaneous fit

From: Constantino Calancha-Paredes <calancha_at_fnal.gov>
Date: Tue, 18 Aug 2009 20:28:25 -0500

  Hi,

  I'm using ROOT version v5.22 and RooFit version v2.95   in a 32 bits machine.

  I'm trying to combine the RooFit tutorial macros rf208 and rf501,   to do a simultaneous fit of two datasets using RooFFTConvPdf to   take the convolution of a Landau with a Gaussian.

  Of course I have success when I try just two separate fits (one   per each dataset), that is what tutorial macro rf208 does. But   when I try to do a simultaneous fit of both datasets together, a lot of   messages as the following appear:

  WARNING:Minization -- RooFitGlue: Minimized function has error status.   getLogVal() top-level p.d.f evaluates to zero or negative number

  and the returned fit is absolutely wrong.

  I'm using the following macro:

  #ifndef __CINT__

#include "RooGlobalFunc.h"
#endif
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooLandau.h"
#include "RooFFTConvPdf.h"
#include "RooSimultaneous.h"
#include "RooCategory.h"
#include "RooPlot.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "TH1.h"

using namespace RooFit ;

void convol_fft()
{

// S e t u p c o m p o n e n t p d f s
// ---------------------------------------

// Construct observable

   RooRealVar t("t","t",-10,30) ;

// Construct landau(t,ml,sl) ;

   RooRealVar ml("ml","mean landau",5.,-20,20) ;
   RooRealVar sl("sl","sigma landau",1,0.1,10) ;
   RooLandau landau("lx","lx",t,ml,sl) ;

// Second landau(t,ml2,sl2)

   RooRealVar ml2("ml2","mean landau",15.,-20,20) ;    RooRealVar sl2("sl2","sigma landau",0.2,0.1,10) ;    RooLandau landau2("lx2","lx",t,ml2,sl2) ;

// Construct gauss(t,mg,sg)

   RooRealVar mg("mg","mg",0) ;
   RooRealVar sg("sg","sg",2,0.1,10) ;
   RooGaussian gauss("gauss","gauss",t,mg,sg) ;

// C o n s t r u c t c o n v o l u t i o n p d f
// ---------------------------------------

// Set #bins to be used for FFT sampling to 10000
   t.setBins(10000,"cache") ;

// Construct landau (x) gauss

   RooFFTConvPdf lxg("lxg","landau (X) gauss",t,landau,gauss) ;    RooFFTConvPdf lxg2("lxg2","landau (X) gauss",t,landau2,gauss) ;

// S a m p l e , f i t a n d p l o t c o n v o l u t e d p d f
//


// Sample 1000 events in x from gxlx

   RooDataSet* data = lxg.generate(t,10000) ;    RooDataSet* data2 = lxg2.generate(t,10000) ;

  // Define category to distinguish physics and control samples events

   RooCategory sample("sample","sample") ;
   sample.defineType("sample1") ;
   sample.defineType("sample2") ;


    // combined dataset in (x,sample)
   RooDataSet combData("combData","combined data",t,Index(sample),Import("sample1",*data),Import("sample2",*data2)) ;

    // Construct a simultaneous pdf using category sample as index    RooSimultaneous simPdf("simPdf","simultaneous pdf",sample) ;    simPdf.addPdf(lxg,"sample1") ;
   simPdf.addPdf(lxg2,"sample2") ;

// Fit gxlx to data

   simPdf.fitTo(combData) ;

// Plot data, landau pdf, landau (X) gauss pdf
   RooPlot* frame = t.frame(Title("simultaneous fit to landau (x) gauss convolution")) ;    combData.plotOn(frame,Cut("sample==sample::sample1"));   simPdf.plotOn(frame,Slice(sample,"sample1"),Components("lx"),ProjWData(sample,combData),LineColor(1));

// Draw frame on canvas

   new TCanvas("rf208_rf501_combined","rf208_rf501_combined",600,600) ;    gPad->SetLeftMargin(0.15) ; frame->GetYaxis()->SetTitleOffset(1.4) ;    frame->Draw() ;

  }

  Any idea of what is wrong with my code?

  Thanks in advance.

  Tino Received on Wed Aug 19 2009 - 03:28:34 CEST

This archive was generated by hypermail 2.2.0 : Wed Aug 19 2009 - 11:50:02 CEST