# TMinuit problem

From: Salvatore Rocco Rappoccio <rappocc_at_fas.harvard.edu>
Date: Thu, 16 Jun 2005 21:54:29 -0400 (EDT)

Hi,

I have a simple counting experiment that I am trying to use a likelihood fitter on. The formula for the counting experiment is

(N_obs - N_bkg) / eff*Lum

So the statistical error should be roughly sqrt(N_obs) / (N_obs-N_bkg).

I have a function that calculates -2log(L) and minuit minimizes it to the correct place. However, when I ask for MINOS to give me the statistical errors, it doesn't give me the right value (without using the fitter). I have set the "UP" value to 1.0 (which is relevant for -2log(L)).

Any ideas?

Thanks,
Sal Rappoccio

The relevant portions of code are:

void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag) {

double lnL2 = 0;

// Calculate nexp_1_i and nexp_2_i

double f1= nexp_1_i - nobs_1_i*TMath::Log(nexp_1_i) + TMath::LnGamma( nobs_1_i + 1 );   double f2 = 0;

lnL2 += f1;
if ( ijet > 0 ) {
f2 = nexp_2_i - nobs_2_i*TMath::Log(nexp_2_i) + TMath::LnGamma( nobs_2_i + 1 );     lnL2 += f2;
}

lnL2 *= 2;

f = lnL2;

}

void FitMyStuff()
{

TMinuit *gMinuit = new TMinuit(9); //initialize TMinuit   gMinuit->SetFCN(fcn); //Sets minimization function

//Generic argument lists/flags

Double_t arglist;
Int_t ierflg = 0;

// Pick Delta(2LnL) = 1.0 as error definition
arglist = 1.0;
gMinuit->mnexcm("SET ERR", arglist, 1, ierflg);

// Setting partial derivative strategy
arglist = 1;
gMinuit->mnexcm("SET STR", arglist, 1, ierflg);

//Initialize parameters (par#, name, guess, step, min, max, flags)
//If min=max=0, no constraints

gMinuit->mnparm(0, "XS" , vstart, step, 0, 0, ierflg);

// Now ready for minimization step

arglist = 500000;
arglist = 1.;
gMinuit->mnexcm("MINOS", arglist, 1, ierflg); //Minimization step: Minos is the algorithm

Double_t dxs_hi, dxs_lo;
Double_t gcc;

gMinuit->mnerrs( 0, dxs_hi, dxs_lo, dxs, gcc);

} Received on Fri Jun 17 2005 - 03:54:37 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:09 MET